13 using namespace MoFEM;
15 static char help[] =
"testing mesh cut test\n\n";
17 int main(
int argc,
char *argv[]) {
23 auto test_tet = [&]() {
27 elem_coords(0, 0) = -1;
28 elem_coords(0, 1) = -1;
29 elem_coords(0, 2) = -1;
30 elem_coords(1, 0) = 2;
31 elem_coords(1, 1) = 0;
32 elem_coords(1, 2) = 0;
33 elem_coords(2, 0) = 0;
34 elem_coords(2, 1) = 1;
35 elem_coords(2, 2) = 0;
36 elem_coords(3, 0) = 0;
37 elem_coords(3, 1) = 0;
38 elem_coords(3, 2) = 1;
41 init_local_coords(0, 0) = 0;
42 init_local_coords(0, 1) = 0;
43 init_local_coords(0, 2) = 0;
44 init_local_coords(1, 0) = 0.5;
45 init_local_coords(1, 1) = 0;
46 init_local_coords(1, 2) = 0;
47 init_local_coords(2, 0) = 0;
48 init_local_coords(2, 1) = 0.5;
49 init_local_coords(2, 2) = 0;
50 init_local_coords(3, 0) = 0;
51 init_local_coords(3, 1) = 0;
52 init_local_coords(3, 2) = 0.5;
53 init_local_coords(4, 0) = 1. / 3.;
54 init_local_coords(4, 1) = 1. / 3.;
55 init_local_coords(4, 2) = 1. / 3.;
58 CHKERR Tools::shapeFunMBTET<3>(&shape(0, 0), &init_local_coords(0, 0),
59 &init_local_coords(0, 1),
60 &init_local_coords(0, 2), 5);
66 &elem_coords(0, 0), &global_coords(0, 0), init_local_coords.size1(),
69 MatrixDouble residual = local_coords - init_local_coords;
70 MOFEM_LOG(
"SELF", Sev::inform) << residual;
71 for (
auto v : residual.data())
72 if (std::abs(
v) > 1e-12)
74 "Should be zer, but is v = %3.4e",
v);
79 auto test_tri = [&]() {
83 elem_coords(0, 0) = -1;
84 elem_coords(0, 1) = -1;
85 elem_coords(0, 2) = -1;
86 elem_coords(1, 0) = 2;
87 elem_coords(1, 1) = 0;
88 elem_coords(1, 2) = 0;
89 elem_coords(2, 0) = 0;
90 elem_coords(2, 1) = 1;
91 elem_coords(2, 2) = 0;
94 init_local_coords(0, 0) = 0;
95 init_local_coords(0, 1) = 0;
96 init_local_coords(1, 0) = 1;
97 init_local_coords(1, 1) = 0;
98 init_local_coords(2, 0) = 0;
99 init_local_coords(2, 1) = 1;
100 init_local_coords(3, 0) = 1. / 3.;
101 init_local_coords(3, 1) = 1. / 3.;
104 CHKERR Tools::shapeFunMBTRI<2>(&shape(0, 0), &init_local_coords(0, 0),
105 &init_local_coords(0, 1),
106 init_local_coords.size1());
107 MOFEM_LOG(
"SELF", Sev::verbose) <<
"tri shape " << shape;
110 MOFEM_LOG(
"SELF", Sev::verbose) <<
"tri global_coords " << global_coords;
112 MatrixDouble local_coords(init_local_coords.size1(), 2);
114 &elem_coords(0, 0), &global_coords(0, 0), init_local_coords.size1(),
115 &local_coords(0, 0));
117 MatrixDouble residual = local_coords - init_local_coords;
118 MOFEM_LOG(
"SELF", Sev::inform) << residual;
119 for (
auto v : residual.data())
120 if (std::abs(
v) > 1e-12)
122 "Should be zer, but is v = %3.4e",
v);
127 auto test_edge = [&]() {
131 elem_coords(0, 0) = -1;
132 elem_coords(0, 1) = -1;
133 elem_coords(0, 2) = -1;
134 elem_coords(1, 0) = 2;
135 elem_coords(1, 1) = 0;
136 elem_coords(1, 2) = 0;
139 init_local_coords[0] = 0;
140 init_local_coords[1] = 1;
141 init_local_coords[2] = 0.5;
142 init_local_coords[4] = 0.25;
143 init_local_coords[5] = 0.75;
146 CHKERR Tools::shapeFunMBEDGE<1>(&shape(0, 0), &init_local_coords[0],
147 init_local_coords.size());
148 MOFEM_LOG(
"SELF", Sev::verbose) <<
"edge shape " << shape;
151 MOFEM_LOG(
"SELF", Sev::verbose) <<
"edge global_coords " << global_coords;
155 &elem_coords(0, 0), &global_coords(0, 0), init_local_coords.size(),
158 VectorDouble residual = local_coords - init_local_coords;
159 MOFEM_LOG(
"SELF", Sev::inform) << residual;
160 for (
auto v : residual.data())
161 if (std::abs(
v) > 1e-12)
163 "Should be zer, but is v = %3.4e",
v);