38 int nb_gauss_pts = pts.size2();
40 auto ©_base_fun = data.dataOnEntities[MBVERTEX][0].getN(copy_base);
41 auto ©_diff_base_fun =
42 data.dataOnEntities[MBVERTEX][0].getDiffN(copy_base);
43 if (copy_base_fun.size1() != nb_gauss_pts)
45 "Inconsistent number of integration pts");
47 auto add_base_on_verts = [&] {
49 data.dataOnEntities[MBVERTEX][0].getN(base).resize(
50 nb_gauss_pts, copy_base_fun.size2(),
false);
51 data.dataOnEntities[MBVERTEX][0].getDiffN(base).resize(
52 nb_gauss_pts, copy_diff_base_fun.size2(),
false);
53 noalias(data.dataOnEntities[MBVERTEX][0].getN(base)) = copy_base_fun;
54 noalias(data.dataOnEntities[MBVERTEX][0].getDiffN(base)) =
60 auto add_base_on_edges = [&] {
62 std::array<int, 12> sense;
63 std::array<int, 12>
order;
64 if (data.spacesOnEntities[MBEDGE].test(
H1)) {
65 if (data.dataOnEntities[MBEDGE].size() != 12)
67 "Expected 12 data on entities");
69 std::array<double *, 12> h1_edge_n;
70 std::array<double *, 12> diff_h1_egde_n;
71 bool nb_dofs_sum =
false;
72 for (
int ee = 0; ee != 12; ++ee) {
73 if (data.dataOnEntities[MBEDGE][ee].getSense() == 0)
75 "Sense of entity not set");
77 sense[ee] = data.dataOnEntities[MBEDGE][ee].getSense();
78 order[ee] = data.dataOnEntities[MBEDGE][ee].getOrder();
80 int nb_dofs =
NBEDGE_H1(data.dataOnEntities[MBEDGE][ee].getOrder());
81 data.dataOnEntities[MBEDGE][ee].getN(base).resize(nb_gauss_pts, nb_dofs,
83 data.dataOnEntities[MBEDGE][ee].getDiffN(base).resize(
84 nb_gauss_pts, 3 * nb_dofs,
false);
86 &*data.dataOnEntities[MBEDGE][ee].getN(base).data().begin();
88 &*data.dataOnEntities[MBEDGE][ee].getDiffN(base).data().begin();
90 nb_dofs_sum |= (nb_dofs > 0);
94 sense.data(),
order.data(), &*copy_base_fun.data().begin(),
95 &*copy_diff_base_fun.data().begin(), h1_edge_n.data(),
96 diff_h1_egde_n.data(), nb_gauss_pts);
99 for (
int ee = 0; ee != 12; ++ee) {
100 data.dataOnEntities[MBEDGE][ee].getN(base).resize(0, 0,
false);
101 data.dataOnEntities[MBEDGE][ee].getDiffN(base).resize(0, 0,
false);
108 auto add_base_on_quads = [&]() {
110 std::array<int, 6>
order;
111 if (data.spacesOnEntities[MBQUAD].test(
H1)) {
113 if (data.dataOnEntities[MBQUAD].size() != 6)
115 "Expected six faces on hex");
117 std::array<double *, 6> h1_face_n;
118 std::array<double *, 6> diff_h1_face_n;
119 bool nb_dofs_sum =
false;
120 for (
int ff = 0; ff != 6; ++ff) {
122 order[ff] = data.dataOnEntities[MBQUAD][ff].getOrder();
125 data.dataOnEntities[MBQUAD][ff].getN(base).resize(nb_gauss_pts, nb_dofs,
127 data.dataOnEntities[MBQUAD][ff].getDiffN(base).resize(
128 nb_gauss_pts, 3 * nb_dofs,
false);
131 &*data.dataOnEntities[MBQUAD][ff].getN(base).data().begin();
133 &*data.dataOnEntities[MBQUAD][ff].getDiffN(base).data().begin();
135 nb_dofs_sum |= (nb_dofs > 0);
137 if (data.facesNodes.size1() != 6)
139 "Expected six face nodes");
140 if (data.facesNodes.size2() != 4)
142 "Expected four nodes on face");
146 &*data.facesNodes.data().begin(),
147 &*data.facesNodesOrder.data().begin(),
order.data(),
148 &*copy_base_fun.data().begin(), &*copy_diff_base_fun.data().begin(),
149 h1_face_n.data(), diff_h1_face_n.data(), nb_gauss_pts);
153 for (
int ff = 0; ff != 6; ++ff) {
154 data.dataOnEntities[MBQUAD][ff].getN(base).resize(0,
false);
155 data.dataOnEntities[MBQUAD][ff].getDiffN(base).resize(0, 0,
false);
163 auto add_base_on_volume = [&]() {
166 if (data.spacesOnEntities[MBHEX].test(
H1)) {
168 int order = data.dataOnEntities[MBHEX][0].getOrder();
170 data.dataOnEntities[MBHEX][0].getN(base).resize(nb_gauss_pts, nb_vol_dofs,
172 data.dataOnEntities[MBHEX][0].getDiffN(base).resize(
173 nb_gauss_pts, 3 * nb_vol_dofs,
false);
178 p.data(), &*copy_base_fun.data().begin(),
179 &*copy_diff_base_fun.data().begin(),
180 &*data.dataOnEntities[MBHEX][0].getN(base).data().begin(),
181 &*data.dataOnEntities[MBHEX][0].getDiffN(base).data().begin(),
185 data.dataOnEntities[MBHEX][0].getN(base).resize(0, 0,
false);
186 data.dataOnEntities[MBHEX][0].getDiffN(base).resize(0, 0,
false);
192 CHKERR add_base_on_verts();
193 CHKERR add_base_on_edges();
194 CHKERR add_base_on_quads();
195 CHKERR add_base_on_volume();
221 int nb_gauss_pts = pts.size2();
223 auto ©_base_fun = data.dataOnEntities[MBVERTEX][0].getN(copy_base);
224 auto ©_diff_base_fun =
225 data.dataOnEntities[MBVERTEX][0].getDiffN(copy_base);
227 if (nb_gauss_pts != copy_base_fun.size1())
229 "Wrong number of gauss pts");
231 if (nb_gauss_pts != copy_diff_base_fun.size1())
233 "Wrong number of gauss pts");
235 auto &base_fun = data.dataOnEntities[MBHEX][0].getN(base);
236 auto &diff_base_fun = data.dataOnEntities[MBHEX][0].getDiffN(base);
237 const int vol_order = data.dataOnEntities[MBHEX][0].getOrder();
240 base_fun.resize(nb_gauss_pts, nb_dofs,
false);
241 diff_base_fun.resize(nb_gauss_pts, 3 * nb_dofs,
false);
244 const std::array<int, 3> p{vol_order, vol_order, vol_order};
246 p.data(), &*copy_base_fun.data().begin(),
247 &*copy_diff_base_fun.data().begin(), &*base_fun.data().begin(),
248 &*diff_base_fun.data().begin(), nb_gauss_pts);
274 const int nb_gauss_pts = pts.size2();
276 auto ©_base_fun = data.dataOnEntities[MBVERTEX][0].getN(copy_base);
277 auto ©_diff_base_fun =
278 data.dataOnEntities[MBVERTEX][0].getDiffN(copy_base);
280 if (nb_gauss_pts != copy_base_fun.size1())
282 "Wrong number of gauss pts");
284 if (nb_gauss_pts != copy_diff_base_fun.size1())
286 "Wrong number of gauss pts");
289 if (data.spacesOnEntities[MBQUAD].test(
HDIV)) {
291 if (data.dataOnEntities[MBQUAD].size() != 6)
293 "Expected six data structures on Hex");
295 std::array<int, 6>
order;
296 std::array<double *, 6> hdiv_face_n;
297 std::array<double *, 6> diff_hdiv_face_n;
299 bool sum_nb_dofs =
false;
300 for (
int ff = 0; ff != 6; ff++) {
301 if (data.dataOnEntities[MBQUAD][ff].getSense() == 0)
303 "Sense pn quad <%d> not set", ff);
305 order[ff] = data.dataOnEntities[MBQUAD][ff].getOrder();
306 if (data.facesNodes.size1() != 6)
308 "Expected six faces");
309 if (data.facesNodes.size2() != 4)
311 "Expected four nodes on face");
314 auto &face_n = data.dataOnEntities[MBQUAD][ff].getN(base);
315 auto &diff_face_n = data.dataOnEntities[MBQUAD][ff].getDiffN(base);
316 face_n.resize(nb_gauss_pts, 3 * nb_dofs,
false);
317 diff_face_n.resize(nb_gauss_pts, 9 * nb_dofs,
false);
319 hdiv_face_n[ff] = &*face_n.data().begin();
320 diff_hdiv_face_n[ff] = &*diff_face_n.data().begin();
322 sum_nb_dofs |= (nb_dofs > 0);
327 &*data.facesNodes.data().begin(),
328 &*data.facesNodesOrder.data().begin(),
order.data(),
329 &*copy_base_fun.data().begin(), &*copy_diff_base_fun.data().begin(),
330 hdiv_face_n.data(), diff_hdiv_face_n.data(), nb_gauss_pts);
333 for (
int ff = 0; ff != 6; ff++) {
334 data.dataOnEntities[MBQUAD][ff].getN(base).resize(nb_gauss_pts, 0,
336 data.dataOnEntities[MBQUAD][ff].getDiffN(base).resize(nb_gauss_pts, 0,
342 for (
int ff = 0; ff != 6; ff++) {
343 data.dataOnEntities[MBQUAD][ff].getN(base).resize(nb_gauss_pts, 0,
false);
344 data.dataOnEntities[MBQUAD][ff].getDiffN(base).resize(nb_gauss_pts, 0,
350 if (data.spacesOnEntities[MBHEX].test(
HDIV)) {
352 const int order = data.dataOnEntities[MBHEX][0].getOrder();
353 const int nb_dofs_family =
356 volFamily.resize(3, 3 * nb_dofs_family * nb_gauss_pts);
358 if (nb_dofs_family) {
362 std::array<double *, 3> diff_family_ptr = {
367 p.data(), &*copy_base_fun.data().begin(),
368 &*copy_diff_base_fun.data().begin(), family_ptr.data(),
369 diff_family_ptr.data(), nb_gauss_pts);
372 auto &face_n = data.dataOnEntities[MBHEX][0].getN(base);
373 auto &diff_face_n = data.dataOnEntities[MBHEX][0].getDiffN(base);
374 face_n.resize(nb_gauss_pts, 3 * nb_vol_dofs,
false);
375 diff_face_n.resize(nb_gauss_pts, 9 * nb_vol_dofs,
false);
380 double *ptr = &face_n(0, 0);
382 for (
int j = 0;
j != 3; ++
j) {
387 for (
int j = 0;
j != 3; ++
j) {
392 for (
int j = 0;
j != 3; ++
j) {
402 double *diff_ptr = &diff_face_n(0, 0);
404 for (
int j = 0;
j != 9; ++
j) {
405 *diff_ptr = *diff_ptr_f0;
409 for (
int j = 0;
j != 9; ++
j) {
410 *diff_ptr = *diff_ptr_f1;
414 for (
int j = 0;
j != 9; ++
j) {
415 *diff_ptr = *diff_ptr_f2;
421 data.dataOnEntities[MBHEX][0].getN(base).resize(nb_gauss_pts, 0,
false);
422 data.dataOnEntities[MBHEX][0].getDiffN(base).resize(nb_gauss_pts, 0,
427 data.dataOnEntities[MBHEX][0].getN(base).resize(nb_gauss_pts, 0,
false);
428 data.dataOnEntities[MBHEX][0].getDiffN(base).resize(nb_gauss_pts, 0,
false);
455 const int nb_gauss_pts = pts.size2();
457 auto ©_base_fun = data.dataOnEntities[MBVERTEX][0].getN(copy_base);
458 auto ©_diff_base_fun =
459 data.dataOnEntities[MBVERTEX][0].getDiffN(copy_base);
461 if (nb_gauss_pts != copy_base_fun.size1())
463 "Wrong number of gauss pts");
465 if (nb_gauss_pts != copy_diff_base_fun.size1())
467 "Wrong number of gauss pts");
470 if (data.spacesOnEntities[MBEDGE].test(
HCURL)) {
471 std::array<int, 12> sense;
472 std::array<int, 12>
order;
473 if (data.dataOnEntities[MBEDGE].size() != 12)
475 "Expected 12 edges data structures on Hex");
477 std::array<double *, 12> hcurl_edge_n;
478 std::array<double *, 12> diff_hcurl_edge_n;
479 bool sum_nb_dofs =
false;
481 for (
int ee = 0; ee != 12; ++ee) {
482 if (data.dataOnEntities[MBEDGE][ee].getSense() == 0)
484 "Sense on edge <%d> on Hex not set", ee);
486 sense[ee] = data.dataOnEntities[MBEDGE][ee].getSense();
487 order[ee] = data.dataOnEntities[MBEDGE][ee].getOrder();
489 data.dataOnEntities[MBEDGE][ee].getN(base).resize(nb_gauss_pts,
491 data.dataOnEntities[MBEDGE][ee].getDiffN(base).resize(nb_gauss_pts,
494 &*data.dataOnEntities[MBEDGE][ee].getN(base).data().begin();
495 diff_hcurl_edge_n[ee] =
496 &*data.dataOnEntities[MBEDGE][ee].getDiffN(base).data().begin();
498 sum_nb_dofs |= (nb_dofs > 0);
503 sense.data(),
order.data(), &*copy_base_fun.data().begin(),
504 &*copy_diff_base_fun.data().begin(), hcurl_edge_n.data(),
505 diff_hcurl_edge_n.data(), nb_gauss_pts);
509 for (
int ee = 0; ee != 12; ee++) {
510 data.dataOnEntities[MBEDGE][ee].getN(base).resize(nb_gauss_pts, 0,
false);
511 data.dataOnEntities[MBEDGE][ee].getDiffN(base).resize(nb_gauss_pts, 0,
517 if (data.spacesOnEntities[MBQUAD].test(
HCURL)) {
519 if (data.dataOnEntities[MBQUAD].size() != 6)
521 "Expected six data structures on Hex");
523 std::array<int, 6>
order;
524 double *face_family_ptr[6][2];
525 double *diff_face_family_ptr[6][2];
527 bool sum_nb_dofs =
false;
528 for (
int ff = 0; ff != 6; ff++) {
529 if (data.dataOnEntities[MBQUAD][ff].getSense() == 0)
531 "Sense pn quad <%d> not set", ff);
533 order[ff] = data.dataOnEntities[MBQUAD][ff].getOrder();
534 if (data.facesNodes.size1() != 6)
536 "Expected six faces");
537 if (data.facesNodes.size2() != 4)
539 "Expected four nodes on face");
541 const int nb_family_dofs =
543 faceFamily[ff].resize(2, 3 * nb_family_dofs * nb_gauss_pts,
false);
544 diffFaceFamily[ff].resize(2, 9 * nb_family_dofs * nb_gauss_pts,
false);
546 if (nb_family_dofs) {
547 face_family_ptr[ff][0] = &(
faceFamily[ff](0, 0));
548 face_family_ptr[ff][1] = &(
faceFamily[ff](1, 0));
553 sum_nb_dofs |= (nb_family_dofs > 0);
558 &*data.facesNodes.data().begin(),
559 &*data.facesNodesOrder.data().begin(),
order.data(),
560 &*copy_base_fun.data().begin(), &*copy_diff_base_fun.data().begin(),
561 face_family_ptr, diff_face_family_ptr, nb_gauss_pts);
563 for (
int ff = 0; ff != 6; ++ff) {
569 auto &face_n = data.dataOnEntities[MBQUAD][ff].getN(base);
570 auto &diff_face_n = data.dataOnEntities[MBQUAD][ff].getDiffN(base);
571 face_n.resize(nb_gauss_pts, 3 * nb_dofs,
false);
572 diff_face_n.resize(nb_gauss_pts, 9 * nb_dofs,
false);
576 double *ptr = &face_n(0, 0);
578 for (
int j = 0;
j != 3; ++
j) {
583 for (
int j = 0;
j != 3; ++
j) {
592 double *diff_ptr = &diff_face_n(0, 0);
594 for (
int j = 0;
j != 9; ++
j) {
595 *diff_ptr = *diff_ptr_f0;
599 for (
int j = 0;
j != 9; ++
j) {
600 *diff_ptr = *diff_ptr_f1;
608 for (
int ff = 0; ff != 6; ff++) {
609 data.dataOnEntities[MBQUAD][ff].getN(base).resize(nb_gauss_pts, 0,
611 data.dataOnEntities[MBQUAD][ff].getDiffN(base).resize(nb_gauss_pts, 0,
617 for (
int ff = 0; ff != 6; ff++) {
618 data.dataOnEntities[MBQUAD][ff].getN(base).resize(nb_gauss_pts, 0,
false);
619 data.dataOnEntities[MBQUAD][ff].getDiffN(base).resize(nb_gauss_pts, 0,
625 if (data.spacesOnEntities[MBHEX].test(
HCURL)) {
627 const int order = data.dataOnEntities[MBHEX][0].getOrder();
630 volFamily.resize(3, 3 * nb_dofs * nb_gauss_pts);
636 std::array<double *, 3> diff_family_ptr = {
641 p.data(), &*copy_base_fun.data().begin(),
642 &*copy_diff_base_fun.data().begin(), family_ptr.data(),
643 diff_family_ptr.data(), nb_gauss_pts);
646 auto &face_n = data.dataOnEntities[MBHEX][0].getN(base);
647 auto &diff_face_n = data.dataOnEntities[MBHEX][0].getDiffN(base);
648 face_n.resize(nb_gauss_pts, 3 * nb_vol_dofs,
false);
649 diff_face_n.resize(nb_gauss_pts, 9 * nb_vol_dofs,
false);
654 double *ptr = &face_n(0, 0);
656 for (
int j = 0;
j != 3; ++
j) {
661 for (
int j = 0;
j != 3; ++
j) {
666 for (
int j = 0;
j != 3; ++
j) {
676 double *diff_ptr = &diff_face_n(0, 0);
678 for (
int j = 0;
j != 9; ++
j) {
679 *diff_ptr = *diff_ptr_f0;
683 for (
int j = 0;
j != 9; ++
j) {
684 *diff_ptr = *diff_ptr_f1;
688 for (
int j = 0;
j != 9; ++
j) {
689 *diff_ptr = *diff_ptr_f2;
695 data.dataOnEntities[MBHEX][0].getN(base).resize(nb_gauss_pts, 0,
false);
696 data.dataOnEntities[MBHEX][0].getDiffN(base).resize(nb_gauss_pts, 0,
701 data.dataOnEntities[MBHEX][0].getN(base).resize(nb_gauss_pts, 0,
false);
702 data.dataOnEntities[MBHEX][0].getDiffN(base).resize(nb_gauss_pts, 0,
false);
710 boost::shared_ptr<BaseFunctionCtx> ctx_ptr) {
715 int nb_gauss_pts = pts.size2();
722 "Wrong dimension of pts, should be at least 3 rows with coordinates");