12 #ifndef GENERATE_VTK_WITH_CURL_BASE
14 using namespace MoFEM;
17 int *sense,
int *p,
double *
N,
double *diffN,
double *edge_n[],
18 double *diff_edge_n[],
int nb_integration_pts,
19 PetscErrorCode (*base_polynomials)(
int p,
double s,
double *diff_s,
20 double *
L,
double *diffL,
24 const int edges_nodes[6][2] = {{0, 1}, {1, 2}, {2, 0},
25 {0, 3}, {1, 3}, {2, 3}};
27 for (
int ee = 0; ee != 6; ee++)
38 double edge_diff_ksi[6][3];
41 &edge_diff_ksi[0][2]),
43 &edge_diff_ksi[1][2]),
45 &edge_diff_ksi[2][2]),
47 &edge_diff_ksi[3][2]),
49 &edge_diff_ksi[4][2]),
51 &edge_diff_ksi[5][2])};
52 for (
int ee = 0; ee != 6; ee++) {
53 t_edge_diff_ksi[ee](
i) = (t_node_diff_ksi[edges_nodes[ee][1]](
i) -
54 t_node_diff_ksi[edges_nodes[ee][0]](
i)) *
73 &diff_edge_n[0][0], &diff_edge_n[0][3], &diff_edge_n[0][6],
74 &diff_edge_n[0][1], &diff_edge_n[0][4], &diff_edge_n[0][7],
75 &diff_edge_n[0][2], &diff_edge_n[0][5], &diff_edge_n[0][8], 9),
77 &diff_edge_n[1][0], &diff_edge_n[1][3], &diff_edge_n[1][6],
78 &diff_edge_n[1][1], &diff_edge_n[1][4], &diff_edge_n[1][7],
79 &diff_edge_n[1][2], &diff_edge_n[1][5], &diff_edge_n[1][8], 9),
81 &diff_edge_n[2][0], &diff_edge_n[2][3], &diff_edge_n[2][6],
82 &diff_edge_n[2][1], &diff_edge_n[2][4], &diff_edge_n[2][7],
83 &diff_edge_n[2][2], &diff_edge_n[2][5], &diff_edge_n[2][8], 9),
85 &diff_edge_n[3][0], &diff_edge_n[3][3], &diff_edge_n[3][6],
86 &diff_edge_n[3][1], &diff_edge_n[3][4], &diff_edge_n[3][7],
87 &diff_edge_n[3][2], &diff_edge_n[3][5], &diff_edge_n[3][8], 9),
89 &diff_edge_n[4][0], &diff_edge_n[4][3], &diff_edge_n[4][6],
90 &diff_edge_n[4][1], &diff_edge_n[4][4], &diff_edge_n[4][7],
91 &diff_edge_n[4][2], &diff_edge_n[4][5], &diff_edge_n[4][8], 9),
93 &diff_edge_n[5][0], &diff_edge_n[5][3], &diff_edge_n[5][6],
94 &diff_edge_n[5][1], &diff_edge_n[5][4], &diff_edge_n[5][7],
95 &diff_edge_n[5][2], &diff_edge_n[5][5], &diff_edge_n[5][8], 9)};
99 for (
int ii = 0; ii != nb_integration_pts; ii++) {
101 const int node_shift = ii * 4;
102 for (
int ee = 0; ee != 6; ee++) {
107 t_psi_e_0(
i) = (
N[node_shift + edges_nodes[ee][1]] *
108 t_node_diff_ksi[edges_nodes[ee][0]](
i) -
109 N[node_shift + edges_nodes[ee][0]] *
110 t_node_diff_ksi[edges_nodes[ee][1]](
i)) *
112 t_diff_psi_e_0(
i,
j) = (t_node_diff_ksi[edges_nodes[ee][1]](
j) *
113 t_node_diff_ksi[edges_nodes[ee][0]](
i) -
114 t_node_diff_ksi[edges_nodes[ee][0]](
j) *
115 t_node_diff_ksi[edges_nodes[ee][1]](
i)) *
118 t_psi_e_1(
i) =
N[node_shift + edges_nodes[ee][1]] *
119 t_node_diff_ksi[edges_nodes[ee][0]](
i) +
120 N[node_shift + edges_nodes[ee][0]] *
121 t_node_diff_ksi[edges_nodes[ee][1]](
i);
122 t_diff_psi_e_1(
i,
j) = t_node_diff_ksi[edges_nodes[ee][1]](
j) *
123 t_node_diff_ksi[edges_nodes[ee][0]](
i) +
124 t_node_diff_ksi[edges_nodes[ee][0]](
j) *
125 t_node_diff_ksi[edges_nodes[ee][1]](
i);
127 (t_edge_n[ee])(
i) = t_psi_e_0(
i);
129 (t_edge_n[ee])(
i) = t_psi_e_1(
i);
132 (t_diff_edge_n[ee])(
i,
j) = t_diff_psi_e_0(
i,
j);
133 ++(t_diff_edge_n[ee]);
134 (t_diff_edge_n[ee])(
i,
j) = t_diff_psi_e_1(
i,
j);
135 ++(t_diff_edge_n[ee]);
139 const double ksi_0i = (
N[node_shift + edges_nodes[ee][1]] -
140 N[node_shift + edges_nodes[ee][0]]) *
142 double psi_l[p[ee] + 1], diff_psi_l[3 * p[ee] + 3];
143 CHKERR base_polynomials(p[ee], ksi_0i, &edge_diff_ksi[ee][0], psi_l,
147 &diff_psi_l[0], &diff_psi_l[p[ee] + 1], &diff_psi_l[2 * p[ee] + 2],
150 for (
int ll = 2; ll !=
P[ee]; ll++) {
155 (t_edge_n[ee])(
i) =
a * psi_l[ll - 1] * t_psi_e_1(
i) -
156 b * psi_l[ll - 2] * t_psi_e_0(
i);
159 (t_diff_edge_n[ee])(
i,
j) =
160 -b * (t_diff_psi_l(
j) * t_psi_e_0(
i) +
161 psi_l[ll - 2] * t_diff_psi_e_0(
i,
j));
163 (t_diff_edge_n[ee])(
i,
j) +=
164 a * (t_diff_psi_l(
j) * t_psi_e_1(
i) +
165 psi_l[ll - 1] * t_diff_psi_e_1(
i,
j));
166 ++(t_diff_edge_n[ee]);
176 int sense,
int p,
double *
N,
double *diffN,
double *edge_n,
177 double *diff_edge_n,
int nb_integration_pts,
178 PetscErrorCode (*base_polynomials)(
int p,
double s,
double *diff_s,
179 double *
L,
double *diffL,
185 if (diff_edge_n != NULL)
187 "Calculation of derivatives not implemented");
191 t_node_diff_ksi[0](0) = diffN[0];
192 t_node_diff_ksi[0](1) = 0;
193 t_node_diff_ksi[0](2) = 0;
194 t_node_diff_ksi[1](0) = diffN[1];
195 t_node_diff_ksi[1](1) = 0;
196 t_node_diff_ksi[1](2) = 0;
199 &edge_n[0], &edge_n[1], &edge_n[2]);
202 for (
int ii = 0; ii != nb_integration_pts; ii++) {
204 const int node_shift = ii * 2;
206 t_psi_e_0(
i) = (
N[node_shift + 1] * t_node_diff_ksi[0](
i) -
207 N[node_shift + 0] * t_node_diff_ksi[1](
i)) *
209 t_psi_e_1(
i) =
N[node_shift + 1] * t_node_diff_ksi[0](
i) +
210 N[node_shift + 0] * t_node_diff_ksi[1](
i);
212 t_edge_n(
i) = t_psi_e_0(
i);
215 t_edge_n(
i) = t_psi_e_1(
i);
220 const double ksi_0i = (
N[node_shift + 1] -
N[node_shift + 0]) * sense;
222 CHKERR base_polynomials(p, ksi_0i, NULL, psi_l, NULL, 3);
228 a * psi_l[ll - 1] * t_psi_e_1(
i) - b * psi_l[ll - 2] * t_psi_e_0(
i);
238 int *sense,
int *p,
double *
N,
double *diffN,
double *edge_n[],
239 double *diff_edge_n[],
int nb_integration_pts,
240 PetscErrorCode (*base_polynomials)(
int p,
double s,
double *diff_s,
241 double *
L,
double *diffL,
248 const int edges_nodes[3][2] = {{0, 1}, {1, 2}, {2, 0}};
250 for (
int ee = 0; ee < 3; ee++)
290 for (
int ee = 0; ee != 3; ee++) {
294 const int node0 = edges_nodes[ee][0];
295 const int node1 = edges_nodes[ee][1];
296 const int sense_edge = sense[ee];
298 t_diff_psi_e_0(
i,
j) =
299 (t_node_diff_ksi[node0](
i) * t_2d_diff_ksi[node1](
j) -
300 t_node_diff_ksi[node1](
i) * t_2d_diff_ksi[node0](
j)) *
302 t_diff_psi_e_1(
i,
j) = t_node_diff_ksi[node0](
i) * t_2d_diff_ksi[node1](
j) +
303 t_node_diff_ksi[node1](
i) * t_2d_diff_ksi[node0](
j);
305 for (
int ii = 0; ii != nb_integration_pts; ii++) {
307 const int node_shift = ii * 3;
308 const double n0 =
N[node_shift + node0];
309 const double n1 =
N[node_shift + node1];
312 (n1 * t_node_diff_ksi[node0](
i) - n0 * t_node_diff_ksi[node1](
i)) *
315 n1 * t_node_diff_ksi[node0](
i) + n0 * t_node_diff_ksi[node1](
i);
317 (t_edge_n[ee])(
i) = t_psi_e_0(
i);
318 (t_diff_edge_n[ee])(
i,
j) = t_diff_psi_e_0(
i,
j);
320 ++(t_diff_edge_n[ee]);
321 (t_edge_n[ee])(
i) = t_psi_e_1(
i);
322 (t_diff_edge_n[ee])(
i,
j) = t_diff_psi_e_1(
i,
j);
324 ++(t_diff_edge_n[ee]);
327 const double ksi_0i = (n1 - n0) * sense_edge;
328 double diff_ksi_0i[] = {
329 ((t_2d_diff_ksi[node1])(0) - (t_2d_diff_ksi[node0])(0)) *
331 ((t_2d_diff_ksi[node1])(1) - (t_2d_diff_ksi[node0])(1)) *
334 double psi_l[p[ee] + 1], diff_psi_l[2 * p[ee] + 2];
336 base_polynomials(p[ee], ksi_0i, diff_ksi_0i, psi_l, diff_psi_l, 2);
339 &diff_psi_l[0 + 2 - 1], &diff_psi_l[p[ee] + 1 + 2 - 1], 1);
341 &diff_psi_l[0 + 2 - 2], &diff_psi_l[p[ee] + 1 + 2 - 2], 1);
342 for (
int ll = 2; ll !=
P[ee]; ll++) {
345 (t_edge_n[ee])(
i) =
a * psi_l[ll - 1] * t_psi_e_1(
i) -
346 b * psi_l[ll - 2] * t_psi_e_0(
i);
347 (t_diff_edge_n[ee])(
i,
j) =
a * t_psi_e_1(
i) * t_diff_psi_ll_m1(
j) +
348 a * psi_l[ll - 1] * t_diff_psi_e_1(
i,
j) -
349 b * t_psi_e_0(
i) * t_diff_psi_ll_m2(
j) -
350 b * psi_l[ll - 2] * t_diff_psi_e_0(
i,
j);
352 ++(t_diff_edge_n[ee]);
364 int *faces_nodes,
int *p,
double *
N,
double *diffN,
double *phi_f_e[4][3],
365 double *diff_phi_f_e[4][3],
int nb_integration_pts,
366 PetscErrorCode (*base_polynomials)(
int p,
double s,
double *diff_s,
367 double *
L,
double *diffL,
371 const int edges[3][2] = {{0, 1}, {1, 2}, {2, 0}};
384 for (
int ff = 0; ff != 4; ff++) {
386 const int o_nodes[3] = {faces_nodes[3 * ff + 2], faces_nodes[3 * ff + 0],
387 faces_nodes[3 * ff + 1]};
390 &diffN[3 * o_nodes[0] + 1],
391 &diffN[3 * o_nodes[0] + 2]),
393 &diffN[3 * o_nodes[1] + 1],
394 &diffN[3 * o_nodes[1] + 2]),
396 &diffN[3 * o_nodes[2] + 1],
397 &diffN[3 * o_nodes[2] + 2])};
398 double psi_l[p[ff] + 1], diff_psi_l[3 * p[ff] + 3];
402 if (nb_base_fun_on_face == 0)
405 for (
int ee = 0; ee != 3; ee++) {
408 &phi_f_e[ff][ee][0], &phi_f_e[ff][ee][1], &phi_f_e[ff][ee][2], 3);
410 &diff_phi_f_e[ff][ee][0], &diff_phi_f_e[ff][ee][3],
411 &diff_phi_f_e[ff][ee][6], &diff_phi_f_e[ff][ee][1],
412 &diff_phi_f_e[ff][ee][4], &diff_phi_f_e[ff][ee][7],
413 &diff_phi_f_e[ff][ee][2], &diff_phi_f_e[ff][ee][5],
414 &diff_phi_f_e[ff][ee][8], 9);
415 const int en[] = {faces_nodes[3 * ff + edges[ee][0]],
416 faces_nodes[3 * ff + edges[ee][1]]};
418 t_node_diff_ksi[en[1]](
i) - t_node_diff_ksi[en[0]](
i);
420 for (
int ii = 0; ii != nb_integration_pts; ii++) {
422 const int node_shift = ii * 4;
423 const double n[] = {
N[node_shift + faces_nodes[3 * ff + edges[ee][0]]],
424 N[node_shift + faces_nodes[3 * ff + edges[ee][1]]]};
425 const double ksi_0i =
n[1] -
n[0];
426 CHKERR base_polynomials(p[ff], ksi_0i, &t_edge_diff_ksi(0), psi_l,
430 &diff_psi_l[0], &diff_psi_l[p[ff] + 1], &diff_psi_l[2 * p[ff] + 2],
433 const double beta_e =
n[0] *
n[1];
435 t_node_diff_ksi[en[0]](
j) *
n[1] +
n[0] * t_node_diff_ksi[en[1]](
j);
437 for (
int ll = 0; ll != nb_base_fun_on_face; ll++) {
440 t_face_edge_base(
i) =
441 beta_e * psi_l[ll] * t_opposite_node_diff[ee](
i);
444 t_diff_face_edge_base(
i,
j) =
445 (beta_e * t_diff_psi_l(
j) + t_diff_beta_e(
j) * psi_l[ll]) *
446 t_opposite_node_diff[ee](
i);
448 ++t_diff_face_edge_base;
459 int *faces_nodes,
int p,
double *
N,
double *diffN,
double *phi_f_e[3],
460 double *diff_phi_f_e[3],
int nb_integration_pts,
461 PetscErrorCode (*base_polynomials)(
int p,
double s,
double *diff_s,
462 double *
L,
double *diffL,
468 if (nb_base_fun_on_face == 0)
471 const int edges[3][2] = {{0, 1}, {1, 2}, {2, 0}};
476 const int o_nodes[3] = {2, 0, 1};
478 diffN[2 * o_nodes[0] + 0], diffN[2 * o_nodes[0] + 1], 0.,
479 diffN[2 * o_nodes[1] + 0], diffN[2 * o_nodes[1] + 1], 0.,
480 diffN[2 * o_nodes[2] + 0], diffN[2 * o_nodes[2] + 1], 0.);
482 double diff_psi_l[2 * p + 2];
486 &phi_f_e[0][
HVEC2], 3),
488 &phi_f_e[1][
HVEC2], 3),
490 &phi_f_e[2][
HVEC2], 3),
493 t_diff_face_edge_base[3] = {
507 for (
int ee = 0; ee != 3; ee++) {
509 const int node0 = faces_nodes[edges[ee][0]];
510 const int node1 = faces_nodes[edges[ee][1]];
511 double diff_ksi0i[] = {diffN[2 * node1 + 0] - diffN[2 * node0 + 0],
512 diffN[2 * node1 + 1] - diffN[2 * node0 + 1]};
514 for (
int ii = 0; ii != nb_integration_pts; ii++) {
516 const int node_shift = ii * 3;
517 const double n0 =
N[node_shift + node0];
518 const double n1 =
N[node_shift + node1];
519 const double ksi_0i = n1 - n0;
520 CHKERR base_polynomials(p, ksi_0i, diff_ksi0i, psi_l, diff_psi_l, 2);
522 const double beta_e = n0 * n1;
524 diffN[2 * node0 + 0] * n1 + n0 * diffN[2 * node1 + 0],
525 diffN[2 * node0 + 1] * n1 + n0 * diffN[2 * node1 + 1]);
527 &diff_psi_l[p + 1], 1);
529 for (
int ll = 0; ll != nb_base_fun_on_face; ll++) {
530 t_face_edge_base[ee](
i) =
531 beta_e * psi_l[ll] * t_opposite_node_diff(ee,
i);
532 t_diff_face_edge_base[ee](
i,
j) =
533 beta_e * t_opposite_node_diff(ee,
i) * t_diff_psi_l(
j) +
534 psi_l[ll] * t_opposite_node_diff(ee,
i) * t_diff_beta_e(
j);
535 ++t_face_edge_base[ee];
536 ++t_diff_face_edge_base[ee];
546 int *faces_nodes,
int *p,
double *
N,
double *diffN,
double *phi_f[4],
547 double *diff_phi_f[4],
int nb_integration_pts,
548 PetscErrorCode (*base_polynomials)(
int p,
double s,
double *diff_s,
549 double *
L,
double *diffL,
575 for (
int ff = 0; ff != 4; ff++) {
580 int n0 = faces_nodes[3 * ff + 0];
581 int n1 = faces_nodes[3 * ff + 1];
582 int n2 = faces_nodes[3 * ff + 2];
586 tou_0i(
i) = t_node_diff_ksi[n1](
i) - t_node_diff_ksi[n0](
i);
587 tou_0j(
i) = t_node_diff_ksi[n2](
i) - t_node_diff_ksi[n0](
i);
589 t_diff_ksi0i(
i) = t_node_diff_ksi[n1](
i) - t_node_diff_ksi[n0](
i);
590 t_diff_ksi0j(
i) = t_node_diff_ksi[n2](
i) - t_node_diff_ksi[n0](
i);
592 double psi_l_0i[p[ff] + 1], diff_psi_l_0i[3 * p[ff] + 3];
593 double psi_l_0j[p[ff] + 1], diff_psi_l_0j[3 * p[ff] + 3];
598 &diff_phi_f[ff][0], &diff_phi_f[ff][3], &diff_phi_f[ff][6],
599 &diff_phi_f[ff][1], &diff_phi_f[ff][4], &diff_phi_f[ff][7],
600 &diff_phi_f[ff][2], &diff_phi_f[ff][5], &diff_phi_f[ff][8], 9);
603 for (
int ii = 0; ii != nb_integration_pts; ii++) {
605 const int node_shift = ii * 4;
606 const double beta_0ij =
607 N[node_shift + n0] *
N[node_shift + n1] *
N[node_shift + n2];
609 t_node_diff_ksi[n0](
i) *
N[node_shift + n1] *
N[node_shift + n2] +
610 N[node_shift + n0] * t_node_diff_ksi[n1](
i) *
N[node_shift + n2] +
611 N[node_shift + n0] *
N[node_shift + n1] * t_node_diff_ksi[n2](
i);
613 const double ksi_0i =
N[node_shift + n1] -
N[node_shift + n0];
614 CHKERR base_polynomials(p[ff], ksi_0i, &t_diff_ksi0i(0), psi_l_0i,
617 const double ksi_0j =
N[node_shift + n2] -
N[node_shift + n0];
618 CHKERR base_polynomials(p[ff], ksi_0j, &t_diff_ksi0j(0), psi_l_0j,
622 for (
int oo = 0; oo <= (p[ff] - 3); oo++) {
624 &diff_psi_l_0i[0], &diff_psi_l_0i[p[ff] + 1],
625 &diff_psi_l_0i[2 * p[ff] + 2], 1);
626 for (
int pp0 = 0; pp0 <= oo; pp0++) {
627 const int pp1 = oo - pp0;
630 &diff_psi_l_0j[pp1], &diff_psi_l_0j[p[ff] + 1 + pp1],
631 &diff_psi_l_0j[2 * p[ff] + 2 + pp1], 1);
633 const double a = beta_0ij * psi_l_0i[pp0] * psi_l_0j[pp1];
634 t_phi_f(
i) =
a * tou_0i(
i);
637 t_phi_f(
i) =
a * tou_0j(
i);
641 t_b(
j) = diff_beta_0ij(
j) * psi_l_0i[pp0] * psi_l_0j[pp1] +
642 beta_0ij * t_diff_psi_l_0i(
j) * psi_l_0j[pp1] +
643 beta_0ij * psi_l_0i[pp0] * t_diff_psi_l_0j(
j);
644 t_diff_phi_f(
i,
j) = t_b(
j) * tou_0i(
i);
646 t_diff_phi_f(
i,
j) = t_b(
j) * tou_0j(
i);
653 if (cc != nb_base_fun_on_face) {
655 "Wrong number of base functions %d != %d", cc,
656 nb_base_fun_on_face);
664 int *faces_nodes,
int p,
double *
N,
double *diffN,
double *phi_f,
665 double *diff_phi_f,
int nb_integration_pts,
666 PetscErrorCode (*base_polynomials)(
int p,
double s,
double *diff_s,
667 double *
L,
double *diffL,
674 &diffN[2], &diffN[3], &zero,
675 &diffN[4], &diffN[5], &zero);
687 const int node0 = faces_nodes[0];
688 const int node1 = faces_nodes[1];
689 const int node2 = faces_nodes[2];
694 tou_0i(
i) = t_node_diff_ksi(N1,
i) - t_node_diff_ksi(N0,
i);
696 tou_0j(
i) = t_node_diff_ksi(N2,
i) - t_node_diff_ksi(N0,
i);
699 double psi_l_0i[p + 1], psi_l_0j[p + 1];
700 double diff_psi_l_0i[2 * p + 2], diff_psi_l_0j[2 * p + 2];
706 double diff_ksi_0i[] = {t_node_diff_ksi(node1, 0) - t_node_diff_ksi(node0, 0),
707 t_node_diff_ksi(node1, 1) -
708 t_node_diff_ksi(node0, 1)};
709 double diff_ksi_0j[] = {t_node_diff_ksi(node2, 0) - t_node_diff_ksi(node0, 0),
710 t_node_diff_ksi(node2, 1) -
711 t_node_diff_ksi(node0, 1)};
713 for (
int ii = 0; ii != nb_integration_pts; ii++) {
715 const int node_shift = ii * 3;
716 const double n0 =
N[node_shift + node0];
717 const double n1 =
N[node_shift + node1];
718 const double n2 =
N[node_shift + node2];
720 const double beta_0ij = n0 * n1 * n2;
722 t_node_diff_ksi(node0, 0) * n1 * n2 +
723 n0 * t_node_diff_ksi(node1, 0) * n2 +
724 n0 * n1 * t_node_diff_ksi(node2, 0),
725 t_node_diff_ksi(node0, 1) * n1 * n2 +
726 n0 * t_node_diff_ksi(node1, 1) * n2 +
727 n0 * n1 * t_node_diff_ksi(node2, 1));
729 const double ksi_0i =
N[node_shift + node1] -
N[node_shift + node0];
730 CHKERR base_polynomials(p, ksi_0i, diff_ksi_0i, psi_l_0i, diff_psi_l_0i, 2);
732 const double ksi_0j =
N[node_shift + node2] -
N[node_shift + node0];
733 CHKERR base_polynomials(p, ksi_0j, diff_ksi_0j, psi_l_0j, diff_psi_l_0j, 2);
737 for (
int oo = 0; oo <= (p - 3); oo++) {
738 for (
int pp0 = 0; pp0 <= oo; pp0++) {
739 const int pp1 = oo - pp0;
742 diff_psi_l_0i[0 + pp0], diff_psi_l_0i[p + 1 + pp0]);
744 diff_psi_l_0j[0 + pp1], diff_psi_l_0j[p + 1 + pp1]);
745 const double a = beta_0ij * psi_l_0i[pp0] * psi_l_0j[pp1];
746 t_diff_a(
j) = diff_beta_0ij(
j) * psi_l_0i[pp0] * psi_l_0j[pp1] +
747 beta_0ij * psi_l_0i[pp0] * t_diff_psi_l_0j(
j) +
748 beta_0ij * psi_l_0j[pp1] * t_diff_psi_l_0i(
j);
750 t_phi_f(
i) =
a * tou_0i(
i);
751 t_diff_phi_f(
i,
j) = tou_0i(
i) * t_diff_a(
j);
755 t_phi_f(
i) =
a * tou_0j(
i);
756 t_diff_phi_f(
i,
j) = tou_0j(
i) * t_diff_a(
j);
765 if (cc != nb_base_fun_on_face) {
767 "Wrong number of base functions %d != %d", cc,
768 nb_base_fun_on_face);
776 int *faces_nodes,
int p,
double *
N,
double *diffN,
double *phi_v,
777 double *diff_phi_v,
int nb_integration_pts,
778 PetscErrorCode (*base_polynomials)(
int p,
double s,
double *diff_s,
779 double *
L,
double *diffL,
787 const int face_opposite_nodes[] = {2, 0, 1, 3};
804 double *psi_l_0i[] = {&m_psi_l_0i(0, 0), &m_psi_l_0i(1, 0), &m_psi_l_0i(2, 0),
806 double *psi_l_0j[] = {&m_psi_l_0j(0, 0), &m_psi_l_0j(1, 0), &m_psi_l_0j(2, 0),
808 double *diff_psi_l_0i[] = {&m_diff_psi_l_0i(0, 0), &m_diff_psi_l_0i(1, 0),
809 &m_diff_psi_l_0i(2, 0), &m_diff_psi_l_0i(3, 0)};
810 double *diff_psi_l_0j[] = {&m_diff_psi_l_0j(0, 0), &m_diff_psi_l_0j(1, 0),
811 &m_diff_psi_l_0j(2, 0), &m_diff_psi_l_0j(3, 0)};
818 &diff_phi_v[0], &diff_phi_v[3], &diff_phi_v[6], &diff_phi_v[1],
819 &diff_phi_v[4], &diff_phi_v[7], &diff_phi_v[2], &diff_phi_v[5],
822 for (
int ii = 0; ii != nb_integration_pts; ii++) {
824 for (
int ff = 0; ff != 4; ff++) {
826 t_diff_ksi0i(
i) = t_node_diff_ksi[faces_nodes[3 * ff + 1]](
i) -
827 t_node_diff_ksi[faces_nodes[3 * ff + 0]](
i);
828 t_diff_ksi0j(
i) = t_node_diff_ksi[faces_nodes[3 * ff + 2]](
i) -
829 t_node_diff_ksi[faces_nodes[3 * ff + 0]](
i);
831 const int node_shift = ii * 4;
833 beta_f[ff] =
N[node_shift + faces_nodes[3 * ff + 0]] *
834 N[node_shift + faces_nodes[3 * ff + 1]] *
835 N[node_shift + faces_nodes[3 * ff + 2]];
837 t_diff_beta_f[ff](
j) = t_node_diff_ksi[faces_nodes[3 * ff + 0]](
j) *
838 N[node_shift + faces_nodes[3 * ff + 1]] *
839 N[node_shift + faces_nodes[3 * ff + 2]] +
840 N[node_shift + faces_nodes[3 * ff + 0]] *
841 t_node_diff_ksi[faces_nodes[3 * ff + 1]](
j) *
842 N[node_shift + faces_nodes[3 * ff + 2]] +
843 N[node_shift + faces_nodes[3 * ff + 0]] *
844 N[node_shift + faces_nodes[3 * ff + 1]] *
845 t_node_diff_ksi[faces_nodes[3 * ff + 2]](
j);
847 const double ksi_0i =
N[node_shift + faces_nodes[3 * ff + 1]] -
848 N[node_shift + faces_nodes[3 * ff + 0]];
849 CHKERR base_polynomials(p, ksi_0i, &t_diff_ksi0i(0), psi_l_0i[ff],
850 diff_psi_l_0i[ff], 3);
852 const double ksi_0j =
N[node_shift + faces_nodes[3 * ff + 2]] -
853 N[node_shift + faces_nodes[3 * ff + 0]];
854 CHKERR base_polynomials(p, ksi_0j, &t_diff_ksi0j(0), psi_l_0j[ff],
855 diff_psi_l_0j[ff], 3);
859 for (
int oo = 0; oo <= (p - 3); oo++) {
862 &diff_psi_l_0i[0][p + 1],
863 &diff_psi_l_0i[0][2 * p + 2], 1),
865 &diff_psi_l_0i[1][p + 1],
866 &diff_psi_l_0i[1][2 * p + 2], 1),
868 &diff_psi_l_0i[2][p + 1],
869 &diff_psi_l_0i[2][2 * p + 2], 1),
871 &diff_psi_l_0i[3][p + 1],
872 &diff_psi_l_0i[3][2 * p + 2], 1),
874 for (
int pp0 = 0; pp0 <= oo; pp0++) {
875 const int pp1 = oo - pp0;
877 for (
int ff = 0; ff != 4; ff++) {
879 &m_diff_psi_l_0j(ff, pp1), &m_diff_psi_l_0j(ff, p + 1 + pp1),
880 &m_diff_psi_l_0j(ff, 2 * p + 2 + pp1), 1);
881 const double t = psi_l_0i[ff][pp0] * psi_l_0j[ff][pp1];
882 const double a = beta_f[ff] *
t;
883 t_phi_v(
i) =
a * t_node_diff_ksi[face_opposite_nodes[ff]](
i);
887 (t_diff_beta_f[ff](
j) *
t +
888 beta_f[ff] * t_diff_psi_l_0i[ff](
j) * psi_l_0j[ff][pp1] +
889 beta_f[ff] * psi_l_0i[ff][pp0] * t_diff_psi_l_0j(
j)) *
890 t_node_diff_ksi[face_opposite_nodes[ff]](
i);
892 ++t_diff_psi_l_0i[ff];
899 if (cc != nb_base_fun_on_face) {
901 "Wrong number of base functions %d != %d", cc,
902 nb_base_fun_on_face);
910 int p,
double *
N,
double *diffN,
double *phi_v,
double *diff_phi_v,
911 int nb_integration_pts,
912 PetscErrorCode (*base_polynomials)(
int p,
double s,
double *diff_s,
913 double *
L,
double *diffL,
933 double diff_ksi0i[3], diff_ksi0j[3], diff_ksi0k[3];
940 t_diff_ksi0i(
i) = t_node_diff_ksi[1](
i) - t_node_diff_ksi[0](
i);
941 t_diff_ksi0j(
i) = t_node_diff_ksi[2](
i) - t_node_diff_ksi[0](
i);
942 t_diff_ksi0k(
i) = t_node_diff_ksi[3](
i) - t_node_diff_ksi[0](
i);
944 std::vector<double> v_psi_l_0i(p + 1), v_diff_psi_l_0i(3 * p + 3);
945 std::vector<double> v_psi_l_0j(p + 1), v_diff_psi_l_0j(3 * p + 3);
946 std::vector<double> v_psi_l_0k(p + 1), v_diff_psi_l_0k(3 * p + 3);
947 double *psi_l_0i = &*v_psi_l_0i.begin();
948 double *diff_psi_l_0i = &*v_diff_psi_l_0i.begin();
949 double *psi_l_0j = &*v_psi_l_0j.begin();
950 double *diff_psi_l_0j = &*v_diff_psi_l_0j.begin();
951 double *psi_l_0k = &*v_psi_l_0k.begin();
952 double *diff_psi_l_0k = &*v_diff_psi_l_0k.begin();
956 &diff_phi_v[0], &diff_phi_v[3], &diff_phi_v[6], &diff_phi_v[1],
957 &diff_phi_v[4], &diff_phi_v[7], &diff_phi_v[2], &diff_phi_v[5],
961 for (
int ii = 0; ii != nb_integration_pts; ii++) {
963 const int node_shift = ii * 4;
964 const int n0 = node_shift + 0;
965 const int n1 = node_shift + 1;
966 const int n2 = node_shift + 2;
967 const int n3 = node_shift + 3;
969 const double beta_v =
N[n0] *
N[n1] *
N[n2] *
N[n3];
971 const double ksi_0i =
N[n1] -
N[n0];
972 CHKERR base_polynomials(p, ksi_0i, diff_ksi0i, psi_l_0i, diff_psi_l_0i, 3);
974 const double ksi_0j =
N[n2] -
N[n0];
975 CHKERR base_polynomials(p, ksi_0j, diff_ksi0j, psi_l_0j, diff_psi_l_0j, 3);
977 const double ksi_0k =
N[n3] -
N[n0];
978 CHKERR base_polynomials(p, ksi_0k, diff_ksi0k, psi_l_0k, diff_psi_l_0k, 3);
981 t_diff_beta_v(
j) = t_node_diff_ksi[0](
j) *
N[n1] *
N[n2] *
N[n3] +
982 N[n0] * t_node_diff_ksi[1](
j) *
N[n2] *
N[n3] +
983 N[n0] *
N[n1] * t_node_diff_ksi[2](
j) *
N[n3] +
984 N[n0] *
N[n1] *
N[n2] * t_node_diff_ksi[3](
j);
987 for (
int oo = 0; oo <= (p - 4); oo++) {
989 &diff_psi_l_0i[0], &diff_psi_l_0i[p + 1], &diff_psi_l_0i[2 * p + 2],
991 for (
int pp0 = 0; pp0 <= oo; pp0++) {
993 &diff_psi_l_0j[0], &diff_psi_l_0j[p + 1], &diff_psi_l_0j[2 * p + 2],
995 for (
int pp1 = 0; (pp0 + pp1) <= oo; pp1++) {
996 const int pp2 = oo - pp0 - pp1;
999 &diff_psi_l_0k[0 + pp2], &diff_psi_l_0k[p + 1 + pp2],
1000 &diff_psi_l_0k[2 * p + 2 + pp2], 1);
1001 const double t = psi_l_0i[pp0] * psi_l_0j[pp1] * psi_l_0k[pp2];
1002 const double a = beta_v *
t;
1019 t_diff_beta_v(
j) *
t +
1020 beta_v * (t_diff_psi_l_0i(
j) * psi_l_0j[pp1] * psi_l_0k[pp2] +
1021 psi_l_0i[pp0] * t_diff_psi_l_0j(
j) * psi_l_0k[pp2] +
1022 psi_l_0i[pp0] * psi_l_0j[pp1] * t_diff_psi_l_0k(
j));
1023 t_diff_phi_v(N0,
j) = t_b(
j);
1024 t_diff_phi_v(N1,
j) = 0;
1025 t_diff_phi_v(N2,
j) = 0;
1027 t_diff_phi_v(N0,
j) = 0;
1028 t_diff_phi_v(N1,
j) = t_b(
j);
1029 t_diff_phi_v(N2,
j) = 0;
1031 t_diff_phi_v(N0,
j) = 0;
1032 t_diff_phi_v(N1,
j) = 0;
1033 t_diff_phi_v(N2,
j) = t_b(
j);
1043 if (cc != nb_base_fun_on_face) {
1045 "Wrong number of base functions %d != %d", cc,
1046 nb_base_fun_on_face);
1053 int *face_nodes,
int *p,
double *
N,
double *diffN,
double *phi_f[4],
1054 double *diff_phi_f[4],
int nb_integration_pts,
1055 PetscErrorCode (*base_polynomials)(
int p,
double s,
double *diff_s,
1056 double *
L,
double *diffL,
1065 double *phi_f_e[4][3];
1066 double *diff_phi_f_e[4][3];
1067 for (
int ff = 0; ff != 4; ff++) {
1069 for (
int ee = 0; ee != 3; ee++) {
1070 phi_f_e[ff][ee] = NULL;
1071 diff_phi_f_e[ff][ee] = NULL;
1074 base_face_edge_functions[ff].resize(
1076 diff_base_face_edge_functions[ff].resize(
1080 for (
int ee = 0; ee != 3; ee++) {
1081 phi_f_e[ff][ee] = &base_face_edge_functions[ff](ee, 0);
1082 diff_phi_f_e[ff][ee] = &diff_base_face_edge_functions[ff](ee, 0);
1087 face_nodes, p,
N, diffN, phi_f_e, diff_phi_f_e, nb_integration_pts,
1093 double *diff_phi_f_f[4];
1094 for (
int ff = 0; ff != 4; ff++) {
1098 diff_phi_f_f[ff] = NULL;
1100 base_face_bubble_functions[ff].resize(3 * nb_dofs * nb_integration_pts,
1102 diff_base_face_bubble_functions[ff].resize(
1103 9 * nb_dofs * nb_integration_pts,
false);
1104 phi_f_f[ff] = &*base_face_bubble_functions[ff].data().begin();
1105 diff_phi_f_f[ff] = &*diff_base_face_bubble_functions[ff].data().begin();
1109 face_nodes, p,
N, diffN, phi_f_f, diff_phi_f_f, nb_integration_pts,
1115 for (
int ff = 0; ff != 4; ff++) {
1122 &phi_f_e[ff][0][2], 3),
1124 &phi_f_e[ff][1][2], 3),
1126 &phi_f_e[ff][2][2], 3)};
1129 &diff_phi_f_e[ff][0][0], &diff_phi_f_e[ff][0][3],
1130 &diff_phi_f_e[ff][0][6], &diff_phi_f_e[ff][0][1],
1131 &diff_phi_f_e[ff][0][4], &diff_phi_f_e[ff][0][7],
1132 &diff_phi_f_e[ff][0][2], &diff_phi_f_e[ff][0][5],
1133 &diff_phi_f_e[ff][0][8], 9),
1135 &diff_phi_f_e[ff][1][0], &diff_phi_f_e[ff][1][3],
1136 &diff_phi_f_e[ff][1][6], &diff_phi_f_e[ff][1][1],
1137 &diff_phi_f_e[ff][1][4], &diff_phi_f_e[ff][1][7],
1138 &diff_phi_f_e[ff][1][2], &diff_phi_f_e[ff][1][5],
1139 &diff_phi_f_e[ff][1][8], 9),
1141 &diff_phi_f_e[ff][2][0], &diff_phi_f_e[ff][2][3],
1142 &diff_phi_f_e[ff][2][6], &diff_phi_f_e[ff][2][1],
1143 &diff_phi_f_e[ff][2][4], &diff_phi_f_e[ff][2][7],
1144 &diff_phi_f_e[ff][2][2], &diff_phi_f_e[ff][2][5],
1145 &diff_phi_f_e[ff][2][8], 9)};
1150 &diff_phi_f[ff][0], &diff_phi_f[ff][3], &diff_phi_f[ff][6],
1151 &diff_phi_f[ff][1], &diff_phi_f[ff][4], &diff_phi_f[ff][7],
1152 &diff_phi_f[ff][2], &diff_phi_f[ff][5], &diff_phi_f[ff][8], 9);
1156 &phi_f_f[ff][0], &phi_f_f[ff][1], &phi_f_f[ff][2], 3);
1158 &diff_phi_f_f[ff][0], &diff_phi_f_f[ff][3], &diff_phi_f_f[ff][6],
1159 &diff_phi_f_f[ff][1], &diff_phi_f_f[ff][4], &diff_phi_f_f[ff][7],
1160 &diff_phi_f_f[ff][2], &diff_phi_f_f[ff][5], &diff_phi_f_f[ff][8],
1162 for (
int ii = 0; ii != nb_integration_pts; ii++) {
1164 for (
int oo = 0; oo <= p[ff]; oo++) {
1167 for (
int ee = 0; ee != 3; ee++) {
1170 t_face_base(
i) = t_face_edge_base[ee](
i);
1173 ++t_face_edge_base[ee];
1174 t_diff_face_base(
i,
j) = t_diff_face_edge_base[ee](
i,
j);
1176 ++t_diff_face_edge_base[ee];
1186 t_face_base(
i) = t_face_face_base(
i);
1190 t_diff_face_base(
i,
j) = t_diff_face_face_base(
i,
j);
1192 ++t_diff_face_face_base;
1198 if (cc != nb_base_fun_on_face) {
1200 "Wrong number of base functions %d != %d", cc,
1201 nb_base_fun_on_face);
1205 for (
int ii = 0; ii != nb_integration_pts; ii++) {
1207 for (
int oo = 0; oo <= p[ff]; oo++) {
1210 for (
int ee = 0; ee != 3; ee++) {
1213 t_face_base(
i) = t_face_edge_base[ee](
i);
1216 ++t_face_edge_base[ee];
1217 t_diff_face_base(
i,
j) = t_diff_face_edge_base[ee](
i,
j);
1219 ++t_diff_face_edge_base[ee];
1228 if (cc != nb_base_fun_on_face) {
1230 "Wrong number of base functions %d != %d", cc,
1231 nb_base_fun_on_face);
1239 }
catch (std::exception &ex) {
1240 std::ostringstream ss;
1241 ss <<
"thorw in method: " << ex.what() <<
" at line " << __LINE__
1242 <<
" in file " << __FILE__;
1250 int *faces_nodes,
int p,
double *
N,
double *diffN,
double *phi_f,
1251 double *diff_phi_f,
int nb_integration_pts,
1252 PetscErrorCode (*base_polynomials)(
int p,
double s,
double *diff_s,
1253 double *
L,
double *diffL,
1261 MatrixDouble base_face_edge_functions, diff_base_face_edge_functions;
1263 double *diff_phi_f_e[3];
1265 nb_integration_pts);
1266 diff_base_face_edge_functions.resize(
1269 for (
int ee = 0; ee != 3; ee++) {
1270 phi_f_e[ee] = &base_face_edge_functions(ee, 0);
1271 diff_phi_f_e[ee] = &diff_base_face_edge_functions(ee, 0);
1274 faces_nodes, p,
N, diffN, phi_f_e, diff_phi_f_e, nb_integration_pts,
1279 double *phi_f_f, *diff_phi_f_f;
1281 nb_integration_pts);
1282 diff_base_face_bubble_functions.resize(
1284 phi_f_f = &*base_face_bubble_functions.data().begin();
1285 diff_phi_f_f = &*diff_base_face_bubble_functions.data().begin();
1287 faces_nodes, p,
N, diffN, phi_f_f, diff_phi_f_f, nb_integration_pts,
1297 &phi_f_e[0][
HVEC2], 3),
1299 &phi_f_e[1][
HVEC2], 3),
1301 &phi_f_e[2][
HVEC2], 3)};
1303 t_diff_face_edge_base[] = {
1328 for (
int ii = 0; ii != nb_integration_pts; ii++) {
1330 for (
int oo = 0; oo <= p; oo++) {
1333 for (
int ee = 0; ee != 3; ee++) {
1336 t_face_base(
i) = t_face_edge_base[ee](
i);
1337 t_diff_face_base(
i,
j) = t_diff_face_edge_base[ee](
i,
j);
1340 ++t_face_edge_base[ee];
1342 ++t_diff_face_edge_base[ee];
1350 t_face_base(
i) = t_face_face_base(
i);
1351 t_diff_face_base(
i,
j) = t_diff_face_face_base(
i,
j);
1356 ++t_diff_face_face_base;
1362 if (cc != nb_base_fun_on_face) {
1364 "Wrong number of base functions %d != %d", cc,
1365 nb_base_fun_on_face);
1369 for (
int ii = 0; ii != nb_integration_pts; ii++) {
1371 for (
int oo = 0; oo <= p; oo++) {
1374 for (
int ee = 0; ee != 3; ee++) {
1377 t_face_base(
i) = t_face_edge_base[ee](
i);
1378 t_diff_face_base(
i,
j) = t_diff_face_edge_base[ee](
i,
j);
1381 ++t_face_edge_base[ee];
1383 ++t_diff_face_edge_base[ee];
1392 if (cc != nb_base_fun_on_face) {
1394 "Wrong number of base functions %d != %d", cc,
1395 nb_base_fun_on_face);
1404 int p,
double *
N,
double *diffN,
double *phi_v,
double *diff_phi_v,
1405 int nb_integration_pts,
1406 PetscErrorCode (*base_polynomials)(
int p,
double s,
double *diff_s,
1407 double *
L,
double *diffL,
1418 double *phi_v_f = &*base_face_inetrior_functions.data().begin();
1419 double *diff_phi_v_f = &*diff_base_face_inetrior_functions.data().begin();
1420 int faces_nodes[] = {0, 1, 3, 1, 2, 3, 0, 2, 3, 0, 1, 2};
1422 faces_nodes, p,
N, diffN, phi_v_f, diff_phi_v_f, nb_integration_pts,
1426 nb_integration_pts);
1431 double *phi_v_v = &*base_interior_functions.data().begin();
1432 double *diff_phi_v_v = &*diff_base_interior_functions.data().begin();
1434 p,
N, diffN, phi_v_v, diff_phi_v_v, nb_integration_pts, base_polynomials);
1442 &diff_phi_v_f[0], &diff_phi_v_f[3], &diff_phi_v_f[6], &diff_phi_v_f[1],
1443 &diff_phi_v_f[4], &diff_phi_v_f[7], &diff_phi_v_f[2], &diff_phi_v_f[5],
1444 &diff_phi_v_f[8], 9);
1448 &diff_phi_v[0], &diff_phi_v[3], &diff_phi_v[6], &diff_phi_v[1],
1449 &diff_phi_v[4], &diff_phi_v[7], &diff_phi_v[2], &diff_phi_v[5],
1456 &diff_phi_v_v[0], &diff_phi_v_v[3], &diff_phi_v_v[6], &diff_phi_v_v[1],
1457 &diff_phi_v_v[4], &diff_phi_v_v[7], &diff_phi_v_v[2], &diff_phi_v_v[5],
1458 &diff_phi_v_v[8], 9);
1459 for (
int ii = 0; ii != nb_integration_pts; ii++) {
1461 for (
int oo = 0; oo <= p; oo++) {
1464 t_phi_v(
i) = t_face_interior(
i);
1468 t_diff_phi_v(
i,
j) = t_diff_face_interior(
i,
j);
1470 ++t_diff_face_interior;
1474 t_phi_v(
i) = t_volume_interior(
i);
1476 ++t_volume_interior;
1478 t_diff_phi_v(
i,
j) = t_diff_volume_interior(
i,
j);
1480 ++t_diff_volume_interior;
1485 if (cc != nb_base_fun_on_face) {
1487 "Wrong number of base functions %d != %d", cc,
1488 nb_base_fun_on_face);
1492 for (
int ii = 0; ii != nb_integration_pts; ii++) {
1494 for (
int oo = 0; oo <= p; oo++) {
1497 t_phi_v(
i) = t_face_interior(
i);
1501 t_diff_phi_v(
i,
j) = t_diff_face_interior(
i,
j);
1503 ++t_diff_face_interior;
1508 if (cc != nb_base_fun_on_face) {
1510 "Wrong number of base functions %d != %d", cc,
1511 nb_base_fun_on_face);
1519 #endif // Not GENERATE_VTK_WITH_CURL_BASE
1521 #ifdef GENERATE_VTK_WITH_CURL_BASE
1525 using namespace MoFEM;
1526 using namespace boost::numeric;
1528 MoFEMErrorCode VTK_Ainsworth_Hcurl_MBTET(
const string file_name) {
1531 double base_coords[] = {0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1};
1537 for (
int nn = 0; nn < 4; nn++) {
1538 CHKERR moab_ref.create_vertex(&base_coords[3 * nn], nodes[nn]);
1541 CHKERR moab_ref.create_element(MBTET, nodes, 4, tet);
1549 const int max_level = 4;
1550 for (
int ll = 0; ll != max_level; ll++) {
1553 ->getEntitiesByTypeAndRefLevel(
BitRefLevel().set(ll),
1557 ->getEntitiesByTypeAndRefLevel(
BitRefLevel().set(ll),
1562 CHKERR m_ref->addVerticesInTheMiddleOfEdges(edges,
1569 ->getEntitiesByTypeAndRefLevel(
BitRefLevel().set(max_level),
1576 CHKERR moab_ref.create_meshset(MESHSET_SET, meshset);
1577 CHKERR moab_ref.add_entities(meshset, tets);
1578 CHKERR moab_ref.convert_entities(meshset,
true,
false,
false);
1579 CHKERR moab_ref.delete_entities(&meshset, 1);
1583 CHKERR moab_ref.get_connectivity(tets, elem_nodes,
false);
1585 const int nb_gauss_pts = elem_nodes.size();
1588 Range::iterator nit = elem_nodes.begin();
1589 for (
int gg = 0; nit != elem_nodes.end(); nit++, gg++) {
1590 CHKERR moab_ref.get_coords(&*nit, 1, &gauss_pts(gg, 0));
1592 gauss_pts = trans(gauss_pts);
1595 shape_fun.resize(nb_gauss_pts, 4);
1597 &gauss_pts(1, 0), &gauss_pts(2, 0), nb_gauss_pts);
1599 double diff_shape_fun[12];
1603 const int order = 5;
1605 double def_val[] = {0, 0, 0, 0, 0, 0};
1607 int faces_nodes[] = {0, 1, 3, 1, 2, 3, 0, 2, 3, 0, 1, 2};
1751 cout <<
"NBFACETRI_AINSWORTH_FACE_HCURL "
1758 double *diff_phi_f[4];
1759 for (
int ff = 0; ff != 4; ff++) {
1760 phi_f[ff] = &base_face_bubble_functions(ff, 0);
1761 diff_phi_f[ff] = &diff_base_face_bubble_functions(ff, 0);
1765 faces_nodes, faces_order, &*shape_fun.data().begin(), diff_shape_fun,
1768 for (
int ff = 0; ff != 4; ff++) {
1770 std::ostringstream ss;
1771 ss <<
"curl_face_bubble_" << ff <<
"_" << ll;
1773 CHKERR moab_ref.tag_get_handle(ss.str().c_str(), 3, MB_TYPE_DOUBLE,
th,
1774 MB_TAG_CREAT | MB_TAG_SPARSE, def_val);
1775 std::ostringstream grad_ss;
1776 grad_ss <<
"grad_curl_face_bubble_" << ff <<
"_" << ll;
1778 CHKERR moab_ref.tag_get_handle(grad_ss.str().c_str(), 9, MB_TYPE_DOUBLE,
1779 th_grad, MB_TAG_CREAT | MB_TAG_SPARSE,
1783 for (Range::iterator nit = elem_nodes.begin(); nit != elem_nodes.end();
1786 CHKERR moab_ref.tag_set_data(
th, &*nit, 1, &(phi_f[ff][idx]));
1788 double grad[9] = {diff_phi_f[ff][sh + 0], diff_phi_f[ff][sh + 3],
1789 diff_phi_f[ff][sh + 6], diff_phi_f[ff][sh + 1],
1790 diff_phi_f[ff][sh + 4], diff_phi_f[ff][sh + 7],
1791 diff_phi_f[ff][sh + 2], diff_phi_f[ff][sh + 5],
1792 diff_phi_f[ff][sh + 8]};
1793 CHKERR moab_ref.tag_set_data(th_grad, &*nit, 1, grad);
1967 CHKERR moab_ref.create_meshset(MESHSET_SET, meshset);
1968 CHKERR moab_ref.add_entities(meshset, tets);
1969 CHKERR moab_ref.write_file(file_name.c_str(),
"VTK",
"", &meshset, 1);
1974 #endif // GENERATE_VTK_WITH_CURL_BASE
1976 #ifndef GENERATE_VTK_WITH_CURL_BASE
1989 template <
int DIM,
bool CALCULATE_DIRVATIVES>
1991 calculate(
int p,
int nb_integration_pts,
int n0_idx,
int n1_idx,
double n[],
2003 tGradN0pN1(
i) = t_grad_n0(
i) + t_grad_n1(
i);
2006 diffFi.resize(3, p + 1);
2011 for (
int gg = 0; gg != nb_integration_pts; ++gg) {
2013 const int shift_n = (DIM + 1) * gg;
2014 const double n0 =
n[shift_n + n0_idx];
2015 const double n1 =
n[shift_n + n1_idx];
2017 tPhi0(
i) = n0 * t_grad_n1(
i) - n1 * t_grad_n0(
i);
2018 t_phi(
i) = tPhi0(
i);
2022 if (CALCULATE_DIRVATIVES) {
2025 t_grad_n0(
j) * t_grad_n1(
i) - t_grad_n1(
j) * t_grad_n0(
i);
2026 (*t_diff_phi_ptr)(
i,
j) = t_diff_phi0(
i,
j);
2027 ++(*t_diff_phi_ptr);
2032 if (CALCULATE_DIRVATIVES)
2034 &tGradN0pN1(0), &*fI.
data().begin(),
2035 &*diffFi.data().begin(), DIM);
2038 &*fI.data().begin(),
nullptr, DIM);
2041 &diffFi(0, 1), &diffFi(1, 1), &diffFi(2, 1));
2043 for (
int oo = 1; oo <= p - 1; ++oo) {
2045 const double b = pow(n0 + n1, oo);
2046 t_phi(
i) = b * fI[oo] * tPhi0(
i);
2048 if (CALCULATE_DIRVATIVES) {
2051 oo * pow(n0 + n1, oo - 1) * (t_grad_n0(
i) + t_grad_n1(
i));
2052 (*t_diff_phi_ptr)(
i,
j) = (b * fI[oo]) * t_diff_phi0(
i,
j) +
2053 (b * t_diff_fi(
j)) * tPhi0(
i) +
2054 tDiffb(
j) * fI[oo] * tPhi0(
i);
2056 ++(*t_diff_phi_ptr);
2069 int *sense,
int *p,
double *
n,
double *diff_n,
double *
phi[],
2070 double *diff_phi[],
int nb_integration_pts) {
2072 constexpr
int e_nodes[6][2] = {{0, 1}, {1, 2}, {2, 0},
2073 {0, 3}, {1, 3}, {2, 3}};
2078 for (
int nn = 0; nn != 4; ++nn)
2080 diff_n[3 * nn + 0], diff_n[3 * nn + 1], diff_n[3 * nn + 2]);
2084 for (
int ee = 0; ee != 6; ++ee) {
2086 auto t_phi = getFTensor1FromPtr<3>(
phi[ee]);
2089 int n0_idx = e_nodes[ee][0];
2090 int n1_idx = e_nodes[ee][1];
2091 if (sense[ee] == -1) {
2097 CHKERR h_curl_base_on_edge.
calculate<3,
true>(p[ee], nb_integration_pts,
2098 n0_idx, n1_idx,
n, t_grad_n,
2099 t_phi, &t_diff_phi);
2106 int *sense,
int *p,
double *
n,
double *diff_n,
double *
phi[],
2107 double *diff_phi[],
int nb_integration_pts) {
2109 constexpr
int e_nodes[3][2] = {{0, 1}, {1, 2}, {2, 0}};
2114 for (
int nn = 0; nn != 3; ++nn)
2120 for (
int ee = 0; ee != 3; ++ee) {
2124 auto t_phi = getFTensor1FromPtr<3>(
phi[ee]);
2127 int n0_idx = e_nodes[ee][0];
2128 int n1_idx = e_nodes[ee][1];
2129 if (sense[ee] == -1) {
2135 CHKERR h_curl_base_on_edge.
calculate<2,
true>(p[ee], nb_integration_pts,
2136 n0_idx, n1_idx,
n, t_grad_n,
2137 t_phi, &t_diff_phi);
2145 int sense,
int p,
double *
n,
double *diff_n,
double *
phi,
double *diff_phi,
2146 int nb_integration_pts) {
2150 for (
int nn = 0; nn != 2; ++nn)
2158 if (diff_phi != NULL)
2160 "Not implemented derivatives for edge for Hcurl Demkowicz base");
2171 p, nb_integration_pts, n0_idx, n1_idx,
n, t_grad_n, t_phi,
nullptr);
2187 int p,
int nb_integration_pts,
int n0f0_idx,
int n1f0_idx,
int n2f0_idx,
2201 double *f0_phi_ii = &*f0PhiII.data().begin();
2202 double *diff_f0_phi_ii = &*diffF0PhiII.data().begin();
2203 auto t_f0_phi_ii = getFTensor1FromPtr<3>(f0_phi_ii);
2204 auto t_diff_f0_phi_ii = getFTensor2FromPtr<3, DIM>(diff_f0_phi_ii);
2206 CHKERR hCurlBaseOnEdge.
calculate<DIM,
true>(p - 1, nb_integration_pts,
2207 n0f0_idx, n1f0_idx,
n, t_grad_n,
2208 t_f0_phi_ii, &t_diff_f0_phi_ii);
2214 t_grad_n0f0_p_n1f0(
i) = t_grad_n0f0(
i) + t_grad_n1f0(
i) + t_grad_n2f0(
i);
2216 iFiF0.resize(p + 1,
false);
2217 diffIFiF0.resize(3 * p + 3,
false);
2220 double *ifif0 = &*iFiF0.data().begin();
2221 double *diff_ifif0 = &*diffIFiF0.data().begin();
2223 for (
int gg = 0; gg != nb_integration_pts; ++gg) {
2225 const int shift_n = (DIM + 1) * gg;
2226 const double n0f0 =
n[shift_n + n0f0_idx];
2227 const double n1f0 =
n[shift_n + n1f0_idx];
2228 const double n2f0 =
n[shift_n + n2f0_idx];
2233 for (
int oo = 2; oo <= p; ++oo) {
2235 auto t_f0_phi_ii = getFTensor1FromPtr<3>(&f0_phi_ii[phi_shift]);
2236 auto t_diff_f0_phi_ii =
2237 getFTensor2FromPtr<3, DIM>(&diff_f0_phi_ii[diff_phi_shift]);
2239 for (
int ii = 0; ii <= oo - 2; ii++) {
2241 int jj = oo - 2 - ii;
2245 jj + 1, 2 * ii + 1, n2f0, n0f0 + n1f0 + n2f0, &t_grad_n2f0(0),
2246 &t_grad_n0f0_p_n1f0(0), ifif0, diff_ifif0, DIM);
2248 diff_ifif0[0 + jj], diff_ifif0[(jj + 1) + jj],
2249 diff_ifif0[2 * (jj + 1) + jj]);
2250 t_phi(
i) = ifif0[jj] * t_f0_phi_ii(
i);
2251 t_diff_phi(
i,
j) = ifif0[jj] * t_diff_f0_phi_ii(
i,
j) +
2252 t_diff_ifif0(
j) * t_f0_phi_ii(
i);
2267 int n2f0_idx,
int n0f1_idx,
int n1f1_idx,
int n2f1_idx,
2285 double *f0_phi_ii = &*f0PhiII.data().begin();
2286 double *diff_f0_phi_ii = &*diffF0PhiII.data().begin();
2287 auto t_f0_phi_ii = getFTensor1FromPtr<3>(f0_phi_ii);
2288 auto t_diff_f0_phi_ii = getFTensor2FromPtr<3, DIM>(diff_f0_phi_ii);
2289 CHKERR hCurlBaseOnEdge.
calculate<DIM,
true>(p - 1, nb_integration_pts,
2290 n0f0_idx, n1f0_idx,
n, t_grad_n,
2291 t_f0_phi_ii, &t_diff_f0_phi_ii);
2294 double *f1_phi_ii = &*f1PhiII.data().begin();
2295 double *diff_f1_phi_ii = &*diffF1PhiII.data().begin();
2296 auto t_f1_phi_ii = getFTensor1FromPtr<3>(f1_phi_ii);
2297 auto t_diff_f1_phi_ii = getFTensor2FromPtr<3, DIM>(diff_f1_phi_ii);
2298 CHKERR hCurlBaseOnEdge.
calculate<DIM,
true>(p - 1, nb_integration_pts,
2299 n0f1_idx, n1f1_idx,
n, t_grad_n,
2300 t_f1_phi_ii, &t_diff_f1_phi_ii);
2306 t_grad_n0f0_p_n1f0(
i) = t_grad_n0f0(
i) + t_grad_n1f0(
i);
2312 t_grad_n0f1_p_n1f1(
i) = t_grad_n0f1(
i) + t_grad_n1f1(
i);
2314 iFiF0.resize(p + 1,
false);
2315 diffIFiF0.resize(3 * p + 3,
false);
2317 double *ifif0 = &*iFiF0.data().begin();
2318 double *diff_ifif0 = &*diffIFiF0.data().begin();
2319 iFiF1.resize(p + 1,
false);
2320 diffIFiF1.resize(3 * p + 3,
false);
2322 double *ifif1 = &*iFiF1.data().begin();
2323 double *diff_ifif1 = &*diffIFiF1.data().begin();
2325 for (
int gg = 0; gg != nb_integration_pts; ++gg) {
2327 const int shift_n = (DIM + 1) * gg;
2328 const double n0f0 =
n[shift_n + n0f0_idx];
2329 const double n1f0 =
n[shift_n + n1f0_idx];
2330 const double n2f0 =
n[shift_n + n2f0_idx];
2331 const double n0f1 =
n[shift_n + n0f1_idx];
2332 const double n1f1 =
n[shift_n + n1f1_idx];
2333 const double n2f1 =
n[shift_n + n2f1_idx];
2339 for (
int oo = 2; oo <= p; ++oo) {
2341 auto t_f0_phi_ii = getFTensor1FromPtr<3>(&f0_phi_ii[phi_shift]);
2342 auto t_diff_f0_phi_ii =
2343 getFTensor2FromPtr<3, DIM>(&diff_f0_phi_ii[diff_phi_shift]);
2344 auto t_f1_phi_ii = getFTensor1FromPtr<3>(&f1_phi_ii[phi_shift]);
2345 auto t_diff_f1_phi_ii =
2346 getFTensor2FromPtr<3, DIM>(&diff_f1_phi_ii[diff_phi_shift]);
2348 for (
int ii = 0; ii <= oo - 2; ii++) {
2350 int jj = oo - 2 - ii;
2354 jj + 1, 2 * ii + 1, n2f0, n0f0 + n1f0, &t_grad_n2f0(0),
2355 &t_grad_n0f0_p_n1f0(0), ifif0, diff_ifif0, 3);
2357 diff_ifif0[0 + jj], diff_ifif0[(jj + 1) + jj],
2358 diff_ifif0[2 * (jj + 1) + jj]);
2360 t_phi(
i) = ifif0[jj] * t_f0_phi_ii(
i);
2361 t_diff_phi(
i,
j) = ifif0[jj] * t_diff_f0_phi_ii(
i,
j) +
2362 t_diff_ifif0(
j) * t_f0_phi_ii(
i);
2372 jj + 1, 2 * ii + 1, n2f1, n0f1 + n1f1, &t_grad_n2f1(0),
2373 &t_grad_n0f1_p_n1f1(0), ifif1, diff_ifif1, 3);
2375 diff_ifif1[0 + jj], diff_ifif1[(jj + 1) + jj],
2376 diff_ifif1[2 * (jj + 1) + jj]);
2377 t_phi(
i) = ifif1[jj] * t_f1_phi_ii(
i);
2378 t_diff_phi(
i,
j) = ifif1[jj] * t_diff_f1_phi_ii(
i,
j) +
2379 t_diff_ifif1(
j) * t_f1_phi_ii(
i);
2389 "Wrong number of base functions");
2396 int *faces_nodes,
int *p,
double *
n,
double *diff_n,
double *
phi[],
2397 double *diff_phi[],
int nb_integration_pts) {
2401 for (
int nn = 0; nn != 4; ++nn) {
2403 diff_n[3 * nn + 0], diff_n[3 * nn + 1], diff_n[3 * nn + 2]);
2408 for (
int ff = 0; ff != 4; ++ff) {
2412 auto t_phi = getFTensor1FromPtr<3>(
phi[ff]);
2416 const int n0f0_idx = faces_nodes[3 * ff + 0];
2417 const int n1f0_idx = faces_nodes[3 * ff + 1];
2418 const int n2f0_idx = faces_nodes[3 * ff + 2];
2420 const int n0f1_idx = faces_nodes[3 * ff + 1];
2421 const int n1f1_idx = faces_nodes[3 * ff + 2];
2422 const int n2f1_idx = faces_nodes[3 * ff + 0];
2425 p[ff], nb_integration_pts, n0f0_idx, n1f0_idx, n2f0_idx, n0f1_idx,
2426 n1f1_idx, n2f1_idx,
n, t_grad_n, t_phi, t_diff_phi);
2434 int *faces_nodes,
int p,
double *
n,
double *diff_n,
double *
phi,
2435 double *diff_phi,
int nb_integration_pts) {
2439 for (
int nn = 0; nn != 3; ++nn) {
2448 auto t_phi = getFTensor1FromPtr<3>(
phi);
2452 const int n0f0_idx = faces_nodes[0];
2453 const int n1f0_idx = faces_nodes[1];
2454 const int n2f0_idx = faces_nodes[2];
2456 const int n0f1_idx = faces_nodes[1];
2457 const int n1f1_idx = faces_nodes[2];
2458 const int n2f1_idx = faces_nodes[0];
2461 p, nb_integration_pts, n0f0_idx, n1f0_idx, n2f0_idx, n0f1_idx, n1f1_idx,
2462 n2f1_idx,
n, t_grad_n, t_phi, t_diff_phi);
2469 int p,
double *
n,
double *diff_n,
double *
phi,
double *diff_phi,
2470 int nb_integration_pts) {
2472 constexpr
int family[3][4] = {{0, 1, 2, 3}, {1, 2, 3, 0}, {2, 3, 0, 1}};
2480 auto t_phi = getFTensor1FromPtr<3>(
phi);
2484 for (
int nn = 0; nn != 4; ++nn) {
2486 diff_n[3 * nn + 0], diff_n[3 * nn + 1], diff_n[3 * nn + 2]);
2490 MatrixDouble phi_ij(3, 3 * nb_face_functions * nb_integration_pts);
2491 MatrixDouble diff_phi_ij(3, 9 * nb_face_functions * nb_integration_pts);
2497 for (
int ff = 0; ff != 3; ++ff) {
2498 double *phi_ij_ptr = &phi_ij(ff, 0);
2499 double *diff_phi_ij_ptr = &diff_phi_ij(ff, 0);
2501 auto t_phi_ij = getFTensor1FromPtr<3>(phi_ij_ptr);
2504 const int n0_idx = family[ff][0];
2505 const int n1_idx = family[ff][1];
2506 const int n2_idx = family[ff][2];
2509 p - 1, nb_integration_pts, n0_idx, n1_idx, n2_idx,
n, t_grad_n,
2510 t_phi_ij, t_diff_phi_ij);
2518 t_sum_f0(
i) = -t_grad_n3f0(
i);
2520 t_sum_f1(
i) = -t_grad_n3f1(
i);
2522 t_sum_f2(
i) = -t_grad_n3f2(
i);
2524 for (
int gg = 0; gg != nb_integration_pts; ++gg) {
2526 int shift_n = 4 * gg;
2528 double n3f0 =
n[shift_n + family[0][3]];
2529 double n3f1 =
n[shift_n + family[1][3]];
2530 double n3f2 =
n[shift_n + family[2][3]];
2533 for (
int oo = 3; oo <= p; ++oo) {
2535 int phi_shift = 3 * nb_face_functions * gg;
2536 int diff_phi_shift = 9 * nb_face_functions * gg;
2538 auto t_phi_face_f0 = getFTensor1FromPtr<3>(&phi_ij(0, phi_shift));
2539 auto t_diff_phi_face_f0 =
2541 auto t_phi_face_f1 = getFTensor1FromPtr<3>(&phi_ij(1, phi_shift));
2542 auto t_diff_phi_face_f1 =
2544 auto t_phi_face_f2 = getFTensor1FromPtr<3>(&phi_ij(2, phi_shift));
2545 auto t_diff_phi_face_f2 =
2549 for (
int oo_ij = 2; oo_ij != oo; ++oo_ij) {
2553 &t_grad_n3f0(0), &t_sum_f0(0),
2554 &fi_k(0, 0), &diff_fi_k(0, 0), 3);
2556 &t_grad_n3f1(0), &t_sum_f1(0),
2557 &fi_k(1, 0), &diff_fi_k(1, 0), 3);
2559 &t_grad_n3f2(0), &t_sum_f2(0),
2560 &fi_k(2, 0), &diff_fi_k(2, 0), 3);
2563 diff_fi_k(0, 0 +
k - 1), diff_fi_k(0,
k +
k - 1),
2564 diff_fi_k(0, 2 *
k +
k - 1));
2566 diff_fi_k(1, 0 +
k - 1), diff_fi_k(1,
k +
k - 1),
2567 diff_fi_k(1, 2 *
k +
k - 1));
2569 diff_fi_k(2, 0 +
k - 1), diff_fi_k(2,
k +
k - 1),
2570 diff_fi_k(2, 2 *
k +
k - 1));
2573 t_phi(
i) = fi_k(0,
k - 1) * t_phi_face_f0(
i);
2574 t_diff_phi(
i,
j) = t_diff_fi_k_f0(
j) * t_phi_face_f0(
i) +
2575 fi_k(0,
k - 1) * t_diff_phi_face_f0(
i,
j);
2579 ++t_diff_phi_face_f0;
2582 t_phi(
i) = fi_k(1,
k - 1) * t_phi_face_f1(
i);
2583 t_diff_phi(
i,
j) = t_diff_fi_k_f1(
j) * t_phi_face_f1(
i) +
2584 fi_k(1,
k - 1) * t_diff_phi_face_f1(
i,
j);
2588 ++t_diff_phi_face_f1;
2591 t_phi(
i) = fi_k(2,
k - 1) * t_phi_face_f2(
i);
2592 t_diff_phi(
i,
j) = t_diff_fi_k_f2(
j) * t_phi_face_f2(
i) +
2593 fi_k(2,
k - 1) * t_diff_phi_face_f2(
i,
j);
2597 ++t_diff_phi_face_f2;
2604 "Wrong number of base functions");
2613 #ifdef GENERATE_VTK_WITH_CURL_BASE
2615 MoFEMErrorCode VTK_Demkowicz_Hcurl_MBTET(
const string file_name) {
2618 double base_coords[] = {0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1};
2624 for (
int nn = 0; nn < 4; nn++) {
2625 CHKERR moab_ref.create_vertex(&base_coords[3 * nn], nodes[nn]);
2628 CHKERR moab_ref.create_element(MBTET, nodes, 4, tet);
2636 const int max_level = 3;
2637 for (
int ll = 0; ll != max_level; ll++) {
2640 ->getEntitiesByTypeAndRefLevel(
BitRefLevel().set(ll),
2644 ->getEntitiesByTypeAndRefLevel(
BitRefLevel().set(ll),
2649 CHKERR m_ref->addVerticesInTheMiddleOfEdges(edges,
2656 ->getEntitiesByTypeAndRefLevel(
BitRefLevel().set(max_level),
2662 CHKERR moab_ref.create_meshset(MESHSET_SET, meshset);
2663 CHKERR moab_ref.add_entities(meshset, tets);
2664 CHKERR moab_ref.convert_entities(meshset,
true,
false,
false);
2665 CHKERR moab_ref.delete_entities(&meshset, 1);
2669 CHKERR moab_ref.get_connectivity(tets, elem_nodes,
false);
2671 const int nb_gauss_pts = elem_nodes.size();
2674 Range::iterator nit = elem_nodes.begin();
2675 for (
int gg = 0; nit != elem_nodes.end(); nit++, gg++) {
2676 CHKERR moab_ref.get_coords(&*nit, 1, &gauss_pts(gg, 0));
2678 gauss_pts = trans(gauss_pts);
2681 shape_fun.resize(nb_gauss_pts, 4);
2683 &gauss_pts(1, 0), &gauss_pts(2, 0), nb_gauss_pts);
2685 double diff_shape_fun[12];
2688 int edge_sense[6] = {1, 1, 1, 1, 1, 1};
2689 const int order = 4;
2697 edge_diff_phi.clear();
2699 double *edge_phi_ptr[] = {&edge_phi(0, 0), &edge_phi(1, 0), &edge_phi(2, 0),
2700 &edge_phi(3, 0), &edge_phi(4, 0), &edge_phi(5, 0)};
2701 double *edge_diff_phi_ptr[] = {&edge_diff_phi(0, 0), &edge_diff_phi(1, 0),
2702 &edge_diff_phi(2, 0), &edge_diff_phi(3, 0),
2703 &edge_diff_phi(4, 0), &edge_diff_phi(5, 0)};
2706 edge_sense, edge_order, &*shape_fun.data().begin(), diff_shape_fun,
2707 edge_phi_ptr, edge_diff_phi_ptr, nb_gauss_pts);
2711 for (
int ee = 0; ee != 6; ++ee) {
2713 double def_val[] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
2714 std::string tag_name =
"E" + boost::lexical_cast<std::string>(ee) +
"_" +
2715 boost::lexical_cast<std::string>(ll);
2717 CHKERR moab_ref.tag_get_handle(tag_name.c_str(), 3, MB_TYPE_DOUBLE,
th,
2718 MB_TAG_CREAT | MB_TAG_SPARSE, def_val);
2721 for (Range::iterator nit = elem_nodes.begin(); nit != elem_nodes.end();
2724 CHKERR moab_ref.tag_set_data(
th, &*nit, 1, &edge_phi(ee, idx));
2730 int faces_nodes[] = {0, 1, 3, 1, 2, 3, 0, 2, 3, 0, 1, 2};
2736 face_diff_phi.clear();
2738 double *face_phi_ptr[] = {&face_phi(0, 0), &face_phi(1, 0), &face_phi(2, 0),
2740 double *face_diff_phi_ptr[] = {&face_diff_phi(0, 0), &face_diff_phi(1, 0),
2741 &face_diff_phi(2, 0), &face_diff_phi(3, 0)};
2744 faces_nodes, faces_order, &*shape_fun.data().begin(), diff_shape_fun,
2745 face_phi_ptr, face_diff_phi_ptr, nb_gauss_pts);
2747 for (
int ff = 0; ff != 4; ++ff) {
2749 double def_val[] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
2750 std::string tag_name =
"F" + boost::lexical_cast<std::string>(ff) +
"_" +
2751 boost::lexical_cast<std::string>(ll);
2753 CHKERR moab_ref.tag_get_handle(tag_name.c_str(), 3, MB_TYPE_DOUBLE,
th,
2754 MB_TAG_CREAT | MB_TAG_SPARSE, def_val);
2757 for (Range::iterator nit = elem_nodes.begin(); nit != elem_nodes.end();
2760 CHKERR moab_ref.tag_set_data(
th, &*nit, 1, &face_phi(ff, idx));
2770 order, &*shape_fun.data().begin(), diff_shape_fun, &vol_phi(0, 0),
2771 &diff_vol_phi(0, 0), nb_gauss_pts);
2774 double def_val[] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
2775 std::string tag_name =
"V_" + boost::lexical_cast<std::string>(ll);
2777 CHKERR moab_ref.tag_get_handle(tag_name.c_str(), 3, MB_TYPE_DOUBLE,
th,
2778 MB_TAG_CREAT | MB_TAG_SPARSE, def_val);
2781 for (Range::iterator nit = elem_nodes.begin(); nit != elem_nodes.end();
2784 CHKERR moab_ref.tag_set_data(
th, &*nit, 1, &vol_phi(gg, idx));
2789 CHKERR moab_ref.create_meshset(MESHSET_SET, meshset);
2790 CHKERR moab_ref.add_entities(meshset, tets);
2791 CHKERR moab_ref.write_file(file_name.c_str(),
"VTK",
"", &meshset, 1);
2796 static char help[] =
"...\n\n";
2798 int main(
int argc,
char *argv[]) {
2805 CHKERR VTK_Demkowicz_Hcurl_MBTET(
"out_curl_vtk_demkowicz_base_on_tet.vtk");
2814 #endif // GENERATE_VTK_WITH_CURL_BASE