40 #define SF_MAX_ELEM_NODES 10 63 if (order == 1) ndof = 2;
64 else if (order == 2) ndof = 3;
66 fprintf(stderr,
"Line element order %d not implemented yet.\n", order);
71 if (order == 1) ndof = 3;
72 else if (order == 2) ndof = 6;
74 fprintf(stderr,
"Tri element order %d not implemented yet.\n", order);
79 if (order == 1) ndof = 4;
80 else if (order == 2) ndof = 8;
82 fprintf(stderr,
"Quad element order %d not implemented yet.\n", order);
87 if (order == 1) ndof = 4;
88 else if (order == 2) ndof = 10;
90 fprintf(stderr,
"Tetra element order %d not implemented yet.\n", order);
95 if (order == 1) ndof = 8;
96 else if (order == 2) ndof = 20;
98 fprintf(stderr,
"Hexa element order %d not implemented yet.\n", order);
104 fprintf(stderr,
"%s error: Unsupported element type.\n", __func__);
130 ip[0].
x = 0.; ip[0].
y = 0.; ip[0].
z = 0.;
132 }
else if (order == 2) {
133 const double sqrt3 = 0.577350269189626;
134 ip[0].
x = -sqrt3; ip[0].
y = 0.; ip[0].
z = 0.;
135 ip[1].
x = +sqrt3; ip[1].
y = 0.; ip[1].
z = 0.;
136 w[0] = 1.; w[1] = 1.; nint = 2;
142 ip[0].
x = 1. / 3.; ip[0].
y = 1. / 3.; ip[0].
z = 0.;
145 }
else if (order == 2) {
146 ip[0].
x = 1. / 6.; ip[0].
y = 1. / 6.; ip[0].
z = 0.;
147 ip[1].
x = 4. / 6.; ip[1].
y = 1. / 6.; ip[1].
z = 0.;
148 ip[2].
x = 1. / 6.; ip[2].
y = 4. / 6.; ip[2].
z = 0.;
149 w[0] = 1. / 6.; w[1] = 1. / 6.; w[2] = 1. / 6.;
151 }
else if (order == 3 || order == 4) {
153 ip[0].
x = 0.188409405952072339650, ip[0].
y = 0.787659461760847001700, ip[0].
z = 0;
154 ip[1].
x = 0.523979067720100721850, ip[1].
y = 0.409466864440734712450, ip[1].
z = 0;
155 ip[2].
x = 0.808694385677669824730, ip[2].
y = 0.088587959512703928766, ip[2].
z = 0;
156 ip[3].
x = 0.106170269119576471390, ip[3].
y = 0.787659461760847001700, ip[3].
z = 0;
157 ip[4].
x = 0.295266567779632616020, ip[4].
y = 0.409466864440734712450, ip[4].
z = 0;
158 ip[5].
x = 0.455706020243648035620, ip[5].
y = 0.088587959512703928766, ip[5].
z = 0;
159 ip[6].
x = 0.023931132287080617016, ip[6].
y = 0.787659461760847001700, ip[6].
z = 0;
160 ip[7].
x = 0.066554067839164496312, ip[7].
y = 0.409466864440734712450, ip[7].
z = 0;
161 ip[8].
x = 0.102717654809626260380, ip[8].
y = 0.088587959512703928766, ip[8].
z = 0;
163 w[0] = 0.019396383305959434551;
164 w[1] = 0.063678085099884929043;
165 w[2] = 0.055814420483044288601;
166 w[3] = 0.03103421328953510222;
167 w[4] = 0.1018849361598159059;
168 w[5] = 0.089303072772870889517;
169 w[6] = 0.019396383305959434551;
170 w[7] = 0.063678085099884929043;
171 w[8] = 0.055814420483044288601;
178 ip[0].
x = 0.; ip[0].
y = 0.; ip[0].
z = 0.;
181 }
else if (order == 2 || order == 3) {
182 const double sqrt3 = 0.577350269189626;
183 ip[0].
x = -sqrt3; ip[0].
y = -sqrt3; ip[0].
z = 0.;
184 ip[1].
x = +sqrt3; ip[1].
y = -sqrt3; ip[1].
z = 0.;
185 ip[2].
x = +sqrt3; ip[2].
y = +sqrt3; ip[2].
z = 0.;
186 ip[3].
x = -sqrt3; ip[3].
y = +sqrt3; ip[3].
z = 0.;
187 w[0] = 1.; w[1] = 1.; w[2] = 1.; w[3] = 1.;
189 }
else if (order == 4) {
191 ip[0].
x = 0.88729833462074170214, ip[0].
y = 0.88729833462074170214, ip[0].
z = 0;
192 ip[1].
x = 0.88729833462074170214, ip[1].
y = 0.5, ip[1].
z = 0;
193 ip[2].
x = 0.88729833462074170214, ip[2].
y = 0.11270166537925829786, ip[2].
z = 0;
194 ip[3].
x = 0.5, ip[3].
y = 0.88729833462074170214, ip[3].
z = 0;
195 ip[4].
x = 0.5, ip[4].
y = 0.5, ip[4].
z = 0;
196 ip[5].
x = 0.5, ip[5].
y = 0.11270166537925829786, ip[5].
z = 0;
197 ip[6].
x = 0.11270166537925829786, ip[6].
y = 0.88729833462074170214, ip[6].
z = 0;
198 ip[7].
x = 0.11270166537925829786, ip[7].
y = 0.5, ip[7].
z = 0;
199 ip[8].
x = 0.11270166537925829786, ip[8].
y = 0.11270166537925829786, ip[8].
z = 0;
201 w[0] = 0.077160493827160225866;
202 w[1] = 0.12345679012345638081;
203 w[2] = 0.077160493827160225866;
204 w[3] = 0.12345679012345638081;
205 w[4] = 0.19753086419753024261;
206 w[5] = 0.12345679012345638081;
207 w[6] = 0.077160493827160225866;
208 w[7] = 0.12345679012345638081;
209 w[8] = 0.077160493827160225866;
216 if (order == 0 || order == 1) {
218 ip[0].
x = 0.25; ip[0].
y = 0.25; ip[0].
z = 0.25;
219 w[0] = .16666666666666666666;
221 }
else if (order == 2) {
223 double gauss1 = 0.13819660112501051518;
224 double gauss2 = 0.58541019662496845446;
225 double weight = 0.0416666666666666666666666666666666;
226 ip[0].
x = gauss1; ip[0].
y = gauss1; ip[0].
z = gauss1;
227 ip[1].
x = gauss2; ip[1].
y = gauss1; ip[1].
z = gauss1;
228 ip[2].
x = gauss1; ip[2].
y = gauss2; ip[2].
z = gauss1;
229 ip[3].
x = gauss1; ip[3].
y = gauss1; ip[3].
z = gauss2;
230 w[0] = weight; w[1] = weight; w[2] = weight; w[3] = weight;
232 }
else if (order == 3 || order == 4) {
234 ip[0].
x = 0.12764656212038541505, ip[0].
y = 0.29399880063162286969, ip[0].
z = 0.54415184401122529412;
235 ip[1].
x = 0.2457133252117133515, ip[1].
y = 0.56593316507280100325, ip[1].
z = 0.12251482265544139105;
236 ip[2].
x = 0.30377276481470755209, ip[2].
y = 0.070679724159396897787, ip[2].
z = 0.54415184401122529412;
237 ip[3].
x = 0.58474756320489440498, ip[3].
y = 0.13605497680284600603, ip[3].
z = 0.12251482265544139105;
238 ip[4].
x = 0.034202793236766414198, ip[4].
y = 0.29399880063162286969, ip[4].
z = 0.54415184401122529412;
239 ip[5].
x = 0.065838687060044420729, ip[5].
y = 0.56593316507280100325, ip[5].
z = 0.12251482265544139105;
240 ip[6].
x = 0.081395667014670256001, ip[6].
y = 0.070679724159396897787, ip[6].
z = 0.54415184401122529412;
241 ip[7].
x = 0.15668263733681833672, ip[7].
y = 0.13605497680284600603, ip[7].
z = 0.12251482265544139105;
243 w[0] = 0.0091694299214797256314;
244 w[1] = 0.0211570064545240181520;
245 w[2] = 0.0160270405984766287080;
246 w[3] = 0.0369798563588529458080;
247 w[4] = 0.0091694299214797291009;
248 w[5] = 0.0211570064545240285600;
249 w[6] = 0.0160270405984766356470;
250 w[7] = 0.0369798563588529666250;
258 ip[0].
x = 0.; ip[0].
y = 0.; ip[0].
z = 0.;
261 }
else if (order == 1 || order == 2) {
262 const double sqrt3 = 0.577350269189626;
263 ip[0].
x = -sqrt3; ip[0].
y = -sqrt3; ip[0].
z = -sqrt3;
264 ip[1].
x = +sqrt3; ip[1].
y = -sqrt3; ip[1].
z = -sqrt3;
265 ip[2].
x = +sqrt3; ip[2].
y = +sqrt3; ip[2].
z = -sqrt3;
266 ip[3].
x = -sqrt3; ip[3].
y = +sqrt3; ip[3].
z = -sqrt3;
267 ip[4].
x = -sqrt3; ip[4].
y = -sqrt3; ip[4].
z = +sqrt3;
268 ip[5].
x = +sqrt3; ip[5].
y = -sqrt3; ip[5].
z = +sqrt3;
269 ip[6].
x = +sqrt3; ip[6].
y = +sqrt3; ip[6].
z = +sqrt3;
270 ip[7].
x = -sqrt3; ip[7].
y = +sqrt3; ip[7].
z = +sqrt3;
271 w[0] = 1.; w[1] = 1.; w[2] = 1.; w[3] = 1.;
272 w[4] = 1.; w[5] = 1.; w[6] = 1.; w[7] = 1.;
279 ip[0].
x = 0.33333333333333331, ip[0].
y = 0.33333333333333337, ip[0].
z = 0.5;
282 }
else if(order == 1 || order == 2) {
284 ip[0].
x = 0.8168475628; ip[0].
y = 0.0915762112; ip[0].
z = 0.2113248706;
285 ip[1].
x = 0.8168475628; ip[1].
y = 0.0915762112; ip[1].
z = 0.7886751294;
286 ip[2].
x = 0.0915762112; ip[2].
y = 0.8168475628; ip[2].
z = 0.2113248706;
287 ip[3].
x = 0.0915762112; ip[3].
y = 0.8168475628; ip[3].
z = 0.7886751294;
288 ip[4].
x = 0.0915762112; ip[4].
y = 0.0915762112; ip[4].
z = 0.2113248706;
289 ip[5].
x = 0.0915762112; ip[5].
y = 0.0915762112; ip[5].
z = 0.7886751294;
298 ip[0].
x = 0.28001991549907407, ip[0].
y = 0.64494897427831788, ip[0].
z = 0.78867513459481287;
299 ip[1].
x = 0.28001991549907407, ip[1].
y = 0.64494897427831788, ip[1].
z = 0.21132486540518713;
300 ip[2].
x = 0.66639024601470143, ip[2].
y = 0.15505102572168217, ip[2].
z = 0.78867513459481287;
301 ip[3].
x = 0.66639024601470143, ip[3].
y = 0.15505102572168217, ip[3].
z = 0.21132486540518713;
302 ip[4].
x = 0.075031110222608124, ip[4].
y = 0.64494897427831788, ip[4].
z = 0.78867513459481287;
303 ip[5].
x = 0.075031110222608124, ip[5].
y = 0.64494897427831788, ip[5].
z = 0.21132486540518713;
304 ip[6].
x = 0.17855872826361643, ip[6].
y = 0.15505102572168217, ip[6].
z = 0.78867513459481287;
305 ip[7].
x = 0.17855872826361643, ip[7].
y = 0.15505102572168217, ip[7].
z = 0.21132486540518713;
306 w[0] = 0.045489654564005534;
307 w[1] = 0.045489654564005548;
308 w[2] = 0.079510345435994237;
309 w[3] = 0.079510345435994265;
310 w[4] = 0.045489654564005548;
311 w[5] = 0.045489654564005562;
312 w[6] = 0.079510345435994265;
313 w[7] = 0.079510345435994292;
321 ip[0].
x = -0.433013; ip[0].
y = -0.433013; ip[0].
z = 0.25;
322 ip[1].
x = 0.433013; ip[1].
y = -0.433013; ip[1].
z = 0.25;
323 ip[2].
x = 0.433013; ip[2].
y = 0.433013; ip[2].
z = 0.25;
324 ip[3].
x = -0.433013; ip[3].
y = 0.433013; ip[3].
z = 0.25;
330 }
else if (order == 2) {
331 ip[0 ].
x = 0.040086493940919059, ip[0 ].
y = 0.040086493940919059, ip[0 ].
z = 0.93056815579702623;
332 ip[1 ].
x = 0.19053106107826956, ip[1 ].
y = 0.19053106107826956, ip[1 ].
z = 0.66999052179242813;
333 ip[2 ].
x = 0.38681920811135617, ip[2 ].
y = 0.38681920811135617, ip[2 ].
z = 0.33000947820757187;
334 ip[3 ].
x = 0.53726377524870672, ip[3 ].
y = 0.53726377524870672, ip[3 ].
z = 0.069431844202973714;
335 ip[4 ].
x = 0.040086493940919059, ip[4 ].
y = -0.040086493940919059, ip[4 ].
z = 0.93056815579702623;
336 ip[5 ].
x = 0.19053106107826956, ip[5 ].
y = -0.19053106107826956, ip[5 ].
z = 0.66999052179242813;
337 ip[6 ].
x = 0.38681920811135617, ip[6 ].
y = -0.38681920811135617, ip[6 ].
z = 0.33000947820757187;
338 ip[7 ].
x = 0.53726377524870672, ip[7 ].
y = -0.53726377524870672, ip[7 ].
z = 0.069431844202973714;
339 ip[8 ].
x = -0.040086493940919059, ip[8 ].
y = 0.040086493940919059, ip[8 ].
z = 0.93056815579702623;
340 ip[9 ].
x = -0.19053106107826956, ip[9 ].
y = 0.19053106107826956, ip[9 ].
z = 0.66999052179242813;
341 ip[10].
x = -0.38681920811135617, ip[10].
y = 0.38681920811135617, ip[10].
z = 0.33000947820757187;
342 ip[11].
x = -0.53726377524870672, ip[11].
y = 0.53726377524870672, ip[11].
z = 0.069431844202973714;
343 ip[12].
x = -0.040086493940919059, ip[12].
y = -0.040086493940919059, ip[12].
z = 0.93056815579702623;
344 ip[13].
x = -0.19053106107826956, ip[13].
y = -0.19053106107826956, ip[13].
z = 0.66999052179242813;
345 ip[14].
x = -0.38681920811135617, ip[14].
y = -0.38681920811135617, ip[14].
z = 0.33000947820757187;
346 ip[15].
x = -0.53726377524870672, ip[15].
y = -0.53726377524870672, ip[15].
z = 0.069431844202973714;
348 w[0 ] = 0.000838466012258970;
349 w[1 ] = 0.035511343496716564;
350 w[2 ] = 0.14636983865620462;
351 w[3 ] = 0.15061368516815288;
352 w[4 ] = 0.000838466012258971;
353 w[5 ] = 0.035511343496716585;
354 w[6 ] = 0.1463698386562047;
355 w[7 ] = 0.15061368516815296;
356 w[8 ] = 0.000838466012258971;
357 w[9 ] = 0.035511343496716585;
358 w[10] = 0.1463698386562047;
359 w[11] = 0.15061368516815296;
360 w[12] = 0.000838466012258971;
361 w[13] = 0.035511343496716599;
362 w[14] = 0.14636983865620476;
363 w[15] = 0.15061368516815302;
369 fprintf(stderr,
"%s error: Unsupported element type.\n", __func__);
390 rshape[0][0] = 1.0 - ip.
x;
406 double lam0 = (1.0 - ip.
x - ip.
y);
433 const double node[4][2] =
442 int v[4] = {0, 1, 2, 3};
444 for (
int i = 0; i < 4; i++) {
446 rshape[0][i] = qrtr * (1. + ip.
x * node[v[i]][0]) * (1. + ip.
y * node[v[i]][1]);
448 rshape[1][i] = node[v[i]][0] * qrtr * (1. + ip.
y * node[v[i]][1]);
450 rshape[2][i] = node[v[i]][1] * qrtr * (1. + ip.
x * node[v[i]][0]);
459 double lam0 = 1.0 - ip.
x - ip.
y - ip.
z;
493 const double oito = 1.0 / 8.0;
494 static const double node[8][3] =
508 static int v[8] = {4, 7, 6, 5, 0, 1, 2, 3};
510 for (
int i = 0; i < 8; i++) {
512 rshape[0][i] = oito * (1. + ip.
x * node[v[i]][0]) * (1. + ip.
y * node[v[i]][1]) * (1. + ip.
z * node[v[i]][2]);
514 rshape[1][i] = node[v[i]][0] * oito * (1. + ip.
y * node[v[i]][1]) * (1. + ip.
z * node[v[i]][2]);
516 rshape[2][i] = node[v[i]][1] * oito * (1. + ip.
x * node[v[i]][0]) * (1. + ip.
z * node[v[i]][2]);
518 rshape[3][i] = node[v[i]][2] * oito * (1. + ip.
x * node[v[i]][0]) * (1. + ip.
y * node[v[i]][1]);
526 rshape[0][0] = (1.0 - ip.
x - ip.
y) * ip.
z;
527 rshape[0][1] = ip.
y * ip.
z;
528 rshape[0][2] = ip.
x * ip.
z;
529 rshape[0][3] = (1.0 - ip.
x - ip.
y) * (1. - ip.
z);
530 rshape[0][4] = ip.
x * (1. - ip.
z);
531 rshape[0][5] = ip.
y * (1. - ip.
z);
534 rshape[1][0] = -ip.
z;
537 rshape[1][3] = ip.
z - 1.0;
538 rshape[1][4] = 1. - ip.
z;
542 rshape[2][0] = -ip.
z;
545 rshape[2][3] = ip.
z - 1.0;
547 rshape[2][5] = 1. - ip.
z;
550 rshape[3][0] = 1.0 - ip.
x - ip.
y;
553 rshape[3][3] = ip.
x + ip.
y - 1.0;
554 rshape[3][4] = -ip.
x;
555 rshape[3][5] = -ip.
y;
561 const double qrtr = 0.25;
563 const double lterm0 = ip.
x * ip.
y * ip.
z / (1.0 - ip.
z);
564 rshape[0][0] = qrtr * ( (1.0 + ip.
x) * (1.0 + ip.
y) - ip.
z + lterm0 );
565 rshape[0][1] = qrtr * ( (1.0 - ip.
x) * (1.0 + ip.
y) - ip.
z - lterm0 );
566 rshape[0][2] = qrtr * ( (1.0 - ip.
x) * (1.0 - ip.
y) - ip.
z + lterm0 );
567 rshape[0][3] = qrtr * ( (1.0 + ip.
x) * (1.0 - ip.
y) - ip.
z - lterm0 );
571 const double lterm1 = (ip.
y * ip.
z) / (1.0 - ip.
z);
572 rshape[1][0] = qrtr * ( (1.0 + ip.
y) + lterm1 );
573 rshape[1][1] = qrtr * ( -(1.0 + ip.
y) - lterm1 );
574 rshape[1][2] = qrtr * ( -(1.0 - ip.
y) + lterm1 );
575 rshape[1][3] = qrtr * ( (1.0 - ip.
y) - lterm1 );
579 const double lterm2 = (ip.
x * ip.
z) / (1.0 - ip.
z);
580 rshape[2][0] = qrtr * ( (1.0 + ip.
x) + lterm2 );
581 rshape[2][1] = qrtr * ( (1.0 - ip.
x) - lterm2 );
582 rshape[2][2] = qrtr * ( -(1.0 - ip.
x) + lterm2 );
583 rshape[2][3] = qrtr * ( -(1.0 + ip.
x) - lterm2 );
587 const double lterm3 = ((ip.
x * ip.
y * ip.
z) / (1.0 - ip.
z) * (1.0 - ip.
z)) + (ip.
x * ip.
y / (1.0 - ip.
z));
588 rshape[3][0] = qrtr * ( -1.0 + lterm3 );
589 rshape[3][1] = qrtr * ( -1.0 - lterm3 );
590 rshape[3][2] = qrtr * ( -1.0 + lterm3 );
591 rshape[3][3] = qrtr * ( -1.0 - lterm3 );
597 fprintf(stderr,
"%s: Unimplemented element type! Aborting!\n", __func__);
616 memset (J, 0, 9 *
sizeof(
double) );
619 for (
int i = 0; i < npts; i++)
621 J[0] += rshape[1][i] * pts[i].
x;
622 J[1] += rshape[1][i] * pts[i].
y;
623 J[2] += rshape[1][i] * pts[i].
z;
624 J[3] += rshape[2][i] * pts[i].
x;
625 J[4] += rshape[2][i] * pts[i].
y;
626 J[5] += rshape[2][i] * pts[i].
z;
627 J[6] += rshape[3][i] * pts[i].
x;
628 J[7] += rshape[3][i] * pts[i].
y;
629 J[8] += rshape[3][i] * pts[i].
z;
646 double J2[4] = {J[0], J[1], J[3], J[4]};
651 J[0] = J2[0]; J[1] = J2[1]; J[2] = 0.0;
652 J[3] = J2[2]; J[4] = J2[3]; J[5] = 0.0;
653 J[6] = 0.0; J[7] = 0.0; J[8] = 0.0;
679 for (
int in = 0; in < ndof; in++)
681 shape[1][in] = iJ[0] * rshape[1][in] +
682 iJ[1] * rshape[2][in] +
683 iJ[2] * rshape[3][in];
685 shape[2][in] = iJ[3] * rshape[1][in] +
686 iJ[4] * rshape[2][in] +
687 iJ[5] * rshape[3][in];
689 shape[3][in] = iJ[6] * rshape[1][in] +
690 iJ[7] * rshape[2][in] +
691 iJ[8] * rshape[3][in];
703 template<
class T,
class S>
710 const T* _offset_con;
721 _mesh(mesh), _glob_numbr(_mesh.get_numbering(nbr))
724 MPI_Comm_rank(_mesh.
comm, &_rank);
736 T offset = _mesh.
dsp[_eidx];
737 _esize = _mesh.
dsp[_eidx+1] - offset;
738 _offset_con = _mesh.
con.data() + offset;
774 return _mesh.
type[_eidx];
784 return _mesh.
tag[_eidx];
794 inline const T &
node(
short nidx)
const 796 return _offset_con[nidx];
808 return _glob_numbr[_offset_con[nidx]];
821 return n[_offset_con[nidx]];
842 T idx = _offset_con[nidx];
843 return {_mesh.
xyz[idx*3+0], _mesh.
xyz[idx*3+1], _mesh.
xyz[idx*3+2]};
853 return {_mesh.
fib[_eidx*3+0], _mesh.
fib[_eidx*3+1], _mesh.
fib[_eidx*3+2]};
863 return {_mesh.
she[_eidx*3+0], _mesh.
she[_eidx*3+1], _mesh.
she[_eidx*3+2]};
895 return _mesh.
epl.algebraic_layout()[_rank] + _eidx;
922 switch(_mesh.
type[_eidx])
944 template<
class T,
class S>
951 virtual void dpn(T & row_dpn, T & col_dpn) = 0;
960 template<
class T,
class S>
966 for(T i=0; i<nrows; i++) buff[i] = 0.0;
973 virtual void dpn(T & dpn) = 0;
986 template<
typename T,
typename V>
inline 993 for(T i=0; i<esize; i++)
994 for(
short j=0; j<dpn; j++)
995 cidx[i*dpn + j] = nbr[nidx[i]]*dpn + j;
1008 template<
class T,
class S>
1014 MPI_Comm_rank(domain.
comm, &rank);
1018 integrator.
dpn(row_dpn, col_dpn);
1031 for(
size_t eidx=0; eidx < domain.
l_numelem; eidx++)
1039 row_idx.resize(nnodes*row_dpn);
1040 col_idx.resize(nnodes*col_dpn);
1041 canonic_indices<mesh_int_t,SF_int>(view.
nodes(), petsc_nbr.
data(), nnodes, row_dpn, row_idx.data());
1042 canonic_indices<mesh_int_t,SF_int>(view.
nodes(), petsc_nbr.
data(), nnodes, col_dpn, col_idx.data());
1045 integrator(view, ebuff);
1048 const bool add =
true;
1055 template<
class T,
class S>
1061 MPI_Comm_rank(domain.
comm, &rank);
1065 integrator.
dpn(row_dpn, col_dpn);
1067 assert(row_dpn == 1 && row_dpn == mat.
dpn_row());
1078 for(
size_t eidx=0; eidx < domain.
l_numelem; eidx++)
1085 row_idx.resize(nnodes*row_dpn);
1086 canonic_indices<mesh_int_t,T>(view.
nodes(), petsc_nbr.
data(), nnodes, row_dpn, row_idx.data());
1089 integrator(view, ebuff);
1092 for(
int i=0; i<nnodes; i++) {
1095 for(
int j=0; j<nnodes; j++)
1096 rowsum += ebuff[i][j];
1099 mat.
set_value(row_idx[i], row_idx[i], rowsum,
true);
1118 template<
class T,
class S>
1124 MPI_Comm_rank(vec.
mesh->
comm, &rank);
1128 integrator.
dpn(dpn);
1129 assert(vec.
dpn == dpn);
1140 for(
size_t eidx=0; eidx < domain.
l_numelem; eidx++)
1147 canonic_indices<mesh_int_t,T>(view.
nodes(), petsc_nbr.
data(), nnodes, dpn, idx.
data());
1150 integrator(view, ebuff.
data());
1153 vec.
set(idx, ebuff, ADD_VALUES);
1159 template<
class T,
class S>
inline 1166 assert(vec.
layout == nodaltype);
1169 for(
int j=0; j<dpn; j++) {
1170 int idx = view.
node(i)*dpn+j;
1171 buffer[i*dpn+j] = vec.
get(idx);
1175 template<
class T,
class S>
inline 1182 assert(vec.
layout == nodaltype);
1187 for(
int j=0; j<dpn; j++) {
1188 int idx = view.
node(i)*dpn+j;
1189 pvec[idx] = buffer[i*dpn+j];
1195 template<
class T,
class S>
inline 1204 loc_pts[0] = {0, 0, 0};
1205 loc_pts[1] = {
mag(p1 - p0), 0, 0};
1206 trsf_fibre = {1, 0, 0};
1212 Point f = trsf_fibre;
1214 Point p01 = p1 - p0, p02 = p2 - p0;
1220 loc_pts[0] = {0, 0, 0};
1221 loc_pts[1] = {
mag(p01), 0, 0};
1225 if((fabs(trsf_fibre.
x) + fabs(trsf_fibre.
y)) < 1e-8) {
1226 fprintf(stderr,
"Fibre direction is orthogonal to triangle. Assigning (1,0,0) fiber direction.\n");
1227 trsf_fibre = {1, 0, 0};
1229 else trsf_fibre =
normalize(trsf_fibre);
1235 Point f = trsf_fibre;
1237 Point p01 = p1 - p0, p02 = p2 - p0, p03 = p3 - p0;
1243 loc_pts[0] = {0, 0, 0};
1244 loc_pts[1] = {
mag(p01), 0, 0};
1250 if((fabs(trsf_fibre.
x) + fabs(trsf_fibre.
y)) < 1e-8) {
1251 fprintf(stderr,
"Fibre direction is orthogonal to quad. Assigning (1,0,0) fiber direction.\n");
1252 trsf_fibre = {1, 0, 0};
1254 else trsf_fibre =
normalize(trsf_fibre);
1261 loc_pts[i] = view.
coord(i);
The mesh storage class. It contains both element and vertex data.
non_overlapping_layout< T > epl
element parallel layout
virtual void release_ptr(S *&p)=0
void assemble_vector(abstract_vector< T, S > &vec, meshdata< mesh_int_t, mesh_real_t > &domain, vector_integrator< mesh_int_t, mesh_real_t > &integrator)
Generalized vector assembly.
vector< T > & get_numbering(SF_nbr nbr_type)
Get the vector defining a certain numbering.
Point normalize(const Point &vect)
virtual void dpn(T &dpn)=0
return (by reference) the row and column dimensions
int dpn
d.o.f. per mesh vertex.
void get_transformed_pts(const element_view< T, S > &view, Point *loc_pts, Point &trsf_fibre)
virtual void finish_assembly()=0
void zero_buff(double *buff, T nrows)
MPI_Comm comm
the parallel mesh is defined on a MPI world
vector< T > tag
element tag
void reference_shape(const elem_t type, const Point ip, dmat< double > &rshape)
Compute shape function and its derivatives on a reference element.
PETSc numbering of nodes.
vector< T > dsp
connectivity starting index of each element
Comfort class. Provides getter functions to access the mesh member variables more comfortably...
Abstract matrix integration base class.
void jacobian_matrix(const dmat< double > &rshape, const int npts, const Point *pts, double *J)
Compute Jacobian matrix from the real element to the reference element.
vector< S > fib
fiber direction
short num_dof(elem_t type, short order)
Get number of d.o.f. for an element type and an Ansatz function order.
Abstract vector integration base class.
dmat< S > invert_2x2(const dmat< S > &m)
size_t element_index() const
Get currently selected element index.
double inner_prod(const Point &a, const Point &b)
vector< S > xyz
node cooridnates
void set_element_data(const element_view< mesh_int_t, mesh_real_t > &view, SF_real *buffer, abstract_vector< T, S > &vec)
ltype layout
used vector layout (nodal, algebraic, unset)
T * data()
Pointer to the vector's start.
void assemble_lumped_matrix(abstract_matrix< T, S > &mat, meshdata< mesh_int_t, mesh_real_t > &domain, matrix_integrator< mesh_int_t, mesh_real_t > &integrator)
void shape_deriv(const double *iJ, const dmat< double > &rshape, const int ndof, dmat< double > &shape)
Compute shape derivatives for an element, based on the shape derivatives of the associated reference ...
SF_nbr
Enumeration encoding the different supported numberings.
Point sheet() const
Get element sheet direction.
Point fiber() const
Get element fiber direction.
elem_t type() const
Getter function for the element type.
bool next()
Select next element if possible.
void general_integration_points(const elem_t type, const short order, Point *ip, double *w, int &nint)
Compute the integration point locations and weights.
virtual void set_values(const vector< T > &row_idx, const vector< T > &col_idx, const vector< S > &vals, bool add)=0
virtual void set(const vector< T > &idx, const vector< S > &vals, const bool additive=false)=0
void invert_jacobian_matrix(const elem_t type, double *J, double &detJ)
T tag() const
Getter function for the element tag.
void canonic_indices(const T *nidx, const T *nbr, const T esize, const short dpn, V *cidx)
Compute canonical indices from nodal indices and dpn.
void set_elem(size_t eidx)
Set the view to a new element.
T num_nodes() const
Getter function for the number of nodes.
void integration_points(const short order, Point *ip, double *w, int &nint) const
const T & global_node(short nidx, SF_nbr nbr) const
Access the connectivity information.
Point coord(short nidx) const
Access vertex coordinates.
short num_dof(short order) const
void assemble_matrix(abstract_matrix< T, S > &mat, meshdata< mesh_int_t, mesh_real_t > &domain, matrix_integrator< mesh_int_t, mesh_real_t > &integrator)
Generalized matrix assembly.
bool has_sheet() const
Check if a sheet direction is present.
element_view(const meshdata< T, S > &mesh, const SF_nbr nbr)
Constructor. Initializes to element index 0.
size_t size() const
The current size of the vector.
virtual void finish_assembly()=0
#define SF_MAX_ELEM_NODES
max #nodes defining an element
const T & global_node(short nidx) const
Access the connectivity information.
A vector storing arbitrary data.
size_t l_numelem
local number of elements
virtual void set_value(T row_idx, T col_idx, S val, bool add)=0
const T * nodes() const
Access the connectivity information.
const meshdata< mesh_int_t, mesh_real_t > * mesh
the connected mesh
vector< S > she
sheet direction
std::int32_t SF_int
Use the general std::int32_t as int type.
double SF_real
Use the general double as real type.
void extract_element_data(const element_view< mesh_int_t, mesh_real_t > &view, abstract_vector< T, S > &vec, SF_real *buffer)
virtual void get(const vector< T > &idx, S *out)=0
Point cross(const Point &a, const Point &b)
cross product
vector< elem_t > type
element type
void invert_3x3(S *ele, S &det)
size_t global_element_index(SF_nbr nbr) const
Get currently selected element index.
size_t global_element_index() const
Get currently selected element index.
const T & node(short nidx) const
Access the connectivity information.
double mag(const Point &vect)
vector magnitude
virtual void dpn(T &row_dpn, T &col_dpn)=0
return (by reference) the row and column dimensions