https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ElementFragmentAlgorithmTest.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
10#include "gtest/gtest.h"
11
12#include "MooseUtils.h"
14
15// set this global to true to enable a lot of mesh data output to the console
16const bool debug_print_mesh = false;
17
18void
19CheckNodes(std::map<unsigned int, EFANode *> & nodes, std::vector<unsigned int> & gold)
20{
21 std::map<unsigned int, EFANode *>::iterator mit;
22 std::vector<unsigned int> test;
23 for (mit = nodes.begin(); mit != nodes.end(); ++mit)
24 test.push_back(mit->second->id());
25
26 ASSERT_EQ(test.size(), gold.size());
27 for (unsigned int i = 0; i < test.size(); i++)
28 EXPECT_EQ(test[i], gold[i]);
29}
30
31void
32CheckElements(std::vector<EFAElement *> & elems, std::vector<unsigned int> & gold)
33{
34 std::vector<EFAElement *>::iterator it;
35 std::vector<unsigned int> test;
36 for (it = elems.begin(); it != elems.end(); ++it)
37 test.push_back((*it)->id());
38
39 ASSERT_EQ(test.size(), gold.size());
40 for (unsigned int i = 0; i < test.size(); i++)
41 EXPECT_EQ(test[i], gold[i]);
42}
43
44void
45CheckElements(std::set<EFAElement *> & elems, std::set<unsigned int> & gold)
46{
47 std::set<EFAElement *>::iterator it;
48 std::set<unsigned int> test;
49 for (it = elems.begin(); it != elems.end(); ++it)
50 test.insert((*it)->id());
51
52 ASSERT_EQ(test.size(), gold.size());
53
54 std::set<unsigned int> intersection;
55 set_intersection(test.begin(),
56 test.end(),
57 gold.begin(),
58 gold.end(),
59 std::inserter(intersection, intersection.begin()));
60
61 ASSERT_EQ(intersection.size(), gold.size());
62}
63
64void
66{
67 // 0 ----- 1 ----- 2
68 // | | |
69 // | | |
70 // | | |
71 // 3 ----- 4 ----- 5
72
73 std::vector<std::vector<unsigned int>> quads;
74 std::vector<unsigned int> v1 = {0, 3, 4, 1};
75 quads.push_back(v1);
76 std::vector<unsigned int> v2 = {1, 4, 5, 2};
77 quads.push_back(v2);
78
79 MyMesh.add2DElements(quads);
80
81 MyMesh.updateEdgeNeighbors();
82
83 // 0 ----- 1 ----- 2
84 // | | |
85 // x-------x |
86 // | | |
87 // 3 ----- 4 ----- 5
88
89 // these will create the embedded nodes - elemid, edgeid, location
90 MyMesh.addElemEdgeIntersection((unsigned int)0, 0, 0.5);
91 MyMesh.addElemEdgeIntersection((unsigned int)0, 2, 0.5);
92
93 // algorithm assumes that an element can only be cut by one crack
94 // segment at a time
96}
97
99{
100 ElementFragmentAlgorithm MyMesh(Moose::out);
101 case1Common(MyMesh);
102
103 // creates all new elements (children)
104 // creates all new temporary nodes
105 // sets the links in the children according to the new temporary nodes
106 MyMesh.updateTopology();
107
108 // Test permanent nodes
109 std::map<unsigned int, EFANode *> permanent_nodes = MyMesh.getPermanentNodes();
110 std::vector<unsigned int> pn_gold = {0, 1, 2, 3, 4, 5, 6, 7};
111 CheckNodes(permanent_nodes, pn_gold);
112
113 // Test temp nodes
114 std::map<unsigned int, EFANode *> temp_nodes = MyMesh.getTempNodes();
115 std::vector<unsigned int> tn_gold;
116 CheckNodes(temp_nodes, tn_gold);
117
118 // Test embedded nodes
119 std::map<unsigned int, EFANode *> embedded_nodes = MyMesh.getEmbeddedNodes();
120 std::vector<unsigned int> en_gold = {0, 1};
121 CheckNodes(embedded_nodes, en_gold);
122
123 // Test child elements
124 std::vector<EFAElement *> child_elem = MyMesh.getChildElements();
125 std::vector<unsigned int> ce_gold = {2, 3, 4};
126 CheckElements(child_elem, ce_gold);
127
128 // Test parent elements
129 std::vector<EFAElement *> parent_elem = MyMesh.getParentElements();
130 std::vector<unsigned int> pe_gold = {0, 1};
131 CheckElements(parent_elem, pe_gold);
132}
133
135{
136 ElementFragmentAlgorithm MyMesh(Moose::out);
137 case1Common(MyMesh);
138
139 // creates all new elements (children)
140 // creates all new temporary nodes
141 // sets the links in the children according to the new temporary nodes
142 MyMesh.updateTopology();
143
144 // Once mesh has been cut, run it through the cutting algorithm again
145 // to test that it can handle the topology at a crack tip.
146 MyMesh.clearAncestry();
147 MyMesh.updateEdgeNeighbors();
148 MyMesh.initCrackTipTopology();
149
150 MyMesh.updateTopology();
151
153 MyMesh.printMesh();
154
155 // Test permanent nodes
156 std::map<unsigned int, EFANode *> permanent_nodes = MyMesh.getPermanentNodes();
157 std::vector<unsigned int> pn_gold = {0, 1, 2, 3, 4, 5, 6, 7};
158 CheckNodes(permanent_nodes, pn_gold);
159
160 // Test temp nodes
161 std::map<unsigned int, EFANode *> temp_nodes = MyMesh.getTempNodes();
162 std::vector<unsigned int> tn_gold;
163 CheckNodes(temp_nodes, tn_gold);
164
165 // Test embedded nodes
166 std::map<unsigned int, EFANode *> embedded_nodes = MyMesh.getEmbeddedNodes();
167 std::vector<unsigned int> en_gold = {0, 1};
168 CheckNodes(embedded_nodes, en_gold);
169
170 // Test child elements
171 std::vector<EFAElement *> child_elem = MyMesh.getChildElements();
172 std::vector<unsigned int> ce_gold;
173 CheckElements(child_elem, ce_gold);
174
175 // Test parent elements
176 std::vector<EFAElement *> parent_elem = MyMesh.getParentElements();
177 std::vector<unsigned int> pe_gold;
178 CheckElements(parent_elem, pe_gold);
179}
180
181void
183{
184 // 0 ----- 1 ----- 2
185 // | | |
186 // | 4 |
187 // | / \ |
188 // | / \ |
189 // | / \ |
190 // 3 5
191 // \ /
192 // \ /
193 // \ /
194 // 6
195
196 std::vector<std::vector<unsigned int>> quads;
197 std::vector<unsigned int> v1 = {0, 3, 4, 1};
198 quads.push_back(v1);
199 std::vector<unsigned int> v2 = {1, 4, 5, 2};
200 quads.push_back(v2);
201 std::vector<unsigned int> v3 = {4, 3, 6, 5};
202 quads.push_back(v3);
203
204 MyMesh.add2DElements(quads);
205
206 MyMesh.updateEdgeNeighbors();
207}
208
209void
211{
212 // 0 ----- 1 ----- 2
213 // | | |
214 // x 4 x
215 // | \ / \ / |
216 // | x ----- x |
217 // | / \ |
218 // 3 5
219 // \ /
220 // \ /
221 // \ /
222 // 6
223
224 MyMesh.addElemEdgeIntersection((unsigned int)0, 0, 0.5);
225 MyMesh.addElemEdgeIntersection((unsigned int)0, 1, 0.5);
226 MyMesh.addElemEdgeIntersection((unsigned int)1, 1, 0.5);
227 MyMesh.addElemEdgeIntersection((unsigned int)1, 2, 0.5);
228
230}
231
233{
234 ElementFragmentAlgorithm MyMesh(Moose::out);
235 case2Mesh(MyMesh);
236 case2Intersections(MyMesh);
237 MyMesh.updateTopology();
239 MyMesh.printMesh();
240
241 // Test permanent nodes
242 std::map<unsigned int, EFANode *> permanent_nodes = MyMesh.getPermanentNodes();
243 std::vector<unsigned int> pn_gold = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13};
244 CheckNodes(permanent_nodes, pn_gold);
245
246 // Test temp nodes
247 std::map<unsigned int, EFANode *> temp_nodes = MyMesh.getTempNodes();
248 std::vector<unsigned int> tn_gold;
249 CheckNodes(temp_nodes, tn_gold);
250
251 // Test embedded nodes
252 std::map<unsigned int, EFANode *> embedded_nodes = MyMesh.getEmbeddedNodes();
253 std::vector<unsigned int> en_gold = {0, 1, 2, 3};
254 CheckNodes(embedded_nodes, en_gold);
255
256 // Test child elements
257 std::vector<EFAElement *> child_elem = MyMesh.getChildElements();
258 std::vector<unsigned int> ce_gold = {3, 4, 5, 6, 7, 8};
259 CheckElements(child_elem, ce_gold);
260
261 // Test parent elements
262 std::vector<EFAElement *> parent_elem = MyMesh.getParentElements();
263 std::vector<unsigned int> pe_gold = {0, 1, 2};
264 CheckElements(parent_elem, pe_gold);
265}
266
268{
269 ElementFragmentAlgorithm MyMesh(Moose::out);
270 case2Mesh(MyMesh);
271
272 MyMesh.addElemEdgeIntersection((unsigned int)0, 0, 0.5);
273 MyMesh.addElemEdgeIntersection((unsigned int)0, 1, 0.5);
274
276 MyMesh.updateTopology(false);
278 MyMesh.printMesh();
279
280 {
281 // Test permanent nodes
282 std::map<unsigned int, EFANode *> permanent_nodes = MyMesh.getPermanentNodes();
283 std::vector<unsigned int> pn_gold = {0, 1, 2, 3, 4, 5, 6, 7, 8};
284 CheckNodes(permanent_nodes, pn_gold);
285
286 // Test temp nodes
287 std::map<unsigned int, EFANode *> temp_nodes = MyMesh.getTempNodes();
288 std::vector<unsigned int> tn_gold;
289 CheckNodes(temp_nodes, tn_gold);
290
291 // Test embedded nodes
292 std::map<unsigned int, EFANode *> embedded_nodes = MyMesh.getEmbeddedNodes();
293 std::vector<unsigned int> en_gold = {0, 1};
294 CheckNodes(embedded_nodes, en_gold);
295
296 // Test child elements
297 std::vector<EFAElement *> child_elem = MyMesh.getChildElements();
298 std::vector<unsigned int> ce_gold = {3, 4, 5};
299 CheckElements(child_elem, ce_gold);
300
301 // Test parent elements
302 std::vector<EFAElement *> parent_elem = MyMesh.getParentElements();
303 std::vector<unsigned int> pe_gold = {0, 2};
304 CheckElements(parent_elem, pe_gold);
305 }
306
307 MyMesh.clearAncestry();
308 MyMesh.updateEdgeNeighbors();
309 MyMesh.initCrackTipTopology();
311 MyMesh.printMesh();
312
313 MyMesh.addElemEdgeIntersection((unsigned int)1, 1, 0.5);
314
316 MyMesh.updateTopology(false);
318 MyMesh.printMesh();
319
320 {
321 // Test permanent nodes
322 std::map<unsigned int, EFANode *> permanent_nodes = MyMesh.getPermanentNodes();
323 std::vector<unsigned int> pn_gold = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
324 CheckNodes(permanent_nodes, pn_gold);
325
326 // Test temp nodes
327 std::map<unsigned int, EFANode *> temp_nodes = MyMesh.getTempNodes();
328 std::vector<unsigned int> tn_gold;
329 CheckNodes(temp_nodes, tn_gold);
330
331 // Test embedded nodes
332 std::map<unsigned int, EFANode *> embedded_nodes = MyMesh.getEmbeddedNodes();
333 std::vector<unsigned int> en_gold = {0, 1, 2};
334 CheckNodes(embedded_nodes, en_gold);
335
336 // Test child elements
337 std::vector<EFAElement *> child_elem = MyMesh.getChildElements();
338 std::vector<unsigned int> ce_gold = {6, 7, 8, 9, 10};
339 CheckElements(child_elem, ce_gold);
340
341 // Test parent elements
342 std::vector<EFAElement *> parent_elem = MyMesh.getParentElements();
343 std::vector<unsigned int> pe_gold = {1, 3, 4, 5};
344 CheckElements(parent_elem, pe_gold);
345 }
346
347 MyMesh.clearAncestry();
348 MyMesh.updateEdgeNeighbors();
349 MyMesh.initCrackTipTopology();
351 MyMesh.printMesh();
352
353 MyMesh.addElemEdgeIntersection((unsigned int)6, 2, 0.5); // I cheated here
354
356 MyMesh.updateTopology(false);
358 MyMesh.printMesh();
359
360 {
361 // Test permanent nodes
362 std::map<unsigned int, EFANode *> permanent_nodes = MyMesh.getPermanentNodes();
363 std::vector<unsigned int> pn_gold = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14};
364 CheckNodes(permanent_nodes, pn_gold);
365
366 // Test temp nodes
367 std::map<unsigned int, EFANode *> temp_nodes = MyMesh.getTempNodes();
368 std::vector<unsigned int> tn_gold;
369 CheckNodes(temp_nodes, tn_gold);
370
371 // Test embedded nodes
372 std::map<unsigned int, EFANode *> embedded_nodes = MyMesh.getEmbeddedNodes();
373 std::vector<unsigned int> en_gold = {0, 1, 2, 3};
374 CheckNodes(embedded_nodes, en_gold);
375
376 // Test child elements
377 std::vector<EFAElement *> child_elem = MyMesh.getChildElements();
378 std::vector<unsigned int> ce_gold = {11, 12, 13, 14, 15};
379 CheckElements(child_elem, ce_gold);
380
381 // Test parent elements
382 std::vector<EFAElement *> parent_elem = MyMesh.getParentElements();
383 std::vector<unsigned int> pe_gold = {6, 8, 9, 10};
384 CheckElements(parent_elem, pe_gold);
385 }
386
387 MyMesh.clearAncestry();
388 MyMesh.updateEdgeNeighbors();
389 MyMesh.initCrackTipTopology();
391 MyMesh.printMesh();
392 {
393 // Test permanent nodes
394 std::map<unsigned int, EFANode *> permanent_nodes = MyMesh.getPermanentNodes();
395 std::vector<unsigned int> pn_gold = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14};
396 CheckNodes(permanent_nodes, pn_gold);
397
398 // Test temp nodes
399 std::map<unsigned int, EFANode *> temp_nodes = MyMesh.getTempNodes();
400 std::vector<unsigned int> tn_gold;
401 CheckNodes(temp_nodes, tn_gold);
402
403 // Test embedded nodes
404 std::map<unsigned int, EFANode *> embedded_nodes = MyMesh.getEmbeddedNodes();
405 std::vector<unsigned int> en_gold = {0, 1, 2, 3};
406 CheckNodes(embedded_nodes, en_gold);
407
408 // Test child elements
409 std::vector<EFAElement *> child_elem = MyMesh.getChildElements();
410 std::vector<unsigned int> ce_gold;
411 CheckElements(child_elem, ce_gold);
412
413 // Test parent elements
414 std::vector<EFAElement *> parent_elem = MyMesh.getParentElements();
415 std::vector<unsigned int> pe_gold;
416 CheckElements(parent_elem, pe_gold);
417 }
418}
419
421{
422
423 // 0 ----- 1 ----- 2
424 // | | |
425 // | | |
426 // | | |
427 // 3 ----- 4 ----- 5
428 // | | |
429 // | | |
430 // | | |
431 // 6 ----- 7 ----- 8
432
433 std::vector<std::vector<unsigned int>> quads;
434 std::vector<std::vector<unsigned int>> quads2;
435 std::vector<unsigned int> v1 = {0, 3, 4, 1};
436 quads.push_back(v1);
437 std::vector<unsigned int> v2 = {1, 4, 5, 2};
438 quads.push_back(v2);
439 std::vector<unsigned int> v3 = {4, 3, 6, 7};
440 quads.push_back(v3);
441 std::vector<unsigned int> v4 = {5, 4, 7, 8};
442 quads2.push_back(v4);
443
444 ElementFragmentAlgorithm MyMesh(Moose::out);
445 MyMesh.add2DElements(quads);
446 MyMesh.add2DElements(quads2); // do in 2 batches just to test that it works
447
448 MyMesh.updateEdgeNeighbors();
449
450 // 0 ----- 1 ----- 2
451 // | | |
452 // | | x
453 // | | / |
454 // 3 ----- 4 --x-- 5
455 // | | / |
456 // | x |
457 // | / | |
458 // 6 --x-- 7 ----- 8
459
460 // these will create the embedded nodes - elemid, edgeid, location
461 MyMesh.addElemEdgeIntersection((unsigned int)1, 1, 0.5);
462 MyMesh.addElemEdgeIntersection((unsigned int)1, 2, 0.5);
463 MyMesh.addElemEdgeIntersection((unsigned int)2, 2, 0.5);
464 MyMesh.addElemEdgeIntersection((unsigned int)2, 3, 0.5);
465 MyMesh.addElemEdgeIntersection((unsigned int)3, 0, 0.5); // not necessary, but test it
466 MyMesh.addElemEdgeIntersection((unsigned int)3, 1, 0.5); // not necessary, but test it
467
469 MyMesh.updateTopology();
470
472 MyMesh.printMesh();
473
474 // Test permanent nodes
475 std::map<unsigned int, EFANode *> permanent_nodes = MyMesh.getPermanentNodes();
476 std::vector<unsigned int> pn_gold = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16};
477 CheckNodes(permanent_nodes, pn_gold);
478
479 // Test temp nodes
480 std::map<unsigned int, EFANode *> temp_nodes = MyMesh.getTempNodes();
481 std::vector<unsigned int> tn_gold;
482 CheckNodes(temp_nodes, tn_gold);
483
484 // Test embedded nodes
485 std::map<unsigned int, EFANode *> embedded_nodes = MyMesh.getEmbeddedNodes();
486 std::vector<unsigned int> en_gold = {0, 1, 2, 3};
487 CheckNodes(embedded_nodes, en_gold);
488
489 // Test child elements
490 std::vector<EFAElement *> child_elem = MyMesh.getChildElements();
491 std::vector<unsigned int> ce_gold = {4, 5, 6, 7, 8, 9};
492 CheckElements(child_elem, ce_gold);
493
494 // Test parent elements
495 std::vector<EFAElement *> parent_elem = MyMesh.getParentElements();
496 std::vector<unsigned int> pe_gold = {1, 2, 3};
497 CheckElements(parent_elem, pe_gold);
498}
499
501{
502 ElementFragmentAlgorithm MyMesh(Moose::out);
503
504 {
505 std::vector<unsigned int> qvec = {0, 1, 2, 3};
506 MyMesh.add2DElement(qvec, 0);
507 }
508
509 {
510 std::vector<unsigned int> qvec = {1, 4, 5, 2};
511 MyMesh.add2DElement(qvec, 1);
512 }
513
514 {
515 std::vector<unsigned int> qvec = {4, 6, 7, 5};
516 MyMesh.add2DElement(qvec, 2);
517 }
518
519 {
520 std::vector<unsigned int> qvec = {6, 8, 9, 7};
521 MyMesh.add2DElement(qvec, 3);
522 }
523
524 {
525 std::vector<unsigned int> qvec = {3, 2, 10, 11};
526 MyMesh.add2DElement(qvec, 4);
527 }
528
529 {
530 std::vector<unsigned int> qvec = {2, 5, 12, 10};
531 MyMesh.add2DElement(qvec, 5);
532 }
533
534 {
535 std::vector<unsigned int> qvec = {5, 7, 13, 12};
536 MyMesh.add2DElement(qvec, 6);
537 }
538
539 {
540 std::vector<unsigned int> qvec = {7, 9, 14, 13};
541 MyMesh.add2DElement(qvec, 7);
542 }
543
544 {
545 std::vector<unsigned int> qvec = {11, 10, 15, 16};
546 MyMesh.add2DElement(qvec, 8);
547 }
548
549 {
550 std::vector<unsigned int> qvec = {10, 12, 17, 15};
551 MyMesh.add2DElement(qvec, 9);
552 }
553
554 {
555 std::vector<unsigned int> qvec = {12, 13, 18, 17};
556 MyMesh.add2DElement(qvec, 10);
557 }
558
559 {
560 std::vector<unsigned int> qvec = {13, 14, 19, 18};
561 MyMesh.add2DElement(qvec, 11);
562 }
563
564 {
565 std::vector<unsigned int> qvec = {16, 15, 20, 21};
566 MyMesh.add2DElement(qvec, 12);
567 }
568
569 {
570 std::vector<unsigned int> qvec = {15, 17, 22, 20};
571 MyMesh.add2DElement(qvec, 13);
572 }
573
574 {
575 std::vector<unsigned int> qvec = {17, 18, 23, 22};
576 MyMesh.add2DElement(qvec, 14);
577 }
578
579 {
580 std::vector<unsigned int> qvec = {18, 19, 24, 23};
581 MyMesh.add2DElement(qvec, 15);
582 }
583
584 MyMesh.updateEdgeNeighbors();
585
586 // these will create the embedded nodes - elemid, edgeid, location
587 MyMesh.addElemEdgeIntersection((unsigned int)1, 1, 0.5);
588 MyMesh.addElemEdgeIntersection((unsigned int)1, 2, 0.5);
589 MyMesh.addElemEdgeIntersection((unsigned int)2, 0, 0.5);
590 MyMesh.addElemEdgeIntersection((unsigned int)5, 2, 0.5);
591 MyMesh.addElemEdgeIntersection((unsigned int)8, 1, 0.5);
592
594 MyMesh.updateTopology();
595
597 MyMesh.printMesh();
598
599 // Test permanent nodes
600 std::map<unsigned int, EFANode *> permanent_nodes = MyMesh.getPermanentNodes();
601 std::vector<unsigned int> pn_gold = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
602 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
603 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32};
604 CheckNodes(permanent_nodes, pn_gold);
605
606 // Test temp nodes
607 std::map<unsigned int, EFANode *> temp_nodes = MyMesh.getTempNodes();
608 std::vector<unsigned int> tn_gold;
609 CheckNodes(temp_nodes, tn_gold);
610
611 // Test embedded nodes
612 std::map<unsigned int, EFANode *> embedded_nodes = MyMesh.getEmbeddedNodes();
613 std::vector<unsigned int> en_gold = {0, 1, 2, 3, 4};
614 CheckNodes(embedded_nodes, en_gold);
615
616 // Test child elements
617 std::vector<EFAElement *> child_elem = MyMesh.getChildElements();
618 std::vector<unsigned int> ce_gold = {16, 17, 18, 19, 20, 21, 22, 23, 24};
619 CheckElements(child_elem, ce_gold);
620
621 // Test parent elements
622 std::vector<EFAElement *> parent_elem = MyMesh.getParentElements();
623 std::vector<unsigned int> pe_gold = {1, 2, 5, 8, 9};
624 CheckElements(parent_elem, pe_gold);
625}
626
627void
629{
630 // 0 ----- 1 ----- 2 ----- 3
631 // | | | |
632 // | | | |
633 // | | | |
634 // 4 ----- 5 ----- 6 ----- 7
635 // | | | |
636 // | | | |
637 // | | | |
638 // 8 ----- 9 -----10 -----11
639
640 std::vector<std::vector<unsigned int>> quads;
641 std::vector<unsigned int> v1 = {0, 4, 5, 1};
642 quads.push_back(v1);
643 std::vector<unsigned int> v2 = {1, 5, 6, 2};
644 quads.push_back(v2);
645 std::vector<unsigned int> v3 = {2, 6, 7, 3};
646 quads.push_back(v3);
647 std::vector<unsigned int> v4 = {4, 8, 9, 5};
648 quads.push_back(v4);
649 std::vector<unsigned int> v5 = {5, 9, 10, 6};
650 quads.push_back(v5);
651 std::vector<unsigned int> v6 = {6, 10, 11, 7};
652 quads.push_back(v6);
653
654 MyMesh.add2DElements(quads);
655 MyMesh.updateEdgeNeighbors();
656}
657
659{
660 // 0 ----- 1 ----- 2 ----- 3
661 // | | | |
662 // x ----- x --x-- x ----- x
663 // | | | | |
664 // 4 ----- 5 --x-- 6 ----- 7
665 // | | | | |
666 // | | | | |
667 // | | | | |
668 // 8 ----- 9 --x--10 -----11
669
670 ElementFragmentAlgorithm MyMesh(Moose::out);
671 case5Mesh(MyMesh);
672
673 // add the horizontal cut
674 MyMesh.addElemEdgeIntersection((unsigned int)0, 0, 0.5);
675 MyMesh.addElemEdgeIntersection((unsigned int)0, 2, 0.5);
676 MyMesh.addElemEdgeIntersection((unsigned int)1, 2, 0.5);
677 MyMesh.addElemEdgeIntersection((unsigned int)2, 2, 0.5);
678
680 MyMesh.updateTopology();
681 MyMesh.clearAncestry();
682 MyMesh.updateEdgeNeighbors();
683 MyMesh.initCrackTipTopology();
685 MyMesh.printMesh();
686
687 // Test permanent nodes
688 std::map<unsigned int, EFANode *> permanent_nodes = MyMesh.getPermanentNodes();
689 std::vector<unsigned int> pn_gold = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
690 10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
691 CheckNodes(permanent_nodes, pn_gold);
692
693 // Test temp nodes
694 std::map<unsigned int, EFANode *> temp_nodes = MyMesh.getTempNodes();
695 std::vector<unsigned int> tn_gold;
696 CheckNodes(temp_nodes, tn_gold);
697
698 // Test embedded nodes
699 std::map<unsigned int, EFANode *> embedded_nodes = MyMesh.getEmbeddedNodes();
700 std::vector<unsigned int> en_gold = {0, 1, 2, 3};
701 CheckNodes(embedded_nodes, en_gold);
702
703 // Test child elements
704 std::vector<EFAElement *> child_elem = MyMesh.getChildElements();
705 std::vector<unsigned int> ce_gold;
706 CheckElements(child_elem, ce_gold);
707
708 // Test parent elements
709 std::vector<EFAElement *> parent_elem = MyMesh.getParentElements();
710 std::vector<unsigned int> pe_gold;
711 CheckElements(parent_elem, pe_gold);
712
713 // add the lower part of the vertical cut
714 MyMesh.addElemEdgeIntersection((unsigned int)4, 1, 0.5);
715 MyMesh.addElemEdgeIntersection((unsigned int)4, 3, 0.5);
716
718 MyMesh.updateTopology();
719 MyMesh.clearAncestry();
720 MyMesh.updateEdgeNeighbors();
721 MyMesh.initCrackTipTopology();
723 MyMesh.printMesh();
724
725 // Test permanent nodes
726 std::map<unsigned int, EFANode *> permanent_nodes2 = MyMesh.getPermanentNodes();
727 std::vector<unsigned int> pn_gold2 = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
728 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21};
729 CheckNodes(permanent_nodes2, pn_gold2);
730
731 // Test temp nodes
732 std::map<unsigned int, EFANode *> temp_nodes2 = MyMesh.getTempNodes();
733 std::vector<unsigned int> tn_gold2;
734 CheckNodes(temp_nodes2, tn_gold2);
735
736 // Test embedded nodes
737 std::map<unsigned int, EFANode *> embedded_nodes2 = MyMesh.getEmbeddedNodes();
738 std::vector<unsigned int> en_gold2 = {0, 1, 2, 3, 4, 5};
739 CheckNodes(embedded_nodes2, en_gold2);
740
741 // Test child elements
742 std::vector<EFAElement *> child_elem2 = MyMesh.getChildElements();
743 std::vector<unsigned int> ce_gold2;
744 CheckElements(child_elem2, ce_gold2);
745
746 // Test parent elements
747 std::vector<EFAElement *> parent_elem2 = MyMesh.getParentElements();
748 std::vector<unsigned int> pe_gold2;
749 CheckElements(parent_elem2, pe_gold2);
750
751 // add the upper vertical cut
752 MyMesh.addFragEdgeIntersection((unsigned int)14, 4, 0.5); // I cheated here
753
755 MyMesh.updateTopology();
756 MyMesh.clearAncestry();
757 MyMesh.updateEdgeNeighbors();
758 MyMesh.initCrackTipTopology();
760 MyMesh.printMesh();
761
762 // Test permanent nodes
763 std::map<unsigned int, EFANode *> permanent_nodes3 = MyMesh.getPermanentNodes();
764 std::vector<unsigned int> pn_gold3 = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
765 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25};
766 CheckNodes(permanent_nodes3, pn_gold3);
767
768 // Test temp nodes
769 std::map<unsigned int, EFANode *> temp_nodes3 = MyMesh.getTempNodes();
770 std::vector<unsigned int> tn_gold3;
771 CheckNodes(temp_nodes3, tn_gold3);
772
773 // Test embedded nodes
774 std::map<unsigned int, EFANode *> embedded_nodes3 = MyMesh.getEmbeddedNodes();
775 std::vector<unsigned int> en_gold3 = {0, 1, 2, 3, 4, 5, 6};
776 CheckNodes(embedded_nodes3, en_gold3);
777
778 // Test child elements
779 std::vector<EFAElement *> child_elem3 = MyMesh.getChildElements();
780 std::vector<unsigned int> ce_gold3;
781 CheckElements(child_elem3, ce_gold3);
782
783 // Test parent elements
784 std::vector<EFAElement *> parent_elem3 = MyMesh.getParentElements();
785 std::vector<unsigned int> pe_gold3;
786 CheckElements(parent_elem3, pe_gold3);
787}
788
790{
791 // 0 ----- 1 ----- 2 ----- 3
792 // | | | |
793 // x ----- x --x-- x ----- x
794 // | | | | |
795 // 4 ----- 5 --x-- 6 ----- 7
796 // | | | | |
797 // | | | | |
798 // | | | | |
799 // 8 ----- 9 --x--10 -----11
800
801 ElementFragmentAlgorithm MyMesh(Moose::out);
802 case5Mesh(MyMesh);
803
804 // add the horizontal cut
805 MyMesh.addElemEdgeIntersection((unsigned int)0, 0, 0.5);
806 MyMesh.addElemEdgeIntersection((unsigned int)0, 2, 0.5);
807 MyMesh.addElemEdgeIntersection((unsigned int)1, 2, 0.5);
808 MyMesh.addElemEdgeIntersection((unsigned int)2, 2, 0.5);
809
811 MyMesh.updateTopology();
812 MyMesh.clearAncestry();
813 MyMesh.updateEdgeNeighbors();
814 MyMesh.initCrackTipTopology();
816 MyMesh.printMesh();
817
818 // Test permanent nodes
819 std::map<unsigned int, EFANode *> permanent_nodes = MyMesh.getPermanentNodes();
820 std::vector<unsigned int> pn_gold = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
821 10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
822 CheckNodes(permanent_nodes, pn_gold);
823
824 // Test temp nodes
825 std::map<unsigned int, EFANode *> temp_nodes = MyMesh.getTempNodes();
826 std::vector<unsigned int> tn_gold;
827 CheckNodes(temp_nodes, tn_gold);
828
829 // Test embedded nodes
830 std::map<unsigned int, EFANode *> embedded_nodes = MyMesh.getEmbeddedNodes();
831 std::vector<unsigned int> en_gold = {0, 1, 2, 3};
832 CheckNodes(embedded_nodes, en_gold);
833
834 // Test child elements
835 std::vector<EFAElement *> child_elem = MyMesh.getChildElements();
836 std::vector<unsigned int> ce_gold;
837 CheckElements(child_elem, ce_gold);
838
839 // Test parent elements
840 std::vector<EFAElement *> parent_elem = MyMesh.getParentElements();
841 std::vector<unsigned int> pe_gold;
842 CheckElements(parent_elem, pe_gold);
843
844 // add the upper part of the vertical cut
845 MyMesh.addElemEdgeIntersection((unsigned int)9, 1, 0.5);
846 MyMesh.addFragEdgeIntersection((unsigned int)9, 3, 0.5); // I cheated here
847
849 MyMesh.updateTopology();
850 MyMesh.clearAncestry();
851 MyMesh.updateEdgeNeighbors();
852 MyMesh.initCrackTipTopology();
854 MyMesh.printMesh();
855
856 // Test permanent nodes
857 std::map<unsigned int, EFANode *> permanent_nodes2 = MyMesh.getPermanentNodes();
858 std::vector<unsigned int> pn_gold2 = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
859 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21};
860 CheckNodes(permanent_nodes2, pn_gold2);
861
862 // Test temp nodes
863 std::map<unsigned int, EFANode *> temp_nodes2 = MyMesh.getTempNodes();
864 std::vector<unsigned int> tn_gold2;
865 CheckNodes(temp_nodes2, tn_gold2);
866
867 // Test embedded nodes
868 std::map<unsigned int, EFANode *> embedded_nodes2 = MyMesh.getEmbeddedNodes();
869 std::vector<unsigned int> en_gold2 = {0, 1, 2, 3, 4, 5};
870 CheckNodes(embedded_nodes2, en_gold2);
871
872 // Test child elements
873 std::vector<EFAElement *> child_elem2 = MyMesh.getChildElements();
874 std::vector<unsigned int> ce_gold2;
875 CheckElements(child_elem2, ce_gold2);
876
877 // Test parent elements
878 std::vector<EFAElement *> parent_elem2 = MyMesh.getParentElements();
879 std::vector<unsigned int> pe_gold2;
880 CheckElements(parent_elem2, pe_gold2);
881
882 // add the lower vertical cut
883 MyMesh.addElemEdgeIntersection((unsigned int)12, 1, 0.5); // I cheated here
884
886 MyMesh.updateTopology();
887 MyMesh.clearAncestry();
888 MyMesh.updateEdgeNeighbors();
889 MyMesh.initCrackTipTopology();
891 MyMesh.printMesh();
892
893 // Test permanent nodes
894 std::map<unsigned int, EFANode *> permanent_nodes3 = MyMesh.getPermanentNodes();
895 std::vector<unsigned int> pn_gold3 = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
896 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25};
897 CheckNodes(permanent_nodes3, pn_gold3);
898
899 // Test temp nodes
900 std::map<unsigned int, EFANode *> temp_nodes3 = MyMesh.getTempNodes();
901 std::vector<unsigned int> tn_gold3;
902 CheckNodes(temp_nodes3, tn_gold3);
903
904 // Test embedded nodes
905 std::map<unsigned int, EFANode *> embedded_nodes3 = MyMesh.getEmbeddedNodes();
906 std::vector<unsigned int> en_gold3 = {0, 1, 2, 3, 4, 5, 6};
907 CheckNodes(embedded_nodes3, en_gold3);
908
909 // Test child elements
910 std::vector<EFAElement *> child_elem3 = MyMesh.getChildElements();
911 std::vector<unsigned int> ce_gold3;
912 CheckElements(child_elem3, ce_gold3);
913
914 // Test parent elements
915 std::vector<EFAElement *> parent_elem3 = MyMesh.getParentElements();
916 std::vector<unsigned int> pe_gold3;
917 CheckElements(parent_elem3, pe_gold3);
918}
919
921{
922 // 0 ----- 1 ----- 2 ----- 3
923 // | | | |
924 // x ----- x --x-- x ----- x
925 // | | | | |
926 // 4 ----- 5 --x-- 6 ----- 7
927 // | | | | |
928 // | | | | |
929 // | | | | |
930 // 8 ----- 9 --x--10 -----11
931
932 ElementFragmentAlgorithm MyMesh(Moose::out);
933 case5Mesh(MyMesh);
934
935 // add the horizontal cut
936 MyMesh.addElemEdgeIntersection((unsigned int)0, 0, 0.5);
937 MyMesh.addElemEdgeIntersection((unsigned int)0, 2, 0.5);
938 MyMesh.addElemEdgeIntersection((unsigned int)1, 1, 0.5);
939 MyMesh.addElemEdgeIntersection((unsigned int)1, 2, 0.5);
940 MyMesh.addElemEdgeIntersection((unsigned int)2, 2, 0.5);
941 MyMesh.addElemEdgeIntersection((unsigned int)4, 1, 0.5);
942
944 MyMesh.updateTopology();
945 MyMesh.clearAncestry();
946 MyMesh.updateEdgeNeighbors();
947 MyMesh.initCrackTipTopology();
949 MyMesh.printMesh();
950
951 // Test permanent nodes
952 std::map<unsigned int, EFANode *> permanent_nodes = MyMesh.getPermanentNodes();
953 std::vector<unsigned int> pn_gold = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
954 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25};
955 CheckNodes(permanent_nodes, pn_gold);
956
957 // Test temp nodes
958 std::map<unsigned int, EFANode *> temp_nodes = MyMesh.getTempNodes();
959 std::vector<unsigned int> tn_gold;
960 CheckNodes(temp_nodes, tn_gold);
961
962 // Test embedded nodes
963 std::map<unsigned int, EFANode *> embedded_nodes = MyMesh.getEmbeddedNodes();
964 std::vector<unsigned int> en_gold = {0, 1, 2, 3, 4, 5, 6};
965 CheckNodes(embedded_nodes, en_gold);
966
967 // Test child elements
968 std::vector<EFAElement *> child_elem = MyMesh.getChildElements();
969 std::vector<unsigned int> ce_gold;
970 CheckElements(child_elem, ce_gold);
971
972 // Test parent elements
973 std::vector<EFAElement *> parent_elem = MyMesh.getParentElements();
974 std::vector<unsigned int> pe_gold;
975 CheckElements(parent_elem, pe_gold);
976}
977
978void
980{
981 // 3D test
982 std::vector<unsigned int> v1 = {0, 1, 4, 3, 9, 10, 13, 12};
983 MyMesh.add3DElement(v1, 0);
984
985 std::vector<unsigned int> v2 = {1, 2, 5, 4, 10, 11, 14, 13};
986 MyMesh.add3DElement(v2, 1);
987
988 std::vector<unsigned int> v3 = {3, 4, 7, 6, 12, 13, 16, 15};
989 MyMesh.add3DElement(v3, 2);
990
991 std::vector<unsigned int> v4 = {4, 5, 8, 7, 13, 14, 17, 16};
992 MyMesh.add3DElement(v4, 3);
993
994 std::vector<unsigned int> v5 = {9, 10, 13, 12, 18, 19, 22, 21};
995 MyMesh.add3DElement(v5, 4);
996
997 std::vector<unsigned int> v6 = {10, 11, 14, 13, 19, 20, 23, 22};
998 MyMesh.add3DElement(v6, 5);
999
1000 std::vector<unsigned int> v7 = {12, 13, 16, 15, 21, 22, 25, 24};
1001 MyMesh.add3DElement(v7, 6);
1002
1003 std::vector<unsigned int> v8 = {13, 14, 17, 16, 22, 23, 26, 25};
1004 MyMesh.add3DElement(v8, 7);
1005
1006 MyMesh.updateEdgeNeighbors();
1007}
1008
1009/* \-------------\-------------\
1010 |\ |\ |\
1011 | \-----------|-\-----------|-\
1012 | |\ | |\ | |\
1013 | | \---------|-|-\---------|-|-\
1014 | | | | | | | | |
1015 | | | | | | | | |
1016 |-|-|---------|-|-|---------| | |
1017 |\| | |\| | |\| |
1018 | |-|---------|-\-|---------|-| |
1019 | |O O O O O O O O | |\|
1020 | |*|---------|-|O|---------|-|-|
1021 | |*| | |O| | | |
1022 | |*| | |O| | | |
1023 |-|*|---------|-|O|---------| | |
1024 \|*| \|O| \| |
1025 \*|-----------\O|-----------\ |
1026 * * * * * * * O| \|
1027 \-------------\-------------\
1028*/
1029
1031{
1032 ElementFragmentAlgorithm MyMesh(Moose::out);
1033 case6Mesh(MyMesh);
1034 if (debug_print_mesh)
1035 MyMesh.printMesh();
1036
1037 std::vector<unsigned int> cut_edge_id(2, 0);
1038 std::vector<double> cut_position(2, 0.5);
1039
1040 cut_edge_id[0] = 1;
1041 cut_edge_id[1] = 3;
1042 MyMesh.addElemFaceIntersection(0, 1, cut_edge_id, cut_position);
1043 MyMesh.addElemFaceIntersection(0, 2, cut_edge_id, cut_position);
1044 MyMesh.addElemFaceIntersection(0, 3, cut_edge_id, cut_position);
1045 MyMesh.addElemFaceIntersection(0, 4, cut_edge_id, cut_position);
1046
1047 MyMesh.addElemFaceIntersection(1, 4, cut_edge_id, cut_position); // unnecessary, just test
1048 MyMesh.addElemFaceIntersection(2, 1, cut_edge_id, cut_position); // unnecessary, just test
1049
1051 MyMesh.updateTopology();
1052 MyMesh.clearAncestry();
1053 MyMesh.updateEdgeNeighbors();
1054 MyMesh.initCrackTipTopology();
1055 // second time, just test
1057 MyMesh.updateTopology();
1058 MyMesh.clearAncestry();
1059 MyMesh.updateEdgeNeighbors();
1060 MyMesh.initCrackTipTopology();
1061
1062 if (debug_print_mesh)
1063 MyMesh.printMesh();
1064
1065 // print crack tip elems
1066 std::set<EFAElement *> crack_tip_elem = MyMesh.getCrackTipElements();
1067
1068 // Test permanent nodes
1069 std::map<unsigned int, EFANode *> permanent_nodes = MyMesh.getPermanentNodes();
1070 std::vector<unsigned int> pn_gold = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1071 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28};
1072 CheckNodes(permanent_nodes, pn_gold);
1073
1074 // Test temp nodes
1075 std::map<unsigned int, EFANode *> temp_nodes = MyMesh.getTempNodes();
1076 std::vector<unsigned int> tn_gold;
1077 CheckNodes(temp_nodes, tn_gold);
1078
1079 // Test embedded nodes
1080 std::map<unsigned int, EFANode *> embedded_nodes = MyMesh.getEmbeddedNodes();
1081 std::vector<unsigned int> en_gold = {0, 1, 2, 3};
1082 CheckNodes(embedded_nodes, en_gold);
1083
1084 // Test child elements
1085 std::vector<EFAElement *> child_elem = MyMesh.getChildElements();
1086 std::vector<unsigned int> ce_gold;
1087 CheckElements(child_elem, ce_gold);
1088
1089 // Test parent elements
1090 std::vector<EFAElement *> parent_elem = MyMesh.getParentElements();
1091 std::vector<unsigned int> pe_gold;
1092 CheckElements(parent_elem, pe_gold);
1093
1094 // Test crack tip elements
1095 unsigned int cte[] = {10, 11};
1096 std::set<unsigned int> cte_gold;
1097 cte_gold.insert(cte, cte + 2);
1098 CheckElements(crack_tip_elem, cte_gold);
1099}
1100
1101/* \-------------\-------------\
1102 |\ |\ |*
1103 | \-----------|-\-----------|-\
1104 | |\ | |\ | |\
1105 | | \---------|-|-\---------|-|-\
1106 | | | | | | | | |
1107 | | | | | | | * |
1108 |-|-|---------|-|-|---------| | |
1109 |\| | |*| | |\| |
1110 | |-|---------|-\-|-----*---|-| |
1111 | | | | |\| | |*|
1112 | | |---------|-|-|---------|-|-|
1113 | | | | * | | | |
1114 | | | | | | | | |
1115 |-|-|---------|-|-|---------| | *
1116 *| | \| | \* |
1117 \-|----*------\-|---------*-\ |
1118 \| *| * \|
1119 \-------------\-----*-------\
1120*/
1121
1123{
1124 ElementFragmentAlgorithm MyMesh(Moose::out);
1125 case6Mesh(MyMesh);
1126
1127 std::vector<unsigned int> cut_edge_id(2, 0);
1128 std::vector<double> cut_position(2, 0.5);
1129
1130 cut_edge_id[0] = 1;
1131 cut_edge_id[1] = 2;
1132 MyMesh.addElemFaceIntersection(0, 1, cut_edge_id, cut_position);
1133 cut_edge_id[0] = 2;
1134 cut_edge_id[1] = 3;
1135 MyMesh.addElemFaceIntersection(0, 2, cut_edge_id, cut_position);
1136 cut_edge_id[0] = 0;
1137 cut_edge_id[1] = 1;
1138 MyMesh.addElemFaceIntersection(0, 5, cut_edge_id, cut_position);
1139
1140 cut_edge_id[0] = 2;
1141 cut_edge_id[1] = 3;
1142 MyMesh.addElemFaceIntersection(1, 0, cut_edge_id, cut_position);
1143 cut_edge_id[0] = 0;
1144 cut_edge_id[1] = 3;
1145 MyMesh.addElemFaceIntersection(1, 1, cut_edge_id, cut_position);
1146 cut_edge_id[0] = 0;
1147 cut_edge_id[1] = 1;
1148 MyMesh.addElemFaceIntersection(1, 2, cut_edge_id, cut_position);
1149 cut_edge_id[0] = 2;
1150 cut_edge_id[1] = 3;
1151 MyMesh.addElemFaceIntersection(1, 3, cut_edge_id, cut_position);
1152 cut_edge_id[0] = 1;
1153 cut_edge_id[1] = 2;
1154 MyMesh.addElemFaceIntersection(1, 4, cut_edge_id, cut_position);
1155 cut_edge_id[0] = 2;
1156 cut_edge_id[1] = 3;
1157 MyMesh.addElemFaceIntersection(1, 5, cut_edge_id, cut_position);
1158
1159 cut_edge_id[0] = 1;
1160 cut_edge_id[1] = 2;
1161 MyMesh.addElemFaceIntersection(3, 1, cut_edge_id, cut_position);
1162 cut_edge_id[0] = 2;
1163 cut_edge_id[1] = 3;
1164 MyMesh.addElemFaceIntersection(3, 2, cut_edge_id, cut_position);
1165 cut_edge_id[0] = 0;
1166 cut_edge_id[1] = 1;
1167 MyMesh.addElemFaceIntersection(3, 5, cut_edge_id, cut_position);
1168
1169 cut_edge_id[0] = 2;
1170 cut_edge_id[1] = 3;
1171 MyMesh.addElemFaceIntersection(4, 0, cut_edge_id, cut_position);
1172 cut_edge_id[0] = 0;
1173 cut_edge_id[1] = 3;
1174 MyMesh.addElemFaceIntersection(4, 1, cut_edge_id, cut_position);
1175 cut_edge_id[0] = 0;
1176 cut_edge_id[1] = 1;
1177 MyMesh.addElemFaceIntersection(4, 2, cut_edge_id, cut_position);
1178
1179 cut_edge_id[0] = 0;
1180 cut_edge_id[1] = 1;
1181 MyMesh.addElemFaceIntersection(5, 0, cut_edge_id, cut_position);
1182 cut_edge_id[0] = 0;
1183 cut_edge_id[1] = 1;
1184 MyMesh.addElemFaceIntersection(5, 3, cut_edge_id, cut_position);
1185 cut_edge_id[0] = 0;
1186 cut_edge_id[1] = 3;
1187 MyMesh.addElemFaceIntersection(5, 4, cut_edge_id, cut_position);
1188
1189 cut_edge_id[0] = 2;
1190 cut_edge_id[1] = 3;
1191 MyMesh.addElemFaceIntersection(7, 0, cut_edge_id, cut_position);
1192 cut_edge_id[0] = 0;
1193 cut_edge_id[1] = 3;
1194 MyMesh.addElemFaceIntersection(7, 1, cut_edge_id, cut_position);
1195 cut_edge_id[0] = 0;
1196 cut_edge_id[1] = 1;
1197 MyMesh.addElemFaceIntersection(7, 2, cut_edge_id, cut_position);
1198
1200 MyMesh.updateTopology();
1201 if (debug_print_mesh)
1202 MyMesh.printMesh();
1203
1204 // Test permanent nodes
1205 std::map<unsigned int, EFANode *> permanent_nodes = MyMesh.getPermanentNodes();
1206 std::vector<unsigned int> pn_gold = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
1207 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
1208 26, 27, 28, 29, 30, 32, 33, 34, 35, 36, 37};
1209 CheckNodes(permanent_nodes, pn_gold);
1210
1211 // Test temp nodes
1212 std::map<unsigned int, EFANode *> temp_nodes = MyMesh.getTempNodes();
1213 std::vector<unsigned int> tn_gold;
1214 CheckNodes(temp_nodes, tn_gold);
1215
1216 // Test embedded nodes
1217 std::map<unsigned int, EFANode *> embedded_nodes = MyMesh.getEmbeddedNodes();
1218 std::vector<unsigned int> en_gold = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
1219 CheckNodes(embedded_nodes, en_gold);
1220
1221 // Test child elements
1222 std::vector<EFAElement *> child_elem = MyMesh.getChildElements();
1223 std::vector<unsigned int> ce_gold = {8, 9, 10, 11, 12, 13, 14, 15, 16, 17};
1224 CheckElements(child_elem, ce_gold);
1225
1226 // Test parent elements
1227 std::vector<EFAElement *> parent_elem = MyMesh.getParentElements();
1228 std::vector<unsigned int> pe_gold = {0, 1, 3, 4, 5, 7};
1229 CheckElements(parent_elem, pe_gold);
1230
1231 MyMesh.clearAncestry();
1232 MyMesh.updateEdgeNeighbors();
1233 MyMesh.initCrackTipTopology();
1234
1235 // second time cut, just test
1236
1237 // print crack tip elems
1238 std::set<EFAElement *> crack_tip_elem = MyMesh.getCrackTipElements();
1239
1240 // Test permanent nodes
1241 std::map<unsigned int, EFANode *> permanent_nodes2 = MyMesh.getPermanentNodes();
1242 std::vector<unsigned int> pn_gold2 = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
1243 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
1244 26, 27, 28, 29, 30, 32, 33, 34, 35, 36, 37};
1245 CheckNodes(permanent_nodes2, pn_gold2);
1246
1247 // Test temp nodes
1248 std::map<unsigned int, EFANode *> temp_nodes2 = MyMesh.getTempNodes();
1249 std::vector<unsigned int> tn_gold2;
1250 CheckNodes(temp_nodes2, tn_gold2);
1251
1252 // Test embedded nodes
1253 std::map<unsigned int, EFANode *> embedded_nodes2 = MyMesh.getEmbeddedNodes();
1254 std::vector<unsigned int> en_gold2 = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
1255 CheckNodes(embedded_nodes2, en_gold2);
1256
1257 // Test child elements
1258 std::vector<EFAElement *> child_elem2 = MyMesh.getChildElements();
1259 std::vector<unsigned int> ce_gold2;
1260 CheckElements(child_elem2, ce_gold2);
1261
1262 // Test parent elements
1263 std::vector<EFAElement *> parent_elem2 = MyMesh.getParentElements();
1264 std::vector<unsigned int> pe_gold2;
1265 CheckElements(parent_elem2, pe_gold2);
1266
1267 // Test crack tip elements
1268 unsigned int cte[] = {14, 17};
1269 std::set<unsigned int> cte_gold;
1270 cte_gold.insert(cte, cte + 2);
1271 CheckElements(crack_tip_elem, cte_gold);
1272}
1273
1274/* \-------------\-------------\
1275 |\ |\ |\
1276 | \-----------|-\-----------|-\
1277 | |\ | |\ | |\
1278 | | \---------|-|-\---------|-|-\
1279 | | | | | | | | |
1280 | | | | | | | | |
1281 |-|-|---------|-|-|---------| | |
1282 |\| | |\| | |\| |
1283 | |-|---------|-\-|---------|-| |
1284 | |\| | |\| | |\|
1285 | | |---------|-|-|---------|-|-|
1286 | | | | | | | | |
1287 | O O O O O O O O | | | |
1288 |-|*|---------| |O|---------| | |
1289 \| * * * * * * * O \| |
1290 \-|-----------\-|-----------\ |
1291 \| \| \|
1292 \-------------\--------------
1293*/
1294
1296{
1297 ElementFragmentAlgorithm MyMesh(Moose::out);
1298 case6Mesh(MyMesh);
1299 if (debug_print_mesh)
1300 MyMesh.printMesh();
1301
1302 std::vector<unsigned int> cut_edge_id(2, 0);
1303 std::vector<double> cut_position(2, 0.5);
1304
1305 cut_edge_id[0] = 0;
1306 cut_edge_id[1] = 2;
1307 MyMesh.addElemFaceIntersection(0, 0, cut_edge_id, cut_position);
1308 MyMesh.addElemFaceIntersection(0, 2, cut_edge_id, cut_position);
1309 MyMesh.addElemFaceIntersection(0, 4, cut_edge_id, cut_position);
1310
1311 cut_edge_id[0] = 1;
1312 cut_edge_id[1] = 3;
1313 MyMesh.addElemFaceIntersection(0, 5, cut_edge_id, cut_position);
1314
1316 MyMesh.updateTopology();
1317 MyMesh.clearAncestry();
1318 MyMesh.updateEdgeNeighbors();
1319 MyMesh.initCrackTipTopology();
1320
1321 if (debug_print_mesh)
1322 MyMesh.printMesh();
1323
1324 // print crack tip elems
1325 std::set<EFAElement *> crack_tip_elem = MyMesh.getCrackTipElements();
1326
1327 // Test permanent nodes
1328 std::map<unsigned int, EFANode *> permanent_nodes = MyMesh.getPermanentNodes();
1329 std::vector<unsigned int> pn_gold = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1330 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28};
1331 CheckNodes(permanent_nodes, pn_gold);
1332
1333 // Test temp nodes
1334 std::map<unsigned int, EFANode *> temp_nodes = MyMesh.getTempNodes();
1335 std::vector<unsigned int> tn_gold;
1336 CheckNodes(temp_nodes, tn_gold);
1337
1338 // Test embedded nodes
1339 std::map<unsigned int, EFANode *> embedded_nodes = MyMesh.getEmbeddedNodes();
1340 std::vector<unsigned int> en_gold = {0, 1, 2, 3};
1341 CheckNodes(embedded_nodes, en_gold);
1342
1343 // Test child elements
1344 std::vector<EFAElement *> child_elem = MyMesh.getChildElements();
1345 std::vector<unsigned int> ce_gold;
1346 CheckElements(child_elem, ce_gold);
1347
1348 // Test parent elements
1349 std::vector<EFAElement *> parent_elem = MyMesh.getParentElements();
1350 std::vector<unsigned int> pe_gold;
1351 CheckElements(parent_elem, pe_gold);
1352
1353 // Test crack tip elements
1354 unsigned int cte[] = {10, 11};
1355 std::set<unsigned int> cte_gold;
1356 cte_gold.insert(cte, cte + 2);
1357 CheckElements(crack_tip_elem, cte_gold);
1358}
1359
1360/* \-------------\-------------\
1361 |\ |\ |\
1362 | \-----------|-\-----------|-\
1363 | |\ | |\ | |\
1364 | | \---------|-|-\---------|-|-\
1365 | | | | | | | | |
1366 | | | | | | | | |
1367 |-|-|---------|-|-|---------| | |
1368 |\| | |\| | |\| |
1369 | |-|----O----|-\-|---------|-| |
1370 | |\| OO | |\| | |\|
1371 | | |----O-*--|-|-|---------|-|-|
1372 | | | O * | | | | | |
1373 | | | O * | | | | | |
1374 |-|-|----O-*--|-|-|---------| | |
1375 \| | O * \| | \| |
1376 \-|----O-*----\-|-----------\ |
1377 \| ** \| \|
1378 \------*------\--------------
1379*/
1380
1382{
1383 ElementFragmentAlgorithm MyMesh(Moose::out);
1384 case6Mesh(MyMesh);
1385 if (debug_print_mesh)
1386 MyMesh.printMesh();
1387
1388 std::vector<unsigned int> cut_edge_id(2, 0);
1389 std::vector<double> cut_position(2, 0.5);
1390
1391 cut_edge_id[0] = 1;
1392 cut_edge_id[1] = 3;
1393 MyMesh.addElemFaceIntersection(0, 0, cut_edge_id, cut_position);
1394
1395 cut_edge_id[0] = 0;
1396 cut_edge_id[1] = 2;
1397 MyMesh.addElemFaceIntersection(0, 3, cut_edge_id, cut_position);
1398 MyMesh.addElemFaceIntersection(0, 1, cut_edge_id, cut_position);
1399 MyMesh.addElemFaceIntersection(0, 5, cut_edge_id, cut_position);
1400
1402 MyMesh.updateTopology();
1403 MyMesh.clearAncestry();
1404 MyMesh.updateEdgeNeighbors();
1405 MyMesh.initCrackTipTopology();
1406 if (debug_print_mesh)
1407 MyMesh.printMesh();
1408
1409 // print crack tip elems
1410 std::set<EFAElement *> crack_tip_elem = MyMesh.getCrackTipElements();
1411
1412 // Test permanent nodes
1413 std::map<unsigned int, EFANode *> permanent_nodes = MyMesh.getPermanentNodes();
1414 std::vector<unsigned int> pn_gold = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1415 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28};
1416 CheckNodes(permanent_nodes, pn_gold);
1417
1418 // Test temp nodes
1419 std::map<unsigned int, EFANode *> temp_nodes = MyMesh.getTempNodes();
1420 std::vector<unsigned int> tn_gold;
1421 CheckNodes(temp_nodes, tn_gold);
1422
1423 // Test embedded nodes
1424 std::map<unsigned int, EFANode *> embedded_nodes = MyMesh.getEmbeddedNodes();
1425 std::vector<unsigned int> en_gold = {0, 1, 2, 3};
1426 CheckNodes(embedded_nodes, en_gold);
1427
1428 // Test child elements
1429 std::vector<EFAElement *> child_elem = MyMesh.getChildElements();
1430 std::vector<unsigned int> ce_gold;
1431 CheckElements(child_elem, ce_gold);
1432
1433 // Test parent elements
1434 std::vector<EFAElement *> parent_elem = MyMesh.getParentElements();
1435 std::vector<unsigned int> pe_gold;
1436 CheckElements(parent_elem, pe_gold);
1437
1438 // Test crack tip elements
1439 unsigned int cte[] = {10, 11};
1440 std::set<unsigned int> cte_gold;
1441 cte_gold.insert(cte, cte + 2);
1442 CheckElements(crack_tip_elem, cte_gold);
1443}
1444
1445/* \-------------\-------------\
1446 |\ |\ |\
1447 | \-----------|-\-----------|-\
1448 | |\ | |\ | |\
1449 | | \---------|-|-\---------|-|-\
1450 | | | | | | | | |
1451 | | | | | | | | |
1452 |-|-|---------|-|-|---------| | |
1453 |\| | |\| | |\| |
1454 | |-|---O-----|-\-|---------|-| |
1455 | |\| O O | |\| | |\|
1456 | | O-----O---|-|-|---------|-|-|
1457 | O | * | | | | | |
1458 | |*| * | | | | | |
1459 |-|-*---------|-|-|---------| | |
1460 \| | \| | \| |
1461 \-|-----------\-|-----------\ |
1462 \| \| \|
1463 \-------------\--------------
1464*/
1465
1467{
1468 ElementFragmentAlgorithm MyMesh(Moose::out);
1469 case6Mesh(MyMesh);
1470 if (debug_print_mesh)
1471 MyMesh.printMesh();
1472
1473 std::vector<unsigned int> cut_edge_id(2, 0);
1474 std::vector<double> cut_position(2, 0.5);
1475
1476 cut_edge_id[0] = 0;
1477 cut_edge_id[1] = 1;
1478 MyMesh.addElemFaceIntersection(0, 0, cut_edge_id, cut_position);
1479 cut_edge_id[0] = 0;
1480 cut_edge_id[1] = 2;
1481 MyMesh.addElemFaceIntersection(0, 3, cut_edge_id, cut_position);
1482
1483 cut_edge_id[0] = 0;
1484 cut_edge_id[1] = 2;
1485 MyMesh.addElemFaceIntersection(0, 4, cut_edge_id, cut_position);
1486
1487 cut_edge_id[0] = 2;
1488 cut_edge_id[1] = 3;
1489 MyMesh.addElemFaceIntersection(0, 5, cut_edge_id, cut_position);
1490
1492 MyMesh.updateTopology();
1493 MyMesh.clearAncestry();
1494 MyMesh.updateEdgeNeighbors();
1495 MyMesh.initCrackTipTopology();
1496
1497 if (debug_print_mesh)
1498 MyMesh.printMesh();
1499
1500 // print crack tip elems
1501 std::set<EFAElement *> crack_tip_elem = MyMesh.getCrackTipElements();
1502
1503 // Test permanent nodes
1504 std::map<unsigned int, EFANode *> permanent_nodes = MyMesh.getPermanentNodes();
1505 std::vector<unsigned int> pn_gold = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1506 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28};
1507 CheckNodes(permanent_nodes, pn_gold);
1508
1509 // Test temp nodes
1510 std::map<unsigned int, EFANode *> temp_nodes = MyMesh.getTempNodes();
1511 std::vector<unsigned int> tn_gold;
1512 CheckNodes(temp_nodes, tn_gold);
1513
1514 // Test embedded nodes
1515 std::map<unsigned int, EFANode *> embedded_nodes = MyMesh.getEmbeddedNodes();
1516 std::vector<unsigned int> en_gold = {0, 1, 2, 3};
1517 CheckNodes(embedded_nodes, en_gold);
1518
1519 // Test child elements
1520 std::vector<EFAElement *> child_elem = MyMesh.getChildElements();
1521 std::vector<unsigned int> ce_gold;
1522 CheckElements(child_elem, ce_gold);
1523
1524 // Test parent elements
1525 std::vector<EFAElement *> parent_elem = MyMesh.getParentElements();
1526 std::vector<unsigned int> pe_gold;
1527 CheckElements(parent_elem, pe_gold);
1528
1529 // Test crack tip elements
1530 unsigned int cte[] = {10, 11};
1531 std::set<unsigned int> cte_gold;
1532 cte_gold.insert(cte, cte + 2);
1533 CheckElements(crack_tip_elem, cte_gold);
1534}
1535
1536/* \-------------\-------------\
1537 |\ |\ |\
1538 | \-----------|-\-----------|-\
1539 | |\ | |\ | |\
1540 | | \---------|-|-\---------|-|-\
1541 | | | | O | | | |
1542 | | | O |O| | | |
1543 |-|-|-------O-|-|-*---------| | |
1544 |\| | O |\* | |\| |
1545 | |-|---O-----*-\-|---------|-| |
1546 | |\| O * | |\| | |\|
1547 | | O-----*---|-|-|---------|-|-|
1548 | O | * | | | | | |
1549 | |*| * | | | | | |
1550 |-|-*---------|-|-|---------| | |
1551 \| | \| | \| |
1552 \-|-----------\-|-----------\ |
1553 \| \| \|
1554 \-------------\--------------
1555*/
1556
1558{
1559 ElementFragmentAlgorithm MyMesh(Moose::out);
1560 case6Mesh(MyMesh);
1561 if (debug_print_mesh)
1562 MyMesh.printMesh();
1563
1564 std::vector<unsigned int> cut_edge_id(2, 0);
1565 std::vector<double> cut_position(2, 0.5);
1566
1567 cut_edge_id[0] = 0;
1568 cut_edge_id[1] = 1;
1569 MyMesh.addElemFaceIntersection(0, 0, cut_edge_id, cut_position);
1570 cut_edge_id[0] = 0;
1571 cut_edge_id[1] = 2;
1572 MyMesh.addElemFaceIntersection(0, 3, cut_edge_id, cut_position);
1573 cut_edge_id[0] = 0;
1574 cut_edge_id[1] = 2;
1575 MyMesh.addElemFaceIntersection(0, 4, cut_edge_id, cut_position);
1576 cut_edge_id[0] = 2;
1577 cut_edge_id[1] = 3;
1578 MyMesh.addElemFaceIntersection(0, 5, cut_edge_id, cut_position);
1579
1580 cut_edge_id[0] = 2;
1581 cut_edge_id[1] = 3;
1582 MyMesh.addElemFaceIntersection(2, 0, cut_edge_id, cut_position);
1583 cut_edge_id[0] = 0;
1584 cut_edge_id[1] = 2;
1585 MyMesh.addElemFaceIntersection(2, 2, cut_edge_id, cut_position);
1586 cut_edge_id[0] = 0;
1587 cut_edge_id[1] = 1;
1588 MyMesh.addElemFaceIntersection(2, 5, cut_edge_id, cut_position);
1589
1591 MyMesh.updateTopology();
1592 MyMesh.clearAncestry();
1593 MyMesh.updateEdgeNeighbors();
1594 MyMesh.initCrackTipTopology();
1595
1596 if (debug_print_mesh)
1597 MyMesh.printMesh();
1598
1599 // print crack tip elems
1600 std::set<EFAElement *> crack_tip_elem = MyMesh.getCrackTipElements();
1601
1602 // Test permanent nodes
1603 std::map<unsigned int, EFANode *> permanent_nodes = MyMesh.getPermanentNodes();
1604 std::vector<unsigned int> pn_gold = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
1605 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
1606 22, 23, 24, 25, 26, 27, 29, 30, 31};
1607 CheckNodes(permanent_nodes, pn_gold);
1608
1609 // Test temp nodes
1610 std::map<unsigned int, EFANode *> temp_nodes = MyMesh.getTempNodes();
1611 std::vector<unsigned int> tn_gold;
1612 CheckNodes(temp_nodes, tn_gold);
1613
1614 // Test embedded nodes
1615 std::map<unsigned int, EFANode *> embedded_nodes = MyMesh.getEmbeddedNodes();
1616 std::vector<unsigned int> en_gold = {0, 1, 2, 3, 4, 5};
1617 CheckNodes(embedded_nodes, en_gold);
1618
1619 // Test child elements
1620 std::vector<EFAElement *> child_elem = MyMesh.getChildElements();
1621 std::vector<unsigned int> ce_gold;
1622 CheckElements(child_elem, ce_gold);
1623
1624 // Test parent elements
1625 std::vector<EFAElement *> parent_elem = MyMesh.getParentElements();
1626 std::vector<unsigned int> pe_gold;
1627 CheckElements(parent_elem, pe_gold);
1628
1629 // Test crack tip elements
1630 unsigned int cte[] = {12, 13, 14};
1631 std::set<unsigned int> cte_gold;
1632 cte_gold.insert(cte, cte + 3);
1633 CheckElements(crack_tip_elem, cte_gold);
1634}
1635
1636/* \-------------\-------------\
1637 |\ |\ |\
1638 | \-----------|-\-----O-----|-\
1639 | |\ | |\ O * | |\
1640 | | \---------|-|-O-----*---|-|-\
1641 | | | | O | * | | |
1642 | | | O | | * | | |
1643 |-|-|-------O-|-|-*---------| | |
1644 |\| | O |\* | |\| |
1645 | \-|---O-----*-\-|---------|-\ |
1646 | |\| O * | |\| | |\|
1647 | | O-----*---|-|-|---------|-|-|
1648 | O | * | | | | | |
1649 | |*| * | | | | | |
1650 |-|-*---------|-|-|---------| | |
1651 \| | \| | \| |
1652 \-|-----------\-|-----------\ |
1653 \| \| \|
1654 \-------------\--------------
1655*/
1656
1658{
1659 ElementFragmentAlgorithm MyMesh(Moose::out);
1660 case6Mesh(MyMesh);
1661 if (debug_print_mesh)
1662 MyMesh.printMesh();
1663
1664 std::vector<unsigned int> cut_edge_id(2, 0);
1665 std::vector<double> cut_position(2, 0.5);
1666
1667 cut_edge_id[0] = 0;
1668 cut_edge_id[1] = 1;
1669 MyMesh.addElemFaceIntersection(0, 0, cut_edge_id, cut_position);
1670 cut_edge_id[0] = 0;
1671 cut_edge_id[1] = 2;
1672 MyMesh.addElemFaceIntersection(0, 3, cut_edge_id, cut_position);
1673 cut_edge_id[0] = 0;
1674 cut_edge_id[1] = 2;
1675 MyMesh.addElemFaceIntersection(0, 4, cut_edge_id, cut_position);
1676 cut_edge_id[0] = 2;
1677 cut_edge_id[1] = 3;
1678 MyMesh.addElemFaceIntersection(0, 5, cut_edge_id, cut_position);
1679
1680 cut_edge_id[0] = 2;
1681 cut_edge_id[1] = 3;
1682 MyMesh.addElemFaceIntersection(2, 0, cut_edge_id, cut_position);
1683 cut_edge_id[0] = 0;
1684 cut_edge_id[1] = 2;
1685 MyMesh.addElemFaceIntersection(2, 2, cut_edge_id, cut_position);
1686 cut_edge_id[0] = 0;
1687 cut_edge_id[1] = 1;
1688 MyMesh.addElemFaceIntersection(2, 5, cut_edge_id, cut_position);
1689
1690 cut_edge_id[0] = 0;
1691 cut_edge_id[1] = 1;
1692 MyMesh.addElemFaceIntersection(3, 0, cut_edge_id, cut_position);
1693 cut_edge_id[0] = 0;
1694 cut_edge_id[1] = 2;
1695 MyMesh.addElemFaceIntersection(3, 3, cut_edge_id, cut_position);
1696 cut_edge_id[0] = 2;
1697 cut_edge_id[1] = 3;
1698 MyMesh.addElemFaceIntersection(3, 5, cut_edge_id, cut_position);
1699
1701 MyMesh.updateTopology();
1702 MyMesh.clearAncestry();
1703 MyMesh.updateEdgeNeighbors();
1704 MyMesh.initCrackTipTopology();
1705
1706 if (debug_print_mesh)
1707 MyMesh.printMesh();
1708
1709 // print crack tip elems
1710 std::set<EFAElement *> crack_tip_elem = MyMesh.getCrackTipElements();
1711
1712 // Test permanent nodes
1713 std::map<unsigned int, EFANode *> permanent_nodes = MyMesh.getPermanentNodes();
1714 std::vector<unsigned int> pn_gold = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
1715 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
1716 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34};
1717 CheckNodes(permanent_nodes, pn_gold);
1718
1719 // Test temp nodes
1720 std::map<unsigned int, EFANode *> temp_nodes = MyMesh.getTempNodes();
1721 std::vector<unsigned int> tn_gold;
1722 CheckNodes(temp_nodes, tn_gold);
1723
1724 // Test embedded nodes
1725 std::map<unsigned int, EFANode *> embedded_nodes = MyMesh.getEmbeddedNodes();
1726 std::vector<unsigned int> en_gold = {0, 1, 2, 3, 4, 5, 6, 7};
1727 CheckNodes(embedded_nodes, en_gold);
1728
1729 // Test child elements
1730 std::vector<EFAElement *> child_elem = MyMesh.getChildElements();
1731 std::vector<unsigned int> ce_gold;
1732 CheckElements(child_elem, ce_gold);
1733
1734 // Test parent elements
1735 std::vector<EFAElement *> parent_elem = MyMesh.getParentElements();
1736 std::vector<unsigned int> pe_gold;
1737 CheckElements(parent_elem, pe_gold);
1738
1739 // Test crack tip elements
1740 unsigned int cte[] = {14, 15, 16};
1741 std::set<unsigned int> cte_gold;
1742 cte_gold.insert(cte, cte + 3);
1743 CheckElements(crack_tip_elem, cte_gold);
1744}
1745
1746/* \-------------\-------------\
1747 |\ |\ |\
1748 | \-----------|-\-----------|-\
1749 | |\ | |\ | |\
1750 | | \---------|-|-\---------|-|-\
1751 | | | | | | | | |
1752 | | | | | | | | |
1753 |-|-|---------|-|-|---------| | |
1754 |\| | |\| | |\| |
1755 | |-|---------|-\-|---------|-| |
1756 | |\| | |\| | |\|
1757 | | |---------|-|-|---------|-|-|
1758 | | | | | | | | |
1759 | o o o o o o o o o o o o o o o |
1760 |-|*|---------| |*|---------| |*|
1761 \| * * * * * * * * * * * * *\* *
1762 \-|-----------\-|-----------\ |
1763 \| \| \|
1764 \-------------\--------------
1765*/
1766
1768{
1769 ElementFragmentAlgorithm MyMesh(Moose::out);
1770 case6Mesh(MyMesh);
1771 if (debug_print_mesh)
1772 MyMesh.printMesh();
1773
1774 std::vector<unsigned int> cut_edge_id(2, 0);
1775 std::vector<double> cut_position(2, 0.5);
1776
1777 cut_edge_id[0] = 0;
1778 cut_edge_id[1] = 2;
1779 MyMesh.addElemFaceIntersection(0, 0, cut_edge_id, cut_position);
1780 MyMesh.addElemFaceIntersection(0, 2, cut_edge_id, cut_position);
1781 MyMesh.addElemFaceIntersection(0, 4, cut_edge_id, cut_position);
1782 cut_edge_id[0] = 1;
1783 cut_edge_id[1] = 3;
1784 MyMesh.addElemFaceIntersection(0, 5, cut_edge_id, cut_position);
1785
1786 cut_edge_id[0] = 0;
1787 cut_edge_id[1] = 2;
1788 MyMesh.addElemFaceIntersection(1, 0, cut_edge_id, cut_position);
1789 cut_edge_id[0] = 0;
1790 cut_edge_id[1] = 2;
1791 MyMesh.addElemFaceIntersection(1, 2, cut_edge_id, cut_position);
1792 cut_edge_id[0] = 1;
1793 cut_edge_id[1] = 3;
1794 MyMesh.addElemFaceIntersection(1, 5, cut_edge_id, cut_position);
1795
1797 MyMesh.updateTopology();
1798 MyMesh.clearAncestry();
1799 MyMesh.updateEdgeNeighbors();
1800 MyMesh.initCrackTipTopology();
1801
1802 if (debug_print_mesh)
1803 MyMesh.printMesh();
1804
1805 // print crack tip elems
1806 std::set<EFAElement *> crack_tip_elem = MyMesh.getCrackTipElements();
1807
1808 // Test permanent nodes
1809 std::map<unsigned int, EFANode *> permanent_nodes = MyMesh.getPermanentNodes();
1810 std::vector<unsigned int> pn_gold = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
1811 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
1812 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32};
1813 CheckNodes(permanent_nodes, pn_gold);
1814
1815 // Test temp nodes
1816 std::map<unsigned int, EFANode *> temp_nodes = MyMesh.getTempNodes();
1817 std::vector<unsigned int> tn_gold;
1818 CheckNodes(temp_nodes, tn_gold);
1819
1820 // Test embedded nodes
1821 std::map<unsigned int, EFANode *> embedded_nodes = MyMesh.getEmbeddedNodes();
1822 std::vector<unsigned int> en_gold = {0, 1, 2, 3, 4, 5};
1823 CheckNodes(embedded_nodes, en_gold);
1824
1825 // Test child elements
1826 std::vector<EFAElement *> child_elem = MyMesh.getChildElements();
1827 std::vector<unsigned int> ce_gold;
1828 CheckElements(child_elem, ce_gold);
1829
1830 // Test parent elements
1831 std::vector<EFAElement *> parent_elem = MyMesh.getParentElements();
1832 std::vector<unsigned int> pe_gold;
1833 CheckElements(parent_elem, pe_gold);
1834
1835 // Test crack tip elements
1836 unsigned int cte[] = {12, 13};
1837 std::set<unsigned int> cte_gold;
1838 cte_gold.insert(cte, cte + 2);
1839 CheckElements(crack_tip_elem, cte_gold);
1840}
1841
1842/* \-------------\-------------\
1843 |\ |\ |\
1844 | \-----------|-\-----------|-\
1845 | |*|* * * * * * * * * * * *| |*
1846 | | \---------|-|*\---------|-|-\
1847 | |*| | |*| | |*|
1848 | | | | | | | | |
1849 |-|*|---------|-|*|---------| |*|
1850 |\| | |\| | |\| |
1851 | |*|---------|-\*|---------|-|*|
1852 | |*|* * * * *|*|*|* * * * *|*|\|
1853 | |*|---------|-|*|---------|-|*|
1854 | | | | | | | | |
1855 | |*| | |*| | |*|
1856 |-|-|---------|-|-|---------| | |
1857 \|*| \|*| \|*|
1858 \-|-----------\-|-----------\ |
1859 *|* * * * * * *|* * * * * * *|
1860 \-------------\--------------
1861*/
1862
1864{
1865 ElementFragmentAlgorithm MyMesh(Moose::out);
1866 case6Mesh(MyMesh);
1867 if (debug_print_mesh)
1868 MyMesh.printMesh();
1869
1870 std::vector<unsigned int> cut_edge_id(2, 0);
1871 std::vector<double> cut_position(2, 0.5);
1872
1873 cut_edge_id[0] = 1;
1874 cut_edge_id[1] = 3;
1875 MyMesh.addElemFaceIntersection(0, 1, cut_edge_id, cut_position);
1876 MyMesh.addElemFaceIntersection(0, 2, cut_edge_id, cut_position);
1877 MyMesh.addElemFaceIntersection(0, 3, cut_edge_id, cut_position);
1878 MyMesh.addElemFaceIntersection(0, 4, cut_edge_id, cut_position);
1879
1880 MyMesh.addElemFaceIntersection(1, 1, cut_edge_id, cut_position);
1881 MyMesh.addElemFaceIntersection(1, 2, cut_edge_id, cut_position);
1882 MyMesh.addElemFaceIntersection(1, 3, cut_edge_id, cut_position);
1883
1884 MyMesh.addElemFaceIntersection(2, 2, cut_edge_id, cut_position);
1885 MyMesh.addElemFaceIntersection(2, 3, cut_edge_id, cut_position);
1886 MyMesh.addElemFaceIntersection(2, 4, cut_edge_id, cut_position);
1887
1888 MyMesh.addElemFaceIntersection(3, 2, cut_edge_id, cut_position);
1889 MyMesh.addElemFaceIntersection(3, 3, cut_edge_id, cut_position);
1890
1892 MyMesh.updateTopology();
1893 MyMesh.clearAncestry();
1894 MyMesh.updateEdgeNeighbors();
1895 MyMesh.initCrackTipTopology();
1896 // second time, just test
1898 MyMesh.updateTopology();
1899 MyMesh.clearAncestry();
1900 MyMesh.updateEdgeNeighbors();
1901 MyMesh.initCrackTipTopology();
1902
1903 if (debug_print_mesh)
1904 MyMesh.printMesh();
1905
1906 // print crack tip elems
1907 std::set<EFAElement *> crack_tip_elem = MyMesh.getCrackTipElements();
1908
1909 // Test permanent nodes
1910 std::map<unsigned int, EFANode *> permanent_nodes = MyMesh.getPermanentNodes();
1911 std::vector<unsigned int> pn_gold = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1912 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
1913 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44};
1914 CheckNodes(permanent_nodes, pn_gold);
1915
1916 // Test temp nodes
1917 std::map<unsigned int, EFANode *> temp_nodes = MyMesh.getTempNodes();
1918 std::vector<unsigned int> tn_gold;
1919 CheckNodes(temp_nodes, tn_gold);
1920
1921 // Test embedded nodes
1922 std::map<unsigned int, EFANode *> embedded_nodes = MyMesh.getEmbeddedNodes();
1923 std::vector<unsigned int> en_gold = {0, 1, 2, 3, 4, 5, 6, 7, 8};
1924 CheckNodes(embedded_nodes, en_gold);
1925
1926 // Test child elements
1927 std::vector<EFAElement *> child_elem = MyMesh.getChildElements();
1928 std::vector<unsigned int> ce_gold;
1929 CheckElements(child_elem, ce_gold);
1930
1931 // Test parent elements
1932 std::vector<EFAElement *> parent_elem = MyMesh.getParentElements();
1933 std::vector<unsigned int> pe_gold;
1934 CheckElements(parent_elem, pe_gold);
1935}
1936
1937/* \------*------\-------------\
1938 |\ |\ |\
1939 | \----*-*----|-\-----------|-\
1940 | |\ | |\ | |\
1941 | | \--*---*--|-|-\---------|-|-\
1942 | | | | | | | | |
1943 | | | * * | | | | | |
1944 |-|-|---------|-|-|---------| | |
1945 |\| | * * |\| | |\| |
1946 | |-|---------|-\-|---------|-| |
1947 | |\| * * | |\| | |\|
1948 | | |---------|-|-|---------|-|-|
1949 | | | * * | | | | | |
1950 | | | | | | | | |
1951 |-|-|--*---*--|-|-|---------| | |
1952 \| | \| | \| |
1953 \-|---*--*----\-|-----------\ |
1954 \| \| \|
1955 \------*------\--------------
1956*/
1957
1959{
1960 ElementFragmentAlgorithm MyMesh(Moose::out);
1961 case6Mesh(MyMesh);
1962 if (debug_print_mesh)
1963 MyMesh.printMesh();
1964
1965 std::vector<unsigned int> cut_edge_id(2, 0);
1966 std::vector<double> cut_position(2, 0.5);
1967
1968 cut_edge_id[0] = 1;
1969 cut_edge_id[1] = 3;
1970 MyMesh.addElemFaceIntersection(0, 0, cut_edge_id, cut_position);
1971 cut_edge_id[0] = 0;
1972 cut_edge_id[1] = 2;
1973 MyMesh.addElemFaceIntersection(0, 1, cut_edge_id, cut_position);
1974
1975 cut_edge_id[0] = 1;
1976 cut_edge_id[1] = 3;
1977 MyMesh.addElemFaceIntersection(2, 0, cut_edge_id, cut_position);
1978 cut_edge_id[0] = 0;
1979 cut_edge_id[1] = 2;
1980 MyMesh.addElemFaceIntersection(2, 1, cut_edge_id, cut_position);
1981 cut_edge_id[0] = 0;
1982 cut_edge_id[1] = 2;
1983 MyMesh.addElemFaceIntersection(2, 3, cut_edge_id, cut_position);
1984
1985 cut_edge_id[0] = 1;
1986 cut_edge_id[1] = 3;
1987 MyMesh.addElemFaceIntersection(4, 0, cut_edge_id, cut_position);
1988 cut_edge_id[0] = 0;
1989 cut_edge_id[1] = 2;
1990 MyMesh.addElemFaceIntersection(4, 1, cut_edge_id, cut_position);
1991 cut_edge_id[0] = 0;
1992 cut_edge_id[1] = 2;
1993 MyMesh.addElemFaceIntersection(4, 5, cut_edge_id, cut_position);
1994
1995 cut_edge_id[0] = 1;
1996 cut_edge_id[1] = 3;
1997 MyMesh.addElemFaceIntersection(6, 0, cut_edge_id, cut_position);
1998 cut_edge_id[0] = 0;
1999 cut_edge_id[1] = 2;
2000 MyMesh.addElemFaceIntersection(6, 1, cut_edge_id, cut_position);
2001 cut_edge_id[0] = 0;
2002 cut_edge_id[1] = 2;
2003 MyMesh.addElemFaceIntersection(6, 3, cut_edge_id, cut_position);
2004 cut_edge_id[0] = 0;
2005 cut_edge_id[1] = 2;
2006 MyMesh.addElemFaceIntersection(6, 5, cut_edge_id, cut_position);
2007
2009 MyMesh.updateTopology();
2010 MyMesh.clearAncestry();
2011 MyMesh.updateEdgeNeighbors();
2012 MyMesh.initCrackTipTopology();
2013
2014 if (debug_print_mesh)
2015 MyMesh.printMesh();
2016
2017 // print crack tip elems
2018 std::set<EFAElement *> crack_tip_elem = MyMesh.getCrackTipElements();
2019
2020 if (debug_print_mesh)
2021 MyMesh.printMesh();
2022
2023 // Test permanent nodes
2024 std::map<unsigned int, EFANode *> permanent_nodes = MyMesh.getPermanentNodes();
2025 std::vector<unsigned int> pn_gold = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
2026 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
2027 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44};
2028 CheckNodes(permanent_nodes, pn_gold);
2029
2030 // Test temp nodes
2031 std::map<unsigned int, EFANode *> temp_nodes = MyMesh.getTempNodes();
2032 std::vector<unsigned int> tn_gold;
2033 CheckNodes(temp_nodes, tn_gold);
2034
2035 // Test embedded nodes
2036 std::map<unsigned int, EFANode *> embedded_nodes = MyMesh.getEmbeddedNodes();
2037 std::vector<unsigned int> en_gold = {0, 1, 2, 3, 4, 5, 6, 7, 8};
2038 CheckNodes(embedded_nodes, en_gold);
2039
2040 // Test child elements
2041 std::vector<EFAElement *> child_elem = MyMesh.getChildElements();
2042 std::vector<unsigned int> ce_gold;
2043 CheckElements(child_elem, ce_gold);
2044
2045 // Test parent elements
2046 std::vector<EFAElement *> parent_elem = MyMesh.getParentElements();
2047 std::vector<unsigned int> pe_gold;
2048 CheckElements(parent_elem, pe_gold);
2049}
2050
2051/* \-------------\-------------\
2052 |\ |\ |\
2053 | \-----------|-\-----------|-\
2054 | |\ | |\ | |\
2055 | | \---------|-|-\---------|-|-\
2056 | | | | | | | | |
2057 | | | | | | | | |
2058 |-|-|-o-------|-|-|---------| | |
2059 |\| * o |\| | |\| |
2060 | *-|---o-----|-\-|---------|-| |
2061 * |\| o | |\| | |\|
2062 |*| |-----o---|-|-|---------|-|-|
2063 | * | * | | | | | |
2064 | |*| * | | | | | |
2065 |-|-*---------|-|-|---------| | |
2066 \| | \| | \| |
2067 \-|-----------\-|-----------\ |
2068 \| \| \|
2069 \-------------\--------------
2070*/
2071
2073{
2074 ElementFragmentAlgorithm MyMesh(Moose::out);
2075 case6Mesh(MyMesh);
2076
2077 if (debug_print_mesh)
2078 MyMesh.printMesh();
2079
2080 std::vector<unsigned int> cut_edge_id(2, 0);
2081 std::vector<double> cut_position(2, 0.5);
2082
2083 cut_edge_id[0] = 0;
2084 cut_edge_id[1] = 1;
2085 MyMesh.addElemFaceIntersection(0, 0, cut_edge_id, cut_position);
2086 cut_edge_id[0] = 0;
2087 cut_edge_id[1] = 2;
2088 MyMesh.addElemFaceIntersection(0, 3, cut_edge_id, cut_position);
2089 cut_edge_id[0] = 0;
2090 cut_edge_id[1] = 2;
2091 MyMesh.addElemFaceIntersection(0, 4, cut_edge_id, cut_position);
2092 cut_edge_id[0] = 2;
2093 cut_edge_id[1] = 3;
2094 MyMesh.addElemFaceIntersection(0, 5, cut_edge_id, cut_position);
2095
2096 cut_edge_id[0] = 0;
2097 cut_edge_id[1] = 2;
2098 MyMesh.addElemFaceIntersection(4, 3, cut_edge_id, cut_position);
2099 cut_edge_id[0] = 0;
2100 cut_edge_id[1] = 2;
2101 MyMesh.addElemFaceIntersection(4, 4, cut_edge_id, cut_position);
2102 cut_edge_id[0] = 2;
2103 cut_edge_id[1] = 3;
2104 MyMesh.addElemFaceIntersection(4, 5, cut_edge_id, cut_position);
2105
2107 MyMesh.updateTopology();
2108 MyMesh.clearAncestry();
2109 MyMesh.updateEdgeNeighbors();
2110 MyMesh.initCrackTipTopology();
2111
2112 if (debug_print_mesh)
2113 MyMesh.printMesh();
2114
2115 // print crack tip elems
2116 std::set<EFAElement *> crack_tip_elem = MyMesh.getCrackTipElements();
2117
2118 // Test permanent nodes
2119 std::map<unsigned int, EFANode *> permanent_nodes = MyMesh.getPermanentNodes();
2120 std::vector<unsigned int> pn_gold = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
2121 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
2122 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32};
2123 CheckNodes(permanent_nodes, pn_gold);
2124
2125 // Test temp nodes
2126 std::map<unsigned int, EFANode *> temp_nodes = MyMesh.getTempNodes();
2127 std::vector<unsigned int> tn_gold;
2128 CheckNodes(temp_nodes, tn_gold);
2129
2130 // Test embedded nodes
2131 std::map<unsigned int, EFANode *> embedded_nodes = MyMesh.getEmbeddedNodes();
2132 std::vector<unsigned int> en_gold = {0, 1, 2, 3, 4, 5};
2133 CheckNodes(embedded_nodes, en_gold);
2134
2135 // Test child elements
2136 std::vector<EFAElement *> child_elem = MyMesh.getChildElements();
2137 std::vector<unsigned int> ce_gold;
2138 CheckElements(child_elem, ce_gold);
2139
2140 // Test parent elements
2141 std::vector<EFAElement *> parent_elem = MyMesh.getParentElements();
2142 std::vector<unsigned int> pe_gold;
2143 CheckElements(parent_elem, pe_gold);
2144
2145 // Test crack tip elements
2146 unsigned int cte[] = {10, 13};
2147 std::set<unsigned int> cte_gold;
2148 cte_gold.insert(cte, cte + 2);
2149 CheckElements(crack_tip_elem, cte_gold);
2150}
2151
2152/* \-------------\-------------\
2153 |\ |\ |\
2154 | \-----------|-\-----------|-\
2155 | |* | |\ | |\
2156 | | \-----*---|-|-\---------|-|-\
2157 | |*| | | | | | |
2158 | | | * | | | | | |
2159 |-|*|---------|-|-|---------| | |
2160 |\| | * |\| | |\| |
2161 | |*|---------|-\-|---------|-| |
2162 | |\| * | |\| | |\|
2163 | |*|---------|-|-|---------|-|-|
2164 | | | * | | | | | |
2165 | |*| | | | | | |
2166 |-|-|-----*---|-|-|---------| | |
2167 \|*| \| | \| |
2168 \-|-----*-----\-|-----------\ |
2169 *| \| \|
2170 \-----*-------\--------------
2171*/
2172
2174{
2175 ElementFragmentAlgorithm MyMesh(Moose::out);
2176 case6Mesh(MyMesh);
2177 if (debug_print_mesh)
2178 MyMesh.printMesh();
2179
2180 std::vector<unsigned int> cut_edge_id(2, 0);
2181 std::vector<double> cut_position(2, 0.5);
2182
2183 cut_edge_id[0] = 1;
2184 cut_edge_id[1] = 3;
2185 MyMesh.addElemFaceIntersection(0, 0, cut_edge_id, cut_position);
2186 cut_edge_id[0] = 0;
2187 cut_edge_id[1] = 1;
2188 MyMesh.addElemFaceIntersection(0, 3, cut_edge_id, cut_position);
2189 cut_edge_id[0] = 0;
2190 cut_edge_id[1] = 3;
2191 MyMesh.addElemFaceIntersection(0, 1, cut_edge_id, cut_position);
2192 cut_edge_id[0] = 1;
2193 cut_edge_id[1] = 3;
2194 MyMesh.addElemFaceIntersection(0, 4, cut_edge_id, cut_position);
2195
2196 cut_edge_id[0] = 1;
2197 cut_edge_id[1] = 3;
2198 MyMesh.addElemFaceIntersection(2, 0, cut_edge_id, cut_position);
2199 cut_edge_id[0] = 0;
2200 cut_edge_id[1] = 1;
2201 MyMesh.addElemFaceIntersection(2, 3, cut_edge_id, cut_position);
2202 cut_edge_id[0] = 1;
2203 cut_edge_id[1] = 3;
2204 MyMesh.addElemFaceIntersection(2, 4, cut_edge_id, cut_position);
2205
2207 MyMesh.updateTopology();
2208 MyMesh.clearAncestry();
2209 MyMesh.updateEdgeNeighbors();
2210 MyMesh.initCrackTipTopology();
2211
2212 if (debug_print_mesh)
2213 MyMesh.printMesh();
2214
2215 // print crack tip elems
2216 std::set<EFAElement *> crack_tip_elem = MyMesh.getCrackTipElements();
2217
2218 // Test permanent nodes
2219 std::map<unsigned int, EFANode *> permanent_nodes = MyMesh.getPermanentNodes();
2220 std::vector<unsigned int> pn_gold = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
2221 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
2222 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38};
2223 CheckNodes(permanent_nodes, pn_gold);
2224
2225 // Test temp nodes
2226 std::map<unsigned int, EFANode *> temp_nodes = MyMesh.getTempNodes();
2227 std::vector<unsigned int> tn_gold;
2228 CheckNodes(temp_nodes, tn_gold);
2229
2230 // Test embedded nodes
2231 std::map<unsigned int, EFANode *> embedded_nodes = MyMesh.getEmbeddedNodes();
2232 std::vector<unsigned int> en_gold = {0, 1, 2, 3, 4, 5};
2233 CheckNodes(embedded_nodes, en_gold);
2234
2235 // Test child elements
2236 std::vector<EFAElement *> child_elem = MyMesh.getChildElements();
2237 std::vector<unsigned int> ce_gold;
2238 CheckElements(child_elem, ce_gold);
2239
2240 // Test parent elements
2241 std::vector<EFAElement *> parent_elem = MyMesh.getParentElements();
2242 std::vector<unsigned int> pe_gold;
2243 CheckElements(parent_elem, pe_gold);
2244}
2245
2246/* \-------------\-------------\
2247 |\ |\ |\
2248 | \-----------|-\-----------|-\
2249 | |\ | |\ | |\
2250 | | \---------|-|-\---------|-|-\
2251 | | | | | | | | |
2252 | | | | | | | | |
2253 |-|-|---------|-|-|---------| | |
2254 |\| | |\| | |\| |
2255 | |-|---------|-\-|---------|-| |
2256 | |O| | |\| | |\|
2257 | | |----O----|-|-|---------|-|-|
2258 | | | * | | | | | |
2259 | | * | | | | | |
2260 |-|-|---------|-|-|---------| | |
2261 \| | \| | \| |
2262 \-|-----------\-|-----------\ |
2263 \| \| \|
2264 \-------------\--------------
2265*/
2266
2268{
2269 ElementFragmentAlgorithm MyMesh(Moose::out);
2270 case6Mesh(MyMesh);
2271 if (debug_print_mesh)
2272 MyMesh.printMesh();
2273
2274 std::vector<unsigned int> cut_edge_id(2, 0);
2275 std::vector<double> cut_position(2, 0.5);
2276
2277 cut_edge_id[0] = 0;
2278 cut_edge_id[1] = 1;
2279 MyMesh.addElemFaceIntersection(0, 0, cut_edge_id, cut_position);
2280 cut_edge_id[0] = 0;
2281 cut_edge_id[1] = 1;
2282 MyMesh.addElemFaceIntersection(0, 3, cut_edge_id, cut_position);
2283 cut_edge_id[0] = 0;
2284 cut_edge_id[1] = 3;
2285 MyMesh.addElemFaceIntersection(0, 4, cut_edge_id, cut_position);
2286
2288 MyMesh.updateTopology();
2289 MyMesh.clearAncestry();
2290 MyMesh.updateEdgeNeighbors();
2291 MyMesh.initCrackTipTopology();
2292
2293 if (debug_print_mesh)
2294 MyMesh.printMesh();
2295
2296 // print crack tip elems
2297 std::set<EFAElement *> crack_tip_elem = MyMesh.getCrackTipElements();
2298
2299 // Test permanent nodes
2300 std::map<unsigned int, EFANode *> permanent_nodes = MyMesh.getPermanentNodes();
2301 std::vector<unsigned int> pn_gold = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
2302 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
2303 22, 23, 24, 25, 26, 27, 28, 29, 30};
2304 CheckNodes(permanent_nodes, pn_gold);
2305
2306 // Test temp nodes
2307 std::map<unsigned int, EFANode *> temp_nodes = MyMesh.getTempNodes();
2308 std::vector<unsigned int> tn_gold;
2309 CheckNodes(temp_nodes, tn_gold);
2310
2311 // Test embedded nodes
2312 std::map<unsigned int, EFANode *> embedded_nodes = MyMesh.getEmbeddedNodes();
2313 std::vector<unsigned int> en_gold = {0, 1, 2};
2314 CheckNodes(embedded_nodes, en_gold);
2315
2316 // Test child elements
2317 std::vector<EFAElement *> child_elem = MyMesh.getChildElements();
2318 std::vector<unsigned int> ce_gold;
2319 CheckElements(child_elem, ce_gold);
2320
2321 // Test parent elements
2322 std::vector<EFAElement *> parent_elem = MyMesh.getParentElements();
2323 std::vector<unsigned int> pe_gold;
2324 CheckElements(parent_elem, pe_gold);
2325
2326 // Test crack tip elements
2327 unsigned int cte[] = {10};
2328 std::set<unsigned int> cte_gold;
2329 cte_gold.insert(cte, cte + 1);
2330 CheckElements(crack_tip_elem, cte_gold);
2331}
2332
2333/* \-------------\-------------\
2334 |\ |\ |\
2335 | \-----------|-------------|-\
2336 | |\ O |\ | |\
2337 | | \-------*-|-|-----------|-|-\
2338 | | | * | O | | | |
2339 | | | * * | | | | |
2340 |-|-|-*-----*-|-|-O---------| | |
2341 |\| * * |\* | |\| |
2342 | *-|---*-----*-\-|---------|-\ |
2343 * |\| * * | |\| | |\|
2344 |*| *-----*---|-|-|---------|-|-|
2345 | * | * | | | | | |
2346 | |*| * | | | | | |
2347 |-|-*---------|-|-|---------| | |
2348 \| | \| | \| |
2349 \-|-----------\-|-----------\ |
2350 \| \| \|
2351 \-------------\--------------
2352*/
2353
2355{
2356 ElementFragmentAlgorithm MyMesh(Moose::out);
2357 case6Mesh(MyMesh);
2358
2359 if (debug_print_mesh)
2360 MyMesh.printMesh();
2361
2362 std::vector<unsigned int> cut_edge_id(2, 0);
2363 std::vector<double> cut_position(2, 0.5);
2364
2365 cut_edge_id[0] = 0;
2366 cut_edge_id[1] = 1;
2367 MyMesh.addElemFaceIntersection(0, 0, cut_edge_id, cut_position);
2368 cut_edge_id[0] = 0;
2369 cut_edge_id[1] = 2;
2370 MyMesh.addElemFaceIntersection(0, 3, cut_edge_id, cut_position);
2371 cut_edge_id[0] = 0;
2372 cut_edge_id[1] = 2;
2373 MyMesh.addElemFaceIntersection(0, 4, cut_edge_id, cut_position);
2374 cut_edge_id[0] = 2;
2375 cut_edge_id[1] = 3;
2376 MyMesh.addElemFaceIntersection(0, 5, cut_edge_id, cut_position);
2377
2378 cut_edge_id[0] = 2;
2379 cut_edge_id[1] = 3;
2380 MyMesh.addElemFaceIntersection(2, 0, cut_edge_id, cut_position);
2381 cut_edge_id[0] = 0;
2382 cut_edge_id[1] = 2;
2383 MyMesh.addElemFaceIntersection(2, 2, cut_edge_id, cut_position);
2384 cut_edge_id[0] = 0;
2385 cut_edge_id[1] = 1;
2386 MyMesh.addElemFaceIntersection(2, 5, cut_edge_id, cut_position);
2387
2388 cut_edge_id[0] = 0;
2389 cut_edge_id[1] = 2;
2390 MyMesh.addElemFaceIntersection(6, 2, cut_edge_id, cut_position);
2391 cut_edge_id[0] = 0;
2392 cut_edge_id[1] = 1;
2393 MyMesh.addElemFaceIntersection(6, 5, cut_edge_id, cut_position);
2394
2395 cut_edge_id[0] = 2;
2396 cut_edge_id[1] = 3;
2397 MyMesh.addElemFaceIntersection(4, 5, cut_edge_id, cut_position);
2398 cut_edge_id[0] = 0;
2399 cut_edge_id[1] = 2;
2400 MyMesh.addElemFaceIntersection(4, 3, cut_edge_id, cut_position);
2401 cut_edge_id[0] = 0;
2402 cut_edge_id[1] = 2;
2403 MyMesh.addElemFaceIntersection(4, 4, cut_edge_id, cut_position);
2404
2406 MyMesh.updateTopology();
2407 MyMesh.clearAncestry();
2408 MyMesh.updateEdgeNeighbors();
2409 MyMesh.initCrackTipTopology();
2410
2411 if (debug_print_mesh)
2412 MyMesh.printMesh();
2413
2414 // print crack tip elems
2415 std::set<EFAElement *> crack_tip_elem = MyMesh.getCrackTipElements();
2416
2417 // Test permanent nodes
2418 std::map<unsigned int, EFANode *> permanent_nodes = MyMesh.getPermanentNodes();
2419 std::vector<unsigned int> pn_gold = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
2420 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
2421 26, 27, 28, 31, 32, 33, 34, 35, 36, 37, 39, 40, 41};
2422 CheckNodes(permanent_nodes, pn_gold);
2423
2424 // Test temp nodes
2425 std::map<unsigned int, EFANode *> temp_nodes = MyMesh.getTempNodes();
2426 std::vector<unsigned int> tn_gold;
2427 CheckNodes(temp_nodes, tn_gold);
2428
2429 // Test embedded nodes
2430 std::map<unsigned int, EFANode *> embedded_nodes = MyMesh.getEmbeddedNodes();
2431 std::vector<unsigned int> en_gold = {0, 1, 2, 3, 4, 5, 6, 7, 8};
2432 CheckNodes(embedded_nodes, en_gold);
2433
2434 // Test child elements
2435 std::vector<EFAElement *> child_elem = MyMesh.getChildElements();
2436 std::vector<unsigned int> ce_gold;
2437 CheckElements(child_elem, ce_gold);
2438
2439 // Test parent elements
2440 std::vector<EFAElement *> parent_elem = MyMesh.getParentElements();
2441 std::vector<unsigned int> pe_gold;
2442 CheckElements(parent_elem, pe_gold);
2443
2444 // Test crack tip elements
2445 unsigned int cte[] = {12, 17};
2446 std::set<unsigned int> cte_gold;
2447 cte_gold.insert(cte, cte + 2);
2448 CheckElements(crack_tip_elem, cte_gold);
2449}
2450
2451/* \-------------\-----*-------\
2452 |\ |\ * * |\
2453 | \-----------|-*-----*-----|-\
2454 | |\ * |\ * * | |\
2455 | | \-------*-|-|-*-----*---|-|-\
2456 | | | * | * | * | | |
2457 | | | * * | | * | | |
2458 |-|-|-*-----*-|-|-*---------| | |
2459 |\| * * |\* | |\| |
2460 | *-|---*-----*-\-|---------|-\ |
2461 * |\| * * | |\| | |\|
2462 |*| *-----*---|-|-|---------|-|-|
2463 | * | * | | | | | |
2464 | |*| * | | | | | |
2465 |-|-*---------|-|-|---------| | |
2466 \| | \| | \| |
2467 \-|-----------\-|-----------\ |
2468 \| \| \|
2469 \-------------\--------------
2470*/
2471
2473{
2474 ElementFragmentAlgorithm MyMesh(Moose::out);
2475 case6Mesh(MyMesh);
2476
2477 if (debug_print_mesh)
2478 MyMesh.printMesh();
2479
2480 std::vector<unsigned int> cut_edge_id(2, 0);
2481 std::vector<double> cut_position(2, 0.5);
2482
2483 cut_edge_id[0] = 0;
2484 cut_edge_id[1] = 1;
2485 MyMesh.addElemFaceIntersection(0, 0, cut_edge_id, cut_position);
2486 cut_edge_id[0] = 0;
2487 cut_edge_id[1] = 2;
2488 MyMesh.addElemFaceIntersection(0, 3, cut_edge_id, cut_position);
2489 cut_edge_id[0] = 0;
2490 cut_edge_id[1] = 2;
2491 MyMesh.addElemFaceIntersection(0, 4, cut_edge_id, cut_position);
2492 cut_edge_id[0] = 2;
2493 cut_edge_id[1] = 3;
2494 MyMesh.addElemFaceIntersection(0, 5, cut_edge_id, cut_position);
2495
2496 cut_edge_id[0] = 0;
2497 cut_edge_id[1] = 2;
2498 MyMesh.addElemFaceIntersection(4, 3, cut_edge_id, cut_position);
2499 cut_edge_id[0] = 0;
2500 cut_edge_id[1] = 2;
2501 MyMesh.addElemFaceIntersection(4, 4, cut_edge_id, cut_position);
2502 cut_edge_id[0] = 2;
2503 cut_edge_id[1] = 3;
2504 MyMesh.addElemFaceIntersection(4, 5, cut_edge_id, cut_position);
2505
2506 cut_edge_id[0] = 2;
2507 cut_edge_id[1] = 3;
2508 MyMesh.addElemFaceIntersection(2, 0, cut_edge_id, cut_position);
2509 cut_edge_id[0] = 0;
2510 cut_edge_id[1] = 2;
2511 MyMesh.addElemFaceIntersection(2, 2, cut_edge_id, cut_position);
2512 cut_edge_id[0] = 0;
2513 cut_edge_id[1] = 1;
2514 MyMesh.addElemFaceIntersection(2, 5, cut_edge_id, cut_position);
2515 cut_edge_id[0] = 0;
2516 cut_edge_id[1] = 2;
2517
2518 MyMesh.addElemFaceIntersection(6, 2, cut_edge_id, cut_position);
2519 cut_edge_id[0] = 0;
2520 cut_edge_id[1] = 1;
2521 MyMesh.addElemFaceIntersection(6, 5, cut_edge_id, cut_position);
2522
2523 cut_edge_id[0] = 0;
2524 cut_edge_id[1] = 1;
2525 MyMesh.addElemFaceIntersection(3, 0, cut_edge_id, cut_position);
2526 cut_edge_id[0] = 0;
2527 cut_edge_id[1] = 2;
2528 MyMesh.addElemFaceIntersection(3, 3, cut_edge_id, cut_position);
2529 cut_edge_id[0] = 2;
2530 cut_edge_id[1] = 3;
2531 MyMesh.addElemFaceIntersection(3, 5, cut_edge_id, cut_position);
2532
2533 cut_edge_id[0] = 0;
2534 cut_edge_id[1] = 2;
2535 MyMesh.addElemFaceIntersection(7, 3, cut_edge_id, cut_position);
2536 cut_edge_id[0] = 2;
2537 cut_edge_id[1] = 3;
2538 MyMesh.addElemFaceIntersection(7, 5, cut_edge_id, cut_position);
2539
2541 MyMesh.updateTopology();
2542 MyMesh.clearAncestry();
2543 MyMesh.updateEdgeNeighbors();
2544 MyMesh.initCrackTipTopology();
2545
2546 if (debug_print_mesh)
2547 MyMesh.printMesh();
2548
2549 // print crack tip elems
2550 std::set<EFAElement *> crack_tip_elem = MyMesh.getCrackTipElements();
2551
2552 // Test permanent nodes
2553 std::map<unsigned int, EFANode *> permanent_nodes = MyMesh.getPermanentNodes();
2554 std::vector<unsigned int> pn_gold = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
2555 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
2556 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
2557 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50};
2558 CheckNodes(permanent_nodes, pn_gold);
2559
2560 // Test temp nodes
2561 std::map<unsigned int, EFANode *> temp_nodes = MyMesh.getTempNodes();
2562 std::vector<unsigned int> tn_gold;
2563 CheckNodes(temp_nodes, tn_gold);
2564
2565 // Test embedded nodes
2566 std::map<unsigned int, EFANode *> embedded_nodes = MyMesh.getEmbeddedNodes();
2567 std::vector<unsigned int> en_gold = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
2568 CheckNodes(embedded_nodes, en_gold);
2569
2570 // Test child elements
2571 std::vector<EFAElement *> child_elem = MyMesh.getChildElements();
2572 std::vector<unsigned int> ce_gold;
2573 CheckElements(child_elem, ce_gold);
2574
2575 // Test parent elements
2576 std::vector<EFAElement *> parent_elem = MyMesh.getParentElements();
2577 std::vector<unsigned int> pe_gold;
2578 CheckElements(parent_elem, pe_gold);
2579}
2580
2581/* \-------------\-------------\
2582 |\ |\ |\
2583 | \-----------|-\-----------|-\
2584 | |\ | |\ | |\
2585 | | \---------|-|-\---------|-|-\
2586 | | | | | | | | |
2587 | | | | | | | | |
2588 |-|-|---------|-|-|---------| | |
2589 |\| | |\| | |\| |
2590 | |-|---------|-\-|---------|-| |
2591 | |\| | |\| | |\|
2592 | | |---------|-|-|---------|-|-|
2593 | | | | | | | | |
2594 | | | | | | | | |
2595 |-|-|---------|-|-|---------| | |
2596 \| * \| | \| |
2597 \-|-----------\-|-----------\ |
2598 *| \| \|
2599 \-----*-------\--------------
2600*/
2601
2603{
2604 ElementFragmentAlgorithm MyMesh(Moose::out);
2605 case6Mesh(MyMesh);
2606 if (debug_print_mesh)
2607 MyMesh.printMesh();
2608
2609 std::vector<unsigned int> cut_edge_id(2, 0);
2610 std::vector<double> cut_position(2, 0.5);
2611
2612 cut_edge_id[0] = 0;
2613 cut_edge_id[1] = 3;
2614 MyMesh.addElemFaceIntersection(0, 0, cut_edge_id, cut_position);
2615 cut_edge_id[0] = 0;
2616 cut_edge_id[1] = 3;
2617 MyMesh.addElemFaceIntersection(0, 1, cut_edge_id, cut_position);
2618 cut_edge_id[0] = 0;
2619 cut_edge_id[1] = 1;
2620 MyMesh.addElemFaceIntersection(0, 4, cut_edge_id, cut_position);
2621
2623 MyMesh.updateTopology();
2624 MyMesh.clearAncestry();
2625 MyMesh.updateEdgeNeighbors();
2626 MyMesh.initCrackTipTopology();
2627
2628 if (debug_print_mesh)
2629 MyMesh.printMesh();
2630
2631 // print crack tip elems
2632 std::set<EFAElement *> crack_tip_elem = MyMesh.getCrackTipElements();
2633
2634 // Test permanent nodes
2635 std::map<unsigned int, EFANode *> permanent_nodes = MyMesh.getPermanentNodes();
2636 std::vector<unsigned int> pn_gold = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
2637 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
2638 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34};
2639 CheckNodes(permanent_nodes, pn_gold);
2640
2641 // Test temp nodes
2642 std::map<unsigned int, EFANode *> temp_nodes = MyMesh.getTempNodes();
2643 std::vector<unsigned int> tn_gold;
2644 CheckNodes(temp_nodes, tn_gold);
2645
2646 // Test embedded nodes
2647 std::map<unsigned int, EFANode *> embedded_nodes = MyMesh.getEmbeddedNodes();
2648 std::vector<unsigned int> en_gold = {0, 1, 2};
2649 CheckNodes(embedded_nodes, en_gold);
2650
2651 // Test child elements
2652 std::vector<EFAElement *> child_elem = MyMesh.getChildElements();
2653 std::vector<unsigned int> ce_gold;
2654 CheckElements(child_elem, ce_gold);
2655
2656 // Test parent elements
2657 std::vector<EFAElement *> parent_elem = MyMesh.getParentElements();
2658 std::vector<unsigned int> pe_gold;
2659 CheckElements(parent_elem, pe_gold);
2660}
2661
2662/* \-------------\-------------\
2663 |\ |\ |\
2664 | \-----------|-\-----------|-\
2665 | |\ | |O | |\
2666 | | \---------|-|-\------*--|-|-\
2667 | | | | |O| | | |
2668 | | | | | | * | | |
2669 |-|-|---------|-|O|---------| | |
2670 | | | |\| | * |\| |
2671 | |-|---------|-\O|---------|-| |
2672 | |\| | |\| * | |\|
2673 | | |---------|-|O|---------|-|-|
2674 | | | | | | * | | |
2675 | | | | |O| | | |
2676 |-|-|---------|-|-|------*--| | |
2677 \| | \|O| \| |
2678 \-|-----------\-|------*----\ |
2679 \| O| \|
2680 \-------------\------*-------
2681*/
2682
2684{
2685 ElementFragmentAlgorithm MyMesh(Moose::out);
2686 case6Mesh(MyMesh);
2687 if (debug_print_mesh)
2688 MyMesh.printMesh();
2689
2690 std::vector<unsigned int> cut_edge_id(2, 0);
2691 std::vector<double> cut_position(2, 0.5);
2692
2693 cut_edge_id[0] = 1;
2694 cut_edge_id[1] = 3;
2695 MyMesh.addElemFaceIntersection(0, 2, cut_edge_id, cut_position);
2696
2697 cut_edge_id[0] = 1;
2698 cut_edge_id[1] = 3;
2699 MyMesh.addElemFaceIntersection(1, 0, cut_edge_id, cut_position);
2700 cut_edge_id[0] = 0;
2701 cut_edge_id[1] = 3;
2702 MyMesh.addElemFaceIntersection(1, 1, cut_edge_id, cut_position);
2703 cut_edge_id[0] = 0;
2704 cut_edge_id[1] = 1;
2705 MyMesh.addElemFaceIntersection(1, 3, cut_edge_id, cut_position);
2706
2707 cut_edge_id[0] = 1;
2708 cut_edge_id[1] = 3;
2709 MyMesh.addElemFaceIntersection(2, 2, cut_edge_id, cut_position);
2710
2711 cut_edge_id[0] = 1;
2712 cut_edge_id[1] = 3;
2713 MyMesh.addElemFaceIntersection(3, 0, cut_edge_id, cut_position);
2714 cut_edge_id[0] = 0;
2715 cut_edge_id[1] = 1;
2716 MyMesh.addElemFaceIntersection(3, 3, cut_edge_id, cut_position);
2717
2719 MyMesh.updateTopology();
2720 MyMesh.clearAncestry();
2721 MyMesh.updateEdgeNeighbors();
2722 MyMesh.initCrackTipTopology();
2723
2724 if (debug_print_mesh)
2725 MyMesh.printMesh();
2726
2727 // print crack tip elems
2728 std::set<EFAElement *> crack_tip_elem = MyMesh.getCrackTipElements();
2729
2730 // Test permanent nodes
2731 std::map<unsigned int, EFANode *> permanent_nodes = MyMesh.getPermanentNodes();
2732 std::vector<unsigned int> pn_gold = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
2733 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
2734 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32};
2735 CheckNodes(permanent_nodes, pn_gold);
2736
2737 // Test temp nodes
2738 std::map<unsigned int, EFANode *> temp_nodes = MyMesh.getTempNodes();
2739 std::vector<unsigned int> tn_gold;
2740 CheckNodes(temp_nodes, tn_gold);
2741
2742 // Test embedded nodes
2743 std::map<unsigned int, EFANode *> embedded_nodes = MyMesh.getEmbeddedNodes();
2744 std::vector<unsigned int> en_gold = {0, 1, 2, 3, 4, 5};
2745 CheckNodes(embedded_nodes, en_gold);
2746
2747 // Test child elements
2748 std::vector<EFAElement *> child_elem = MyMesh.getChildElements();
2749 std::vector<unsigned int> ce_gold;
2750 CheckElements(child_elem, ce_gold);
2751
2752 // Test parent elements
2753 std::vector<EFAElement *> parent_elem = MyMesh.getParentElements();
2754 std::vector<unsigned int> pe_gold;
2755 CheckElements(parent_elem, pe_gold);
2756}
2757
2758/* \-------------\-------------\
2759 |\ |\ |\
2760 | \------O----|-\-----------|-\
2761 | |\ | |* | |\
2762 | | \----O----|-|-\------*--|-|-\
2763 | | | | |*| | | |
2764 | | | O | | | * | | |
2765 |-|-|---------|-|*|---------| | |
2766 | | | O |\| | * |\| |
2767 | |-|---------|-\*|---------|-| |
2768 | |\| O | |\| * | |\|
2769 | | |---------|-|*|---------|-|-|
2770 | | | O | | | * | | |
2771 | | | | |*| | | |
2772 |-|-|----O----|-|-|------*--| | |
2773 \| | \|*| \| |
2774 \-|----O------\-|------*----\ |
2775 \| *| \|
2776 \-------------\------*-------
2777*/
2778
2780{
2781 ElementFragmentAlgorithm MyMesh(Moose::out);
2782 case6Mesh(MyMesh);
2783 if (debug_print_mesh)
2784 MyMesh.printMesh();
2785
2786 std::vector<unsigned int> cut_edge_id(2, 0);
2787 std::vector<double> cut_position(2, 0.5);
2788
2789 cut_edge_id[0] = 1;
2790 cut_edge_id[1] = 2;
2791 MyMesh.addElemFaceIntersection(0, 1, cut_edge_id, cut_position);
2792 cut_edge_id[0] = 1;
2793 cut_edge_id[1] = 3;
2794 MyMesh.addElemFaceIntersection(0, 2, cut_edge_id, cut_position);
2795 cut_edge_id[0] = 2;
2796 cut_edge_id[1] = 3;
2797 MyMesh.addElemFaceIntersection(0, 3, cut_edge_id, cut_position);
2798 cut_edge_id[0] = 0;
2799 cut_edge_id[1] = 2;
2800 MyMesh.addElemFaceIntersection(0, 5, cut_edge_id, cut_position);
2801
2802 cut_edge_id[0] = 1;
2803 cut_edge_id[1] = 3;
2804 MyMesh.addElemFaceIntersection(1, 0, cut_edge_id, cut_position);
2805 cut_edge_id[0] = 0;
2806 cut_edge_id[1] = 3;
2807 MyMesh.addElemFaceIntersection(1, 1, cut_edge_id, cut_position);
2808 cut_edge_id[0] = 0;
2809 cut_edge_id[1] = 1;
2810 MyMesh.addElemFaceIntersection(1, 3, cut_edge_id, cut_position);
2811
2812 cut_edge_id[0] = 1;
2813 cut_edge_id[1] = 3;
2814 MyMesh.addElemFaceIntersection(2, 2, cut_edge_id, cut_position);
2815 cut_edge_id[0] = 2;
2816 cut_edge_id[1] = 3;
2817 MyMesh.addElemFaceIntersection(2, 3, cut_edge_id, cut_position);
2818 cut_edge_id[0] = 0;
2819 cut_edge_id[1] = 2;
2820 MyMesh.addElemFaceIntersection(2, 5, cut_edge_id, cut_position);
2821
2822 cut_edge_id[0] = 1;
2823 cut_edge_id[1] = 3;
2824 MyMesh.addElemFaceIntersection(3, 0, cut_edge_id, cut_position);
2825 cut_edge_id[0] = 0;
2826 cut_edge_id[1] = 1;
2827 MyMesh.addElemFaceIntersection(3, 3, cut_edge_id, cut_position);
2828
2830 MyMesh.updateTopology();
2831 MyMesh.clearAncestry();
2832 MyMesh.updateEdgeNeighbors();
2833 MyMesh.initCrackTipTopology();
2834
2835 if (debug_print_mesh)
2836 MyMesh.printMesh();
2837
2838 // print crack tip elems
2839 std::set<EFAElement *> crack_tip_elem = MyMesh.getCrackTipElements();
2840
2841 // Test permanent nodes
2842 std::map<unsigned int, EFANode *> permanent_nodes = MyMesh.getPermanentNodes();
2843 std::vector<unsigned int> pn_gold = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
2844 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
2845 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38};
2846 CheckNodes(permanent_nodes, pn_gold);
2847
2848 // Test temp nodes
2849 std::map<unsigned int, EFANode *> temp_nodes = MyMesh.getTempNodes();
2850 std::vector<unsigned int> tn_gold;
2851 CheckNodes(temp_nodes, tn_gold);
2852
2853 // Test embedded nodes
2854 std::map<unsigned int, EFANode *> embedded_nodes = MyMesh.getEmbeddedNodes();
2855 std::vector<unsigned int> en_gold = {0, 1, 2, 3, 4, 5, 6, 7, 8};
2856 CheckNodes(embedded_nodes, en_gold);
2857
2858 // Test child elements
2859 std::vector<EFAElement *> child_elem = MyMesh.getChildElements();
2860 std::vector<unsigned int> ce_gold;
2861 CheckElements(child_elem, ce_gold);
2862
2863 // Test parent elements
2864 std::vector<EFAElement *> parent_elem = MyMesh.getParentElements();
2865 std::vector<unsigned int> pe_gold;
2866 CheckElements(parent_elem, pe_gold);
2867}
2868
2869/* \-------------\-------------\
2870 |* |\ |\
2871 |*\------*----|-\-----------|-\
2872 | |\ | |* | |\
2873 |*| \----*----|-|-\------*--|-|-\
2874 | | | | |*| | | |
2875 |*| | * | | | * | | |
2876 |-|-|---------|-|*|---------| | |
2877 |*| | * |\| | * |\| |
2878 | |-|---------|-\*|---------|-| |
2879 |*|\| * | |\| * | |\|
2880 | | |---------|-|*|---------|-|-|
2881 |*| | * | | | * | | |
2882 | | | | |*| | | |
2883 |*|-|----*----|-|-|------*--| | |
2884 *| | \|*| \| |
2885 \-|----*------\-|------*----\ |
2886 \| *| \|
2887 \-------------\------*-------
2888*/
2889
2891{
2892 ElementFragmentAlgorithm MyMesh(Moose::out);
2893 case6Mesh(MyMesh);
2894 if (debug_print_mesh)
2895 MyMesh.printMesh();
2896
2897 std::vector<unsigned int> cut_edge_id(2, 0);
2898 std::vector<double> cut_position(2, 0.5);
2899
2900 cut_edge_id[0] = 1;
2901 cut_edge_id[1] = 2;
2902 MyMesh.addElemFaceIntersection(0, 1, cut_edge_id, cut_position);
2903 cut_edge_id[0] = 1;
2904 cut_edge_id[1] = 3;
2905 MyMesh.addElemFaceIntersection(0, 2, cut_edge_id, cut_position);
2906 cut_edge_id[0] = 2;
2907 cut_edge_id[1] = 3;
2908 MyMesh.addElemFaceIntersection(0, 3, cut_edge_id, cut_position);
2909 cut_edge_id[0] = 0;
2910 cut_edge_id[1] = 2;
2911 MyMesh.addElemFaceIntersection(0, 5, cut_edge_id, cut_position);
2912
2913 cut_edge_id[0] = 1;
2914 cut_edge_id[1] = 3;
2915 MyMesh.addElemFaceIntersection(1, 0, cut_edge_id, cut_position);
2916 cut_edge_id[0] = 0;
2917 cut_edge_id[1] = 3;
2918 MyMesh.addElemFaceIntersection(1, 1, cut_edge_id, cut_position);
2919 cut_edge_id[0] = 0;
2920 cut_edge_id[1] = 1;
2921 MyMesh.addElemFaceIntersection(1, 3, cut_edge_id, cut_position);
2922
2923 cut_edge_id[0] = 1;
2924 cut_edge_id[1] = 3;
2925 MyMesh.addElemFaceIntersection(2, 2, cut_edge_id, cut_position);
2926 cut_edge_id[0] = 2;
2927 cut_edge_id[1] = 3;
2928 MyMesh.addElemFaceIntersection(2, 3, cut_edge_id, cut_position);
2929 cut_edge_id[0] = 0;
2930 cut_edge_id[1] = 2;
2931 MyMesh.addElemFaceIntersection(2, 5, cut_edge_id, cut_position);
2932
2933 cut_edge_id[0] = 1;
2934 cut_edge_id[1] = 3;
2935 MyMesh.addElemFaceIntersection(3, 0, cut_edge_id, cut_position);
2936 cut_edge_id[0] = 0;
2937 cut_edge_id[1] = 1;
2938 MyMesh.addElemFaceIntersection(3, 3, cut_edge_id, cut_position);
2939
2940 cut_edge_id[0] = 0;
2941 cut_edge_id[1] = 3;
2942 MyMesh.addElemFaceIntersection(4, 1, cut_edge_id, cut_position);
2943 cut_edge_id[0] = 0;
2944 cut_edge_id[1] = 1;
2945 MyMesh.addElemFaceIntersection(4, 3, cut_edge_id, cut_position);
2946 cut_edge_id[0] = 1;
2947 cut_edge_id[1] = 3;
2948 MyMesh.addElemFaceIntersection(4, 4, cut_edge_id, cut_position);
2949
2950 cut_edge_id[0] = 0;
2951 cut_edge_id[1] = 1;
2952 MyMesh.addElemFaceIntersection(6, 3, cut_edge_id, cut_position);
2953 cut_edge_id[0] = 1;
2954 cut_edge_id[1] = 3;
2955 MyMesh.addElemFaceIntersection(6, 4, cut_edge_id, cut_position);
2956
2958 MyMesh.updateTopology();
2959 MyMesh.clearAncestry();
2960 MyMesh.updateEdgeNeighbors();
2961 MyMesh.initCrackTipTopology();
2962
2963 if (debug_print_mesh)
2964 MyMesh.printMesh();
2965
2966 // print crack tip elems
2967 std::set<EFAElement *> crack_tip_elem = MyMesh.getCrackTipElements();
2968
2969 // Test permanent nodes
2970 std::map<unsigned int, EFANode *> permanent_nodes = MyMesh.getPermanentNodes();
2971 std::vector<unsigned int> pn_gold = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
2972 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
2973 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
2974 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50};
2975 CheckNodes(permanent_nodes, pn_gold);
2976
2977 // Test temp nodes
2978 std::map<unsigned int, EFANode *> temp_nodes = MyMesh.getTempNodes();
2979 std::vector<unsigned int> tn_gold;
2980 CheckNodes(temp_nodes, tn_gold);
2981
2982 // Test embedded nodes
2983 std::map<unsigned int, EFANode *> embedded_nodes = MyMesh.getEmbeddedNodes();
2984 std::vector<unsigned int> en_gold = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
2985 CheckNodes(embedded_nodes, en_gold);
2986
2987 // Test child elements
2988 std::vector<EFAElement *> child_elem = MyMesh.getChildElements();
2989 std::vector<unsigned int> ce_gold;
2990 CheckElements(child_elem, ce_gold);
2991
2992 // Test parent elements
2993 std::vector<EFAElement *> parent_elem = MyMesh.getParentElements();
2994 std::vector<unsigned int> pe_gold;
2995 CheckElements(parent_elem, pe_gold);
2996}
2997
2998/* \-------------\-------------\
2999 |* |\ |\
3000 | \------*----|-\-----------|-\
3001 | |\ | |* | |\
3002 | | \---------|-|-\-----*---|-|-\
3003 | | | | | | * | | |
3004 | * | | | | * | | |
3005 |-|-|---------|-|-*---------| | |
3006 |\| | |\| | |\| |
3007 | |-|---------|-\-|---------|-| |
3008 | |*| * | |\| | |\|
3009 | | |----*----|-|-|---------|-|-|
3010 | | | * | | | | | |
3011 | | * | | | | | |
3012 |-|-|---------|-|-|---------| | |
3013 \| | \| | \| |
3014 \-|-----------\-|-----------\ |
3015 \| \| \|
3016 \-------------\--------------
3017*/
3018
3020{
3021 ElementFragmentAlgorithm MyMesh(Moose::out);
3022 case6Mesh(MyMesh);
3023 if (debug_print_mesh)
3024 MyMesh.printMesh();
3025
3026 std::vector<unsigned int> cut_edge_id(2, 0);
3027 std::vector<double> cut_position(2, 0.5);
3028
3029 cut_edge_id[0] = 0;
3030 cut_edge_id[1] = 1;
3031 MyMesh.addElemFaceIntersection(0, 0, cut_edge_id, cut_position);
3032 cut_edge_id[0] = 0;
3033 cut_edge_id[1] = 1;
3034 MyMesh.addElemFaceIntersection(0, 3, cut_edge_id, cut_position);
3035 cut_edge_id[0] = 0;
3036 cut_edge_id[1] = 3;
3037 MyMesh.addElemFaceIntersection(0, 4, cut_edge_id, cut_position);
3038 //
3039 cut_edge_id[0] = 2;
3040 cut_edge_id[1] = 3;
3041 MyMesh.addElemFaceIntersection(2, 0, cut_edge_id, cut_position);
3042
3043 cut_edge_id[0] = 0;
3044 cut_edge_id[1] = 1;
3045 MyMesh.addElemFaceIntersection(2, 2, cut_edge_id, cut_position);
3046
3047 cut_edge_id[0] = 2;
3048 cut_edge_id[1] = 3;
3049 MyMesh.addElemFaceIntersection(2, 3, cut_edge_id, cut_position);
3050
3051 cut_edge_id[0] = 1;
3052 cut_edge_id[1] = 2;
3053 MyMesh.addElemFaceIntersection(2, 4, cut_edge_id, cut_position);
3054
3055 cut_edge_id[0] = 2;
3056 cut_edge_id[1] = 3;
3057 MyMesh.addElemFaceIntersection(2, 5, cut_edge_id, cut_position);
3058
3059 cut_edge_id[0] = 0;
3060 cut_edge_id[1] = 1;
3061 MyMesh.addElemFaceIntersection(3, 0, cut_edge_id, cut_position);
3062
3063 cut_edge_id[0] = 0;
3064 cut_edge_id[1] = 1;
3065 MyMesh.addElemFaceIntersection(3, 3, cut_edge_id, cut_position);
3066
3067 cut_edge_id[0] = 0;
3068 cut_edge_id[1] = 1;
3069 MyMesh.addElemFaceIntersection(6, 3, cut_edge_id, cut_position);
3070
3071 cut_edge_id[0] = 0;
3072 cut_edge_id[1] = 3;
3073 MyMesh.addElemFaceIntersection(6, 4, cut_edge_id, cut_position);
3074
3076 MyMesh.updateTopology();
3077 MyMesh.clearAncestry();
3078 MyMesh.updateEdgeNeighbors();
3079 MyMesh.initCrackTipTopology();
3080
3081 if (debug_print_mesh)
3082 MyMesh.printMesh();
3083
3084 // print crack tip elems
3085 std::set<EFAElement *> crack_tip_elem = MyMesh.getCrackTipElements();
3086
3087 // Test permanent nodes
3088 std::map<unsigned int, EFANode *> permanent_nodes = MyMesh.getPermanentNodes();
3089 std::vector<unsigned int> pn_gold = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
3090 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
3091 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
3092 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46};
3093 CheckNodes(permanent_nodes, pn_gold);
3094
3095 // Test temp nodes
3096 std::map<unsigned int, EFANode *> temp_nodes = MyMesh.getTempNodes();
3097 std::vector<unsigned int> tn_gold;
3098 CheckNodes(temp_nodes, tn_gold);
3099
3100 // Test embedded nodes
3101 std::map<unsigned int, EFANode *> embedded_nodes = MyMesh.getEmbeddedNodes();
3102 std::vector<unsigned int> en_gold = {0, 1, 2, 3, 4, 5, 6, 7, 8};
3103 CheckNodes(embedded_nodes, en_gold);
3104
3105 // Test child elements
3106 std::vector<EFAElement *> child_elem = MyMesh.getChildElements();
3107 std::vector<unsigned int> ce_gold;
3108 CheckElements(child_elem, ce_gold);
3109
3110 // Test parent elements
3111 std::vector<EFAElement *> parent_elem = MyMesh.getParentElements();
3112 std::vector<unsigned int> pe_gold;
3113 CheckElements(parent_elem, pe_gold);
3114}
3115
3116/* \-------------\-------------\
3117 |\ |\ |\
3118 | \-----------|-\-----------|-\
3119 | |\ | |\ | |\
3120 | | \---------|-|-\---------|-|-\
3121 | | | | | | | | |
3122 | | | | | | | O |
3123 |-|-|---------|-|-|---------| | |
3124 |\| | |\| | |\| |
3125 | |-|---------|-\-|------O--|-| |
3126 | |\| | |\| O | |*|
3127 | | |---------|-|-|-O-------|-|-|
3128 | | | | | | | | |
3129 | | | | O | | | |
3130 |-|-|---------|-|-|---------| | |
3131 \| | \| | \| *
3132 \-|------O----\-|-----------\ |
3133 \| *| \|
3134 \-------------\--------*-----
3135*/
3136
3138{
3139 ElementFragmentAlgorithm MyMesh(Moose::out);
3140 case6Mesh(MyMesh);
3141 if (debug_print_mesh)
3142 MyMesh.printMesh();
3143
3144 std::vector<unsigned int> cut_edge_id(2, 0);
3145 std::vector<double> cut_position(2, 0.5);
3146
3147 cut_edge_id[0] = 1;
3148 cut_edge_id[1] = 2;
3149 MyMesh.addElemFaceIntersection(0, 1, cut_edge_id, cut_position);
3150 cut_edge_id[0] = 2;
3151 cut_edge_id[1] = 3;
3152 MyMesh.addElemFaceIntersection(0, 2, cut_edge_id, cut_position);
3153 cut_edge_id[0] = 0;
3154 cut_edge_id[1] = 1;
3155 MyMesh.addElemFaceIntersection(0, 5, cut_edge_id, cut_position);
3156 //
3157 cut_edge_id[0] = 2;
3158 cut_edge_id[1] = 3;
3159 MyMesh.addElemFaceIntersection(1, 0, cut_edge_id, cut_position);
3160
3161 cut_edge_id[0] = 0;
3162 cut_edge_id[1] = 3;
3163 MyMesh.addElemFaceIntersection(1, 1, cut_edge_id, cut_position);
3164
3165 cut_edge_id[0] = 0;
3166 cut_edge_id[1] = 1;
3167 MyMesh.addElemFaceIntersection(1, 2, cut_edge_id, cut_position);
3168
3169 cut_edge_id[0] = 2;
3170 cut_edge_id[1] = 3;
3171 MyMesh.addElemFaceIntersection(1, 3, cut_edge_id, cut_position);
3172
3173 cut_edge_id[0] = 2;
3174 cut_edge_id[1] = 3;
3175 MyMesh.addElemFaceIntersection(1, 5, cut_edge_id, cut_position);
3176
3177 cut_edge_id[0] = 2;
3178 cut_edge_id[1] = 3;
3179 MyMesh.addElemFaceIntersection(3, 2, cut_edge_id, cut_position);
3180
3181 cut_edge_id[0] = 0;
3182 cut_edge_id[1] = 1;
3183 MyMesh.addElemFaceIntersection(3, 5, cut_edge_id, cut_position);
3184
3186 MyMesh.updateTopology();
3187 MyMesh.clearAncestry();
3188 MyMesh.updateEdgeNeighbors();
3189 MyMesh.initCrackTipTopology();
3190
3191 if (debug_print_mesh)
3192 MyMesh.printMesh();
3193
3194 // print crack tip elems
3195 std::set<EFAElement *> crack_tip_elem = MyMesh.getCrackTipElements();
3196
3197 // Test permanent nodes
3198 std::map<unsigned int, EFANode *> permanent_nodes = MyMesh.getPermanentNodes();
3199 std::vector<unsigned int> pn_gold = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
3200 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
3201 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34};
3202 CheckNodes(permanent_nodes, pn_gold);
3203
3204 // Test temp nodes
3205 std::map<unsigned int, EFANode *> temp_nodes = MyMesh.getTempNodes();
3206 std::vector<unsigned int> tn_gold;
3207 CheckNodes(temp_nodes, tn_gold);
3208
3209 // Test embedded nodes
3210 std::map<unsigned int, EFANode *> embedded_nodes = MyMesh.getEmbeddedNodes();
3211 std::vector<unsigned int> en_gold = {0, 1, 2, 3, 4, 5, 6, 7};
3212 CheckNodes(embedded_nodes, en_gold);
3213
3214 // Test child elements
3215 std::vector<EFAElement *> child_elem = MyMesh.getChildElements();
3216 std::vector<unsigned int> ce_gold;
3217 CheckElements(child_elem, ce_gold);
3218
3219 // Test parent elements
3220 std::vector<EFAElement *> parent_elem = MyMesh.getParentElements();
3221 std::vector<unsigned int> pe_gold;
3222 CheckElements(parent_elem, pe_gold);
3223
3224 // Test crack tip elements
3225 unsigned int cte[] = {14, 15, 16};
3226 std::set<unsigned int> cte_gold;
3227 cte_gold.insert(cte, cte + 3);
3228 CheckElements(crack_tip_elem, cte_gold);
3229}
3230
3231// create new Mesh
3232
3233/* \-------------\-------------\-------------\
3234 |\ |\ |\ |\
3235 | \-----------|-\-----------|-\-----------|-\
3236 | | | | | | | |
3237 | | | | | | | |
3238 |-|-----------|-|-----------| |---------- | |
3239 |\| |\| |\| |\|
3240 | |-----------|-\-----------|-|-----------| |
3241 | | | | | | | |
3242 | | | | | | | |
3243 | | | | | | | |
3244 | | | | | | | |
3245 | | | | | | | |
3246 |-|-----------|-|-----------| |---------- | |
3247 |\| |\| |\| |\|
3248 | |-----------|-\-----------|-|-----------| |
3249 | | | | | | | |
3250 | | | | | | | |
3251 |-|-----------|-|-----------|-|-----------| |
3252 \| \| \| \|
3253 \-------------\-------------\--------------
3254*/
3255
3256void
3258{
3259 // 3D test
3260 std::vector<unsigned int> v1 = {0, 1, 5, 4, 16, 17, 21, 20};
3261 MyMesh.add3DElement(v1, 0);
3262
3263 std::vector<unsigned int> v2 = {1, 2, 6, 5, 17, 18, 22, 21};
3264 MyMesh.add3DElement(v2, 1);
3265
3266 std::vector<unsigned int> v3 = {2, 3, 7, 6, 18, 19, 23, 22};
3267 MyMesh.add3DElement(v3, 2);
3268
3269 std::vector<unsigned int> v4 = {4, 5, 9, 8, 20, 21, 25, 24};
3270 MyMesh.add3DElement(v4, 3);
3271
3272 std::vector<unsigned int> v5 = {5, 6, 10, 9, 21, 22, 26, 25};
3273 MyMesh.add3DElement(v5, 4);
3274
3275 std::vector<unsigned int> v6 = {6, 7, 11, 10, 22, 23, 27, 26};
3276 MyMesh.add3DElement(v6, 5);
3277
3278 std::vector<unsigned int> v7 = {8, 9, 13, 12, 24, 25, 29, 28};
3279 MyMesh.add3DElement(v7, 6);
3280
3281 std::vector<unsigned int> v8 = {9, 10, 14, 13, 25, 26, 30, 29};
3282 MyMesh.add3DElement(v8, 7);
3283
3284 std::vector<unsigned int> v9 = {10, 11, 15, 14, 26, 27, 31, 30};
3285 MyMesh.add3DElement(v9, 8);
3286
3287 MyMesh.updateEdgeNeighbors();
3288}
3289
3290/* \-------------\-------------\-------------\
3291 |\ |\ |\ |\
3292 | \-----------|-\-----------|-\-----------|-\
3293 | | | | | | | |
3294 | | | | | | | |
3295 |-|-----------|-|-----------| |---------- | |
3296 |\| |\| |\| |\|
3297 | |-----------|-\-----------|-|-----------| |
3298 | | | | | | | |
3299 * * * * * * * * * * * * * * O | | |
3300 |*| | | |O| | |
3301 | * * * * * * * * * * * * * * O | |
3302 | | | | | | | |
3303 |-|-----------|-|-----------| |---------- | |
3304 |\| |\| |\| |\|
3305 | |-----------|-\-----------|-|-----------| |
3306 | | | | | | | |
3307 | | | | | | | |
3308 |-|-----------|-|-----------|-|-----------| |
3309 \| \| \| \|
3310 \-------------\-------------\--------------
3311*/
3312
3314{
3315 ElementFragmentAlgorithm MyMesh(Moose::out);
3316 case7Mesh(MyMesh);
3317 if (debug_print_mesh)
3318 MyMesh.printMesh();
3319
3320 std::vector<unsigned int> cut_edge_id(2, 0);
3321 std::vector<double> cut_position(2, 0.5);
3322
3323 cut_edge_id[0] = 0;
3324 cut_edge_id[1] = 2;
3325 MyMesh.addElemFaceIntersection(3, 0, cut_edge_id, cut_position);
3326 MyMesh.addElemFaceIntersection(3, 2, cut_edge_id, cut_position);
3327 MyMesh.addElemFaceIntersection(3, 4, cut_edge_id, cut_position);
3328
3329 cut_edge_id[0] = 1;
3330 cut_edge_id[1] = 3;
3331 MyMesh.addElemFaceIntersection(3, 5, cut_edge_id, cut_position);
3332
3333 cut_edge_id[0] = 0;
3334 cut_edge_id[1] = 2;
3335 MyMesh.addElemFaceIntersection(4, 0, cut_edge_id, cut_position);
3336 cut_edge_id[0] = 0;
3337 cut_edge_id[1] = 2;
3338 MyMesh.addElemFaceIntersection(4, 2, cut_edge_id, cut_position);
3339 cut_edge_id[0] = 1;
3340 cut_edge_id[1] = 3;
3341 MyMesh.addElemFaceIntersection(4, 5, cut_edge_id, cut_position);
3342
3344 MyMesh.updateTopology();
3345 MyMesh.clearAncestry();
3346 MyMesh.updateEdgeNeighbors();
3347 MyMesh.initCrackTipTopology();
3348
3349 if (debug_print_mesh)
3350 MyMesh.printMesh();
3351
3352 // print crack tip elems
3353 std::set<EFAElement *> crack_tip_elem = MyMesh.getCrackTipElements();
3354
3355 // Test permanent nodes
3356 std::map<unsigned int, EFANode *> permanent_nodes = MyMesh.getPermanentNodes();
3357 std::vector<unsigned int> pn_gold = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
3358 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
3359 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39};
3360 CheckNodes(permanent_nodes, pn_gold);
3361
3362 // Test temp nodes
3363 std::map<unsigned int, EFANode *> temp_nodes = MyMesh.getTempNodes();
3364 std::vector<unsigned int> tn_gold;
3365 CheckNodes(temp_nodes, tn_gold);
3366
3367 // Test embedded nodes
3368 std::map<unsigned int, EFANode *> embedded_nodes = MyMesh.getEmbeddedNodes();
3369 std::vector<unsigned int> en_gold = {0, 1, 2, 3, 4, 5};
3370 CheckNodes(embedded_nodes, en_gold);
3371}
void case2Mesh(ElementFragmentAlgorithm &MyMesh)
void CheckNodes(std::map< unsigned int, EFANode * > &nodes, std::vector< unsigned int > &gold)
void CheckElements(std::vector< EFAElement * > &elems, std::vector< unsigned int > &gold)
void case2Intersections(ElementFragmentAlgorithm &MyMesh)
void case6Mesh(ElementFragmentAlgorithm &MyMesh)
void case1Common(ElementFragmentAlgorithm &MyMesh)
void case5Mesh(ElementFragmentAlgorithm &MyMesh)
TEST(ElementFragmentAlgorithm, test1a)
const bool debug_print_mesh
void case7Mesh(ElementFragmentAlgorithm &MyMesh)
const std::map< unsigned int, EFANode * > & getEmbeddedNodes()
EFAElement * add3DElement(const std::vector< unsigned int > &quad, unsigned int id)
const std::vector< EFAElement * > & getChildElements()
const std::map< unsigned int, EFANode * > & getTempNodes()
void addElemFaceIntersection(unsigned int elemid, unsigned int faceid, const std::vector< unsigned int > &edgeid, const std::vector< double > &position)
unsigned int add2DElements(std::vector< std::vector< unsigned int > > &quads)
void addElemEdgeIntersection(unsigned int elemid, unsigned int edgeid, double position)
const std::set< EFAElement * > & getCrackTipElements()
EFAElement * add2DElement(const std::vector< unsigned int > &quad, unsigned int id)
bool addFragEdgeIntersection(unsigned int elemid, unsigned int frag_edge_id, double position)
void updateTopology(bool mergeUncutVirtualEdges=true)
const std::vector< EFAElement * > & getParentElements()
const std::map< unsigned int, EFANode * > & getPermanentNodes()