FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
standard_tetra.cpp
1// FEAT3: Finite Element Analysis Toolbox, Version 3
2// Copyright (C) 2010 by Stefan Turek & the FEAT group
3// FEAT3 is released under the GNU General Public License version 3,
4// see the file 'copyright.txt' in the top level directory for details.
5
6#include <kernel/geometry/test_aux/standard_tetra.hpp>
7#include <kernel/geometry/test_aux/copy_comp_set.hpp>
8
9namespace FEAT
10{
11 namespace Geometry
12 {
13 namespace TestAux
14 {
15 TetraMesh* create_tetra_mesh_3d(int orientation)
16 {
17
18 Index num_entities[] =
19 {
20 4, // vertices
21 6, // edges
22 4, // triangles
23 1 // tetrahedron
24 };
25
26 // create mesh
27 TetraMesh* mesh = new TetraMesh(num_entities);
28
29 // first possibility (standard)
30
31 // set up vertex coordinates array
32 static const Real vtx0[3*4] =
33 {
34 0.0, 0.0, 0.0,
35 1.0, 0.0, 0.0,
36 0.0, 1.0, 0.0,
37 0.0, 0.0, 1.0
38 };
39
40 // set up vertices-at-edge array
41 static const Index v_e0[6*2] =
42 {
43 0, 1,
44 0, 2,
45 0, 3,
46 1, 2,
47 1, 3,
48 2, 3
49 };
50
51 // set up vertices-at-triangle array
52 static const Index v_t0[4*3] =
53 {
54 1, 2, 3,
55 0, 2, 3,
56 0, 1, 3,
57 0, 1, 2
58 };
59
60 // set up vertices-at-tetrahedron array
61 static const Index v_s0[1*4] =
62 {
63 0, 1, 2, 3
64 };
65
66 // set up edges-at-triangle array
67 static const Index e_t0[3*4] =
68 {
69 5, 4, 3,
70 5, 2, 1,
71 4, 2, 0,
72 3, 1, 0
73 };
74
75 // set up edges-at-tetrahedron array
76 static const Index e_s0[1*6] =
77 {
78 0, 1, 2, 3, 4, 5
79 };
80
81 // set up triangle-at-tetrahedron array
82 static const Index t_s0[1*4] =
83 {
84 0, 1, 2, 3
85 };
86
87 // second possibility
88
89 /* v_3
90 /\\
91 / \ \
92 / \ \
93 / \ \
94 / \ \
95 / \ \
96 / \ v e_5
97 / \ \
98 / \ \
99 / \ \
100 / \ \
101 / e_3 \ \ v_2
102 e_4 v v / /
103 / \ / /
104 / \ / /
105 / \ / /
106 / e_0 / \ /
107 / s_0 ^ \ /
108 / / \ ^ e_1
109 / / \ /
110 / / \ /
111 / / \ /
112 / / \ /
113 //____________________<________________________\/
114 v_0 e_2 v_1
115
116 orientation:
117 t0: v_2 - v_1 - v_0
118 t1: v_2 - v_3 - v_1
119 t2: v_3 - v_0 - v_2
120 t3: v_0 - v_3 - v_1
121 tetrahedron:
122 v_0 - v_1 - v_2 - v_3
123 */
124
125
126 // set up vertex coordinates array
127 static const Real vtx1[3*4] =
128 {
129 0.0, 0.0, 0.0,
130 1.0, 0.0, 0.0,
131 0.0, 1.0, 0.0,
132 0.0, 0.0, 1.0
133 };
134
135 // set up vertices-at-edge array
136 static const Index v_e1[6*2] =
137 {
138 0, 2,
139 1, 2,
140 1, 0,
141 3, 1,
142 3, 0,
143 3, 2
144 };
145
146 // set up vertices-at-triangle array
147 static const Index v_t1[4*3] =
148 {
149 2, 1, 0,
150 2, 3, 1,
151 3, 0, 2,
152 0, 3, 1
153 };
154
155 // set up vertices-at-tetrahedron array
156 static const Index v_s1[1*4] =
157 {
158 0, 1, 2, 3
159 };
160
161 // set up edges-at-triangle array
162 static const Index e_t1[3*4] =
163 {
164 2, 0, 1,
165 3, 1, 5,
166 0, 5, 4,
167 3, 2, 4
168 };
169
170 // set up edges-at-tetrahedron array
171 static const Index e_s1[1*6] =
172 {
173 2, 0, 4, 1, 3, 5
174 };
175
176 // set up triangle-at-tetrahedron array
177 static const Index t_s1[1*4] =
178 {
179 1, 2, 3, 0
180 };
181
182 // third possibility
183
184 /* v_2
185 /\\
186 / \ \
187 / \ \
188 / \ \
189 / \ \
190 / \ \
191 / \ ^ e_5
192 / \ \
193 / \ \
194 / \ \
195 / \ \
196 / e_3 \ \ v_0
197 e_0 v v / /
198 / \ / /
199 / \ / /
200 / \ / /
201 / e_4 / \ /
202 / s_0 ^ \ /
203 / / \ ^ e_2
204 / / \ /
205 / / \ /
206 / / \ /
207 / / \ /
208 //____________________>________________________\/
209 v_3 e_1 v_1
210
211 orientation:
212 t0: v_0 - v_3 - v_2
213 t1: v_0 - v_1 - v_3
214 t2: v_0 - v_1 - v_2
215 t3: v_2 - v_1 - v_3
216 tetrahedron:
217 v_3 - v_1 - v_0 - v_2
218 */
219
220 // set up vertex coordinates array
221 static const Real vtx2[3*4] =
222 {
223 1.0, 2.0, 0.0,
224 2.0, 1.0, 0.0,
225 0.0, 0.0, 2.0,
226 1.0, 1.0, 0.0
227 };
228
229 // set up vertices-at-edge array
230 static const Index v_e2[6*2] =
231 {
232 2, 3,
233 3, 1,
234 1, 0,
235 2, 1,
236 3, 0,
237 0, 2
238 };
239
240 // set up vertices-at-triangle array
241 static const Index v_t2[4*3] =
242 {
243 0, 3, 2,
244 0, 1, 3,
245 0, 1, 2,
246 2, 1, 3
247 };
248
249 // set up vertices-at-tetrahedron array
250 static const Index v_s2[1*4] =
251 {
252 3, 1, 0, 2
253 };
254
255 // set up edges-at-triangle array
256 static const Index e_t2[3*4] =
257 {
258 0, 5, 4,
259 1, 4, 2,
260 3, 5, 2,
261 1, 0, 3
262 };
263
264 // set up edges-at-tetrahedron array
265 static const Index e_s2[1*6] =
266 {
267 1, 4, 0, 2, 3, 5
268 };
269
270 // set up triangle-at-tetrahedron array
271 static const Index t_s2[1*4] =
272 {
273 2, 0, 3, 1
274 };
275
276 switch(orientation)
277 {
278 case 0:
279 copy_vtx(mesh->get_vertex_set(), vtx0);
280 copy_idx(mesh->get_index_set<1,0>(), v_e0);
281 copy_idx(mesh->get_index_set<2,0>(), v_t0);
282 copy_idx(mesh->get_index_set<2,1>(), e_t0);
283 copy_idx(mesh->get_index_set<3,0>(), v_s0);
284 copy_idx(mesh->get_index_set<3,1>(), e_s0);
285 copy_idx(mesh->get_index_set<3,2>(), t_s0);
286 break;
287
288 case 1:
289 copy_vtx(mesh->get_vertex_set(), vtx1);
290 copy_idx(mesh->get_index_set<1,0>(), v_e1);
291 copy_idx(mesh->get_index_set<2,0>(), v_t1);
292 copy_idx(mesh->get_index_set<2,1>(), e_t1);
293 copy_idx(mesh->get_index_set<3,0>(), v_s1);
294 copy_idx(mesh->get_index_set<3,1>(), e_s1);
295 copy_idx(mesh->get_index_set<3,2>(), t_s1);
296 break;
297
298 case 2:
299 copy_vtx(mesh->get_vertex_set(), vtx2);
300 copy_idx(mesh->get_index_set<1,0>(), v_e2);
301 copy_idx(mesh->get_index_set<2,0>(), v_t2);
302 copy_idx(mesh->get_index_set<2,1>(), e_t2);
303 copy_idx(mesh->get_index_set<3,0>(), v_s2);
304 copy_idx(mesh->get_index_set<3,1>(), e_s2);
305 copy_idx(mesh->get_index_set<3,2>(), t_s2);
306 break;
307
308 default:
309 XABORTM("Unhandled orientation "+stringify(orientation));
310 }
311 // okay
312 return mesh;
313 } // create_tetra_mesh_3d
314
315 void validate_refined_tetra_mesh_3d(const TetraMesh& mesh, int orientation)
316 {
317
318 // validate sizes
319 if(mesh.get_num_entities(0) != 11)
320 throw String("Vertex count mismatch");
321 if(mesh.get_num_entities(1) != 30)
322 throw String("Edge count mismatch");
323 if(mesh.get_num_entities(2) != 32)
324 throw String("Triangle count mismatch");
325 if(mesh.get_num_entities(3) != 12)
326 throw String("Triangle count mismatch");
327
328
329 // first possibility (standard)
330
331 // vertex coordinates array
332 static const Real vtx0[] =
333 {
334 0.0, 0.0, 0.0,
335 1.0, 0.0, 0.0,
336 0.0, 1.0, 0.0,
337 0.0, 0.0, 1.0,
338 0.5, 0.0, 0.0,
339 0.0, 0.5, 0.0,
340 0.0, 0.0, 0.5,
341 0.5, 0.5, 0.0,
342 0.5, 0.0, 0.5,
343 0.0, 0.5, 0.5,
344 0.25, 0.25, 0.25
345 };
346
347 // vertices-at-edge array
348 static const Index v_e0[] =
349 {
350 //edges
351 0, 4,
352 4, 1,
353 0, 5,
354 5, 2,
355 0, 6,
356 6, 3,
357 1, 7,
358 7, 2,
359 1, 8,
360 8, 3,
361 2, 9,
362 9, 3,
363
364 //triangles
365 7, 8,
366 9, 7,
367 8, 9,
368 5, 6,
369 9, 5,
370 6, 9,
371 4, 6,
372 8, 4,
373 6, 8,
374 4, 5,
375 7, 4,
376 5, 7,
377
378 //tetrahedron
379 4, 10,
380 5, 10,
381 6, 10,
382 7, 10,
383 8, 10,
384 9, 10
385 };
386
387 // vertices-at-triangle
388 static const Index v_t0[] =
389 {
390 //triangles
391 1, 7, 8,
392 7, 2, 9,
393 8, 9, 3,
394 9, 8, 7,
395 0, 5, 6,
396 5, 2, 9,
397 6, 9, 3,
398 9, 6, 5,
399 0, 4, 6,
400 4, 1, 8,
401 6, 8, 3,
402 8, 6, 4,
403 0, 4, 5,
404 4, 1, 7,
405 5, 7, 2,
406 7, 5, 4,
407 4, 5, 6,
408 4, 7, 8,
409 5, 7, 9,
410 6, 8, 9,
411 4, 5, 10,
412 4, 6, 10,
413 4, 7, 10,
414 4, 8, 10,
415 5, 6, 10,
416 5, 7, 10,
417 5, 9, 10,
418 6, 8, 10,
419 6, 9, 10,
420 7, 8, 10,
421 7, 9, 10,
422 8, 9, 10
423 };
424
425 // vertices-at-tetrahedron
426 static const Index v_s0[] =
427 {
428 4, 6, 5, 0,
429 4, 5, 6, 10,
430 4, 7, 8, 1,
431 4, 8, 7, 10,
432 5, 9, 7, 2,
433 5, 7, 9, 10,
434 6, 8, 9, 3,
435 6, 9, 8, 10,
436
437 7, 8, 9, 10,
438 5, 9, 6, 10,
439 4, 6, 8, 10,
440 4, 7, 5, 10
441
442 };
443
444 // edges-at-triangle
445 static const Index e_t0[] =
446 {
447 // surfaces
448 12, 8, 6, //0
449 10, 13, 7,
450 11, 9, 14,
451 12, 13, 14,
452
453 15, 4, 2,
454 10, 16, 3, //5
455 11, 5, 17,
456 15, 16, 17,
457
458 18, 4, 0,
459 8, 19, 1,
460 9, 5, 20, //10
461 18, 19, 20,
462
463 21, 2, 0,
464 6, 22, 1,
465 7, 3, 23,
466 21, 22, 23, //15
467
468 // inside
469 15, 18, 21,
470 12, 19, 22,
471 13, 16, 23,
472 14, 17, 20,
473
474 25, 24, 21, //20
475 26, 24, 18,
476 27, 24, 22,
477 28, 24, 19,
478
479 26, 25, 15,
480 27, 25, 23, //25
481 29, 25, 16,
482
483 28, 26, 20,
484 29, 26, 17,
485
486 28, 27, 12,
487 29, 27, 13, //30
488
489 29, 28, 14
490 };
491
492 // edges-at-tetrahedron
493 static const Index e_s0[] =
494 {
495 //corners
496 18, 21, 0, 15, 4, 2,
497 21, 18, 24, 15, 25, 26,
498
499 22, 19, 1, 12, 6, 8,
500 19, 22, 24, 12, 28, 27,
501
502 16, 23, 3, 13, 10, 7,
503 23, 16, 25, 13, 27, 29,
504
505 20, 17, 5, 14, 9, 11,
506 17, 20, 26, 14, 29, 28,
507
508 // surfaces
509 12, 13, 27, 14, 28, 29,
510 16, 15, 25, 17, 29, 26,
511 18, 19, 24, 20, 26, 28,
512 22, 21, 24, 23, 27, 25,
513 };
514
515 // triangle-at-tetrahedron
516 static const Index t_s0[] =
517 {
518 4, 12, 8, 16,
519 24, 21, 20, 16,
520
521 0, 9, 13, 17,
522 29, 22, 23, 17,
523
524 1, 14, 5, 18,
525 30, 26, 25, 18,
526
527 2, 6, 10, 19,
528 31, 27, 28, 19,
529
530 31, 30, 29, 3,
531 28, 24, 26, 7,
532 27, 23, 21, 11,
533 25, 20, 22, 15
534
535 };
536
537 // second possibility
538
539 // vertex coordinates array
540 static const Real vtx1[] =
541 {
542 0.0, 0.0, 0.0,
543 1.0, 0.0, 0.0,
544 0.0, 1.0, 0.0,
545 0.0, 0.0, 1.0,
546
547 0.0, 0.5, 0.0,
548 0.5, 0.5, 0.0,
549 0.5, 0.0, 0.0,
550 0.5, 0.0, 0.5,
551 0.0, 0.0, 0.5,
552 0.0, 0.5, 0.5,
553
554 0.25, 0.25, 0.25
555 };
556
557 // vertices-at-edge array
558 static const Index v_e1[] =
559 {
560 //edges
561 0, 4,
562 4, 2,
563 1, 5,
564 5, 2,
565 1, 6,
566 6, 0, //5
567 3, 7,
568 7, 1,
569 3, 8,
570 8, 0,
571 3, 9, //10
572 9, 2,
573
574 //triangles
575 5, 4,
576 6, 5,
577 4, 6,
578
579 9, 5, //15
580 7, 9,
581 5, 7,
582
583 8, 9,
584 4, 8,
585 9, 4, //20
586
587 8, 6,
588 7, 8,
589 6, 7,
590
591 //tetrahedron
592 6, 10,
593 4, 10, //25
594 8, 10,
595 5, 10,
596 7, 10,
597 9, 10
598 };
599
600 // vertices-at-triangle
601 static const Index v_t1[] =
602 {
603 //triangles
604 2, 5, 4,
605 5, 1, 6,
606 4, 6, 0,
607 6, 4, 5,
608
609 2, 9, 5,
610 9, 3, 7,//5
611 5, 7, 1,
612 7, 5, 9,
613
614 3, 8, 9,
615 8, 0, 4,
616 9, 4, 2,//10
617 4, 9, 8,
618
619 0, 8, 6,
620 8, 3, 7,
621 6, 7, 1,
622 7, 6, 8,//15
623
624 //tetrahedron
625 6, 4, 8,
626 6, 5, 7,
627 4, 5, 9,
628 8, 7, 9,
629
630 6, 4, 10, //20
631 6, 8, 10,
632 6, 5, 10,
633 6, 7, 10,
634
635 4, 8, 10,
636 4, 5, 10,//25
637 4, 9, 10,
638
639 8, 7, 10,
640 8, 9, 10,
641
642 5, 7, 10,
643 5, 9, 10,//30
644
645 7, 9, 10
646 };
647
648 // vertices-at-tetrahedron
649 static const Index v_s1[] =
650 {
651 6, 8, 4, 0,
652 6, 4, 8, 10,
653 6, 5, 7, 1,
654 6, 7, 5, 10,
655 4, 9, 5, 2,
656 4, 5, 9, 10,
657 8, 7, 9, 3,
658 8, 9, 7, 10,
659
660 5, 7, 9, 10,
661 4, 9, 8, 10,
662 6, 8, 7, 10,
663 6, 5, 4, 10
664 };
665
666 // edges-at-triangle
667 static const Index e_t1[] =
668 {
669 // surfaces
670 12, 1, 3,
671 4, 13, 2,
672 5, 0, 14,
673 12, 13, 14,
674
675 15, 3, 11,
676 6, 16, 10,
677 7, 2, 17,
678 15, 16, 17,
679
680 18, 10, 8,
681 0, 19, 9,
682 1, 11, 20,
683 18, 19, 20,
684
685 21, 5, 9,
686 6, 22, 8,
687 7, 4, 23,
688 21, 22, 23,
689
690 // inside
691 19, 21, 14,
692 17, 23, 13,
693 15, 20, 12,
694 16, 18, 22,
695
696 25, 24, 14,
697 26, 24, 21,
698 27, 24, 13,
699 28, 24, 23,
700
701 26, 25, 19,
702 27, 25, 12,
703 29, 25, 20,
704
705 28, 26, 22,
706 29, 26, 18,
707
708 28, 27, 17,
709 29, 27, 15,
710
711 29, 28, 16
712 };
713
714 // edges-at-tetrahedron
715 static const Index e_s1[] =
716 {
717 //corners
718 21, 14, 5, 19, 9, 0,
719 14, 21, 24, 19, 25, 26,
720 13, 23, 4, 17, 2, 7,
721 23, 13, 24, 17, 28, 27,
722 20, 12, 1, 15, 11, 3,
723 12, 20, 25, 15, 27, 29,
724 22, 18, 8, 16, 6, 10,
725 18, 22, 26, 16, 29, 28,
726
727 // surfaces
728 17, 15, 27, 16, 28, 29,
729 20, 19, 25, 18, 29, 26,
730 21, 23, 24, 22, 26, 28,
731 13, 14, 24, 12, 27, 25
732 };
733
734 // triangle-at-tetrahedron
735 static const Index t_s1[] =
736 {
737 9, 2, 12, 16,
738 24, 21, 20, 16,
739
740 6, 14, 1, 17,
741 29, 22, 23, 17,
742
743 4, 0, 10, 18,
744 30, 26, 25, 18,
745
746 5, 8, 13, 19,
747 31, 27, 28, 19,
748
749 31, 30, 29, 7,
750 28, 24, 26, 11,
751 27, 23, 21, 15,
752 25, 20, 22, 3
753 };
754
755 // third possibility
756
757 // vertex coordinates array
758 static const Real vtx2[] =
759 {
760 1.0, 2.0, 0.0,
761 2.0, 1.0, 0.0,
762 0.0, 0.0, 2.0,
763 1.0, 1.0, 0.0,
764
765 0.5, 0.5, 1.0,
766 1.5, 1.0, 0.0,
767 1.5, 1.5, 0.0,
768 1.0, 0.5, 1.0,
769 1.0, 1.5, 0.0,
770 0.5, 1.0, 1.0,
771
772 1.0, 1.0, 0.5
773 };
774
775 // vertices-at-edge array
776 static const Index v_e2[] =
777 {
778 //edges
779 2, 4,
780 4, 3,
781 3, 5,
782 5, 1,
783 1, 6,
784 6, 0, //5
785 2, 7,
786 7, 1,
787 3, 8,
788 8, 0,
789 0, 9, //10
790 9, 2,
791
792 //triangles
793 8, 9,
794 4, 8,
795 9, 4,
796
797 6, 8, //15
798 5, 6,
799 8, 5,
800
801 6, 9,
802 7, 6,
803 9, 7, //20
804
805 7, 4,
806 5, 7,
807 4, 5,
808
809 //tetrahedron
810 5, 10,
811 8, 10, //25
812 4, 10,
813 6, 10,
814 7, 10,
815 9, 10
816 };
817
818 // vertices-at-triangle
819 static const Index v_t2[] =
820 {
821 //triangles
822 0, 8, 9, //0
823 8, 3, 4,
824 9, 4, 2,
825 4, 9, 8,
826
827 0, 6, 8,
828 6, 1, 5, //5
829 8, 5, 3,
830 5, 8, 6,
831
832 0, 6, 9,
833 6, 1, 7,
834 9, 7, 2,//10
835 7, 9, 6,
836
837 2, 7, 4,
838 7, 1, 5,
839 4, 5, 3,
840 5, 4, 7,//15
841
842 //tetrahedron
843 5, 8, 4,
844 5, 6, 7,
845 8, 6, 9,
846 4, 7, 9,
847
848 5, 8, 10, //20
849 5, 4, 10,
850 5, 6, 10,
851 5, 7, 10,
852
853 8, 4, 10,
854 8, 6, 10,//25
855 8, 9, 10,
856
857 4, 7, 10,
858 4, 9, 10,
859
860 6, 7, 10,
861 6, 9, 10,//30
862
863 7, 9, 10
864 };
865
866 // vertices-at-tetrahedron
867 static const Index v_s2[] =
868 {
869 5, 4, 8, 3,
870 5, 8, 4, 10,
871 5, 6, 7, 1,
872 5, 7, 6, 10,
873 8, 9, 6, 0,
874 8, 6, 9, 10,
875 4, 7, 9, 2,
876 4, 9, 7, 10,
877
878 6, 7, 9, 10,
879 8, 9, 4, 10,
880 5, 4, 7, 10,
881 5, 6, 8, 10
882 };
883
884 // edges-at-triangle
885 static const Index e_t2[] =
886 {
887 // surfaces
888 12, 10, 9,
889 1, 13, 8,
890 0, 11, 14,
891 12, 13, 14,
892
893 15, 9, 5,
894 3, 16, 4,
895 2, 8, 17,
896 15, 16, 17,
897
898 18, 10, 5,
899 7, 19, 4,
900 6, 11, 20,
901 18, 19, 20,
902
903 21, 0, 6,
904 3, 22, 7,
905 2, 1, 23,
906 21, 22, 23,
907
908 // inside
909 13, 23, 17,
910 19, 22, 16,
911 18, 12, 15,
912 20, 14, 21,
913
914 25, 24, 17,
915 26, 24, 23,
916 27, 24, 16,
917 28, 24, 22,
918
919 26, 25, 13,
920 27, 25, 15,
921 29, 25, 12,
922
923 28, 26, 21,
924 29, 26, 14,
925
926 28, 27, 19,
927 29, 27, 18,
928
929 29, 28, 20
930 };
931
932 // edges-at-tetrahedron
933 static const Index e_s2[] =
934 {
935 //corners
936 23, 17, 2, 13, 1, 8,
937 17, 23, 24, 13, 25, 26,
938 16, 22, 3, 19, 4, 7,
939 22, 16, 24, 19, 28, 27,
940 12, 15, 9, 18, 10, 5,
941 15, 12, 25, 18, 27, 29,
942 21, 14, 0, 20, 6, 11,
943 14, 21, 26, 20, 29, 28,
944
945 // surfaces
946
947 19, 18, 27, 20, 28, 29,
948 12, 13, 25, 14, 29, 26,
949 23, 22, 24, 21, 26, 28,
950 16, 17, 24, 15, 27, 25
951 };
952
953 // triangle-at-tetrahedron
954 static const Index t_s2[] =
955 {
956 1, 6, 14, 16,
957 24, 21, 20, 16,
958
959 9, 13, 5, 17,
960 29, 22, 23, 17,
961
962 8, 4, 0, 18,
963 30, 26, 25, 18,
964
965 10, 2, 12, 19,
966 31, 27, 28, 19,
967
968 31, 30, 29, 11,
969
970 28, 24, 26, 3,
971
972 27, 23, 21, 15,
973
974 25, 20, 22, 7
975 };
976
977 switch(orientation)
978 {
979 case 0:
980 // check vertex coordinates array
981 if(!comp_vtx(mesh.get_vertex_set(), vtx0))
982 throw String("Vertex coordinate refinement failure");
983
984 // check vertices-at-edge array
985 if(!comp_idx(mesh.get_index_set<1,0>(), v_e0))
986 throw String("Vertex-At-Edge index set refinement failure");
987
988 // check vertices-at-triangle
989 if(!comp_idx(mesh.get_index_set<2,0>(), v_t0))
990 throw String("Vertex-At-Triangle index set refinement failure");
991
992 // check vertices-at-tetrahedron
993 if(!comp_idx(mesh.get_index_set<3,0>(), v_s0))
994 throw String("Vertex-At-Tetrahedron index set refinement failure");
995
996 // check edges-at-triangle
997 if(!comp_idx(mesh.get_index_set<2,1>(), e_t0))
998 throw String("Edge-At-Triangle index set refinement failure");
999
1000 // check edges-at-tetrahedron
1001 if(!comp_idx(mesh.get_index_set<3,1>(), e_s0))
1002 throw String("Edge-At-Tetrahedron index set refinement failure");
1003
1004 // check triangles-at-tetrahedron
1005 if(!comp_idx(mesh.get_index_set<3,2>(), t_s0))
1006 throw String("Triangle-At-Tetrahedron index set refinement failure");
1007 break;
1008
1009 case 1:
1010 // check vertex coordinates array
1011 if(!comp_vtx(mesh.get_vertex_set(), vtx1))
1012 throw String("Vertex coordinate refinement failure");
1013
1014 // check vertices-at-edge array
1015 if(!comp_idx(mesh.get_index_set<1,0>(), v_e1))
1016 throw String("Vertex-At-Edge index set refinement failure");
1017
1018 // check vertices-at-triangle
1019 if(!comp_idx(mesh.get_index_set<2,0>(), v_t1))
1020 throw String("Vertex-At-Triangle index set refinement failure");
1021
1022 // check vertices-at-tetrahedron
1023 if(!comp_idx(mesh.get_index_set<3,0>(), v_s1))
1024 throw String("Vertex-At-Tetrahedron index set refinement failure");
1025
1026 // check edges-at-triangle
1027 if(!comp_idx(mesh.get_index_set<2,1>(), e_t1))
1028 throw String("Edge-At-Triangle index set refinement failure");
1029
1030 // check edges-at-tetrahedron
1031 if(!comp_idx(mesh.get_index_set<3,1>(), e_s1))
1032 throw String("Edge-At-Tetrahedron index set refinement failure");
1033
1034 // check triangles-at-tetrahedron
1035 if(!comp_idx(mesh.get_index_set<3,2>(), t_s1))
1036 throw String("Triangle-At-Tetrahedron index set refinement failure");
1037 break;
1038
1039 case 2:
1040 // check vertex coordinates array
1041 if(!comp_vtx(mesh.get_vertex_set(), vtx2))
1042 throw String("Vertex coordinate refinement failure");
1043
1044 // check vertices-at-edge array
1045 if(!comp_idx(mesh.get_index_set<1,0>(), v_e2))
1046 throw String("Vertex-At-Edge index set refinement failure");
1047
1048 // check vertices-at-triangle
1049 if(!comp_idx(mesh.get_index_set<2,0>(), v_t2))
1050 throw String("Vertex-At-Triangle index set refinement failure");
1051
1052 // check vertices-at-tetrahedron
1053 if(!comp_idx(mesh.get_index_set<3,0>(), v_s2))
1054 throw String("Vertex-At-Tetrahedron index set refinement failure");
1055
1056 // check edges-at-triangle
1057 if(!comp_idx(mesh.get_index_set<2,1>(), e_t2))
1058 throw String("Edge-At-Triangle index set refinement failure");
1059
1060 // check edges-at-tetrahedron
1061 if(!comp_idx(mesh.get_index_set<3,1>(), e_s2))
1062 throw String("Edge-At-Tetrahedron index set refinement failure");
1063
1064 // check triangles-at-tetrahedron
1065 if(!comp_idx(mesh.get_index_set<3,2>(), t_s2))
1066 throw String("Triangle-At-Tetrahedron index set refinement failure");
1067 break;
1068
1069 default:
1070 XABORTM("Unhandled orientation "+stringify(orientation));
1071 } //switch
1072 } // validate_refined_tetra_mesh_3d
1073
1074 TetraMesh* create_big_tetra_mesh_3d()
1075 {
1076
1077 Index num_entities[] =
1078 {
1079 5, // vertices
1080 10, // edges
1081 9, // triangles
1082 3 // tetrahedron
1083 };
1084
1085 // create mesh
1086 TetraMesh* mesh = new TetraMesh(num_entities);
1087
1088 // set up vertex coordinates array
1089 static const Real vtx0[3*5] =
1090 {
1091 -2.0, -4.0, 0.0,
1092 -2.0, 4.0, 0.0,
1093 4.0, 0.0, 0.0,
1094 0.0, 0.0, 42.0,
1095 0.0, 0.0, 0.0
1096 };
1097
1098 // set up vertices-at-edge array
1099 static const Index v_e0[10*2] =
1100 {
1101 3, 4,
1102 0, 4,
1103 1, 4,
1104 2, 4,
1105 3, 0,
1106 3, 1,
1107 3, 2,
1108 0, 1,
1109 1, 2,
1110 2, 0
1111 };
1112
1113 // set up vertices-at-triangle array
1114 static const Index v_t0[9*3] =
1115 {
1116 1, 4, 3,//0
1117 1, 2, 3,
1118 1, 0, 3,
1119 3, 0, 2,
1120 1, 2, 4,
1121 2, 0, 4,//5
1122 1, 0, 4,
1123 2, 3, 4,
1124 0, 4, 3
1125 };
1126
1127 // set up vertices-at-tetrahedron array
1128 static const Index v_s0[3*4] =
1129 {
1130 0, 1, 3, 4,
1131 2, 3, 4, 1,
1132 2, 3, 0, 4
1133 };
1134
1135 // set up edges-at-triangle array
1136 static const Index e_t0[3*9] =
1137 {
1138 0, 5, 2,
1139 6, 5, 8,
1140 4, 5, 7,
1141 9, 6, 4,
1142 3, 2, 8,
1143 1, 3, 9,
1144 1, 2, 7,
1145 0, 3, 6,
1146 0, 4, 1
1147 };
1148
1149 // set up edges-at-tetrahedron array
1150 static const Index e_s0[3*6] =
1151 {
1152 7, 4, 1, 5, 2, 0,
1153 6, 3, 8, 0, 5, 2,
1154 6, 9, 3, 4, 0, 1
1155 };
1156
1157 // set up triangle-at-tetrahedron array
1158 static const Index t_s0[3*4] =
1159 {
1160 0, 8, 6, 2,
1161 0, 4, 1, 7,
1162 8, 5, 7, 3
1163 };
1164
1165 copy_vtx(mesh->get_vertex_set(), vtx0);
1166 copy_idx(mesh->get_index_set<1,0>(), v_e0);
1167 copy_idx(mesh->get_index_set<2,0>(), v_t0);
1168 copy_idx(mesh->get_index_set<2,1>(), e_t0);
1169 copy_idx(mesh->get_index_set<3,0>(), v_s0);
1170 copy_idx(mesh->get_index_set<3,1>(), e_s0);
1171 copy_idx(mesh->get_index_set<3,2>(), t_s0);
1172
1173 // okay
1174 return mesh;
1175 } // create_big_tetra_mesh_3d
1176
1177 void validate_refined_big_tetra_mesh_3d(const TetraMesh& mesh)
1178 {
1179
1180 // validate sizes
1181 if(mesh.get_num_entities(0) != 18)
1182 throw String("Vertex count mismatch");
1183 if(mesh.get_num_entities(1) != 65)
1184 throw String("Edge count mismatch");
1185 if(mesh.get_num_entities(2) != 84)
1186 throw String("Triangle count mismatch");
1187 if(mesh.get_num_entities(3) != 36)
1188 throw String("Triangle count mismatch");
1189
1190 // vertex coordinates array
1191 static const Real vtx0[] =
1192 {
1193 -2.0, -4.0, 0.0,
1194 -2.0, 4.0, 0.0,
1195 4.0, 0.0, 0.0,
1196 0.0, 0.0, 42.0,
1197 0.0, 0.0, 0.0,
1198
1199 0.0, 0.0, 21.0,
1200 -1.0, -2.0, 0.0,
1201 -1.0, 2.0, 0.0,
1202 2.0, 0.0, 0.0,
1203 -1.0, -2.0, 21.0,
1204 -1.0, 2.0, 21.0,
1205 2.0, 0.0, 21.0,
1206 -2.0, 0.0, 0.0,
1207 1.0, 2.0, 0.0,
1208 1.0, -2.0, 0.0,
1209
1210 -1.0, 0.0, 10.5,
1211 0.5, 1.0, 10.5,
1212 0.5, -1.0, 10.5
1213 };
1214
1215 // vertices-at-edge array
1216 static const Index v_e0[] =
1217 {
1218 //edges
1219 3, 5, //0
1220 5, 4,
1221 0, 6,
1222 6, 4,
1223 1, 7,
1224 7, 4, //5
1225 2, 8,
1226 8, 4,
1227 3, 9,
1228 9, 0,
1229 3, 10,//10
1230 10, 1,
1231 3, 11,
1232 11, 2,
1233 0, 12,
1234 12, 1,//15
1235 1, 13,
1236 13, 2,
1237 2, 14,
1238 14, 0,
1239
1240 //triangles
1241 7, 10,//20
1242 5, 7,
1243 10, 5,
1244
1245 13, 10,
1246 11, 13,
1247 10, 11,//25
1248
1249 12, 10,
1250 9, 12,
1251 10, 9,
1252
1253 9, 11,
1254 14, 9,//30
1255 11, 14,
1256
1257 13, 7,
1258 8, 13,
1259 7, 8,
1260
1261 14, 8,//35
1262 6, 14,
1263 8, 6,
1264
1265 12, 7,
1266 6, 12,
1267 7, 6,//40
1268
1269 11, 8,
1270 5, 11,
1271 8, 5,
1272
1273 6, 9,
1274 5, 6,//45
1275 9, 5,
1276
1277 //tetrahedron
1278 12, 15,
1279 9, 15,
1280 6, 15,
1281 10, 15,//50
1282 7, 15,
1283 5, 15,
1284
1285 11, 16,
1286 8, 16,
1287 13, 16,//55
1288 5, 16,
1289 10, 16,
1290 7, 16,
1291
1292 11, 17,
1293 14, 17,//60
1294 8, 17,
1295 9, 17,
1296 5, 17,
1297 6, 17 //64
1298 };
1299
1300 // vertices-at-triangle
1301 static const Index v_t0[] =
1302 {
1303 //triangles
1304 1, 7, 10, //0
1305 7, 4, 5,
1306 10, 5, 3,
1307 5, 10, 7,
1308
1309 1, 13, 10,
1310 13, 2, 11, //5
1311 10, 11, 3,
1312 11, 10, 13,
1313
1314 1, 12, 10,
1315 12, 0, 9,
1316 10, 9, 3,//10
1317 9, 10, 12,
1318
1319 3, 9, 11,
1320 9, 0, 14,
1321 11, 14, 2,
1322 14, 11, 9,//15
1323
1324 1, 13, 7,
1325 13, 2, 8,
1326 7, 8, 4,
1327 8, 7, 13,
1328
1329 2, 14, 8,//20
1330 14, 0, 6,
1331 8, 6, 4,
1332 6, 8, 14,
1333
1334 1, 12, 7,
1335 12, 0, 6,//25
1336 7, 6, 4,
1337 6, 7, 12,
1338
1339 2, 11, 8,
1340 11, 3, 5,
1341 8, 5, 4,//30
1342 5, 8, 11,
1343
1344 0, 6, 9,
1345 6, 4, 5,
1346 9, 5, 3,
1347 5, 9, 6,//35
1348
1349 //tetrahedron
1350 12, 9, 6,
1351 12, 10, 7,
1352 9, 10, 5,
1353 6, 7, 5,
1354
1355 12, 9, 15,//40
1356 12, 6, 15,
1357 12, 10, 15,
1358 12, 7, 15,
1359 9, 6, 15,
1360 9, 10, 15,//45
1361 9, 5, 15,
1362 6, 7, 15,
1363 6, 5, 15,
1364 10, 7, 15,
1365 10, 5, 15,//50
1366 7, 5, 15,
1367
1368 11, 8, 13,
1369 11, 5, 10,
1370 8, 5, 7,
1371 13, 10, 7,//55
1372
1373 11, 8, 16,
1374 11, 13, 16,
1375 11, 5, 16,
1376 11, 10, 16,
1377 8, 13, 16,//60
1378 8, 5, 16,
1379 8, 7, 16,
1380 13, 10, 16,
1381 13, 7, 16,
1382 5, 10, 16,//65
1383 5, 7, 16,
1384 10, 7, 16,
1385
1386 11, 14, 8,
1387 11, 9, 5,
1388 14, 9, 6,//70
1389 8, 5, 6,
1390
1391 11, 14, 17,
1392 11, 8, 17,
1393 11, 9, 17,
1394 11, 5, 17,//75
1395 14, 8, 17,
1396 14, 9, 17,
1397 14, 6, 17,
1398 8, 5, 17,
1399 8, 6, 17,//80
1400 9, 5, 17,
1401 9, 6, 17,
1402 5, 6, 17
1403 };
1404
1405 // vertices-at-tetrahedron
1406 static const Index v_s0[] =
1407 {
1408 12, 6, 9, 0,//0
1409 12, 9, 6, 15,
1410 12, 10, 7, 1,
1411 12, 7, 10, 15,
1412 9, 5, 10, 3,
1413 9, 10, 5, 15,//5
1414 6, 7, 5, 4,
1415 6, 5, 7, 15,
1416
1417 10, 7, 5, 15,
1418 9, 5, 6, 15,
1419 12, 6, 7, 15,//10
1420 12, 10, 9, 15,
1421
1422 11, 13, 8, 2,
1423 11, 8, 13, 16,
1424 11, 5, 10, 3,
1425 11, 10, 5, 16,//15
1426 8, 7, 5, 4,
1427 8, 5, 7, 16,
1428 13, 10, 7, 1,
1429 13, 7, 10, 16,
1430
1431 5, 10, 7, 16,//20
1432 8, 7, 13, 16,
1433 11, 13, 10, 16,
1434 11, 5, 8, 16,
1435
1436 11, 8, 14, 2,
1437 11, 14, 8, 17,//25
1438 11, 9, 5, 3,
1439 11, 5, 9, 17,
1440 14, 6, 9, 0,
1441 14, 9, 6, 17,
1442 8, 5, 6, 4,//30
1443 8, 6, 5, 17,
1444
1445 9, 5, 6, 17,
1446 14, 6, 8, 17,
1447 11, 8, 5, 17,
1448 11, 9, 14, 17//35
1449 };
1450
1451 // edges-at-triangle
1452 static const Index e_t0[] =
1453 {
1454 // surfaces
1455 20, 11, 4,
1456 1, 21, 5,
1457 0, 10, 22,
1458 20, 21, 22,
1459
1460 23, 11, 16,
1461 13, 24, 17,
1462 12, 10, 25,
1463 23, 24, 25,
1464
1465 26, 11, 15,
1466 9, 27, 14,
1467 8, 10, 28,
1468 26, 27, 28,
1469
1470 29, 12, 8,
1471 19, 30, 9,
1472 18, 13, 31,
1473 29, 30, 31,
1474
1475 32, 4, 16,
1476 6, 33, 17,
1477 7, 5, 34,
1478 32, 33, 34,
1479
1480 35, 6, 18,
1481 2, 36, 19,
1482 3, 7, 37,
1483 35, 36, 37,
1484
1485 38, 4, 15,
1486 2, 39, 14,
1487 3, 5, 40,
1488 38, 39, 40,
1489
1490 41, 6, 13,
1491 0, 42, 12,
1492 1, 7, 43,
1493 41, 42, 43,
1494
1495 44, 9, 2,
1496 1, 45, 3,
1497 0, 8, 46,
1498 44, 45, 46, //108
1499
1500 // inside
1501 44, 39, 27,
1502 20, 38, 26,
1503 22, 46, 28,
1504 21, 45, 40,
1505
1506 48, 47, 27,
1507 49, 47, 39,
1508 50, 47, 26,
1509 51, 47, 38,
1510 49, 48, 44,
1511 50, 48, 28,
1512 52, 48, 46,
1513 51, 49, 40,
1514 52, 49, 45,
1515 51, 50, 20,
1516 52, 50, 22,
1517 52, 51, 21,
1518
1519 33, 24, 41,
1520 22, 25, 42,
1521 21, 34, 43,
1522 20, 32, 23,
1523
1524 54, 53, 41,
1525 55, 53, 24,
1526 56, 53, 42,
1527 57, 53, 25,
1528 55, 54, 33,
1529 56, 54, 43,
1530 58, 54, 34,
1531 57, 55, 23,
1532 58, 55, 32,
1533 57, 56, 22,
1534 58, 56, 21,
1535 58, 57, 20,
1536
1537 35, 41, 31,
1538 46, 42, 29,
1539 44, 36, 30,
1540 45, 37, 43,
1541
1542 60, 59, 31,
1543 61, 59, 41,
1544 62, 59, 29,
1545 63, 59, 42,
1546 61, 60, 35,
1547 62, 60, 30,
1548 64, 60, 36,
1549 63, 61, 43,
1550 64, 61, 37,
1551 63, 62, 46,
1552 64, 62, 44,
1553 64, 63, 45
1554 };
1555
1556 // edges-at-tetrahedron
1557 static const Index e_s0[] =
1558 {
1559 //corners
1560 39, 27, 14, 44, 2, 9,
1561 27, 39, 47, 44, 48, 49,
1562 26, 38, 15, 20, 11, 4,
1563 38, 26, 47, 20, 51, 50,
1564 46, 28, 8, 22, 0, 10,
1565 28, 46, 48, 22, 50, 52,
1566 40, 45, 3, 21, 5, 1,
1567 45, 40, 49, 21, 52, 51,
1568
1569 20, 22, 50, 21, 51, 52,
1570 46, 44, 48, 45, 52, 49,
1571 39, 38, 47, 40, 49, 51,
1572 26, 27, 47, 28, 50, 48,
1573
1574 24, 41, 13, 33, 17, 6,
1575 41, 24, 53, 33, 54, 55,
1576 42, 25, 12, 22, 0, 10,
1577 25, 42, 53, 22, 57, 56,
1578 34, 43, 7, 21, 5, 1,
1579 43, 34, 54, 21, 56, 58,
1580 23, 32, 16, 20, 11, 4,
1581 32, 23, 55, 20, 58, 57,
1582
1583
1584 22, 21, 56, 20, 57, 58,
1585 34, 33, 54, 32, 58, 55,
1586 24, 25, 53, 23, 55, 57,
1587 42, 41, 53, 43, 56, 54,
1588
1589 41, 31, 13, 35, 6, 18,
1590 31, 41, 59, 35, 60, 61,
1591 29, 42, 12, 46, 8, 0,
1592 42, 29, 59, 46, 63, 62,
1593 36, 30, 19, 44, 2, 9,
1594 30, 36, 60, 44, 62, 64,
1595 43, 37, 7, 45, 1, 3,
1596 37, 43, 61, 45, 64, 63,
1597
1598 46, 44, 62, 45, 63, 64,
1599 36, 35, 60, 37, 64, 61,
1600 41, 42, 59, 43, 61, 63,
1601 29, 31, 59, 30, 62, 60
1602 };
1603
1604 // triangle-at-tetrahedron
1605 static const Index t_s0[] =
1606 {
1607 32, 9, 25, 36,//0
1608 44, 41, 40, 36,
1609 0, 24, 8, 37,
1610 49, 42, 43, 37,
1611 2, 10, 34, 38,
1612 50, 46, 45, 38,//5
1613 1, 33, 26, 39,
1614 51, 47, 48, 39,
1615
1616 51, 50, 49, 3,
1617 48, 44, 46, 35,
1618 47, 43, 41, 27,//10
1619 45, 40, 42, 11,
1620
1621 17, 28, 5, 52,
1622 60, 57, 56, 52,
1623 2, 6, 29, 53,
1624 65, 58, 59, 53,//15
1625 1, 30, 18, 54,
1626 66, 62, 61, 54,
1627 0, 16, 4, 55,
1628 67, 63, 64, 55,
1629
1630 67, 66, 65, 3,//20
1631 64, 60, 62, 19,
1632 63, 59, 57, 7,
1633 61, 56, 58, 31,
1634
1635 20, 14, 28, 68,
1636 76, 73, 72, 68,//25
1637 34, 29, 12, 69,
1638 81, 74, 75, 69,
1639 32, 13, 21, 70,
1640 82, 78, 77, 70,
1641 33, 22, 30, 71,//30
1642 83, 79, 80, 71,
1643
1644 83, 82, 81, 35,
1645 80, 76, 78, 23,
1646 79, 75, 73, 31,
1647 77, 72, 74, 15//35
1648 };
1649
1650 // check vertex coordinates array
1651 if(!comp_vtx(mesh.get_vertex_set(), vtx0))
1652 throw String("Vertex coordinate refinement failure");
1653
1654 // check vertices-at-edge array
1655 if(!comp_idx(mesh.get_index_set<1,0>(), v_e0))
1656 throw String("Vertex-At-Edge index set refinement failure");
1657
1658 // check vertices-at-triangle
1659 if(!comp_idx(mesh.get_index_set<2,0>(), v_t0))
1660 throw String("Vertex-At-Triangle index set refinement failure");
1661
1662 // check vertices-at-tetrahedron
1663 if(!comp_idx(mesh.get_index_set<3,0>(), v_s0))
1664 throw String("Vertex-At-Tetrahedron index set refinement failure");
1665
1666 // check edges-at-triangle
1667 if(!comp_idx(mesh.get_index_set<2,1>(), e_t0))
1668 throw String("Edge-At-Triangle index set refinement failure");
1669
1670 // check edges-at-tetrahedron
1671 if(!comp_idx(mesh.get_index_set<3,1>(), e_s0))
1672 throw String("Edge-At-Tetrahedron index set refinement failure");
1673
1674 // check triangles-at-tetrahedron
1675 if(!comp_idx(mesh.get_index_set<3,2>(), t_s0))
1676 throw String("Triangle-At-Tetrahedron index set refinement failure");
1677
1678 } // validate_refined_big_tetra_mesh_3d
1679
1680 TetraMesh* create_really_big_tetra_mesh_3d()
1681 {
1682
1683 Index num_entities[] =
1684 {
1685 18, // vertices
1686 65, // edges
1687 84, // triangles
1688 36 // tetrahedron
1689 };
1690
1691 // create mesh
1692 TetraMesh* mesh = new TetraMesh(num_entities);
1693
1694 // set up vertex coordinates array
1695 static const Real vtx0[3*18] =
1696 {
1697 -2.0, -4.0, 0.0,
1698 -2.0, 4.0, 0.0,
1699 4.0, 0.0, 0.0,
1700 0.0, 0.0, 42.0,
1701 0.0, 0.0, 0.0,
1702
1703 0.0, 0.0, 21.0,
1704 -1.0, -2.0, 0.0,
1705 -1.0, 2.0, 0.0,
1706 2.0, 0.0, 0.0,
1707 -1.0, -2.0, 21.0,
1708 -1.0, 2.0, 21.0,
1709 2.0, 0.0, 21.0,
1710 -2.0, 0.0, 0.0,
1711 1.0, 2.0, 0.0,
1712 1.0, -2.0, 0.0,
1713
1714 -1.0, 0.0, 10.5,
1715 0.5, 1.0, 10.5,
1716 0.5, -1.0, 10.5
1717 };
1718
1719 // set up vertices-at-edge array
1720 static const Index v_e0[65*2] =
1721 {
1722 //edges
1723 3, 5, //0
1724 5, 4,
1725 0, 6,
1726 6, 4,
1727 1, 7,
1728 7, 4, //5
1729 2, 8,
1730 8, 4,
1731 3, 9,
1732 9, 0,
1733 3, 10,//10
1734 10, 1,
1735 3, 11,
1736 11, 2,
1737 0, 12,
1738 12, 1,//15
1739 1, 13,
1740 13, 2,
1741 2, 14,
1742 14, 0,
1743
1744 //triangles
1745 7, 10,//20
1746 5, 7,
1747 10, 5,
1748
1749 13, 10,
1750 11, 13,
1751 10, 11,//25
1752
1753 12, 10,
1754 9, 12,
1755 10, 9,
1756
1757 9, 11,
1758 14, 9,//30
1759 11, 14,
1760
1761 13, 7,
1762 8, 13,
1763 7, 8,
1764
1765 14, 8,//35
1766 6, 14,
1767 8, 6,
1768
1769 12, 7,
1770 6, 12,
1771 7, 6,//40
1772
1773 11, 8,
1774 5, 11,
1775 8, 5,
1776
1777 6, 9,
1778 5, 6,//45
1779 9, 5,
1780
1781 //tetrahedron
1782 12, 15,
1783 9, 15,
1784 6, 15,
1785 10, 15,//50
1786 7, 15,
1787 5, 15,
1788
1789 11, 16,
1790 8, 16,
1791 13, 16,//55
1792 5, 16,
1793 10, 16,
1794 7, 16,
1795
1796 11, 17,
1797 14, 17,//60
1798 8, 17,
1799 9, 17,
1800 5, 17,
1801 6, 17 //64
1802 };
1803
1804 // set up vertices-at-triangle array
1805 static const Index v_t0[84*3] =
1806 {
1807 //triangles
1808 1, 7, 10, //0
1809 7, 4, 5,
1810 10, 5, 3,
1811 5, 10, 7,
1812
1813 1, 13, 10,
1814 13, 2, 11, //5
1815 10, 11, 3,
1816 11, 10, 13,
1817
1818 1, 12, 10,
1819 12, 0, 9,
1820 10, 9, 3,//10
1821 9, 10, 12,
1822
1823 3, 9, 11,
1824 9, 0, 14,
1825 11, 14, 2,
1826 14, 11, 9,//15
1827
1828 1, 13, 7,
1829 13, 2, 8,
1830 7, 8, 4,
1831 8, 7, 13,
1832
1833 2, 14, 8,//20
1834 14, 0, 6,
1835 8, 6, 4,
1836 6, 8, 14,
1837
1838 1, 12, 7,
1839 12, 0, 6,//25
1840 7, 6, 4,
1841 6, 7, 12,
1842
1843 2, 11, 8,
1844 11, 3, 5,
1845 8, 5, 4,//30
1846 5, 8, 11,
1847
1848 0, 6, 9,
1849 6, 4, 5,
1850 9, 5, 3,
1851 5, 9, 6,//35
1852
1853 //tetrahedron
1854 12, 9, 6,
1855 12, 10, 7,
1856 9, 10, 5,
1857 6, 7, 5,
1858
1859 12, 9, 15,//40
1860 12, 6, 15,
1861 12, 10, 15,
1862 12, 7, 15,
1863 9, 6, 15,
1864 9, 10, 15,//45
1865 9, 5, 15,
1866 6, 7, 15,
1867 6, 5, 15,
1868 10, 7, 15,
1869 10, 5, 15,//50
1870 7, 5, 15,
1871
1872 11, 8, 13,
1873 11, 5, 10,
1874 8, 5, 7,
1875 13, 10, 7,//55
1876
1877 11, 8, 16,
1878 11, 13, 16,
1879 11, 5, 16,
1880 11, 10, 16,
1881 8, 13, 16,//60
1882 8, 5, 16,
1883 8, 7, 16,
1884 13, 10, 16,
1885 13, 7, 16,
1886 5, 10, 16,//65
1887 5, 7, 16,
1888 10, 7, 16,
1889
1890 11, 14, 8,
1891 11, 9, 5,
1892 14, 9, 6,//70
1893 8, 5, 6,
1894
1895 11, 14, 17,
1896 11, 8, 17,
1897 11, 9, 17,
1898 11, 5, 17,//75
1899 14, 8, 17,
1900 14, 9, 17,
1901 14, 6, 17,
1902 8, 5, 17,
1903 8, 6, 17,//80
1904 9, 5, 17,
1905 9, 6, 17,
1906 5, 6, 17
1907 };
1908
1909 // set up vertices-at-tetrahedron array
1910 static const Index v_s0[36*4] =
1911 {
1912 12, 6, 9, 0,//0
1913 12, 9, 6, 15,
1914 12, 10, 7, 1,
1915 12, 7, 10, 15,
1916 9, 5, 10, 3,
1917 9, 10, 5, 15,//5
1918 6, 7, 5, 4,
1919 6, 5, 7, 15,
1920
1921 10, 7, 5, 15,
1922 9, 5, 6, 15,
1923 12, 6, 7, 15,//10
1924 12, 10, 9, 15,
1925
1926 11, 13, 8, 2,
1927 11, 8, 13, 16,
1928 11, 5, 10, 3,
1929 11, 10, 5, 16,//15
1930 8, 7, 5, 4,
1931 8, 5, 7, 16,
1932 13, 10, 7, 1,
1933 13, 7, 10, 16,
1934
1935 5, 10, 7, 16,//20
1936 8, 7, 13, 16,
1937 11, 13, 10, 16,
1938 11, 5, 8, 16,
1939
1940 11, 8, 14, 2,
1941 11, 14, 8, 17,//25
1942 11, 9, 5, 3,
1943 11, 5, 9, 17,
1944 14, 6, 9, 0,
1945 14, 9, 6, 17,
1946 8, 5, 6, 4,//30
1947 8, 6, 5, 17,
1948
1949 9, 5, 6, 17,
1950 14, 6, 8, 17,
1951 11, 8, 5, 17,
1952 11, 9, 14, 17//35
1953 };
1954
1955 copy_vtx(mesh->get_vertex_set(), vtx0);
1956 copy_idx(mesh->get_index_set<1,0>(), v_e0);
1957 copy_idx(mesh->get_index_set<2,0>(), v_t0);
1958 copy_idx(mesh->get_index_set<3,0>(), v_s0);
1959
1960 // okay
1961 return mesh;
1962 } // create_really_big_tetra_mesh_3d
1963
1964 TetraSubMesh* create_tria_submesh_3d()
1965 {
1966
1967 Index num_entities[] =
1968 {
1969 4, // vertices
1970 6, // edges
1971 3, // tria
1972 0 // tetra
1973 };
1974
1975 // create mesh
1976 TetraSubMesh* mesh = new TetraSubMesh(num_entities, true);
1977 // create a AttributeSet that holds one value for each vertex
1978 std::unique_ptr<TetraSubMesh::AttributeSetType> my_attrib_set(new TetraSubMesh::AttributeSetType(num_entities[0], 2));
1979 // Add the attribute to mesh
1980 mesh->add_attribute(std::move(my_attrib_set), "TriaSubAttributeSet");
1981
1982 // set up vertex coordinates array
1983 Real attr[] =
1984 {
1985 2.0, 2.0,
1986 0.0, 0.0,
1987 2.0, 4.0,
1988 4.0, 0.0
1989 };
1990 copy_attr(*(mesh->find_attribute("TriaSubAttributeSet")), attr);
1991
1992 // set up vertices-at-edge array
1993 Index v_e[] =
1994 {
1995 3, 1,
1996 3, 0,
1997 2, 3,
1998 0, 2,
1999 2, 1,
2000 1, 0
2001 };
2002 copy_idx(mesh->get_index_set<1,0>(), v_e);
2003
2004 // set up vertices-at-tria array
2005 Index v_t[] =
2006 {
2007 0, 3, 1,
2008 2, 1, 0,
2009 2, 0, 3
2010 };
2011 copy_idx(mesh->get_index_set<2,0>(), v_t);
2012
2013 // set up edges-at-tria array
2014 Index e_t[] =
2015 {
2016 0, 5, 1,
2017 5, 3, 4,
2018 1, 2, 3
2019 };
2020 copy_idx(mesh->get_index_set<2,1>(), e_t);
2021
2022 // set up vertex-target indices
2023 Index vti[] =
2024 {
2025 4, 0, 3, 2
2026 };
2027 copy_trg(mesh->get_target_set<0>(), vti);
2028
2029 // set up edge-target indices
2030 Index eqi[] =
2031 {
2032 9, 3, 6, 0, 4, 1
2033 };
2034 copy_trg(mesh->get_target_set<1>(), eqi);
2035
2036 // set up tria-target indices
2037 Index tti[] =
2038 {
2039 5, 8, 7
2040 };
2041 copy_trg(mesh->get_target_set<2>(), tti);
2042 // okay
2043 return mesh;
2044 } // create_tria_submesh_3d()
2045
2046 void validate_refined_tria_submesh_3d(const TetraSubMesh& mesh)
2047 {
2048
2049 // validate sizes
2050 if(mesh.get_num_entities(0) != 10)
2051 throw String("Vertex count mismatch");
2052 if(mesh.get_num_entities(1) != 21)
2053 throw String("Edge count mismatch");
2054 if(mesh.get_num_entities(2) != 12)
2055 throw String("Triangle count mismatch");
2056
2057 // check vertex coordinates array
2058 Real attr[] =
2059 {
2060 2.0, 2.0,
2061 0.0, 0.0,
2062 2.0, 4.0,
2063 4.0, 0.0,
2064
2065 2.0, 0.0,
2066 3.0, 1.0,
2067 3.0, 2.0,
2068 2.0, 3.0,
2069 1.0, 2.0,
2070 1.0, 1.0
2071 };
2072 if(!comp_attr(*(mesh.find_attribute("TriaSubAttributeSet")), attr))
2073 throw String("Attribute refinement failure");
2074
2075 // check vertices-at-edge array
2076 Index v_e[] =
2077 {
2078 3, 4,
2079 4, 1,
2080 3, 5,
2081 5, 0,
2082 2, 6,
2083 6, 3,
2084 0, 7,
2085 7, 2,
2086 2, 8,
2087 8, 1,
2088 1, 9,
2089 9, 0,
2090 5, 9,
2091 4, 5,
2092 9, 4,
2093 8, 7,
2094 9, 8,
2095 7, 9,
2096 7, 6,
2097 5, 7,
2098 6, 5
2099 };
2100 if(!comp_idx(mesh.get_index_set<1,0>(), v_e))
2101 throw String("Vertex-At-Edge index set refinement failure");
2102
2103 // check vertices-at-tria
2104 Index v_t[] =
2105 {
2106 0, 5, 9,
2107 5, 3, 4,
2108 9, 4, 1,
2109 4, 9, 5,
2110 2, 8, 7,
2111 8, 1, 9,
2112 7, 9, 0,
2113 9, 7, 8,
2114 2, 7, 6,
2115 7, 0, 5,
2116 6, 5, 3,
2117 5, 6, 7
2118 };
2119 if(!comp_idx(mesh.get_index_set<2,0>(), v_t))
2120 throw String("Vertex-At-Triangle index set refinement failure");
2121
2122 // check edges-at-tria
2123 Index e_t[] =
2124 {
2125 12, 11, 3,
2126 0, 13, 2,
2127 1, 10, 14,
2128 12, 13, 14,
2129 15, 7, 8,
2130 10, 16, 9,
2131 11, 6, 17,
2132 15, 16, 17,
2133 18, 4, 7,
2134 3, 19, 6,
2135 2, 5, 20,
2136 18, 19, 20
2137 };
2138 if(!comp_idx(mesh.get_index_set<2,1>(), e_t))
2139 throw String("Edges-At-Triangle refinement failure");
2140
2141 // check vertex-target indices
2142 Index vti[] =
2143 {
2144 4, 0, 3, 2, 14, 8, 11, 5, 9, 6
2145 };
2146 if(!comp_trg(mesh.get_target_set<0>(), vti))
2147 throw String("Vertex-Target-Indices refinement failure");
2148
2149 // check edge-target indices
2150 Index eti[] =
2151 {
2152 18, 19, 6, 7, 12, 13, 1, 0, 8, 9, 2, 3,
2153 37, 35, 36, 46, 44, 45, 42, 43, 41
2154 };
2155 if(!comp_trg(mesh.get_target_set<1>(), eti))
2156 throw String("Edge-Target-Indices refinement failure");
2157
2158 // check tria-target indices
2159 Index tti[] =
2160 {
2161 22, 20, 21, 23,
2162 34, 32, 33, 35,
2163 29, 30, 28, 31
2164 };
2165 if(!comp_trg(mesh.get_target_set<2>(), tti))
2166 throw String("Triangle-Target-Indices refinement failure");
2167 } //validate_refined_tria_submesh_3d
2168
2169 } // namespace TestAux
2170 } // namespace Geometry
2171} // namespace FEAT
#define XABORTM(msg)
Abortion macro definition with custom message.
Definition: assertion.hpp:192
FEAT namespace.
Definition: adjactor.hpp:12
double Real
Real data type.
String stringify(const T_ &item)
Converts an item into a String.
Definition: string.hpp:944
std::uint64_t Index
Index data type.