100 MESH_TIMER_START(totalTime,
" Total Time for Mesh Refinement of this Step ");
103 if(meshP1->FEType_ !=
"P1" && meshP1->FEType_ !=
"P2"){
104 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::runtime_error,
"Mesh Refinement only works for Triangular Elements");
107 currentIter_ = iteration;
109 refinementMode_ = refinementMode;
110 if(refinementMode_ ==
"Bisection")
111 this->refinementRestriction_ =
"Bisection";
113 this->dim_ = meshP1->getDimension();
114 this->FEType_ =meshP1->FEType_;
115 this->volumeID_ = meshP1->volumeID_;
116 this->rankRange_=meshP1->rankRange_;
119 SurfaceElementsPtr_Type surfaceTriangleElements = meshP1->getSurfaceTriangleElements();
120 ElementsPtr_Type elementsTmp = meshP1->getElementsC();
122 EdgeElementsPtr_Type edgeElements =meshP1->getEdgeElements();
125 ElementsPtr_Type elements =Teuchos::rcp(
new Elements(*elementsTmp));
127 vec2D_dbl_ptr_Type points = meshP1->getPointsRepeated();
128 this->elementMap_ = meshP1->elementMap_;
129 this->mapUnique_ = meshP1->mapUnique_;
130 this->mapRepeated_=meshP1->mapRepeated_;
131 this->edgeMap_ = meshP1->edgeMap_;
137 this->elementsC_.reset(
new Elements(*elementsTmp));
138 this->pointsRep_.reset(
new std::vector<std::vector<double> >(meshP1->pointsRep_->size(),std::vector<double>(this->dim_,-1.)));
139 *this->pointsRep_ = *meshP1->pointsRep_;
140 this->pointsUni_.reset(
new std::vector<std::vector<double> >( this->mapUnique_->getNodeNumElements(), std::vector<double>(this->dim_,-1. ) ) );
141 *this->pointsUni_ = *meshP1->pointsUni_;
142 this->bcFlagUni_.reset(
new std::vector<int> ( this->mapUnique_->getNodeNumElements(), 0 ) );
143 *this->bcFlagUni_ = *meshP1->bcFlagUni_;
145 this->bcFlagRep_.reset(
new std::vector<int>(meshP1->bcFlagRep_->size()));
146 *this->bcFlagRep_ = *meshP1->bcFlagRep_;
149 this->edgesElementOrder_=meshP1->getEdgeElementOrder();
151 this->numElementsGlob_ = meshP1->numElementsGlob_;
156 meshP1->assignEdgeFlags();
160 if (this->dim_ == 2 || this->dim_ == 3){
163 if(this->comm_->getRank() == 0){
164 std::cout <<
" \t-- Mesh Refinement -- " << std::endl;
165 std::cout <<
"\t__________________________________________________________________________________________________________ " << std::endl;
166 std::cout <<
" " << std::endl;
167 std::cout <<
" \tStart Iteration " << iteration+1 <<
" of "<< this->dim_ <<
"D Mesh Refinement " << std::endl;
168 std::cout <<
" \tNumber of Elements:\t" << this->elementMap_->getGlobalNumElements() << std::endl;
169 std::cout <<
" \tNumber of Nodes:\t" << this->mapUnique_->getGlobalNumElements() << std::endl;
170 std::cout <<
" \tNumber of Edges:\t" << this->edgeMap_->getGlobalNumElements() << std::endl;
171 std::cout <<
"\t__________________________________________________________________________________________________________ " << std::endl;
180 MESH_TIMER_START(preprocessingTimer,
" Step 0:\t Preprocessing");
181 const int myRank = this->comm_->getRank();
183 edgeElements->matchEdgesToElements(this->elementMap_);
186 vec2D_GO_Type elementsOfEdgeGlobal = edgeElements->getElementsOfEdgeGlobal();
187 vec2D_LO_Type elementsOfEdgeLocal = edgeElements->getElementsOfEdgeLocal();
194 vec_GO_Type globalInterfaceIDs;
196 globalInterfaceIDs = edgeElements->determineInterfaceEdges(this->edgeMap_);
197 for(
int i=0; i< elements->numberElements(); i++){
198 this->elementsC_->getElement(i).setPredecessorElement(i);
203 for(
int i=0; i< edgeElements->numberElements(); i++){
204 if(edgeElements->getElement(i).isInterfaceElement()){
205 globalInterfaceIDs.push_back(this->edgeMap_->getGlobalElement(i));
208 sort(globalInterfaceIDs.begin(), globalInterfaceIDs.end());
210 globalInterfaceIDs_ = globalInterfaceIDs;
214 if(surfaceTriangleElements.is_null()){
219 else if(surfaceTriangleElements->numberElements() ==0){
222 surfaceTriangleElements->matchSurfacesToElements(this->elementMap_);
227 int newPointsRepeated= 0;
232 int newEdgesUnique=0;
233 int newEdgesRepeated =0;
237 MESH_TIMER_STOP(preprocessingTimer);
239 MESH_TIMER_START(regularRefinementTimer,
" Step 1:\t Tagging Edges for Refinement");
242 for(
int i=0; i<elements->numberElements();i++){
243 if(elements->getElement(i).isTaggedForRefinement()){
244 numPoints= this->pointsRep_->size();
245 this->
bisectEdges( edgeElements, elements, i, surfaceTriangleElements);
246 newPoints=newPoints + this->pointsRep_->size()-numPoints;
250 MESH_TIMER_STOP(regularRefinementTimer);
261 MESH_TIMER_START(commEdgesTimer,
" Step 2:\t Communicating tagged edges");
262 MapConstPtr_Type edgeMap = this->
getEdgeMap();
266 vec_GO_Type globalInterfaceIDsTagged(0);
268 for(
int i=0; i<globalInterfaceIDs.size(); i++){
269 indE = edgeMap->getLocalElement(globalInterfaceIDs[i]);
270 if(edgeElements->getElement(indE).isTaggedForRefinement()){
271 globalInterfaceIDsTagged.push_back(globalInterfaceIDs[i]);
277 Teuchos::ArrayView<GO> globalEdgesInterfaceArray = Teuchos::arrayViewFromVector( globalInterfaceIDs);
278 Teuchos::ArrayView<GO> globalEdgesInterfaceTaggedArray = Teuchos::arrayViewFromVector( globalInterfaceIDsTagged);
280 MapPtr_Type mapInterfaceEdges =
281 Teuchos::rcp(
new Map_Type( Teuchos::OrdinalTraits<GO>::invalid(), globalEdgesInterfaceArray, 0, this->comm_) );
282 MapPtr_Type mapInterfaceEdgesTagged =
283 Teuchos::rcp(
new Map_Type( Teuchos::OrdinalTraits<GO>::invalid(), globalEdgesInterfaceTaggedArray, 0, this->comm_) );
286 MultiVectorGOPtr_Type taggedEdgesGlobal = Teuchos::rcp(
new MultiVectorGO_Type(mapInterfaceEdges, 1 ) );
287 taggedEdgesGlobal->putScalar(0);
290 MultiVectorGOPtr_Type isActiveEdge = Teuchos::rcp(
new MultiVectorGO_Type( mapInterfaceEdgesTagged, 1 ) );
291 isActiveEdge->putScalar( (LO) 1);
293 taggedEdgesGlobal->importFromVector(isActiveEdge,
true,
"Insert");
294 Teuchos::ArrayRCP< const GO > tags = taggedEdgesGlobal->getData( 0 );
299 for (
int i=0; i<tags.size(); i++) {
301 ind = edgeMap->getLocalElement(globalInterfaceIDs[i]);
302 newPointsRepeated ++;
303 if(!edgeElements->getElement(ind).isTaggedForRefinement()){
304 edgeElements->getElement(ind).tagForRefinement();
307 globalInterfaceIDsTagged.push_back(globalInterfaceIDs[i]);
312 MESH_TIMER_STOP(commEdgesTimer);
321 MESH_TIMER_START(checkTimer,
" Step 3:\t Checking Restrictions");
322 this->
refinementRestrictions(meshP1, elements ,edgeElements, surfaceTriangleElements, newPoints, newPointsRepeated, globalInterfaceIDsTagged, mapInterfaceEdges, newElements);
324 sort(globalInterfaceIDsTagged.begin(), globalInterfaceIDsTagged.end());
326 MESH_TIMER_STOP(checkTimer);
335 MESH_TIMER_START(nodeTimer,
" Step 4:\t Updating Node Map");
337 int maxRank = std::get<1>(this->rankRange_);
342 vec_GO_Type globalProcs(0);
343 for (
int i=0; i<= maxRank; i++)
344 globalProcs.push_back(i);
346 Teuchos::ArrayView<GO> globalProcArray = Teuchos::arrayViewFromVector( globalProcs);
348 vec_GO_Type localProc(0);
349 localProc.push_back(this->comm_->getRank());
350 Teuchos::ArrayView<GO> localProcArray = Teuchos::arrayViewFromVector( localProc);
352 MapPtr_Type mapGlobalProc =
353 Teuchos::rcp(
new Map_Type( Teuchos::OrdinalTraits<GO>::invalid(), globalProcArray, 0, this->comm_) );
355 MapPtr_Type mapProc =
356 Teuchos::rcp(
new Map_Type( Teuchos::OrdinalTraits<GO>::invalid(), localProcArray, 0, this->comm_) );
358 this->
buildNodeMap(edgeElements, mapGlobalProc, mapProc, newPoints, newPointsRepeated);
360 MESH_TIMER_STOP(nodeTimer);
370 MESH_TIMER_START(irregRefTimer,
" Step 5:\t Irregular Refinement");
371 this->
refineMeshRegIreg(elements, edgeElements, newElements,edgeMap, surfaceTriangleElements);
372 MESH_TIMER_STOP(irregRefTimer);
381 MESH_TIMER_START(elementMapTimer,
" Step 6:\t Updating Element Map");
382 MapConstPtr_Type elementMap = meshP1->getElementMap();
384 MultiVectorLOPtr_Type exportLocalEntry = Teuchos::rcp(
new MultiVectorLO_Type( mapProc, 1 ) );
385 exportLocalEntry->putScalar( (LO) newElements );
388 MultiVectorLOPtr_Type isActiveElement= Teuchos::rcp(
new MultiVectorLO_Type( mapGlobalProc, 1 ) );
389 isActiveElement->putScalar( (LO) 0 );
390 isActiveElement->importFromVector( exportLocalEntry,
false,
"Insert");
393 Teuchos::ArrayRCP< const LO > elementsRank = isActiveElement->getData(0);
395 Teuchos::ArrayView<const GO> elementList = elementMap->getNodeElementList();
396 std::vector<GO> vecGlobalIDsElements = Teuchos::createVector( elementList );
399 int offsetElements = elementMap->getGlobalNumElements();
402 GO procOffsetElements=0;
403 for(
int i=0; i< myRank; i++)
404 procOffsetElements = procOffsetElements + elementsRank[i];
406 for (
int i=0; i<newElements; i++){
407 vecGlobalIDsElements.push_back( i + offsetElements + procOffsetElements);
410 Teuchos::RCP<std::vector<GO> > elementsGlobMapping = Teuchos::rcp(
new std::vector<GO>( vecGlobalIDsElements ) );
411 Teuchos::ArrayView<GO> elementsGlobMappingArray = Teuchos::arrayViewFromVector( *elementsGlobMapping);
413 this->elementMap_.reset(
new Map<LO,GO,NO>( Teuchos::OrdinalTraits<GO>::invalid(), elementsGlobMappingArray, 0, this->comm_) );
416 this->numElementsGlob_ = this->elementMap_->getMaxAllGlobalIndex()+1;
417 MESH_TIMER_STOP(elementMapTimer);
427 MESH_TIMER_START(uniqueEdgesTimer,
" Step 7:\t Making Edges Unique");
428 vec2D_GO_Type combinedEdgeElements;
429 this->edgeElements_->sortUniqueAndSetGlobalIDsParallel(this->elementMap_,combinedEdgeElements);
430 MESH_TIMER_STOP(uniqueEdgesTimer);
442 MESH_TIMER_START(edgeMapTimer,
" Step 8:\t Creating EdgeMap");
444 MESH_TIMER_STOP(edgeMapTimer);
452 MESH_TIMER_START(elementsOfEdgeTimer,
" Step 9:\t Updating ElementsOfEdgeLocal/Global");
453 this->edgeElements_->setElementsEdges( combinedEdgeElements );
455 this->edgeElements_->setUpElementsOfEdge( this->elementMap_, this->edgeMap_);
459 MESH_TIMER_STOP(elementsOfEdgeTimer);
461 MESH_TIMER_START(elementsOfSurfaceTimer,
" Step 10: Updating ElementsOfSurfaceLocal/Global");
463 vec2D_GO_Type combinedSurfaceElements;
465 this->surfaceTriangleElements_->sortUniqueAndSetGlobalIDsParallel(this->elementMap_,combinedSurfaceElements);
467 this->surfaceTriangleElements_->setElementsSurface( combinedSurfaceElements );
469 this->surfaceTriangleElements_->setUpElementsOfSurface( this->elementMap_, this->edgeMap_, this->edgeElements_);
471 MESH_TIMER_STOP(elementsOfSurfaceTimer);
473 vec2D_GO_Type elementsOfSurfaceGlobal = this->surfaceTriangleElements_->getElementsOfSurfaceGlobal();
475 vec2D_LO_Type elementsOfSurfaceLocal = this->surfaceTriangleElements_->getElementsOfSurfaceLocal();
478 MESH_TIMER_STOP(totalTime);
481 if(this->comm_->getRank() == 0){
482 std::cout <<
"\t__________________________________________________________________________________________________________ " << std::endl;
483 std::cout <<
" " << std::endl;
484 std::cout <<
" \t... finished Iteration " << iteration+1 <<
" of " << this->dim_ <<
"D Mesh Refinement " << std::endl;
485 std::cout <<
" \tNumber of new Elements:\t" << this->elementMap_->getGlobalNumElements() - meshP1->elementMap_-> getGlobalNumElements() << std::endl;
486 std::cout <<
" \tNumber of new Nodes:\t" << this->mapUnique_->getGlobalNumElements()- meshP1->mapUnique_-> getGlobalNumElements() << std::endl;
487 std::cout <<
" \tNumber of new Edges:\t" << this->edgeMap_->getGlobalNumElements()- meshP1->edgeMap_-> getGlobalNumElements() << std::endl;
488 std::cout <<
"\t__________________________________________________________________________________________________________ " << std::endl;
489 std::cout <<
" " << std::endl;
492 if(writeRefinementTime_ )
493 Teuchos::TimeMonitor::report(std::cout,
"Mesh Refinement");
498 outputMesh->dim_ = this->dim_ ;
499 outputMesh->FEType_ = this->FEType_ ;
500 outputMesh->rankRange_ = this->rankRange_;
502 outputMesh->elementMap_ = this->elementMap_ ;
503 outputMesh->mapUnique_ = this->mapUnique_ ;
504 outputMesh->mapRepeated_ = this->mapRepeated_;
505 outputMesh->edgeMap_ = this->edgeMap_ ;
507 outputMesh->elementsC_ = this->elementsC_;
508 outputMesh->edgeElements_ = this->edgeElements_;
509 outputMesh->surfaceTriangleElements_ = this->surfaceTriangleElements_;
511 outputMesh->pointsRep_ = this->pointsRep_ ;
512 outputMesh->pointsUni_ = this->pointsUni_;
514 outputMesh->bcFlagUni_ = this->bcFlagUni_ ;
515 outputMesh->bcFlagRep_ = this->bcFlagRep_ ;
518 outputMesh->edgesElementOrder_ = this->edgesElementOrder_;
519 outputMesh->numElementsGlob_ = this->numElementsGlob_ ;
2541 if(this->dim_ == 3){
2546 vec_int_Type midPointInd( 0 );
2547 vec_int_Type edgeNumbers = edgeElements->getEdgesOfElement(indexElement);
2548 vec_int_Type edgeNumbersUntagged(0);
2552 vec_int_Type nodeInd1(0);
2553 vec_int_Type nodeInd2(0);
2554 bool firstEdge =
true;
2555 for(
int i=0; i<6; i++){
2557 if(edgeElements->getElement(edgeNumbers[i]).isTaggedForRefinement() && firstEdge ==
false){
2558 nodeInd2.push_back(edgeElements->getElement(edgeNumbers[i]).getNode(0));
2559 nodeInd2.push_back(edgeElements->getElement(edgeNumbers[i]).getNode(1));
2562 if(edgeElements->getElement(edgeNumbers[i]).isTaggedForRefinement() && firstEdge ==
true){
2563 nodeInd1.push_back(edgeElements->getElement(edgeNumbers[i]).getNode(0));
2564 nodeInd1.push_back(edgeElements->getElement(edgeNumbers[i]).getNode(1));
2569 sort( nodeInd1.begin(), nodeInd1.end() );
2570 sort( nodeInd2.begin(), nodeInd2.end() );
2572 vec_int_Type nodeInd = {nodeInd1[0],nodeInd1[1],nodeInd2[0],nodeInd2[1]};
2584 vec_int_Type edgeNumbersTmp = edgeNumbers;
2585 for(
int i=0; i<6; i++){
2586 if(edgeElements->getElement(edgeNumbersTmp[i]).getNode(0) == nodeInd[0] || edgeElements->getElement(edgeNumbersTmp[i]).getNode(1) == nodeInd[0]){
2587 if(edgeElements->getElement(edgeNumbersTmp[i]).getNode(0) == nodeInd[1] || edgeElements->getElement(edgeNumbersTmp[i]).getNode(1) == nodeInd[1])
2588 edgeNumbers[0] = edgeNumbersTmp[i];
2589 else if(edgeElements->getElement(edgeNumbersTmp[i]).getNode(0) == nodeInd[2] || edgeElements->getElement(edgeNumbersTmp[i]).getNode(1) == nodeInd[2])
2590 edgeNumbers[1] = edgeNumbersTmp[i];
2591 else if(edgeElements->getElement(edgeNumbersTmp[i]).getNode(0) == nodeInd[3] || edgeElements->getElement(edgeNumbersTmp[i]).getNode(1) == nodeInd[3])
2592 edgeNumbers[2] = edgeNumbersTmp[i];
2594 else if(edgeElements->getElement(edgeNumbersTmp[i]).getNode(0) == nodeInd[1] || edgeElements->getElement(edgeNumbersTmp[i]).getNode(1) == nodeInd[1]){
2595 if(edgeElements->getElement(edgeNumbersTmp[i]).getNode(0) == nodeInd[2] || edgeElements->getElement(edgeNumbersTmp[i]).getNode(1) == nodeInd[2])
2596 edgeNumbers[3] = edgeNumbersTmp[i];
2597 else if(edgeElements->getElement(edgeNumbersTmp[i]).getNode(0) == nodeInd[3] || edgeElements->getElement(edgeNumbersTmp[i]).getNode(1) == nodeInd[3])
2598 edgeNumbers[4] = edgeNumbersTmp[i];
2600 else if(edgeElements->getElement(edgeNumbersTmp[i]).getNode(0) == nodeInd[2] || edgeElements->getElement(edgeNumbersTmp[i]).getNode(1) == nodeInd[2]){
2601 if(edgeElements->getElement(edgeNumbersTmp[i]).getNode(0) == nodeInd[3] || edgeElements->getElement(edgeNumbersTmp[i]).getNode(1) == nodeInd[3])
2602 edgeNumbers[5] = edgeNumbersTmp[i];
2617 vec_int_Type surfaceElementsIDs = surfaceTriangleElements->getSurfacesOfElement(indexElement);
2618 vec2D_int_Type originTriangles(4,vec_int_Type(3));
2620 originTriangles[0] = {nodeInd[0], nodeInd[1], nodeInd[2] };
2621 originTriangles[1] = {nodeInd[0], nodeInd[1], nodeInd[3] };
2622 originTriangles[2] = {nodeInd[0], nodeInd[2], nodeInd[3] };
2623 originTriangles[3] = {nodeInd[1], nodeInd[2], nodeInd[3] };
2625 vec_int_Type originFlag(4,this->volumeID_);
2627 vec_bool_Type interfaceSurface(4);
2628 vec_LO_Type triTmp(3);
2629 vec_int_Type originTriangleTmp(3);
2631 for(
int i=0; i< 4 ; i++){
2632 originTriangleTmp = originTriangles[i];
2633 sort(originTriangleTmp.begin(),originTriangleTmp.end());
2634 for(
int j=0; j<4 ; j++){
2635 FiniteElement surfaceTmp = surfaceTriangleElements->getElement(surfaceElementsIDs[j]);
2636 triTmp = surfaceTmp.getVectorNodeList();
2637 sort(triTmp.begin(),triTmp.end());
2638 if(triTmp[0] == originTriangleTmp[0] && triTmp[1] == originTriangleTmp[1] && triTmp[2] == originTriangleTmp[2] ) {
2639 originFlag[i] = surfaceTmp.getFlag();
2640 interfaceSurface[i] = surfaceTmp.isInterfaceElement();
2653 for(
int i=0; i<6; i++){
2654 if(edgeElements->getElement(edgeNumbers[i]).isTaggedForRefinement()){
2655 midPointInd.push_back(edgeElements->getMidpoint(edgeNumbers[i]));
2663 vec2D_int_Type newElements(4, vec_int_Type( 0 ));
2664 vec2D_int_Type newEdges(24,vec_int_Type(0));
2665 vec2D_int_Type newTriangles(16,vec_int_Type(0));
2666 vec_int_Type newTrianglesFlag(16) ;
2667 vec_bool_Type isInterfaceSurface(16);
2668 vec_int_Type edgeFlags(24);
2669 vec_bool_Type isInterfaceEdge(24);
2670 vec_GO_Type predecessorElement(24);
2672 vec2D_LO_Type newTriangleEdgeIDs(4,vec_LO_Type(12));
2681 (newElements)[0]={nodeInd[0],nodeInd[2], midPointInd[0],midPointInd[1]};
2683 (newEdges)[0] = {nodeInd[0] ,nodeInd[2]};
2684 (newEdges)[1] = {nodeInd[0] ,midPointInd[0]};
2685 (newEdges)[2] = {nodeInd[0] ,midPointInd[1]};
2686 (newEdges)[3] = {nodeInd[2] ,midPointInd[0]};
2687 (newEdges)[4] = {nodeInd[2] ,midPointInd[1]};
2688 (newEdges)[5] = {midPointInd[0] ,midPointInd[1]};
2690 edgeFlags[0]=edgeElements->getElement(edgeNumbers[1]).getFlag();
2691 edgeFlags[1]=this->bcFlagRep_->at(midPointInd[0]);
2692 edgeFlags[2]=originFlag[2];
2693 edgeFlags[3]=originFlag[0];
2694 edgeFlags[4]=this->bcFlagRep_->at(midPointInd[1]);
2695 edgeFlags[5]=this->volumeID_;
2697 isInterfaceEdge[0] = edgeElements->getElement(edgeNumbers[1]).isInterfaceElement();
2698 isInterfaceEdge[1] = edgeElements->getElement(edgeNumbers[0]).isInterfaceElement();
2699 isInterfaceEdge[2] = interfaceSurface[2];
2700 isInterfaceEdge[3] = interfaceSurface[0];
2701 isInterfaceEdge[4] = edgeElements->getElement(edgeNumbers[5]).isInterfaceElement();
2702 isInterfaceEdge[5] =
false;
2704 predecessorElement[0] = this->edgeMap_->getGlobalElement(edgeNumbers[1]);
2705 predecessorElement[1] = this->edgeMap_->getGlobalElement(edgeNumbers[0]);
2706 predecessorElement[2] = -1;
2707 predecessorElement[3] = -1;
2708 predecessorElement[4] = this->edgeMap_->getGlobalElement(edgeNumbers[5]);
2709 predecessorElement[5] = -1;
2712 newTriangles[0]= {nodeInd[0],nodeInd[2],midPointInd[0]};
2713 newTriangles[1]= {nodeInd[0],nodeInd[2],midPointInd[1]};
2714 newTriangles[2]= {nodeInd[0],midPointInd[0],midPointInd[1]};
2715 newTriangles[3]= {nodeInd[2],midPointInd[0],midPointInd[1]};
2717 newTrianglesFlag[0]= originFlag[0];
2718 newTrianglesFlag[1]= originFlag[2];
2719 newTrianglesFlag[2]= this->volumeID_;
2720 newTrianglesFlag[3]= this->volumeID_;
2722 isInterfaceSurface[0]= interfaceSurface[0];
2723 isInterfaceSurface[1]= interfaceSurface[2];
2724 isInterfaceSurface[2]=
false;
2725 isInterfaceSurface[3]=
false;
2727 newTriangleEdgeIDs[0]={0,1,3,0,2,4,1,2,5,3,4,5};
2730 (newElements)[1]={nodeInd[1],nodeInd[2],midPointInd[0],midPointInd[1]};
2732 (newEdges)[6] = {nodeInd[1] ,nodeInd[2]};
2733 (newEdges)[7] = {nodeInd[1] ,midPointInd[0]};
2734 (newEdges)[8] = {nodeInd[1] ,midPointInd[1]};
2735 (newEdges)[9] = {nodeInd[2] ,midPointInd[0]};
2736 (newEdges)[10] = {nodeInd[2] ,midPointInd[1]};
2737 (newEdges)[11] = {midPointInd[0] ,midPointInd[1]};
2739 edgeFlags[6]=edgeElements->getElement(edgeNumbers[3]).getFlag();
2740 edgeFlags[7]=edgeElements->getElement(edgeNumbers[0]).getFlag();
2741 edgeFlags[8]=originFlag[3];
2742 edgeFlags[9]=originFlag[0];
2743 edgeFlags[10]=this->bcFlagRep_->at(midPointInd[1]);
2744 edgeFlags[11]=this->volumeID_;
2746 isInterfaceEdge[6] = edgeElements->getElement(edgeNumbers[3]).isInterfaceElement();
2747 isInterfaceEdge[7] = edgeElements->getElement(edgeNumbers[0]).isInterfaceElement();
2748 isInterfaceEdge[8] = interfaceSurface[3];
2749 isInterfaceEdge[9] = interfaceSurface[0];
2750 isInterfaceEdge[10] = edgeElements->getElement(edgeNumbers[5]).isInterfaceElement();
2751 isInterfaceEdge[11] =
false;
2753 predecessorElement[6] = this->edgeMap_->getGlobalElement(edgeNumbers[3]);
2754 predecessorElement[7] = this->edgeMap_->getGlobalElement(edgeNumbers[0]);
2755 predecessorElement[8] = -1;
2756 predecessorElement[9] = -1;
2757 predecessorElement[10] = this->edgeMap_->getGlobalElement(edgeNumbers[5]);
2758 predecessorElement[11] = -1;
2761 newTriangles[4]= {nodeInd[1],nodeInd[2],midPointInd[0]};
2762 newTriangles[5]= {nodeInd[1],nodeInd[2],midPointInd[1]};
2763 newTriangles[6]= {nodeInd[1],midPointInd[0],midPointInd[1]};
2764 newTriangles[7]= {nodeInd[2],midPointInd[0],midPointInd[1]};
2766 newTrianglesFlag[4]= originFlag[0];
2767 newTrianglesFlag[5]= originFlag[3];
2768 newTrianglesFlag[6]= this->volumeID_;
2769 newTrianglesFlag[7]= this->volumeID_;
2771 isInterfaceSurface[4]= interfaceSurface[0];
2772 isInterfaceSurface[5]= interfaceSurface[3];
2773 isInterfaceSurface[6]=
false;
2774 isInterfaceSurface[7]=
false;
2776 newTriangleEdgeIDs[1]={6,7,9,6,8,10,7,8,11,9,10,11};
2779 (newElements)[2]={nodeInd[0],nodeInd[3],midPointInd[0],midPointInd[1]};
2781 (newEdges)[12] = {nodeInd[0] ,nodeInd[3]};
2782 (newEdges)[13] = {nodeInd[0] ,midPointInd[0]};
2783 (newEdges)[14] = {nodeInd[0] ,midPointInd[1]};
2784 (newEdges)[15] = {nodeInd[3] ,midPointInd[0]};
2785 (newEdges)[16] = {nodeInd[3] ,midPointInd[1]};
2786 (newEdges)[17] = {midPointInd[0] ,midPointInd[1]};
2788 edgeFlags[12]=edgeElements->getElement(edgeNumbers[2]).getFlag();
2789 edgeFlags[13]=edgeElements->getElement(edgeNumbers[0]).getFlag();
2790 edgeFlags[14]=originFlag[2];
2791 edgeFlags[15]=originFlag[1];
2792 edgeFlags[16]=edgeElements->getElement(edgeNumbers[5]).getFlag();;
2793 edgeFlags[17]=this->volumeID_;
2795 isInterfaceEdge[12] = edgeElements->getElement(edgeNumbers[2]).isInterfaceElement();
2796 isInterfaceEdge[13] = edgeElements->getElement(edgeNumbers[0]).isInterfaceElement();
2797 isInterfaceEdge[14] = interfaceSurface[2];
2798 isInterfaceEdge[15] = interfaceSurface[1];
2799 isInterfaceEdge[16] = edgeElements->getElement(edgeNumbers[5]).isInterfaceElement();
2800 isInterfaceEdge[17] =
false;
2802 predecessorElement[12] = this->edgeMap_->getGlobalElement(edgeNumbers[2]);
2803 predecessorElement[13] = this->edgeMap_->getGlobalElement(edgeNumbers[0]);
2804 predecessorElement[14] = -1;
2805 predecessorElement[15] = -1;
2806 predecessorElement[16] = this->edgeMap_->getGlobalElement(edgeNumbers[5]);
2807 predecessorElement[17] = -1;
2810 newTriangles[8]= {nodeInd[0],nodeInd[3],midPointInd[0]};
2811 newTriangles[9]= {nodeInd[0],nodeInd[3],midPointInd[1]};
2812 newTriangles[10]= {nodeInd[0],midPointInd[0],midPointInd[1]};
2813 newTriangles[11]= {nodeInd[3],midPointInd[0],midPointInd[1]};
2815 newTrianglesFlag[8]= originFlag[1];
2816 newTrianglesFlag[9]= originFlag[2];
2817 newTrianglesFlag[10]= this->volumeID_;
2818 newTrianglesFlag[11]= this->volumeID_;
2820 isInterfaceSurface[8]= interfaceSurface[1];
2821 isInterfaceSurface[9]= interfaceSurface[2];
2822 isInterfaceSurface[10]=
false;
2823 isInterfaceSurface[11]=
false;
2825 newTriangleEdgeIDs[2]={8,9,11,8,10,12,9,10,13,11,12,13};
2829 (newElements)[3]={nodeInd[1],nodeInd[3],midPointInd[0],midPointInd[1]};
2831 (newEdges)[18] = {nodeInd[1] ,nodeInd[3]};
2832 (newEdges)[19] = {nodeInd[1] ,midPointInd[0]};
2833 (newEdges)[20] = {nodeInd[1] ,midPointInd[1]};
2834 (newEdges)[21] = {nodeInd[3] ,midPointInd[0]};
2835 (newEdges)[22] = {nodeInd[3] ,midPointInd[1]};
2836 (newEdges)[23] = {midPointInd[0] ,midPointInd[1]};
2838 edgeFlags[18]=edgeElements->getElement(edgeNumbers[4]).getFlag();
2839 edgeFlags[19]=edgeElements->getElement(edgeNumbers[0]).getFlag();
2840 edgeFlags[20]=originFlag[3];
2841 edgeFlags[21]=originFlag[1];
2842 edgeFlags[22]=edgeElements->getElement(edgeNumbers[5]).getFlag();;
2843 edgeFlags[23]=this->volumeID_;
2845 isInterfaceEdge[18] = edgeElements->getElement(edgeNumbers[4]).isInterfaceElement();
2846 isInterfaceEdge[19] = edgeElements->getElement(edgeNumbers[0]).isInterfaceElement();
2847 isInterfaceEdge[20] = interfaceSurface[3];
2848 isInterfaceEdge[21] = interfaceSurface[1];
2849 isInterfaceEdge[22] = edgeElements->getElement(edgeNumbers[5]).isInterfaceElement();
2850 isInterfaceEdge[23] =
false;
2852 predecessorElement[18] = this->edgeMap_->getGlobalElement(edgeNumbers[4]);
2853 predecessorElement[19] = this->edgeMap_->getGlobalElement(edgeNumbers[0]);
2854 predecessorElement[20] = -1;
2855 predecessorElement[21] = -1;
2856 predecessorElement[22] = this->edgeMap_->getGlobalElement(edgeNumbers[5]);
2857 predecessorElement[23] = -1;
2860 newTriangles[12]= {nodeInd[1],nodeInd[3],midPointInd[0]};
2861 newTriangles[13]= {nodeInd[1],nodeInd[3],midPointInd[1]};
2862 newTriangles[14]= {nodeInd[1],midPointInd[0],midPointInd[1]};
2863 newTriangles[15]= {nodeInd[3],midPointInd[0],midPointInd[1]};
2865 newTrianglesFlag[12]= originFlag[1];
2866 newTrianglesFlag[13]= originFlag[3];
2867 newTrianglesFlag[14]= this->volumeID_;
2868 newTrianglesFlag[15]= this->volumeID_;
2870 isInterfaceSurface[12]= interfaceSurface[1];
2871 isInterfaceSurface[13]= interfaceSurface[3];
2872 isInterfaceSurface[14]=
false;
2873 isInterfaceSurface[15]=
false;
2875 newTriangleEdgeIDs[3]={18,19,21,18,20,22,19,20,23,21,22,23};
2880 int offsetElements = this->elementsC_->numberElements();
2881 int offsetEdges = this->edgeElements_->numberElements();
2882 for(
int i=0;i<4; i++){
2883 sort( newElements.at(i).begin(), newElements.at(i).end() );
2885 feNew.setFiniteElementRefinementType(
"irregular");
2886 feNew.setPredecessorElement(indexElement);
2888 this->elementsC_->addElement(feNew);
2890 this->elementsC_->switchElement(indexElement,feNew);
2894 for(
int i=0;i<24; i++){
2895 sort( newEdges.at(i).begin(), newEdges.at(i).end() );
2897 feNew.setInterfaceElement(isInterfaceEdge[i]);
2898 feNew.setPredecessorElement(predecessorElement[i]);
2900 this->edgeElements_->addEdge(feNew,i/6+offsetElements);
2903 this->edgeElements_->addEdge(feNew,indexElement);
2907 int offsetSurface=0;
2908 for(
int i=0;i<16; i++){
2909 sort( newTriangles.at(i).begin(), newTriangles.at(i).end() );
2911 feNew.setInterfaceElement(isInterfaceSurface[i]);
2913 if(newTrianglesFlag[i]!=0 && newTrianglesFlag[i]!=this->volumeID_){
2914 if ( !this->elementsC_->getElement(i/4+offsetElements).subElementsInitialized() )
2915 this->elementsC_->getElement(i/4+offsetElements).initializeSubElements( this->FEType_, this->dim_ -1) ;
2916 this->elementsC_->getElement(i/4+offsetElements).addSubElement(feNew);
2918 this->surfaceTriangleElements_->addSurface(feNew, i/4+offsetElements);
2921 if(newTrianglesFlag[i]!=0 && newTrianglesFlag[i]!=this->volumeID_){
2922 if ( !this->elementsC_->getElement(indexElement).subElementsInitialized() )
2923 this->elementsC_->getElement(indexElement).initializeSubElements( this->FEType_, this->dim_ -1) ;
2924 this->elementsC_->getElement(indexElement).addSubElement(feNew);
2926 this->surfaceTriangleElements_->addSurface(feNew, indexElement);
2931 for(
int i=0;i<4; i++){
2933 element = this->elementsC_->getElement(i+offsetElements);
2935 element = this->elementsC_->getElement(indexElement);
2937 for(
int j=0; j<24 ; j++){
2938 FiniteElement feEdge = this->edgeElements_->getElement(j+offsetEdges);
2939 if(feEdge.getFlag() != this->volumeID_){
2941 element.addSubElement( feEdge );
2942 else if ( !element.subElementsInitialized() ){
2943 element.initializeSubElements(
"P1", 1 );
2944 element.addSubElement( feEdge );
2948 ElementsPtr_Type surfaces = element.getSubElements();
2950 surfaces->setToCorrectElement( feEdge );
2958 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::runtime_error,
"The Type 4 irregular Refinement Method you requested is only applicable to a 3 dimensional Mesh. Please reconsider.");
2979 if(this->dim_ == 3){
2984 vec_int_Type midPointInd(0);
2985 vec_int_Type edgeNumbers = edgeElements->getEdgesOfElement(indexElement);
2986 vec_int_Type edgeNumbersUntagged(0);
2988 vec_int_Type nodeInd(0);
2989 for(
int i=0; i<6; i++){
2990 if(edgeElements->getElement(edgeNumbers[i]).isTaggedForRefinement()){
2991 nodeInd.push_back(edgeElements->getElement(edgeNumbers[i]).getNode(0));
2992 nodeInd.push_back(edgeElements->getElement(edgeNumbers[i]).getNode(1));
2995 edgeNumbersUntagged.push_back(edgeNumbers[i]);
2997 sort( nodeInd.begin(), nodeInd.end() );
2998 vec_int_Type nodeIndTmp = nodeInd;
2999 nodeInd.erase( unique( nodeInd.begin(), nodeInd.end() ), nodeInd.end() );
3003 int entryCommonNode;
3004 vec_int_Type leftOverNodes(0);
3005 for(
int i=0; i<3; i++){
3006 if(nodeIndTmp[i] == nodeIndTmp[i+1]){
3007 commonNode=nodeIndTmp[i];
3012 for(
int i=0; i<3; i++){
3013 if(nodeInd[i] != commonNode){
3014 leftOverNodes.push_back(nodeInd[i]);
3020 vec_dbl_Type length(2);
3021 vec_dbl_Type P1(3),P2(3);
3022 double maxLength=0.0;
3026 for(
int i=0;i<2;i++){
3028 p2ID =leftOverNodes[i];
3029 P1 = this->pointsRep_->at(p1ID);
3030 P2 = this->pointsRep_->at(p2ID);
3031 length[i] = std::sqrt(std::pow(P1[0]-P2[0],2)+std::pow(P1[1]-P2[1],2)+std::pow(P1[2]-P2[2],2));
3032 if(length[i] > maxLength){
3033 maxLength = length[i];
3039 nodeInd[0] = commonNode;
3040 nodeInd[1] = leftOverNodes[minEntry];
3041 nodeInd[2] = leftOverNodes[maxEntry];
3045 for(
int i=0; i<4; i++){
3046 if(edgeElements->getElement(edgeNumbersUntagged[i]).getNode(0) == nodeInd[0])
3047 nodeInd.push_back(edgeElements->getElement(edgeNumbersUntagged[i]).getNode(1));
3048 else if(edgeElements->getElement(edgeNumbersUntagged[i]).getNode(1) == nodeInd[0])
3049 nodeInd.push_back(edgeElements->getElement(edgeNumbersUntagged[i]).getNode(0));
3062 vec_int_Type edgeNumbersTmp = edgeNumbers;
3063 for(
int i=0; i<6; i++){
3064 if(edgeElements->getElement(edgeNumbersTmp[i]).getNode(0) == nodeInd[0] || edgeElements->getElement(edgeNumbersTmp[i]).getNode(1) == nodeInd[0]){
3065 if(edgeElements->getElement(edgeNumbersTmp[i]).getNode(0) == nodeInd[1] || edgeElements->getElement(edgeNumbersTmp[i]).getNode(1) == nodeInd[1])
3066 edgeNumbers[0] = edgeNumbersTmp[i];
3067 else if(edgeElements->getElement(edgeNumbersTmp[i]).getNode(0) == nodeInd[2] || edgeElements->getElement(edgeNumbersTmp[i]).getNode(1) == nodeInd[2])
3068 edgeNumbers[1] = edgeNumbersTmp[i];
3069 else if(edgeElements->getElement(edgeNumbersTmp[i]).getNode(0) == nodeInd[3] || edgeElements->getElement(edgeNumbersTmp[i]).getNode(1) == nodeInd[3])
3070 edgeNumbers[2] = edgeNumbersTmp[i];
3072 else if(edgeElements->getElement(edgeNumbersTmp[i]).getNode(0) == nodeInd[1] || edgeElements->getElement(edgeNumbersTmp[i]).getNode(1) == nodeInd[1]){
3073 if(edgeElements->getElement(edgeNumbersTmp[i]).getNode(0) == nodeInd[2] || edgeElements->getElement(edgeNumbersTmp[i]).getNode(1) == nodeInd[2])
3074 edgeNumbers[3] = edgeNumbersTmp[i];
3075 else if(edgeElements->getElement(edgeNumbersTmp[i]).getNode(0) == nodeInd[3] || edgeElements->getElement(edgeNumbersTmp[i]).getNode(1) == nodeInd[3])
3076 edgeNumbers[4] = edgeNumbersTmp[i];
3078 else if(edgeElements->getElement(edgeNumbersTmp[i]).getNode(0) == nodeInd[2] || edgeElements->getElement(edgeNumbersTmp[i]).getNode(1) == nodeInd[2]){
3079 if(edgeElements->getElement(edgeNumbersTmp[i]).getNode(0) == nodeInd[3] || edgeElements->getElement(edgeNumbersTmp[i]).getNode(1) == nodeInd[3])
3080 edgeNumbers[5] = edgeNumbersTmp[i];
3095 vec_int_Type surfaceElementsIDs = surfaceTriangleElements->getSurfacesOfElement(indexElement);
3096 vec2D_int_Type originTriangles(4,vec_int_Type(3));
3098 originTriangles[0] = {nodeInd[0], nodeInd[1], nodeInd[2] };
3099 originTriangles[1] = {nodeInd[0], nodeInd[1], nodeInd[3] };
3100 originTriangles[2] = {nodeInd[0], nodeInd[2], nodeInd[3] };
3101 originTriangles[3] = {nodeInd[1], nodeInd[2], nodeInd[3] };
3105 vec_int_Type originFlag(4,this->volumeID_);
3107 vec_bool_Type interfaceSurface(4);
3108 vec_LO_Type triTmp(3);
3109 vec_int_Type originTriangleTmp(3);
3111 for(
int i=0; i< 4 ; i++){
3112 originTriangleTmp = originTriangles[i];
3113 sort(originTriangleTmp.begin(),originTriangleTmp.end());
3114 for(
int j=0; j<4 ; j++){
3115 FiniteElement surfaceTmp = surfaceTriangleElements->getElement(surfaceElementsIDs[j]);
3116 triTmp = surfaceTmp.getVectorNodeList();
3117 sort(triTmp.begin(),triTmp.end());
3118 if(triTmp[0] == originTriangleTmp[0] && triTmp[1] == originTriangleTmp[1] && triTmp[2] == originTriangleTmp[2] ) {
3119 originFlag[i] = surfaceTmp.getFlag();
3120 interfaceSurface[i] = surfaceTmp.isInterfaceElement();
3133 for(
int i=0; i<6; i++){
3134 if(edgeElements->getElement(edgeNumbers[i]).isTaggedForRefinement()){
3135 midPointInd.push_back(edgeElements->getMidpoint(edgeNumbers[i]));
3142 vec2D_int_Type newElements(3, vec_int_Type( 0 ));
3143 vec2D_int_Type newEdges(18,vec_int_Type(0));
3144 vec2D_int_Type newTriangles(12,vec_int_Type(0));
3145 vec_int_Type newTrianglesFlag(12) ;
3146 vec_int_Type isInterfaceSurface(12);
3147 vec_int_Type edgeFlags(18);
3148 vec_bool_Type isInterfaceEdge(18);
3149 vec_GO_Type predecessorElement(18);
3151 vec2D_LO_Type newTriangleEdgeIDs(3,vec_LO_Type(12));
3160 (newElements)[0]={nodeInd[0],nodeInd[3], midPointInd[0],midPointInd[1]};
3162 (newEdges)[0] = {nodeInd[0] ,nodeInd[3]};
3163 (newEdges)[1] = {nodeInd[0] ,midPointInd[0]};
3164 (newEdges)[2] = {nodeInd[0] ,midPointInd[1]};
3165 (newEdges)[3] = {nodeInd[3] ,midPointInd[0]};
3166 (newEdges)[4] = {nodeInd[3] ,midPointInd[1]};
3167 (newEdges)[5] = {midPointInd[0] ,midPointInd[1]};
3169 edgeFlags[0]=edgeElements->getElement(edgeNumbers[2]).getFlag();
3170 edgeFlags[1]=this->bcFlagRep_->at(midPointInd[0]);
3171 edgeFlags[2]=this->bcFlagRep_->at(midPointInd[1]);
3172 edgeFlags[3]=originFlag[1];
3173 edgeFlags[4]=originFlag[2];
3174 edgeFlags[5]=originFlag[0];
3176 isInterfaceEdge[0] = edgeElements->getElement(edgeNumbers[2]).isInterfaceElement();
3177 isInterfaceEdge[1] = edgeElements->getElement(edgeNumbers[0]).isInterfaceElement();
3178 isInterfaceEdge[2] = edgeElements->getElement(edgeNumbers[1]).isInterfaceElement();
3179 isInterfaceEdge[3] = interfaceSurface[1];
3180 isInterfaceEdge[4] = interfaceSurface[2];
3181 isInterfaceEdge[5] = interfaceSurface[0];
3183 predecessorElement[0] = this->edgeMap_->getGlobalElement(edgeNumbers[2]);
3184 predecessorElement[1] = this->edgeMap_->getGlobalElement(edgeNumbers[0]);
3185 predecessorElement[2] = this->edgeMap_->getGlobalElement(edgeNumbers[1]);
3186 predecessorElement[3] = -1;
3187 predecessorElement[4] = -1;
3188 predecessorElement[5] = -1;
3191 newTriangles[0]= {nodeInd[0],nodeInd[3],midPointInd[0]};
3192 newTriangles[1]= {nodeInd[0],nodeInd[3],midPointInd[1]};
3193 newTriangles[2]= {nodeInd[0],midPointInd[0],midPointInd[1]};
3194 newTriangles[3]= {nodeInd[3],midPointInd[0],midPointInd[1]};
3196 newTrianglesFlag[0]= originFlag[1];
3197 newTrianglesFlag[1]= originFlag[2];
3198 newTrianglesFlag[2]= originFlag[0];
3199 newTrianglesFlag[3]= this->volumeID_;
3201 isInterfaceSurface[0]= interfaceSurface[1];
3202 isInterfaceSurface[1]= interfaceSurface[2];
3203 isInterfaceSurface[2]= interfaceSurface[0];
3204 isInterfaceSurface[3]=
false;
3206 newTriangleEdgeIDs[0]={0,1,3,0,2,4,1,2,5,3,4,5};
3209 (newElements)[1]={nodeInd[1],nodeInd[2],nodeInd[3],midPointInd[0]};
3211 (newEdges)[6] = {nodeInd[1] ,nodeInd[2]};
3212 (newEdges)[7] = {nodeInd[1] ,nodeInd[3]};
3213 (newEdges)[8] = {nodeInd[1] ,midPointInd[0]};
3214 (newEdges)[9] = {nodeInd[2] ,nodeInd[3]};
3215 (newEdges)[10] = {nodeInd[2] ,midPointInd[0]};
3216 (newEdges)[11] = {nodeInd[3] ,midPointInd[0]};
3218 edgeFlags[6]=edgeElements->getElement(edgeNumbers[3]).getFlag();
3219 edgeFlags[7]=edgeElements->getElement(edgeNumbers[4]).getFlag();
3220 edgeFlags[8]=edgeElements->getElement(edgeNumbers[0]).getFlag();
3221 edgeFlags[9]=edgeElements->getElement(edgeNumbers[5]).getFlag();
3222 edgeFlags[10]=originFlag[0];
3223 edgeFlags[11]=originFlag[1];
3225 isInterfaceEdge[6] = edgeElements->getElement(edgeNumbers[3]).isInterfaceElement();
3226 isInterfaceEdge[7] = edgeElements->getElement(edgeNumbers[4]).isInterfaceElement();
3227 isInterfaceEdge[8] = edgeElements->getElement(edgeNumbers[0]).isInterfaceElement();
3228 isInterfaceEdge[9] = edgeElements->getElement(edgeNumbers[5]).isInterfaceElement();
3229 isInterfaceEdge[10] = interfaceSurface[0];
3230 isInterfaceEdge[11] = interfaceSurface[1];
3232 predecessorElement[6] = this->edgeMap_->getGlobalElement(edgeNumbers[3]);
3233 predecessorElement[7] = this->edgeMap_->getGlobalElement(edgeNumbers[4]);
3234 predecessorElement[8] = this->edgeMap_->getGlobalElement(edgeNumbers[0]);
3235 predecessorElement[9] = this->edgeMap_->getGlobalElement(edgeNumbers[5]);
3236 predecessorElement[10] = -1;
3237 predecessorElement[11] = -1;
3240 newTriangles[4]= {nodeInd[1],nodeInd[2],nodeInd[3]};
3241 newTriangles[5]= {nodeInd[1],nodeInd[2],midPointInd[0]};
3242 newTriangles[6]= {nodeInd[1],nodeInd[3],midPointInd[0]};
3243 newTriangles[7]= {nodeInd[2],nodeInd[3],midPointInd[0]};
3245 newTrianglesFlag[4]= originFlag[3];
3246 newTrianglesFlag[5]= originFlag[0];
3247 newTrianglesFlag[6]= originFlag[1];
3248 newTrianglesFlag[7]= this->volumeID_;
3250 isInterfaceSurface[4]= interfaceSurface[3];
3251 isInterfaceSurface[5]= interfaceSurface[0];
3252 isInterfaceSurface[6]= interfaceSurface[1];
3253 isInterfaceSurface[7]=
false;
3255 newTriangleEdgeIDs[1]={6,7,9,6,8,10,7,8,11,9,10,11};
3257 (newElements)[2]={nodeInd[2],nodeInd[3],midPointInd[0],midPointInd[1]};
3259 (newEdges)[12] = {nodeInd[2] ,nodeInd[3]};
3260 (newEdges)[13] = {nodeInd[2] ,midPointInd[0]};
3261 (newEdges)[14] = {nodeInd[2] ,midPointInd[1]};
3262 (newEdges)[15] = {nodeInd[3] ,midPointInd[0]};
3263 (newEdges)[16] = {nodeInd[3] ,midPointInd[1]};
3264 (newEdges)[17] = {midPointInd[0] ,midPointInd[1]};
3266 edgeFlags[12]=edgeElements->getElement(edgeNumbers[5]).getFlag();
3267 edgeFlags[13]=originFlag[0];
3268 edgeFlags[14]=edgeElements->getElement(edgeNumbers[1]).getFlag();
3269 edgeFlags[15]=originFlag[1];
3270 edgeFlags[16]=originFlag[2];
3271 edgeFlags[17]=originFlag[0];
3273 isInterfaceEdge[12] = edgeElements->getElement(edgeNumbers[5]).isInterfaceElement();
3274 isInterfaceEdge[13] = interfaceSurface[0];
3275 isInterfaceEdge[14] = edgeElements->getElement(edgeNumbers[1]).isInterfaceElement();
3276 isInterfaceEdge[15] = interfaceSurface[1];
3277 isInterfaceEdge[16] = interfaceSurface[2];
3278 isInterfaceEdge[17] = interfaceSurface[0];
3280 predecessorElement[12] = this->edgeMap_->getGlobalElement(edgeNumbers[5]);
3281 predecessorElement[13] = -1;
3282 predecessorElement[14] = this->edgeMap_->getGlobalElement(edgeNumbers[1]);
3283 predecessorElement[15] = -1;
3284 predecessorElement[16] = -1;
3285 predecessorElement[17] = -1;
3288 newTriangles[8]= {nodeInd[2],nodeInd[3],midPointInd[0]};
3289 newTriangles[9]= {nodeInd[2],nodeInd[3],midPointInd[1]};
3290 newTriangles[10]= {nodeInd[2],midPointInd[0],midPointInd[1]};
3291 newTriangles[11]= {nodeInd[3],midPointInd[0],midPointInd[1]};
3293 newTrianglesFlag[8]=this->volumeID_;
3294 newTrianglesFlag[9]= originFlag[2];
3295 newTrianglesFlag[10]= originFlag[0];
3296 newTrianglesFlag[11]= this->volumeID_;
3298 isInterfaceSurface[8]=
false;
3299 isInterfaceSurface[9]= interfaceSurface[2];
3300 isInterfaceSurface[10]= interfaceSurface[0];
3301 isInterfaceSurface[11]=
false;
3303 newTriangleEdgeIDs[2]={8,9,11,8,10,12,9,10,13,11,12,13};
3310 int offsetElements = this->elementsC_->numberElements();
3311 int offsetEdges = this->edgeElements_->numberElements();
3312 for(
int i=0;i<3; i++){
3313 sort( newElements.at(i).begin(), newElements.at(i).end() );
3315 feNew.setFiniteElementRefinementType(
"irregular");
3316 feNew.setPredecessorElement(indexElement);
3318 this->elementsC_->addElement(feNew);
3320 this->elementsC_->switchElement(indexElement,feNew);
3324 for(
int i=0;i<18; i++){
3325 sort( newEdges.at(i).begin(), newEdges.at(i).end() );
3327 feNew.setInterfaceElement(isInterfaceEdge[i]);
3328 feNew.setPredecessorElement(predecessorElement[i]);
3330 this->edgeElements_->addEdge(feNew,i/6+offsetElements);
3333 this->edgeElements_->addEdge(feNew,indexElement);
3337 int offsetSurface =0;
3338 for(
int i=0;i<12; i++){
3339 sort( newTriangles.at(i).begin(), newTriangles.at(i).end() );
3341 feNew.setInterfaceElement(isInterfaceSurface[i]);
3343 if(newTrianglesFlag[i]!=0 && newTrianglesFlag[i]!=this->volumeID_){
3344 if ( !this->elementsC_->getElement(i/4+offsetElements).subElementsInitialized() )
3345 this->elementsC_->getElement(i/4+offsetElements).initializeSubElements( this->FEType_, this->dim_ -1) ;
3346 this->elementsC_->getElement(i/4+offsetElements).addSubElement(feNew);
3348 this->surfaceTriangleElements_->addSurface(feNew, i/4+offsetElements);
3351 if(newTrianglesFlag[i]!=0 && newTrianglesFlag[i]!=this->volumeID_){
3352 if ( !this->elementsC_->getElement(indexElement).subElementsInitialized() )
3353 this->elementsC_->getElement(indexElement).initializeSubElements( this->FEType_, this->dim_ -1) ;
3354 this->elementsC_->getElement(indexElement).addSubElement(feNew);
3356 this->surfaceTriangleElements_->addSurface(feNew, indexElement);
3361 for(
int i=0;i<3; i++){
3363 element = this->elementsC_->getElement(i+offsetElements);
3365 element = this->elementsC_->getElement(indexElement);
3367 for(
int j=0; j<18 ; j++){
3368 FiniteElement feEdge = this->edgeElements_->getElement(j+offsetEdges);
3369 if(feEdge.getFlag() != this->volumeID_){
3371 element.addSubElement( feEdge );
3372 else if ( !element.subElementsInitialized() ){
3373 element.initializeSubElements(
"P1", 1 );
3374 element.addSubElement( feEdge );
3378 ElementsPtr_Type surfaces = element.getSubElements();
3380 surfaces->setToCorrectElement( feEdge );
3388 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::runtime_error,
"The Type 1 irregular Refinement Method you requested is only applicable to a 3 dimensional Mesh. Please reconsider.");
3410 if(this->dim_ == 3){
3417 vec_int_Type midPointInd( 1 );
3418 vec_int_Type edgeNumbers = edgeElements->getEdgesOfElement(indexElement);
3419 vec_int_Type edgeNumbersUntagged(0);
3421 vec_int_Type nodeInd(0);
3422 for(
int i=0; i<6; i++){
3423 if(edgeElements->getElement(edgeNumbers[i]).isTaggedForRefinement()){
3424 nodeInd.push_back(edgeElements->getElement(edgeNumbers[i]).getNode(0));
3425 nodeInd.push_back(edgeElements->getElement(edgeNumbers[i]).getNode(1));
3428 edgeNumbersUntagged.push_back(edgeNumbers[i]);
3430 sort( nodeInd.begin(), nodeInd.end() );
3431 nodeInd.erase( unique( nodeInd.begin(), nodeInd.end() ), nodeInd.end() );
3435 vec_int_Type nodeIndTmp(0);
3436 for(
int i=0; i<5; i++){
3437 if(edgeElements->getElement(edgeNumbersUntagged[i]).getNode(0) == nodeInd[0])
3438 nodeIndTmp.push_back(edgeElements->getElement(edgeNumbersUntagged[i]).getNode(1));
3439 else if(edgeElements->getElement(edgeNumbersUntagged[i]).getNode(1) == nodeInd[0])
3440 nodeIndTmp.push_back(edgeElements->getElement(edgeNumbersUntagged[i]).getNode(0));
3441 else if(edgeElements->getElement(edgeNumbersUntagged[i]).getNode(0) == nodeInd[1])
3442 nodeIndTmp.push_back(edgeElements->getElement(edgeNumbersUntagged[i]).getNode(1));
3443 else if(edgeElements->getElement(edgeNumbersUntagged[i]).getNode(1) == nodeInd[1])
3444 nodeIndTmp.push_back(edgeElements->getElement(edgeNumbersUntagged[i]).getNode(0));
3447 sort( nodeIndTmp.begin(), nodeIndTmp.end() );
3448 nodeIndTmp.erase( unique( nodeIndTmp.begin(), nodeIndTmp.end() ), nodeIndTmp.end() );
3451 nodeInd.push_back(nodeIndTmp[0]);
3452 nodeInd.push_back(nodeIndTmp[1]);
3464 vec_int_Type edgeNumbersTmp = edgeNumbers;
3465 for(
int i=0; i<6; i++){
3466 if(edgeElements->getElement(edgeNumbersTmp[i]).getNode(0) == nodeInd[0] || edgeElements->getElement(edgeNumbersTmp[i]).getNode(1) == nodeInd[0]){
3467 if(edgeElements->getElement(edgeNumbersTmp[i]).getNode(0) == nodeInd[1] || edgeElements->getElement(edgeNumbersTmp[i]).getNode(1) == nodeInd[1])
3468 edgeNumbers[0] = edgeNumbersTmp[i];
3469 else if(edgeElements->getElement(edgeNumbersTmp[i]).getNode(0) == nodeInd[2] || edgeElements->getElement(edgeNumbersTmp[i]).getNode(1) == nodeInd[2])
3470 edgeNumbers[1] = edgeNumbersTmp[i];
3471 else if(edgeElements->getElement(edgeNumbersTmp[i]).getNode(0) == nodeInd[3] || edgeElements->getElement(edgeNumbersTmp[i]).getNode(1) == nodeInd[3])
3472 edgeNumbers[2] = edgeNumbersTmp[i];
3474 else if(edgeElements->getElement(edgeNumbersTmp[i]).getNode(0) == nodeInd[1] || edgeElements->getElement(edgeNumbersTmp[i]).getNode(1) == nodeInd[1]){
3475 if(edgeElements->getElement(edgeNumbersTmp[i]).getNode(0) == nodeInd[2] || edgeElements->getElement(edgeNumbersTmp[i]).getNode(1) == nodeInd[2])
3476 edgeNumbers[3] = edgeNumbersTmp[i];
3477 else if(edgeElements->getElement(edgeNumbersTmp[i]).getNode(0) == nodeInd[3] || edgeElements->getElement(edgeNumbersTmp[i]).getNode(1) == nodeInd[3])
3478 edgeNumbers[4] = edgeNumbersTmp[i];
3480 else if(edgeElements->getElement(edgeNumbersTmp[i]).getNode(0) == nodeInd[2] || edgeElements->getElement(edgeNumbersTmp[i]).getNode(1) == nodeInd[2]){
3481 if(edgeElements->getElement(edgeNumbersTmp[i]).getNode(0) == nodeInd[3] || edgeElements->getElement(edgeNumbersTmp[i]).getNode(1) == nodeInd[3])
3482 edgeNumbers[5] = edgeNumbersTmp[i];
3497 vec_int_Type surfaceElementsIDs = surfaceTriangleElements->getSurfacesOfElement(indexElement);
3498 vec2D_int_Type originTriangles(4,vec_int_Type(3));
3500 originTriangles[0] = {nodeInd[0], nodeInd[1], nodeInd[2] };
3501 originTriangles[1] = {nodeInd[0], nodeInd[1], nodeInd[3] };
3502 originTriangles[2] = {nodeInd[0], nodeInd[2], nodeInd[3] };
3503 originTriangles[3] = {nodeInd[1], nodeInd[2], nodeInd[3] };
3507 vec_int_Type originFlag(4,this->volumeID_);
3509 vec_bool_Type interfaceSurface(4);
3510 vec_LO_Type triTmp(3);
3511 vec_int_Type originTriangleTmp(3);
3513 for(
int i=0; i< 4 ; i++){
3514 originTriangleTmp = originTriangles[i];
3515 sort(originTriangleTmp.begin(),originTriangleTmp.end());
3516 for(
int j=0; j<4 ; j++){
3517 FiniteElement surfaceTmp = surfaceTriangleElements->getElement(surfaceElementsIDs[j]);
3518 triTmp = surfaceTmp.getVectorNodeList();
3519 sort(triTmp.begin(),triTmp.end());
3520 if(triTmp[0] == originTriangleTmp[0] && triTmp[1] == originTriangleTmp[1] && triTmp[2] == originTriangleTmp[2] ) {
3521 originFlag[i] = surfaceTmp.getFlag();
3522 interfaceSurface[i] = surfaceTmp.isInterfaceElement();
3535 for(
int i=0; i<6; i++){
3536 if(edgeElements->getElement(edgeNumbers[i]).isTaggedForRefinement()){
3537 midPointInd[0] = edgeElements->getMidpoint(edgeNumbers[i]);
3544 vec2D_int_Type newElements(2, vec_int_Type( 0 ));
3545 vec2D_int_Type newEdges(12,vec_int_Type(0));
3546 vec2D_int_Type newTriangles(8,vec_int_Type(0));
3547 vec_int_Type newTrianglesFlag(8) ;
3548 vec_bool_Type isInterfaceSurface(8);
3549 vec_int_Type edgeFlags(12);
3550 vec_bool_Type isInterfaceEdge(12);
3551 vec_GO_Type predecessorElement(12);
3553 vec2D_LO_Type newTriangleEdgeIDs(2,vec_LO_Type(12));
3562 (newElements)[0]={nodeInd[0],nodeInd[2],nodeInd[3],midPointInd[0]};
3564 (newEdges)[0] = {nodeInd[0] ,nodeInd[2]};
3565 (newEdges)[1] = {nodeInd[0] ,nodeInd[3]};
3566 (newEdges)[2] = {nodeInd[0] ,midPointInd[0]};
3567 (newEdges)[3] = {nodeInd[2] ,nodeInd[3]};
3568 (newEdges)[4] = {nodeInd[2] ,midPointInd[0]};
3569 (newEdges)[5] = {nodeInd[3] ,midPointInd[0]};
3571 edgeFlags[0]=edgeElements->getElement(edgeNumbers[1]).getFlag();
3572 edgeFlags[1]=edgeElements->getElement(edgeNumbers[2]).getFlag();
3573 edgeFlags[2]=this->bcFlagRep_->at(midPointInd[0]);
3574 edgeFlags[3]=edgeElements->getElement(edgeNumbers[5]).getFlag();
3575 edgeFlags[4]=originFlag[0];
3576 edgeFlags[5]=originFlag[1];
3578 isInterfaceEdge[0] = edgeElements->getElement(edgeNumbers[1]).isInterfaceElement();
3579 isInterfaceEdge[1] = edgeElements->getElement(edgeNumbers[2]).isInterfaceElement();
3580 isInterfaceEdge[2] = edgeElements->getElement(edgeNumbers[0]).isInterfaceElement();
3581 isInterfaceEdge[3] = edgeElements->getElement(edgeNumbers[5]).isInterfaceElement();;
3582 isInterfaceEdge[4] = interfaceSurface[0];
3583 isInterfaceEdge[5] = interfaceSurface[1];
3585 predecessorElement[0] = this->edgeMap_->getGlobalElement(edgeNumbers[1]);
3586 predecessorElement[1] = this->edgeMap_->getGlobalElement(edgeNumbers[2]);
3587 predecessorElement[2] = this->edgeMap_->getGlobalElement(edgeNumbers[0]);
3588 predecessorElement[3] = this->edgeMap_->getGlobalElement(edgeNumbers[5]);
3589 predecessorElement[4] = -1;
3590 predecessorElement[5] = -1;
3593 newTriangles[0]= {nodeInd[0],nodeInd[2],nodeInd[3]};
3594 newTriangles[1]= {nodeInd[0],nodeInd[2],midPointInd[0]};
3595 newTriangles[2]= {nodeInd[0],nodeInd[3],midPointInd[0]};
3596 newTriangles[3]= {nodeInd[2],nodeInd[3],midPointInd[0]};
3598 newTrianglesFlag[0]= originFlag[2];
3599 newTrianglesFlag[1]= originFlag[0];
3600 newTrianglesFlag[2]= originFlag[1];
3601 newTrianglesFlag[3]= this->volumeID_;
3603 isInterfaceSurface[0] = interfaceSurface[2];
3604 isInterfaceSurface[1] = interfaceSurface[0];
3605 isInterfaceSurface[2] = interfaceSurface[1];
3606 isInterfaceSurface[3] =
false;
3608 newTriangleEdgeIDs[0]={0,1,3,0,2,4,1,2,5,3,4,5};
3611 (newElements)[1]={nodeInd[1],nodeInd[2],nodeInd[3],midPointInd[0]};
3613 (newEdges)[6] = {nodeInd[1] ,nodeInd[2]};
3614 (newEdges)[7] = {nodeInd[1] ,nodeInd[3]};
3615 (newEdges)[8] = {nodeInd[1] ,midPointInd[0]};
3616 (newEdges)[9] = {nodeInd[2] ,nodeInd[3]};
3617 (newEdges)[10] = {nodeInd[2] ,midPointInd[0]};
3618 (newEdges)[11] = {nodeInd[3] ,midPointInd[0]};
3620 edgeFlags[6]=edgeElements->getElement(edgeNumbers[3]).getFlag();
3621 edgeFlags[7]=edgeElements->getElement(edgeNumbers[4]).getFlag();
3622 edgeFlags[8]=edgeElements->getElement(edgeNumbers[0]).getFlag();
3623 edgeFlags[9]=edgeElements->getElement(edgeNumbers[5]).getFlag();
3624 edgeFlags[10]=originFlag[0];
3625 edgeFlags[11]=originFlag[1];
3627 isInterfaceEdge[6] = edgeElements->getElement(edgeNumbers[3]).isInterfaceElement();
3628 isInterfaceEdge[7] = edgeElements->getElement(edgeNumbers[4]).isInterfaceElement();
3629 isInterfaceEdge[8] = edgeElements->getElement(edgeNumbers[0]).isInterfaceElement();
3630 isInterfaceEdge[9] = edgeElements->getElement(edgeNumbers[5]).isInterfaceElement();
3631 isInterfaceEdge[10] = interfaceSurface[0];
3632 isInterfaceEdge[11] = interfaceSurface[1];
3634 predecessorElement[6] = this->edgeMap_->getGlobalElement(edgeNumbers[3]);
3635 predecessorElement[7] = this->edgeMap_->getGlobalElement(edgeNumbers[4]);
3636 predecessorElement[8] = this->edgeMap_->getGlobalElement(edgeNumbers[0]);
3637 predecessorElement[9] = this->edgeMap_->getGlobalElement(edgeNumbers[5]);
3638 predecessorElement[10] = -1;
3639 predecessorElement[11] = -1;
3642 newTriangles[4]= {nodeInd[1],nodeInd[2],nodeInd[3]};
3643 newTriangles[5]= {nodeInd[1],nodeInd[2],midPointInd[0]};
3644 newTriangles[6]= {nodeInd[1],nodeInd[3],midPointInd[0]};
3645 newTriangles[7]= {nodeInd[2],nodeInd[3],midPointInd[0]};
3647 newTrianglesFlag[4]= originFlag[3];
3648 newTrianglesFlag[5]= originFlag[0];
3649 newTrianglesFlag[6]= originFlag[1];
3650 newTrianglesFlag[7]= this->volumeID_;
3652 isInterfaceSurface[4] = interfaceSurface[3];
3653 isInterfaceSurface[5] = interfaceSurface[0];
3654 isInterfaceSurface[6] = interfaceSurface[1];
3655 isInterfaceSurface[7] =
false;
3657 newTriangleEdgeIDs[1]={6,7,9,6,8,10,7,8,11,9,10,11};
3662 int offsetElements = this->elementsC_->numberElements();
3663 int offsetEdges = this->edgeElements_->numberElements();
3664 for(
int i=0;i<2; i++){
3665 sort( newElements.at(i).begin(), newElements.at(i).end() );
3667 feNew.setFiniteElementRefinementType(
"irregular");
3668 if(refinementMode_ ==
"Bisection")
3669 feNew.setFiniteElementRefinementType(
"regular");
3670 feNew.setPredecessorElement(indexElement);
3672 this->elementsC_->addElement(feNew);
3674 this->elementsC_->switchElement(indexElement,feNew);
3678 for(
int i=0;i<12; i++){
3679 sort( newEdges.at(i).begin(), newEdges.at(i).end() );
3681 feNew.setInterfaceElement(isInterfaceEdge[i]);
3682 feNew.setPredecessorElement(predecessorElement[i]);
3684 this->edgeElements_->addEdge(feNew,i/6+offsetElements);
3687 this->edgeElements_->addEdge(feNew,indexElement);
3691 int offsetSurface =0;
3692 for(
int i=0;i<8; i++){
3693 sort( newTriangles.at(i).begin(), newTriangles.at(i).end() );
3695 feNew.setInterfaceElement(isInterfaceSurface[i]);
3697 if(newTrianglesFlag[i]!=0 && newTrianglesFlag[i]!=this->volumeID_){
3698 if ( !this->elementsC_->getElement(i/4+offsetElements).subElementsInitialized() )
3699 this->elementsC_->getElement(i/4+offsetElements).initializeSubElements( this->FEType_, this->dim_ -1) ;
3700 this->elementsC_->getElement(i/4+offsetElements).addSubElement(feNew);
3702 this->surfaceTriangleElements_->addSurface(feNew, i/4+offsetElements);
3705 if(newTrianglesFlag[i]!=0 && newTrianglesFlag[i]!=this->volumeID_){
3706 if ( !this->elementsC_->getElement(indexElement).subElementsInitialized() )
3707 this->elementsC_->getElement(indexElement).initializeSubElements( this->FEType_, this->dim_ -1) ;
3708 this->elementsC_->getElement(indexElement).addSubElement(feNew);
3710 this->surfaceTriangleElements_->addSurface(feNew, indexElement);
3716 for(
int i=0;i<2; i++){
3718 element = this->elementsC_->getElement(i+offsetElements);
3720 element = this->elementsC_->getElement(indexElement);
3722 for(
int j=0; j<12 ; j++){
3723 FiniteElement feEdge = this->edgeElements_->getElement(j+offsetEdges);
3724 if(feEdge.getFlag() != this->volumeID_){
3726 element.addSubElement( feEdge );
3727 else if ( !element.subElementsInitialized() ){
3728 element.initializeSubElements(
"P1", 1 );
3729 element.addSubElement( feEdge );
3733 ElementsPtr_Type surfaces = element.getSubElements();
3735 surfaces->setToCorrectElement( feEdge );
3742 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::runtime_error,
"The Type 1 irregular Refinement Method you requested is only applicable to a 3 dimensional Mesh. Please reconsider.");
3763 if(this->dim_ == 3){
3770 vec_int_Type midPointInd(0);
3771 vec_int_Type edgeNumbers = edgeElements->getEdgesOfElement(indexElement);
3772 vec_int_Type edgeNumbersUntagged(0);
3774 vec_int_Type nodeInd(0);
3776 for(
int i=0; i<6; i++){
3777 if(edgeElements->getElement(edgeNumbers[i]).isTaggedForRefinement()){
3778 nodeInd.push_back(edgeElements->getElement(edgeNumbers[i]).getNode(0));
3779 nodeInd.push_back(edgeElements->getElement(edgeNumbers[i]).getNode(1));
3782 edgeNumbersUntagged.push_back(edgeNumbers[i]);
3784 sort( nodeInd.begin(), nodeInd.end() );
3785 nodeInd.erase( unique( nodeInd.begin(), nodeInd.end() ), nodeInd.end() );
3789 for(
int i=0; i<3; i++){
3790 if(edgeElements->getElement(edgeNumbersUntagged[0]).getNode(0) == nodeInd[i])
3791 nodeInd.push_back(edgeElements->getElement(edgeNumbersUntagged[0]).getNode(1));
3792 if(edgeElements->getElement(edgeNumbersUntagged[0]).getNode(1) == nodeInd[i])
3793 nodeInd.push_back(edgeElements->getElement(edgeNumbersUntagged[0]).getNode(0));
3806 vec_int_Type edgeNumbersTmp = edgeNumbers;
3807 for(
int i=0; i<6; i++){
3808 if(edgeElements->getElement(edgeNumbersTmp[i]).getNode(0) == nodeInd[0] || edgeElements->getElement(edgeNumbersTmp[i]).getNode(1) == nodeInd[0]){
3809 if(edgeElements->getElement(edgeNumbersTmp[i]).getNode(0) == nodeInd[1] || edgeElements->getElement(edgeNumbersTmp[i]).getNode(1) == nodeInd[1])
3810 edgeNumbers[0] = edgeNumbersTmp[i];
3811 else if(edgeElements->getElement(edgeNumbersTmp[i]).getNode(0) == nodeInd[2] || edgeElements->getElement(edgeNumbersTmp[i]).getNode(1) == nodeInd[2])
3812 edgeNumbers[1] = edgeNumbersTmp[i];
3813 else if(edgeElements->getElement(edgeNumbersTmp[i]).getNode(0) == nodeInd[3] || edgeElements->getElement(edgeNumbersTmp[i]).getNode(1) == nodeInd[3])
3814 edgeNumbers[2] = edgeNumbersTmp[i];
3816 else if(edgeElements->getElement(edgeNumbersTmp[i]).getNode(0) == nodeInd[1] || edgeElements->getElement(edgeNumbersTmp[i]).getNode(1) == nodeInd[1]){
3817 if(edgeElements->getElement(edgeNumbersTmp[i]).getNode(0) == nodeInd[2] || edgeElements->getElement(edgeNumbersTmp[i]).getNode(1) == nodeInd[2])
3818 edgeNumbers[3] = edgeNumbersTmp[i];
3819 else if(edgeElements->getElement(edgeNumbersTmp[i]).getNode(0) == nodeInd[3] || edgeElements->getElement(edgeNumbersTmp[i]).getNode(1) == nodeInd[3])
3820 edgeNumbers[4] = edgeNumbersTmp[i];
3822 else if(edgeElements->getElement(edgeNumbersTmp[i]).getNode(0) == nodeInd[2] || edgeElements->getElement(edgeNumbersTmp[i]).getNode(1) == nodeInd[2]){
3823 if(edgeElements->getElement(edgeNumbersTmp[i]).getNode(0) == nodeInd[3] || edgeElements->getElement(edgeNumbersTmp[i]).getNode(1) == nodeInd[3])
3824 edgeNumbers[5] = edgeNumbersTmp[i];
3840 vec_int_Type surfaceElementsIDs = surfaceTriangleElements->getSurfacesOfElement(indexElement);
3841 vec2D_int_Type originTriangles(4,vec_int_Type(3));
3843 originTriangles[0] = {nodeInd[0], nodeInd[1], nodeInd[2] };
3844 originTriangles[1] = {nodeInd[0], nodeInd[1], nodeInd[3] };
3845 originTriangles[2] = {nodeInd[0], nodeInd[2], nodeInd[3] };
3846 originTriangles[3] = {nodeInd[1], nodeInd[2], nodeInd[3] };
3848 vec_int_Type originFlag(4,this->volumeID_);
3850 vec_bool_Type interfaceSurface(4);
3851 vec_LO_Type triTmp(3);
3852 vec_int_Type originTriangleTmp(3);
3854 for(
int i=0; i< 4 ; i++){
3855 originTriangleTmp = originTriangles[i];
3856 sort(originTriangleTmp.begin(),originTriangleTmp.end());
3857 for(
int j=0; j<4 ; j++){
3858 FiniteElement surfaceTmp = surfaceTriangleElements->getElement(surfaceElementsIDs[j]);
3859 triTmp = surfaceTmp.getVectorNodeList();
3860 sort(triTmp.begin(),triTmp.end());
3861 if(triTmp[0] == originTriangleTmp[0] && triTmp[1] == originTriangleTmp[1] && triTmp[2] == originTriangleTmp[2] ) {
3862 originFlag[i] = surfaceTmp.getFlag();
3863 interfaceSurface[i] = surfaceTmp.isInterfaceElement();
3875 for(
int i=0; i<6; i++){
3876 if(edgeElements->getElement(edgeNumbers[i]).isTaggedForRefinement())
3877 midPointInd.push_back(edgeElements->getMidpoint(edgeNumbers[i]));
3882 vec2D_int_Type newElements(4, vec_int_Type( 0 ));
3883 vec2D_int_Type newEdges(24,vec_int_Type(0));
3884 vec2D_int_Type newTriangles(16,vec_int_Type(0));
3885 vec_int_Type newTrianglesFlag(16) ;
3886 vec_bool_Type isInterfaceSurface(16);
3887 vec_int_Type edgeFlags(24);
3888 vec_bool_Type isInterfaceEdge(24);
3889 vec_GO_Type predecessorElement(24);
3891 vec2D_LO_Type newTriangleEdgeIDs(4,vec_LO_Type(12));
3900 (newElements)[0]={nodeInd[0],midPointInd[0],midPointInd[1],nodeInd[3]};
3902 (newEdges)[0] = {nodeInd[0] ,midPointInd[0]};
3903 (newEdges)[1] = {nodeInd[0] ,midPointInd[1]};
3904 (newEdges)[2] = {nodeInd[0] ,nodeInd[3]};
3905 (newEdges)[3] = {midPointInd[0] ,midPointInd[1]};
3906 (newEdges)[4] = {midPointInd[0] ,nodeInd[3]};
3907 (newEdges)[5] = {midPointInd[1] ,nodeInd[3]};
3909 edgeFlags[0]=this->bcFlagRep_->at(midPointInd[0]);
3910 edgeFlags[1]=this->bcFlagRep_->at(midPointInd[1]);
3911 edgeFlags[2]=edgeElements->getElement(edgeNumbers[2]).getFlag();
3912 edgeFlags[3]=originFlag[0];
3913 edgeFlags[4]=originFlag[1];
3914 edgeFlags[5]=originFlag[2];
3916 isInterfaceEdge[0] = edgeElements->getElement(edgeNumbers[0]).isInterfaceElement();
3917 isInterfaceEdge[1] = edgeElements->getElement(edgeNumbers[1]).isInterfaceElement();
3918 isInterfaceEdge[2] = edgeElements->getElement(edgeNumbers[2]).isInterfaceElement();
3919 isInterfaceEdge[3] = interfaceSurface[0];
3920 isInterfaceEdge[4] = interfaceSurface[1];
3921 isInterfaceEdge[5] = interfaceSurface[2];
3923 predecessorElement[0] = this->edgeMap_->getGlobalElement(edgeNumbers[0]);
3924 predecessorElement[1] = this->edgeMap_->getGlobalElement(edgeNumbers[1]);
3925 predecessorElement[2] = this->edgeMap_->getGlobalElement(edgeNumbers[2]);
3926 predecessorElement[3] = -1;
3927 predecessorElement[4] = -1;
3928 predecessorElement[5] = -1;
3932 newTriangles[0]= {nodeInd[0],midPointInd[0],midPointInd[1]};
3933 newTriangles[1]= {nodeInd[0],midPointInd[0],nodeInd[3]};
3934 newTriangles[2]= {nodeInd[0],midPointInd[1],nodeInd[3]};
3935 newTriangles[3]= {midPointInd[0],midPointInd[1],nodeInd[3]};
3937 newTrianglesFlag[0]= originFlag[0];
3938 newTrianglesFlag[1]= originFlag[1];
3939 newTrianglesFlag[2]= originFlag[2];
3940 newTrianglesFlag[3]= this->volumeID_;
3942 isInterfaceSurface[0] = interfaceSurface[0];
3943 isInterfaceSurface[1] = interfaceSurface[1];
3944 isInterfaceSurface[2] = interfaceSurface[2];
3945 isInterfaceSurface[3] =
false;
3947 newTriangleEdgeIDs[0]={0,1,3,0,2,4,1,2,5,3,4,5};
3950 (newElements)[1]={nodeInd[1],midPointInd[0],midPointInd[2],nodeInd[3]};
3952 (newEdges)[6] = {nodeInd[1] ,midPointInd[0]};
3953 (newEdges)[7] = {nodeInd[1] ,midPointInd[2]};
3954 (newEdges)[8] = {nodeInd[1] ,nodeInd[3]};
3955 (newEdges)[9] = {midPointInd[0] ,midPointInd[2]};
3956 (newEdges)[10] = {midPointInd[0] ,nodeInd[3]};
3957 (newEdges)[11] = {midPointInd[2] ,nodeInd[3]};
3959 edgeFlags[6]=this->bcFlagRep_->at(midPointInd[0]);
3960 edgeFlags[7]=this->bcFlagRep_->at(midPointInd[2]);
3961 edgeFlags[8]=edgeElements->getElement(edgeNumbers[4]).getFlag();
3962 edgeFlags[9]=originFlag[0];
3963 edgeFlags[10]=originFlag[1];
3964 edgeFlags[11]=originFlag[3];
3966 isInterfaceEdge[6] =edgeElements->getElement(edgeNumbers[0]).isInterfaceElement();
3967 isInterfaceEdge[7] =edgeElements->getElement(edgeNumbers[3]).isInterfaceElement();
3968 isInterfaceEdge[8] =edgeElements->getElement(edgeNumbers[4]).isInterfaceElement();
3969 isInterfaceEdge[9] = interfaceSurface[0];
3970 isInterfaceEdge[10] = interfaceSurface[1];
3971 isInterfaceEdge[11] = interfaceSurface[3];
3973 predecessorElement[6] = this->edgeMap_->getGlobalElement(edgeNumbers[0]);
3974 predecessorElement[7] = this->edgeMap_->getGlobalElement(edgeNumbers[3]);
3975 predecessorElement[8] = this->edgeMap_->getGlobalElement(edgeNumbers[4]);
3976 predecessorElement[9] = -1;
3977 predecessorElement[10] = -1;
3978 predecessorElement[11] = -1;
3981 newTriangles[4]= {nodeInd[1],midPointInd[0],midPointInd[2]};
3982 newTriangles[5]= {nodeInd[1],midPointInd[0],nodeInd[3]};
3983 newTriangles[6]= {nodeInd[1],midPointInd[2],nodeInd[3]};
3984 newTriangles[7]= {midPointInd[0],midPointInd[2],nodeInd[3]};
3986 newTrianglesFlag[4]= originFlag[0];
3987 newTrianglesFlag[5]= originFlag[1];
3988 newTrianglesFlag[6]= originFlag[3];
3989 newTrianglesFlag[7]= this->volumeID_;
3991 isInterfaceSurface[4] = interfaceSurface[0];
3992 isInterfaceSurface[5] = interfaceSurface[1];
3993 isInterfaceSurface[6] = interfaceSurface[3];
3994 isInterfaceSurface[7] =
false;
3996 newTriangleEdgeIDs[1]={6,7,9,6,8,10,7,8,11,9,10,11};
4000 (newElements)[2]={nodeInd[2],midPointInd[1],midPointInd[2],nodeInd[3]};
4002 (newEdges)[12] = {nodeInd[2] ,midPointInd[1]};
4003 (newEdges)[13] = {nodeInd[2] ,midPointInd[2]};
4004 (newEdges)[14] = {nodeInd[2] ,nodeInd[3]};
4005 (newEdges)[15] = {midPointInd[1] ,midPointInd[2]};
4006 (newEdges)[16] = {midPointInd[1] ,nodeInd[3]};
4007 (newEdges)[17] = {midPointInd[2] ,nodeInd[3]};
4009 edgeFlags[12]=this->bcFlagRep_->at(midPointInd[1]);
4010 edgeFlags[13]=this->bcFlagRep_->at(midPointInd[2]);
4011 edgeFlags[14]=edgeElements->getElement(edgeNumbers[5]).getFlag();
4012 edgeFlags[15]=originFlag[0];
4013 edgeFlags[16]=originFlag[2];
4014 edgeFlags[17]=originFlag[3];
4016 isInterfaceEdge[12] = edgeElements->getElement(edgeNumbers[1]).isInterfaceElement();
4017 isInterfaceEdge[13] = edgeElements->getElement(edgeNumbers[3]).isInterfaceElement();
4018 isInterfaceEdge[14] = edgeElements->getElement(edgeNumbers[5]).isInterfaceElement();
4019 isInterfaceEdge[15] = interfaceSurface[0];
4020 isInterfaceEdge[16] = interfaceSurface[2];
4021 isInterfaceEdge[17] = interfaceSurface[3];
4023 predecessorElement[12] = this->edgeMap_->getGlobalElement(edgeNumbers[1]);
4024 predecessorElement[13] = this->edgeMap_->getGlobalElement(edgeNumbers[3]);
4025 predecessorElement[14] = this->edgeMap_->getGlobalElement(edgeNumbers[5]);
4026 predecessorElement[15] = -1;
4027 predecessorElement[16] = -1;
4028 predecessorElement[17] = -1;
4031 newTriangles[8]= {nodeInd[2],midPointInd[1],midPointInd[2]};
4032 newTriangles[9]= {nodeInd[2],midPointInd[1],nodeInd[3]};
4033 newTriangles[10]= {nodeInd[2],midPointInd[2],nodeInd[3]};
4034 newTriangles[11]= {midPointInd[1],midPointInd[2],nodeInd[3]};
4036 newTrianglesFlag[8]= originFlag[0];
4037 newTrianglesFlag[9]= originFlag[2];
4038 newTrianglesFlag[10]= originFlag[3];
4039 newTrianglesFlag[11]= this->volumeID_;
4041 isInterfaceSurface[8] = interfaceSurface[0];
4042 isInterfaceSurface[9] = interfaceSurface[2];
4043 isInterfaceSurface[10] = interfaceSurface[3];
4044 isInterfaceSurface[11] =
false;
4046 newTriangleEdgeIDs[2]={12,13,15,12,14,16,13,14,17,15,16,17};
4050 (newElements)[3]={nodeInd[3],midPointInd[0],midPointInd[1],midPointInd[2]};
4052 (newEdges)[18] = {nodeInd[3] ,midPointInd[0]};
4053 (newEdges)[19] = {nodeInd[3] ,midPointInd[1]};
4054 (newEdges)[20] = {nodeInd[3] ,midPointInd[2]};
4055 (newEdges)[21] = {midPointInd[0] ,midPointInd[1]};
4056 (newEdges)[22] = {midPointInd[0] ,midPointInd[2]};
4057 (newEdges)[23] = {midPointInd[1] ,midPointInd[2]};
4059 edgeFlags[18]=originFlag[1];
4060 edgeFlags[19]=originFlag[2];
4061 edgeFlags[20]=originFlag[3];
4062 edgeFlags[21]=originFlag[0];
4063 edgeFlags[22]=originFlag[0];
4064 edgeFlags[23]=originFlag[0];
4066 isInterfaceEdge[18] = interfaceSurface[1];
4067 isInterfaceEdge[19] = interfaceSurface[2];
4068 isInterfaceEdge[20] = interfaceSurface[3];
4069 isInterfaceEdge[21] = interfaceSurface[0];
4070 isInterfaceEdge[22] = interfaceSurface[0];
4071 isInterfaceEdge[23] = interfaceSurface[0];
4073 predecessorElement[18] = -1;
4074 predecessorElement[19] = -1;
4075 predecessorElement[20] = -1;
4076 predecessorElement[21] = -1;
4077 predecessorElement[22] = -1;
4078 predecessorElement[23] = -1;
4082 newTriangles[12]= {nodeInd[3],midPointInd[0],midPointInd[1]};
4083 newTriangles[13]= {nodeInd[3],midPointInd[0],midPointInd[2]};
4084 newTriangles[14]= {nodeInd[3],midPointInd[1],midPointInd[2]};
4085 newTriangles[15]= {midPointInd[0],midPointInd[1],midPointInd[2]};
4087 newTrianglesFlag[12]= this->volumeID_;
4088 newTrianglesFlag[13]= this->volumeID_;
4089 newTrianglesFlag[14]= this->volumeID_;
4090 newTrianglesFlag[15]= originFlag[0];
4092 isInterfaceSurface[12] =
false;
4093 isInterfaceSurface[13] =
false;
4094 isInterfaceSurface[14] =
false;
4095 isInterfaceSurface[15] = interfaceSurface[0];
4098 newTriangleEdgeIDs[3]={18,19,21,18,20,22,19,20,23,21,22,23};
4102 int offsetElements = this->elementsC_->numberElements();
4103 int offsetEdges = this->edgeElements_->numberElements();
4104 for(
int i=0;i<4; i++){
4105 sort( newElements.at(i).begin(), newElements.at(i).end() );
4107 feNew.setFiniteElementRefinementType(
"irregular");
4108 feNew.setPredecessorElement(indexElement);
4110 this->elementsC_->addElement(feNew);
4112 this->elementsC_->switchElement(indexElement,feNew);
4116 for(
int i=0;i<24; i++){
4117 sort( newEdges.at(i).begin(), newEdges.at(i).end() );
4119 feNew.setInterfaceElement(isInterfaceEdge[i]);
4120 feNew.setPredecessorElement(predecessorElement[i]);
4122 this->edgeElements_->addEdge(feNew,i/6+offsetElements);
4125 this->edgeElements_->addEdge(feNew,indexElement);
4129 int offsetSurface=0;
4130 for(
int i=0;i<16; i++){
4131 sort( newTriangles.at(i).begin(), newTriangles.at(i).end() );
4133 feNew.setInterfaceElement(isInterfaceSurface[i]);
4135 if(newTrianglesFlag[i]!=0 && newTrianglesFlag[i]!=this->volumeID_){
4136 if ( !this->elementsC_->getElement(i/4+offsetElements).subElementsInitialized() )
4137 this->elementsC_->getElement(i/4+offsetElements).initializeSubElements( this->FEType_, this->dim_ -1) ;
4138 this->elementsC_->getElement(i/4+offsetElements).addSubElement(feNew);
4140 this->surfaceTriangleElements_->addSurface(feNew, i/4+offsetElements);
4143 if(newTrianglesFlag[i]!=0 && newTrianglesFlag[i]!=this->volumeID_){
4144 if ( !this->elementsC_->getElement(indexElement).subElementsInitialized() )
4145 this->elementsC_->getElement(indexElement).initializeSubElements( this->FEType_, this->dim_ -1) ;
4146 this->elementsC_->getElement(indexElement).addSubElement(feNew);
4148 this->surfaceTriangleElements_->addSurface(feNew, indexElement);
4154 for(
int i=0;i<4; i++){
4156 element = this->elementsC_->getElement(i+offsetElements);
4158 element = this->elementsC_->getElement(indexElement);
4160 for(
int j=0; j<24 ; j++){
4161 FiniteElement feEdge = this->edgeElements_->getElement(j+offsetEdges);
4162 if(feEdge.getFlag() != this->volumeID_){
4164 element.addSubElement( feEdge );
4165 else if ( !element.subElementsInitialized() ){
4166 element.initializeSubElements(
"P1", 1 );
4167 element.addSubElement( feEdge );
4171 ElementsPtr_Type surfaces = element.getSubElements();
4173 surfaces->setToCorrectElement( feEdge );
4181 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::runtime_error,
"The Type 1 irregular Refinement Method you requested is only applicable to a 3 dimensional Mesh. Please reconsider.");
4200 if(this->dim_ == 2){
4201 vec_int_Type midPointInd( 3 );
4203 vec_int_Type edgeNumbers = edgeElements->getEdgesOfElement(indexElement);
4205 for(
int i=0; i<3; i++) {
4206 midPointInd[i] = edgeElements->getMidpoint(edgeNumbers[i]);
4210 vec_int_Type mutualNode(3);
4212 for(
int i=0;i<2; i++){
4213 for(
int j=1;j+i<3;j++){
4214 if(edgeElements->getElement(edgeNumbers[i]).getNode(0) == edgeElements->getElement(edgeNumbers[j+i]).getNode(0))
4215 mutualNode[ind]= edgeElements->getElement(edgeNumbers[j+i]).getNode(0);
4217 if(edgeElements->getElement(edgeNumbers[i]).getNode(1) == edgeElements->getElement(edgeNumbers[j+i]).getNode(1))
4218 mutualNode[ind]= edgeElements->getElement(edgeNumbers[j+i]).getNode(1);
4220 if(edgeElements->getElement(edgeNumbers[i]).getNode(0) == edgeElements->getElement(edgeNumbers[j+i]).getNode(1))
4221 mutualNode[ind]= edgeElements->getElement(edgeNumbers[j+i]).getNode(1);
4223 if(edgeElements->getElement(edgeNumbers[i]).getNode(1) == edgeElements->getElement(edgeNumbers[j+i]).getNode(0))
4224 mutualNode[ind]= edgeElements->getElement(edgeNumbers[j+i]).getNode(0);
4231 vec2D_int_Type newElements(4, vec_int_Type( 0 ));
4232 vec2D_int_Type newEdges(12,vec_int_Type(0));
4233 vec_int_Type edgeFlags(12);
4235 vec_bool_Type isInterfaceEdge(12);
4236 vec_GO_Type predecessorElement(12);
4240 (newElements)[0]={mutualNode[0],midPointInd[0],midPointInd[1]};
4242 (newEdges)[0] = {mutualNode[0] ,midPointInd[0]};
4243 (newEdges)[1] = {mutualNode[0] ,midPointInd[1]};
4244 (newEdges)[2] = {midPointInd[0] ,midPointInd[1]};
4246 edgeFlags[0]=this->bcFlagRep_->at(midPointInd[0]);
4247 edgeFlags[1]=this->bcFlagRep_->at(midPointInd[1]);
4248 edgeFlags[2]=this->volumeID_;
4250 isInterfaceEdge[0] = edgeElements->getElement(edgeNumbers[0]).isInterfaceElement();
4251 isInterfaceEdge[1] = edgeElements->getElement(edgeNumbers[1]).isInterfaceElement();
4252 isInterfaceEdge[2] =
false;
4254 predecessorElement[0] = this->edgeMap_->getGlobalElement(edgeNumbers[0]);
4255 predecessorElement[1] = this->edgeMap_->getGlobalElement(edgeNumbers[1]);
4256 predecessorElement[2] = -1;
4260 newElements[1]={mutualNode[1],midPointInd[0],midPointInd[2]};
4262 (newEdges)[3] = {mutualNode[1] ,midPointInd[0]};
4263 (newEdges)[4] = {mutualNode[1] ,midPointInd[2]};
4264 (newEdges)[5] = {midPointInd[0] ,midPointInd[2]};
4266 edgeFlags[3]=this->bcFlagRep_->at(midPointInd[0]);
4267 edgeFlags[4]=this->bcFlagRep_->at(midPointInd[2]);
4268 edgeFlags[5]=this->volumeID_;
4270 isInterfaceEdge[3] = edgeElements->getElement(edgeNumbers[0]).isInterfaceElement();
4271 isInterfaceEdge[4] = edgeElements->getElement(edgeNumbers[2]).isInterfaceElement();
4272 isInterfaceEdge[5] =
false;
4274 predecessorElement[3] = this->edgeMap_->getGlobalElement(edgeNumbers[0]);
4275 predecessorElement[4] = this->edgeMap_->getGlobalElement(edgeNumbers[2]);
4276 predecessorElement[5] = -1;
4279 (newElements)[2]={mutualNode[2] , midPointInd[1] ,midPointInd[2]};
4281 (newEdges)[6] = {mutualNode[2] ,midPointInd[1]};
4282 (newEdges)[7] = {mutualNode[2] ,midPointInd[2]};
4283 (newEdges)[8] = {midPointInd[1] ,midPointInd[2]};
4285 edgeFlags[6]=this->bcFlagRep_->at(midPointInd[1]);
4286 edgeFlags[7]=this->bcFlagRep_->at(midPointInd[2]);
4287 edgeFlags[8]=this->volumeID_;
4289 isInterfaceEdge[6] = edgeElements->getElement(edgeNumbers[1]).isInterfaceElement();
4290 isInterfaceEdge[7] = edgeElements->getElement(edgeNumbers[2]).isInterfaceElement();
4291 isInterfaceEdge[8] =
false;
4293 predecessorElement[6] = this->edgeMap_->getGlobalElement(edgeNumbers[1]);
4294 predecessorElement[7] = this->edgeMap_->getGlobalElement(edgeNumbers[2]);
4295 predecessorElement[8] = -1;
4299 (newElements)[3]={midPointInd[0],midPointInd[1],midPointInd[2]};
4301 (newEdges)[9] = {midPointInd[0] ,midPointInd[1]};
4302 (newEdges)[10] = {midPointInd[1] ,midPointInd[2]};
4303 (newEdges)[11] = {midPointInd[2] ,midPointInd[0]};
4305 edgeFlags[9]=this->volumeID_;
4306 edgeFlags[10]=this->volumeID_;
4307 edgeFlags[11]=this->volumeID_;
4309 isInterfaceEdge[9] =
false;
4310 isInterfaceEdge[10] =
false;
4311 isInterfaceEdge[11] =
false;
4313 predecessorElement[9] = -1;
4314 predecessorElement[10] = -1;
4315 predecessorElement[11] = -1;
4318 int offsetElements = this->elementsC_->numberElements();
4319 int offsetEdges = this->edgeElements_->numberElements();
4320 for(
int i=0;i<4; i++){
4321 sort( newElements.at(i).begin(), newElements.at(i).end() );
4323 feNew.setFiniteElementRefinementType(
"regular");
4324 feNew.setPredecessorElement(indexElement);
4326 this->elementsC_->addElement(feNew);
4328 this->elementsC_->switchElement(indexElement,feNew);
4331 for(
int i=0;i<12; i++){
4332 sort( newEdges.at(i).begin(), newEdges.at(i).end() );
4334 feNew.setInterfaceElement(isInterfaceEdge[i]);
4335 feNew.setPredecessorElement(predecessorElement[i]);
4337 this->edgeElements_->addEdge(feNew,i/3+offsetElements);
4338 if(edgeFlags[i]!=0 && edgeFlags[i]!=this->volumeID_){
4339 if ( !this->elementsC_->getElement(i/3+offsetElements).subElementsInitialized() )
4340 this->elementsC_->getElement(i/3+offsetElements).initializeSubElements( this->FEType_, this->dim_ -1) ;
4341 this->elementsC_->getElement(i/3+offsetElements).addSubElement(feNew);
4346 this->edgeElements_->addEdge(feNew,indexElement);
4354 else if(this->dim_ == 3){
4360 vec_int_Type midPointInd( 6 );
4361 vec_int_Type edgeNumbers = edgeElements->getEdgesOfElement(indexElement);
4372 vec_int_Type nodeInd = elements->getElement(indexElement).getVectorNodeList();
4374 vec2D_dbl_ptr_Type pointsRep = this->pointsRep_;
4405 vec_int_Type edgeNumbersTmp = edgeNumbers;
4406 for(
int i=0; i<6; i++){
4407 if(edgeElements->getElement(edgeNumbersTmp[i]).getNode(0) == nodeInd[0] || edgeElements->getElement(edgeNumbersTmp[i]).getNode(1) == nodeInd[0]){
4408 if(edgeElements->getElement(edgeNumbersTmp[i]).getNode(0) == nodeInd[1] || edgeElements->getElement(edgeNumbersTmp[i]).getNode(1) == nodeInd[1])
4409 edgeNumbers[0] = edgeNumbersTmp[i];
4410 else if(edgeElements->getElement(edgeNumbersTmp[i]).getNode(0) == nodeInd[2] || edgeElements->getElement(edgeNumbersTmp[i]).getNode(1) == nodeInd[2])
4411 edgeNumbers[1] = edgeNumbersTmp[i];
4412 else if(edgeElements->getElement(edgeNumbersTmp[i]).getNode(0) == nodeInd[3] || edgeElements->getElement(edgeNumbersTmp[i]).getNode(1) == nodeInd[3])
4413 edgeNumbers[2] = edgeNumbersTmp[i];
4415 else if(edgeElements->getElement(edgeNumbersTmp[i]).getNode(0) == nodeInd[1] || edgeElements->getElement(edgeNumbersTmp[i]).getNode(1) == nodeInd[1]){
4416 if(edgeElements->getElement(edgeNumbersTmp[i]).getNode(0) == nodeInd[2] || edgeElements->getElement(edgeNumbersTmp[i]).getNode(1) == nodeInd[2])
4417 edgeNumbers[3] = edgeNumbersTmp[i];
4418 else if(edgeElements->getElement(edgeNumbersTmp[i]).getNode(0) == nodeInd[3] || edgeElements->getElement(edgeNumbersTmp[i]).getNode(1) == nodeInd[3])
4419 edgeNumbers[4] = edgeNumbersTmp[i];
4421 else if(edgeElements->getElement(edgeNumbersTmp[i]).getNode(0) == nodeInd[2] || edgeElements->getElement(edgeNumbersTmp[i]).getNode(1) == nodeInd[2]){
4422 if(edgeElements->getElement(edgeNumbersTmp[i]).getNode(0) == nodeInd[3] || edgeElements->getElement(edgeNumbersTmp[i]).getNode(1) == nodeInd[3])
4423 edgeNumbers[5] = edgeNumbersTmp[i];
4437 vec_int_Type surfaceElementsIDs = surfaceTriangleElements->getSurfacesOfElement(indexElement);
4438 vec2D_int_Type originTriangles(4,vec_int_Type(3));
4440 originTriangles[0] = {nodeInd[0], nodeInd[1], nodeInd[2] };
4441 originTriangles[1] = {nodeInd[0], nodeInd[1], nodeInd[3] };
4442 originTriangles[2] = {nodeInd[0], nodeInd[2], nodeInd[3] };
4443 originTriangles[3] = {nodeInd[1], nodeInd[2], nodeInd[3] };
4447 vec_int_Type originFlag(4,this->volumeID_);
4449 vec_bool_Type interfaceSurface(4);
4450 vec_LO_Type triTmp(3);
4451 vec_int_Type originTriangleTmp(3);
4453 for(
int i=0; i< 4 ; i++){
4454 originTriangleTmp = originTriangles[i];
4455 sort(originTriangleTmp.begin(),originTriangleTmp.end());
4456 for(
int j=0; j<4 ; j++){
4457 FiniteElement surfaceTmp = surfaceTriangleElements->getElement(surfaceElementsIDs[j]);
4458 triTmp = surfaceTmp.getVectorNodeList();
4459 sort(triTmp.begin(),triTmp.end());
4460 if(triTmp[0] == originTriangleTmp[0] && triTmp[1] == originTriangleTmp[1] && triTmp[2] == originTriangleTmp[2] ) {
4461 originFlag[i] = surfaceTmp.getFlag();
4462 interfaceSurface[i] = surfaceTmp.isInterfaceElement();
4485 for(
int i=0; i<6; i++){
4486 if(!edgeElements->getElement(edgeNumbers[i]).isTaggedForRefinement())
4489 midPointInd[i] = edgeElements->getMidpoint(edgeNumbers[i]);
4492 midPointInd[i] = edgeElements->getMidpoint(edgeNumbers[i]);
4501 vec2D_int_Type newElements(8, vec_int_Type( 0 ));
4502 vec2D_int_Type newEdges(48,vec_int_Type(0));
4503 vec2D_int_Type newTriangles(32,vec_int_Type(0));
4504 vec_int_Type newTrianglesFlag(32) ;
4505 vec_int_Type isInterfaceSurface(32);
4506 vec_int_Type edgeFlags(48);
4507 vec_bool_Type isInterfaceEdge(48);
4508 vec_GO_Type predecessorElement(48);
4510 vec2D_LO_Type newTriangleEdgeIDs(8,vec_LO_Type(12));
4519 (newElements)[0]={nodeInd[0],midPointInd[0],midPointInd[1],midPointInd[2]};
4521 (newEdges)[0] = {nodeInd[0] ,midPointInd[0]};
4522 (newEdges)[1] = {nodeInd[0] ,midPointInd[1]};
4523 (newEdges)[2] = {nodeInd[0] ,midPointInd[2]};
4524 (newEdges)[3] = {midPointInd[0] ,midPointInd[1]};
4525 (newEdges)[4] = {midPointInd[0] ,midPointInd[2]};
4526 (newEdges)[5] = {midPointInd[1] ,midPointInd[2]};
4528 edgeFlags[0]=this->bcFlagRep_->at(midPointInd[0]);
4529 edgeFlags[1]=this->bcFlagRep_->at(midPointInd[1]);
4530 edgeFlags[2]=this->bcFlagRep_->at(midPointInd[2]);
4531 edgeFlags[3]=originFlag[0];
4532 edgeFlags[4]=originFlag[1];
4533 edgeFlags[5]=originFlag[2];
4535 isInterfaceEdge[0] = edgeElements->getElement(edgeNumbers[0]).isInterfaceElement();
4536 isInterfaceEdge[1] = edgeElements->getElement(edgeNumbers[1]).isInterfaceElement();
4537 isInterfaceEdge[2] = edgeElements->getElement(edgeNumbers[2]).isInterfaceElement();
4538 isInterfaceEdge[3] = interfaceSurface[0];
4539 isInterfaceEdge[4] = interfaceSurface[1];
4540 isInterfaceEdge[5] = interfaceSurface[2];
4542 predecessorElement[0] = this->edgeMap_->getGlobalElement(edgeNumbers[0]);
4543 predecessorElement[1] = this->edgeMap_->getGlobalElement(edgeNumbers[1]);
4544 predecessorElement[2] = this->edgeMap_->getGlobalElement(edgeNumbers[2]);
4545 predecessorElement[3] = -1;
4546 predecessorElement[4] = -1;
4547 predecessorElement[5] = -1;
4550 newTriangles[0]= {nodeInd[0],midPointInd[1],midPointInd[0]};
4551 newTriangles[1]= {nodeInd[0],midPointInd[0],midPointInd[2]};
4552 newTriangles[2]= {nodeInd[0],midPointInd[2],midPointInd[1]};
4553 newTriangles[3]= {midPointInd[0],midPointInd[1],midPointInd[2]};
4555 newTrianglesFlag[0]= originFlag[0];
4556 newTrianglesFlag[1]= originFlag[1];
4557 newTrianglesFlag[2]= originFlag[2];
4558 newTrianglesFlag[3]= this->volumeID_;
4560 isInterfaceSurface[0] = interfaceSurface[0];
4561 isInterfaceSurface[1] = interfaceSurface[1];
4562 isInterfaceSurface[2] = interfaceSurface[2];
4563 isInterfaceSurface[3] =
false;
4565 newTriangleEdgeIDs[0]={0,1,3,0,2,4,1,2,5,3,4,5};
4567 (newElements)[1]={midPointInd[0],nodeInd[1],midPointInd[3],midPointInd[4]};
4569 (newEdges)[6] = {nodeInd[1] ,midPointInd[0]};
4570 (newEdges)[7] = {nodeInd[1] ,midPointInd[3]};
4571 (newEdges)[8] = {nodeInd[1] ,midPointInd[4]};
4572 (newEdges)[9] = {midPointInd[0] ,midPointInd[3]};
4573 (newEdges)[10] = {midPointInd[0] ,midPointInd[4]};
4574 (newEdges)[11] = {midPointInd[3] ,midPointInd[4]};
4576 edgeFlags[6]=this->bcFlagRep_->at(midPointInd[0]);
4577 edgeFlags[7]=this->bcFlagRep_->at(midPointInd[3]);
4578 edgeFlags[8]=this->bcFlagRep_->at(midPointInd[4]);
4579 edgeFlags[9]=originFlag[0];
4580 edgeFlags[10]=originFlag[1];
4581 edgeFlags[11]=originFlag[3];
4583 isInterfaceEdge[6] =edgeElements->getElement(edgeNumbers[0]).isInterfaceElement();
4584 isInterfaceEdge[7] =edgeElements->getElement(edgeNumbers[3]).isInterfaceElement();
4585 isInterfaceEdge[8] =edgeElements->getElement(edgeNumbers[4]).isInterfaceElement();
4586 isInterfaceEdge[9] = interfaceSurface[0];
4587 isInterfaceEdge[10] = interfaceSurface[1];
4588 isInterfaceEdge[11] = interfaceSurface[3];
4590 predecessorElement[6] = this->edgeMap_->getGlobalElement(edgeNumbers[0]);
4591 predecessorElement[7] = this->edgeMap_->getGlobalElement(edgeNumbers[3]);
4592 predecessorElement[8] = this->edgeMap_->getGlobalElement(edgeNumbers[4]);
4593 predecessorElement[9] = -1;
4594 predecessorElement[10] = -1;
4595 predecessorElement[11] = -1;
4598 newTriangles[4]= {nodeInd[1],midPointInd[0],midPointInd[3]};
4599 newTriangles[5]= {nodeInd[1],midPointInd[4],midPointInd[0]};
4600 newTriangles[6]= {nodeInd[1],midPointInd[3],midPointInd[4]};
4601 newTriangles[7]= {midPointInd[0],midPointInd[3],midPointInd[4]};
4603 newTrianglesFlag[4]= originFlag[0];
4604 newTrianglesFlag[5]= originFlag[1];
4605 newTrianglesFlag[6]= originFlag[3];
4606 newTrianglesFlag[7]= this->volumeID_;
4608 isInterfaceSurface[4] = interfaceSurface[0];
4609 isInterfaceSurface[5] = interfaceSurface[1];
4610 isInterfaceSurface[6] = interfaceSurface[3];
4611 isInterfaceSurface[7] =
false;
4613 newTriangleEdgeIDs[1]={6,7,9,6,8,10,7,8,11,9,10,11};
4615 (newElements)[2]={nodeInd[2],midPointInd[1],midPointInd[3],midPointInd[5]};
4617 (newEdges)[12] = {nodeInd[2] ,midPointInd[1]};
4618 (newEdges)[13] = {nodeInd[2] ,midPointInd[3]};
4619 (newEdges)[14] = {nodeInd[2] ,midPointInd[5]};
4620 (newEdges)[15] = {midPointInd[1] ,midPointInd[3]};
4621 (newEdges)[16] = {midPointInd[1] ,midPointInd[5]};
4622 (newEdges)[17] = {midPointInd[3] ,midPointInd[5]};
4624 edgeFlags[12]=this->bcFlagRep_->at(midPointInd[1]);
4625 edgeFlags[13]=this->bcFlagRep_->at(midPointInd[3]);
4626 edgeFlags[14]=this->bcFlagRep_->at(midPointInd[5]);
4627 edgeFlags[15]=originFlag[0];
4628 edgeFlags[16]=originFlag[2];
4629 edgeFlags[17]=originFlag[3];
4631 isInterfaceEdge[12] = edgeElements->getElement(edgeNumbers[1]).isInterfaceElement();
4632 isInterfaceEdge[13] = edgeElements->getElement(edgeNumbers[3]).isInterfaceElement();
4633 isInterfaceEdge[14] = edgeElements->getElement(edgeNumbers[5]).isInterfaceElement();
4634 isInterfaceEdge[15] = interfaceSurface[0];
4635 isInterfaceEdge[16] = interfaceSurface[2];
4636 isInterfaceEdge[17] = interfaceSurface[3];
4638 predecessorElement[12] = this->edgeMap_->getGlobalElement(edgeNumbers[1]);
4639 predecessorElement[13] = this->edgeMap_->getGlobalElement(edgeNumbers[3]);
4640 predecessorElement[14] = this->edgeMap_->getGlobalElement(edgeNumbers[5]);
4641 predecessorElement[15] = -1;
4642 predecessorElement[16] = -1;
4643 predecessorElement[17] = -1;
4646 newTriangles[8]= {nodeInd[2],midPointInd[3],midPointInd[1]};
4647 newTriangles[9]= {nodeInd[2],midPointInd[1],midPointInd[5]};
4648 newTriangles[10]= {nodeInd[2],midPointInd[5],midPointInd[3]};
4649 newTriangles[11]= {midPointInd[1],midPointInd[3],midPointInd[5]};
4651 newTrianglesFlag[8]= originFlag[0];
4652 newTrianglesFlag[9]= originFlag[2];
4653 newTrianglesFlag[10]= originFlag[3];
4654 newTrianglesFlag[11]= this->volumeID_;
4656 isInterfaceSurface[8] = interfaceSurface[0];
4657 isInterfaceSurface[9] = interfaceSurface[2];
4658 isInterfaceSurface[10] = interfaceSurface[3];
4659 isInterfaceSurface[11] =
false;
4661 newTriangleEdgeIDs[2]={12,13,15,12,14,16,13,14,17,15,16,17};
4664 (newElements)[3]={midPointInd[2],midPointInd[4],midPointInd[5],nodeInd[3]};
4666 (newEdges)[18] = {nodeInd[3] ,midPointInd[2]};
4667 (newEdges)[19] = {nodeInd[3] ,midPointInd[4]};
4668 (newEdges)[20] = {nodeInd[3] ,midPointInd[5]};
4669 (newEdges)[21] = {midPointInd[2] ,midPointInd[4]};
4670 (newEdges)[22] = {midPointInd[2] ,midPointInd[5]};
4671 (newEdges)[23] = {midPointInd[4] ,midPointInd[5]};
4673 edgeFlags[18]=this->bcFlagRep_->at(midPointInd[2]);
4674 edgeFlags[19]=this->bcFlagRep_->at(midPointInd[4]);
4675 edgeFlags[20]=this->bcFlagRep_->at(midPointInd[5]);
4676 edgeFlags[21]=originFlag[1];
4677 edgeFlags[22]=originFlag[2];
4678 edgeFlags[23]=originFlag[3];
4680 isInterfaceEdge[18] = edgeElements->getElement(edgeNumbers[2]).isInterfaceElement();
4681 isInterfaceEdge[19] = edgeElements->getElement(edgeNumbers[4]).isInterfaceElement();
4682 isInterfaceEdge[20] = edgeElements->getElement(edgeNumbers[5]).isInterfaceElement();
4683 isInterfaceEdge[21] = interfaceSurface[1];
4684 isInterfaceEdge[22] = interfaceSurface[2];
4685 isInterfaceEdge[23] = interfaceSurface[3];
4687 predecessorElement[18] = this->edgeMap_->getGlobalElement(edgeNumbers[2]);
4688 predecessorElement[19] = this->edgeMap_->getGlobalElement(edgeNumbers[4]);
4689 predecessorElement[20] = this->edgeMap_->getGlobalElement(edgeNumbers[5]);
4690 predecessorElement[21] = -1;
4691 predecessorElement[22] = -1;
4692 predecessorElement[23] = -1;
4696 newTriangles[12]= {nodeInd[3],midPointInd[2],midPointInd[4]};
4697 newTriangles[13]= {nodeInd[3],midPointInd[5],midPointInd[2]};
4698 newTriangles[14]= {nodeInd[3],midPointInd[4],midPointInd[5]};
4699 newTriangles[15]= {midPointInd[2],midPointInd[4],midPointInd[5]};
4701 newTrianglesFlag[12]= originFlag[1];
4702 newTrianglesFlag[13]= originFlag[2];
4703 newTrianglesFlag[14]= originFlag[3];
4704 newTrianglesFlag[15]= this->volumeID_;
4706 isInterfaceSurface[12] = interfaceSurface[1];
4707 isInterfaceSurface[13] = interfaceSurface[2];
4708 isInterfaceSurface[14] = interfaceSurface[3];
4709 isInterfaceSurface[15] =
false;
4712 newTriangleEdgeIDs[3]={18,19,20,18,20,22,19,21,23,21,22,23};
4716 vec_dbl_Type lengthDia(3);
4720 lengthDia[0] = std::sqrt(std::pow(pointsRep->at(midPointInd[1]).at(0) - pointsRep->at(midPointInd[4]).at(0),2) + std::pow(pointsRep->at(midPointInd[1]).at(1) - pointsRep->at(midPointInd[4]).at(1),2) +std::pow(pointsRep->at(midPointInd[1]).at(2) - pointsRep->at(midPointInd[4]).at(2),2) );
4722 lengthDia[1] = std::sqrt(std::pow(pointsRep->at(midPointInd[0]).at(0) - pointsRep->at(midPointInd[5]).at(0),2) + std::pow(pointsRep->at(midPointInd[0]).at(1) - pointsRep->at(midPointInd[5]).at(1),2) +std::pow(pointsRep->at(midPointInd[0]).at(2) - pointsRep->at(midPointInd[5]).at(2),2) );
4724 lengthDia[2] = std::sqrt(std::pow(pointsRep->at(midPointInd[2]).at(0) - pointsRep->at(midPointInd[3]).at(0),2) + std::pow(pointsRep->at(midPointInd[2]).at(1) - pointsRep->at(midPointInd[3]).at(1),2) +std::pow(pointsRep->at(midPointInd[2]).at(2) - pointsRep->at(midPointInd[3]).at(2),2) );
4727 vec2D_dbl_Type dia(3,vec_dbl_Type(2));
4728 dia[0] = { lengthDia[0],0.};
4729 dia[1] = { lengthDia[1],1.};
4730 dia[2] = { lengthDia[2],2.};
4731 sort(dia.begin(),dia.end());
4738 if(refinement3DDiagonal_>2 || refinement3DDiagonal_ == 0)
4741 diaInd = (int) dia[refinement3DDiagonal_][1];
4742 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::runtime_error,
"The Refinement feature to pick a specific internal Diagonal in regular refinement is not yet orientation preserving!");
4749 (newElements)[4]={midPointInd[0],midPointInd[1],midPointInd[2],midPointInd[4]};
4751 (newEdges)[24] = {midPointInd[0] ,midPointInd[1]};
4752 (newEdges)[25] = {midPointInd[0] ,midPointInd[2]};
4753 (newEdges)[26] = {midPointInd[0] ,midPointInd[4]};
4754 (newEdges)[27] = {midPointInd[1] ,midPointInd[2]};
4755 (newEdges)[28] = {midPointInd[1] ,midPointInd[4]};
4756 (newEdges)[29] = {midPointInd[2] ,midPointInd[4]};
4758 edgeFlags[24]=originFlag[0];
4759 edgeFlags[25]=originFlag[1];
4760 edgeFlags[26]=originFlag[1];
4761 edgeFlags[27]=originFlag[2];
4762 edgeFlags[28]=this->volumeID_;
4763 edgeFlags[29]=originFlag[1];
4765 isInterfaceEdge[24] = interfaceSurface[0];
4766 isInterfaceEdge[25] = interfaceSurface[1];
4767 isInterfaceEdge[26] = interfaceSurface[1];
4768 isInterfaceEdge[27] = interfaceSurface[2];
4769 isInterfaceEdge[28] =
false;
4770 isInterfaceEdge[29] = interfaceSurface[1];
4773 predecessorElement[24] = -1;
4774 predecessorElement[25] = -1;
4775 predecessorElement[26] = -1;
4776 predecessorElement[27] = -1;
4777 predecessorElement[28] = -1;
4778 predecessorElement[29] = -1;
4781 newTriangles[16]= {midPointInd[0],midPointInd[1],midPointInd[2]};
4782 newTriangles[17]= {midPointInd[0],midPointInd[1],midPointInd[4]};
4783 newTriangles[18]= {midPointInd[0],midPointInd[4],midPointInd[2]};
4784 newTriangles[19]= {midPointInd[1],midPointInd[2],midPointInd[4]};
4787 newTrianglesFlag[16]= this->volumeID_;
4788 newTrianglesFlag[17]= this->volumeID_;
4789 newTrianglesFlag[18]= originFlag[1];
4790 newTrianglesFlag[19]= this->volumeID_;
4792 isInterfaceSurface[16] =
false;
4793 isInterfaceSurface[17] =
false;
4794 isInterfaceSurface[18] = interfaceSurface[1];
4795 isInterfaceSurface[19] =
false;
4797 newTriangleEdgeIDs[4]={24,25,27,24,26,28,25,26,29,27,28,29};
4800 (newElements)[5]={midPointInd[0],midPointInd[3],midPointInd[1],midPointInd[4]};
4802 (newEdges)[30] = {midPointInd[0],midPointInd[1]};
4803 (newEdges)[31] = {midPointInd[0] ,midPointInd[3]};
4804 (newEdges)[32] = {midPointInd[0],midPointInd[4]};
4805 (newEdges)[33] = {midPointInd[1] ,midPointInd[3]};
4806 (newEdges)[34] = {midPointInd[1] ,midPointInd[4]};
4807 (newEdges)[35] = {midPointInd[3] ,midPointInd[4]};
4809 edgeFlags[30]=originFlag[0];
4810 edgeFlags[31]=originFlag[0];
4811 edgeFlags[32]=originFlag[1];
4812 edgeFlags[33]=originFlag[0];
4813 edgeFlags[34]=this->volumeID_;
4814 edgeFlags[35]=originFlag[3];
4816 isInterfaceEdge[30] = interfaceSurface[0];
4817 isInterfaceEdge[31] = interfaceSurface[0];
4818 isInterfaceEdge[32] = interfaceSurface[1];
4819 isInterfaceEdge[33] = interfaceSurface[0];
4820 isInterfaceEdge[34] =
false;
4821 isInterfaceEdge[35] = interfaceSurface[3];
4823 predecessorElement[30] = -1;
4824 predecessorElement[31] = -1;
4825 predecessorElement[32] = -1;
4826 predecessorElement[33] = -1;
4827 predecessorElement[34] = -1;
4828 predecessorElement[35] = -1;
4832 newTriangles[20]= {midPointInd[0],midPointInd[1],midPointInd[3]};
4833 newTriangles[21]= {midPointInd[0],midPointInd[1],midPointInd[4]};
4834 newTriangles[22]= {midPointInd[0],midPointInd[3],midPointInd[4]};
4835 newTriangles[23]= {midPointInd[1],midPointInd[3],midPointInd[4]};
4837 newTrianglesFlag[20]= originFlag[0];
4838 newTrianglesFlag[21]= this->volumeID_;
4839 newTrianglesFlag[22]= this->volumeID_;
4840 newTrianglesFlag[23]= this->volumeID_;
4842 isInterfaceSurface[20] = interfaceSurface[0];
4843 isInterfaceSurface[21] =
false;
4844 isInterfaceSurface[22] =
false;
4845 isInterfaceSurface[23] =
false;
4847 newTriangleEdgeIDs[5]={30,31,33,30,32,34,31,32,35,33,34,35};
4849 (newElements)[6]={midPointInd[1],midPointInd[2],midPointInd[4],midPointInd[5]};
4851 (newEdges)[36] = {midPointInd[1] ,midPointInd[2]};
4852 (newEdges)[37] = {midPointInd[1] ,midPointInd[4]};
4853 (newEdges)[38] = {midPointInd[1] ,midPointInd[5]};
4854 (newEdges)[39] = {midPointInd[2] ,midPointInd[4]};
4855 (newEdges)[40] = {midPointInd[2] ,midPointInd[5]};
4856 (newEdges)[41] = {midPointInd[4] ,midPointInd[5]};
4858 edgeFlags[36]=originFlag[2];
4859 edgeFlags[37]=this->volumeID_;
4860 edgeFlags[38]=originFlag[2];
4861 edgeFlags[39]=originFlag[1];
4862 edgeFlags[40]=originFlag[2];
4863 edgeFlags[41]=originFlag[3];
4865 isInterfaceEdge[36] = interfaceSurface[2];
4866 isInterfaceEdge[37] =
false;
4867 isInterfaceEdge[38] = interfaceSurface[2];
4868 isInterfaceEdge[39] = interfaceSurface[1];
4869 isInterfaceEdge[40] = interfaceSurface[2];
4870 isInterfaceEdge[41] = interfaceSurface[3];
4872 predecessorElement[36] = -1;
4873 predecessorElement[37] = -1;
4874 predecessorElement[38] = -1;
4875 predecessorElement[39] = -1;
4876 predecessorElement[40] = -1;
4877 predecessorElement[41] = -1;
4880 newTriangles[24]= {midPointInd[1],midPointInd[2],midPointInd[4]};
4881 newTriangles[25]= {midPointInd[1],midPointInd[2],midPointInd[5]};
4882 newTriangles[26]= {midPointInd[1],midPointInd[4],midPointInd[5]};
4883 newTriangles[27]= {midPointInd[2],midPointInd[4],midPointInd[5]};
4885 newTrianglesFlag[24]= this->volumeID_;
4886 newTrianglesFlag[25]= originFlag[2];
4887 newTrianglesFlag[26]= this->volumeID_;
4888 newTrianglesFlag[27]= this->volumeID_;
4890 isInterfaceSurface[24] =
false;
4891 isInterfaceSurface[25] = interfaceSurface[2];
4892 isInterfaceSurface[26] =
false;
4893 isInterfaceSurface[27] =
false;
4895 newTriangleEdgeIDs[6]={36,37,39,36,38,40,37,38,41,39,40,41};
4898 (newElements)[7]={midPointInd[1],midPointInd[3],midPointInd[5],midPointInd[4]};
4900 (newEdges)[42] = {midPointInd[1] ,midPointInd[3]};
4901 (newEdges)[43] = {midPointInd[1] ,midPointInd[4]};
4902 (newEdges)[44] = {midPointInd[1] ,midPointInd[5]};
4903 (newEdges)[45] = {midPointInd[3] ,midPointInd[4]};
4904 (newEdges)[46] = {midPointInd[3] ,midPointInd[5]};
4905 (newEdges)[47] = {midPointInd[4] ,midPointInd[5]};
4907 edgeFlags[42]=originFlag[0];
4908 edgeFlags[43]=this->volumeID_;
4909 edgeFlags[44]=originFlag[2];
4910 edgeFlags[45]=originFlag[3];
4911 edgeFlags[46]=originFlag[3];
4912 edgeFlags[47]=originFlag[3];
4914 isInterfaceEdge[42] = interfaceSurface[0];
4915 isInterfaceEdge[43] =
false;
4916 isInterfaceEdge[44] = interfaceSurface[2];
4917 isInterfaceEdge[45] = interfaceSurface[3];
4918 isInterfaceEdge[46] = interfaceSurface[3];
4919 isInterfaceEdge[47] = interfaceSurface[3];
4921 predecessorElement[42] = -1;
4922 predecessorElement[43] = -1;
4923 predecessorElement[44] = -1;
4924 predecessorElement[45] = -1;
4925 predecessorElement[46] = -1;
4926 predecessorElement[47] = -1;
4929 newTriangles[28]= {midPointInd[1],midPointInd[3],midPointInd[4]};
4930 newTriangles[29]= {midPointInd[1],midPointInd[3],midPointInd[5]};
4931 newTriangles[30]= {midPointInd[1],midPointInd[4],midPointInd[5]};
4932 newTriangles[31]= {midPointInd[3],midPointInd[5],midPointInd[4]};
4934 newTrianglesFlag[28]= this->volumeID_;
4935 newTrianglesFlag[29]= this->volumeID_;
4936 newTrianglesFlag[30]= this->volumeID_;
4937 newTrianglesFlag[31]= originFlag[3];
4939 isInterfaceSurface[28] =
false;
4940 isInterfaceSurface[29] =
false;
4941 isInterfaceSurface[30] =
false;
4942 isInterfaceSurface[31] = interfaceSurface[3];
4944 newTriangleEdgeIDs[7]={42,43,45,42,44,46,43,44,47,45,46,47};
4947 else if(diaInd ==1){
4949 (newElements)[4]={midPointInd[0],midPointInd[1],midPointInd[2],midPointInd[5]};
4951 (newEdges)[24] = {midPointInd[0] ,midPointInd[1]};
4952 (newEdges)[25] = {midPointInd[0] ,midPointInd[2]};
4953 (newEdges)[26] = {midPointInd[0] ,midPointInd[5]};
4954 (newEdges)[27] = {midPointInd[1] ,midPointInd[2]};
4955 (newEdges)[28] = {midPointInd[1] ,midPointInd[5]};
4956 (newEdges)[29] = {midPointInd[2] ,midPointInd[5]};
4958 edgeFlags[24]=originFlag[0];
4959 edgeFlags[25]=originFlag[1];
4960 edgeFlags[26]=this->volumeID_;
4961 edgeFlags[27]=originFlag[2];
4962 edgeFlags[28]=originFlag[2];
4963 edgeFlags[29]=originFlag[2];
4965 isInterfaceEdge[24] = interfaceSurface[0];
4966 isInterfaceEdge[25] = interfaceSurface[1];
4967 isInterfaceEdge[26] =
false;
4968 isInterfaceEdge[27] = interfaceSurface[2];
4969 isInterfaceEdge[28] = interfaceSurface[2];
4970 isInterfaceEdge[29] = interfaceSurface[2];
4973 predecessorElement[24] = -1;
4974 predecessorElement[25] = -1;
4975 predecessorElement[26] = -1;
4976 predecessorElement[27] = -1;
4977 predecessorElement[28] = -1;
4978 predecessorElement[29] = -1;
4981 newTriangles[16]= {midPointInd[0],midPointInd[1],midPointInd[2]};
4982 newTriangles[17]= {midPointInd[0],midPointInd[1],midPointInd[5]};
4983 newTriangles[18]= {midPointInd[0],midPointInd[2],midPointInd[5]};
4984 newTriangles[19]= {midPointInd[1],midPointInd[2],midPointInd[5]};
4987 newTrianglesFlag[16]= this->volumeID_;
4988 newTrianglesFlag[17]= this->volumeID_;
4989 newTrianglesFlag[18]= this->volumeID_;
4990 newTrianglesFlag[19]= originFlag[2];
4992 isInterfaceSurface[16] =
false;
4993 isInterfaceSurface[17] =
false;
4994 isInterfaceSurface[18] =
false;
4995 isInterfaceSurface[19] = interfaceSurface[2];;
4997 newTriangleEdgeIDs[4]={24,25,27,24,26,28,25,26,29,27,28,29};
5000 (newElements)[5]={midPointInd[0],midPointInd[3],midPointInd[4],midPointInd[5]};
5002 (newEdges)[30] = {midPointInd[0],midPointInd[3]};
5003 (newEdges)[31] = {midPointInd[0] ,midPointInd[4]};
5004 (newEdges)[32] = {midPointInd[0],midPointInd[5]};
5005 (newEdges)[33] = {midPointInd[3] ,midPointInd[4]};
5006 (newEdges)[34] = {midPointInd[3] ,midPointInd[5]};
5007 (newEdges)[35] = {midPointInd[4] ,midPointInd[5]};
5009 edgeFlags[30]=originFlag[0];
5010 edgeFlags[31]=originFlag[1];
5011 edgeFlags[32]=this->volumeID_;
5012 edgeFlags[33]=originFlag[3];
5013 edgeFlags[34]=originFlag[3];
5014 edgeFlags[35]=originFlag[3];
5016 isInterfaceEdge[30] = interfaceSurface[0];
5017 isInterfaceEdge[31] = interfaceSurface[1];
5018 isInterfaceEdge[32] =
false;
5019 isInterfaceEdge[33] = interfaceSurface[3];
5020 isInterfaceEdge[34] = interfaceSurface[3];
5021 isInterfaceEdge[35] = interfaceSurface[3];
5023 predecessorElement[30] = -1;
5024 predecessorElement[31] = -1;
5025 predecessorElement[32] = -1;
5026 predecessorElement[33] = -1;
5027 predecessorElement[34] = -1;
5028 predecessorElement[35] = -1;
5032 newTriangles[20]= {midPointInd[0],midPointInd[3],midPointInd[4]};
5033 newTriangles[21]= {midPointInd[0],midPointInd[3],midPointInd[5]};
5034 newTriangles[22]= {midPointInd[0],midPointInd[4],midPointInd[5]};
5035 newTriangles[23]= {midPointInd[3],midPointInd[4],midPointInd[5]};
5037 newTrianglesFlag[20]= this->volumeID_;
5038 newTrianglesFlag[21]= this->volumeID_;
5039 newTrianglesFlag[22]= this->volumeID_;
5040 newTrianglesFlag[23]= originFlag[3];
5042 isInterfaceSurface[20] =
false;
5043 isInterfaceSurface[21] =
false;
5044 isInterfaceSurface[22] =
false;
5045 isInterfaceSurface[23] = interfaceSurface[3];
5047 newTriangleEdgeIDs[5]={30,31,33,30,32,34,31,32,35,33,34,35};
5050 (newElements)[6]={midPointInd[0],midPointInd[1],midPointInd[3],midPointInd[5]};
5052 (newEdges)[36] = {midPointInd[0] ,midPointInd[1]};
5053 (newEdges)[37] = {midPointInd[0] ,midPointInd[3]};
5054 (newEdges)[38] = {midPointInd[0] ,midPointInd[5]};
5055 (newEdges)[39] = {midPointInd[1] ,midPointInd[3]};
5056 (newEdges)[40] = {midPointInd[1] ,midPointInd[5]};
5057 (newEdges)[41] = {midPointInd[3] ,midPointInd[5]};
5059 edgeFlags[36]=originFlag[0];
5060 edgeFlags[37]=originFlag[0];
5061 edgeFlags[38]=this->volumeID_;
5062 edgeFlags[39]=originFlag[0];
5063 edgeFlags[40]=originFlag[2];
5064 edgeFlags[41]=originFlag[3];
5066 isInterfaceEdge[36] = interfaceSurface[0];
5067 isInterfaceEdge[37] = interfaceSurface[0];
5068 isInterfaceEdge[38] =
false;
5069 isInterfaceEdge[39] = interfaceSurface[0];
5070 isInterfaceEdge[40] = interfaceSurface[2];
5071 isInterfaceEdge[41] = interfaceSurface[3];
5073 predecessorElement[36] = -1;
5074 predecessorElement[37] = -1;
5075 predecessorElement[38] = -1;
5076 predecessorElement[39] = -1;
5077 predecessorElement[40] = -1;
5078 predecessorElement[41] = -1;
5081 newTriangles[24]= {midPointInd[0],midPointInd[1],midPointInd[3]};
5082 newTriangles[25]= {midPointInd[0],midPointInd[1],midPointInd[5]};
5083 newTriangles[26]= {midPointInd[0],midPointInd[3],midPointInd[5]};
5084 newTriangles[27]= {midPointInd[1],midPointInd[3],midPointInd[5]};
5086 newTrianglesFlag[24]= originFlag[0];
5087 newTrianglesFlag[25]= this->volumeID_;
5088 newTrianglesFlag[26]= this->volumeID_;
5089 newTrianglesFlag[27]= this->volumeID_;
5091 isInterfaceSurface[24] = interfaceSurface[0];
5092 isInterfaceSurface[25] =
false;
5093 isInterfaceSurface[26] =
false;
5094 isInterfaceSurface[27] =
false;
5096 newTriangleEdgeIDs[6]={36,37,39,36,38,40,37,38,41,39,40,41};
5099 (newElements)[7]={midPointInd[0],midPointInd[4],midPointInd[2],midPointInd[5]};
5101 (newEdges)[42] = {midPointInd[0] ,midPointInd[2]};
5102 (newEdges)[43] = {midPointInd[0] ,midPointInd[4]};
5103 (newEdges)[44] = {midPointInd[0] ,midPointInd[5]};
5104 (newEdges)[45] = {midPointInd[2] ,midPointInd[4]};
5105 (newEdges)[46] = {midPointInd[2] ,midPointInd[5]};
5106 (newEdges)[47] = {midPointInd[4] ,midPointInd[5]};
5108 edgeFlags[42]=originFlag[1];
5109 edgeFlags[43]=originFlag[1];
5110 edgeFlags[44]=this->volumeID_;
5111 edgeFlags[45]=originFlag[1];
5112 edgeFlags[46]=originFlag[2];
5113 edgeFlags[47]=originFlag[3];
5115 isInterfaceEdge[42] = interfaceSurface[1];
5116 isInterfaceEdge[43] = interfaceSurface[1];
5117 isInterfaceEdge[44] =
false;
5118 isInterfaceEdge[45] = interfaceSurface[1];
5119 isInterfaceEdge[46] = interfaceSurface[2];
5120 isInterfaceEdge[47] = interfaceSurface[3];
5122 predecessorElement[42] = -1;
5123 predecessorElement[43] = -1;
5124 predecessorElement[44] = -1;
5125 predecessorElement[45] = -1;
5126 predecessorElement[46] = -1;
5127 predecessorElement[47] = -1;
5130 newTriangles[28]= {midPointInd[0],midPointInd[2],midPointInd[4]};
5131 newTriangles[29]= {midPointInd[0],midPointInd[2],midPointInd[5]};
5132 newTriangles[30]= {midPointInd[0],midPointInd[4],midPointInd[5]};
5133 newTriangles[31]= {midPointInd[2],midPointInd[4],midPointInd[5]};
5135 newTrianglesFlag[28]= originFlag[1];
5136 newTrianglesFlag[29]= this->volumeID_;
5137 newTrianglesFlag[30]= this->volumeID_;
5138 newTrianglesFlag[31]= this->volumeID_;
5140 isInterfaceSurface[28] = interfaceSurface[1];
5141 isInterfaceSurface[29] =
false;
5142 isInterfaceSurface[30] =
false;
5143 isInterfaceSurface[31] =
false;
5145 newTriangleEdgeIDs[7]={42,43,45,42,44,46,43,44,47,45,46,47};
5147 else if(diaInd ==2){
5149 (newElements)[4]={midPointInd[0],midPointInd[1],midPointInd[2],midPointInd[3]};
5151 (newEdges)[24] = {midPointInd[0] ,midPointInd[1]};
5152 (newEdges)[25] = {midPointInd[0] ,midPointInd[2]};
5153 (newEdges)[26] = {midPointInd[0] ,midPointInd[3]};
5154 (newEdges)[27] = {midPointInd[1] ,midPointInd[2]};
5155 (newEdges)[28] = {midPointInd[1] ,midPointInd[3]};
5156 (newEdges)[29] = {midPointInd[2] ,midPointInd[3]};
5158 edgeFlags[24]=originFlag[0];
5159 edgeFlags[25]=originFlag[1];
5160 edgeFlags[26]=originFlag[0];
5161 edgeFlags[27]=originFlag[2];
5162 edgeFlags[28]=originFlag[0];
5163 edgeFlags[29]=this->volumeID_;
5165 isInterfaceEdge[24] = interfaceSurface[0];
5166 isInterfaceEdge[25] = interfaceSurface[1];
5167 isInterfaceEdge[26] = interfaceSurface[0];
5168 isInterfaceEdge[27] = interfaceSurface[2];
5169 isInterfaceEdge[28] = interfaceSurface[0];
5170 isInterfaceEdge[29] =
false;
5173 predecessorElement[24] = -1;
5174 predecessorElement[25] = -1;
5175 predecessorElement[26] = -1;
5176 predecessorElement[27] = -1;
5177 predecessorElement[28] = -1;
5178 predecessorElement[29] = -1;
5181 newTriangles[16]= {midPointInd[0],midPointInd[1],midPointInd[2]};
5182 newTriangles[17]= {midPointInd[0],midPointInd[1],midPointInd[3]};
5183 newTriangles[18]= {midPointInd[0],midPointInd[2],midPointInd[3]};
5184 newTriangles[19]= {midPointInd[1],midPointInd[2],midPointInd[3]};
5187 newTrianglesFlag[16]= this->volumeID_;
5188 newTrianglesFlag[17]= originFlag[0];
5189 newTrianglesFlag[18]= this->volumeID_;
5190 newTrianglesFlag[19]= this->volumeID_;
5192 isInterfaceSurface[16] =
false;
5193 isInterfaceSurface[17] = interfaceSurface[0];
5194 isInterfaceSurface[18] =
false;
5195 isInterfaceSurface[19] =
false;
5197 newTriangleEdgeIDs[4]={24,25,27,24,26,28,25,26,29,27,28,29};
5200 (newElements)[5]={midPointInd[0],midPointInd[2],midPointInd[3],midPointInd[4]};
5202 (newEdges)[30] = {midPointInd[0],midPointInd[2]};
5203 (newEdges)[31] = {midPointInd[0] ,midPointInd[3]};
5204 (newEdges)[32] = {midPointInd[0],midPointInd[4]};
5205 (newEdges)[33] = {midPointInd[2] ,midPointInd[3]};
5206 (newEdges)[34] = {midPointInd[2] ,midPointInd[4]};
5207 (newEdges)[35] = {midPointInd[3] ,midPointInd[4]};
5209 edgeFlags[30]=originFlag[1];
5210 edgeFlags[31]=originFlag[0];
5211 edgeFlags[32]=originFlag[1];
5212 edgeFlags[33]=this->volumeID_;
5213 edgeFlags[34]=originFlag[1];
5214 edgeFlags[35]=originFlag[3];
5216 isInterfaceEdge[30] = interfaceSurface[1];
5217 isInterfaceEdge[31] = interfaceSurface[0];
5218 isInterfaceEdge[32] = interfaceSurface[1];
5219 isInterfaceEdge[33] =
false;
5220 isInterfaceEdge[34] = interfaceSurface[1];
5221 isInterfaceEdge[35] = interfaceSurface[3];
5223 predecessorElement[30] = -1;
5224 predecessorElement[31] = -1;
5225 predecessorElement[32] = -1;
5226 predecessorElement[33] = -1;
5227 predecessorElement[34] = -1;
5228 predecessorElement[35] = -1;
5232 newTriangles[20]= {midPointInd[0],midPointInd[2],midPointInd[3]};
5233 newTriangles[21]= {midPointInd[0],midPointInd[2],midPointInd[4]};
5234 newTriangles[22]= {midPointInd[0],midPointInd[3],midPointInd[4]};
5235 newTriangles[23]= {midPointInd[2],midPointInd[3],midPointInd[4]};
5237 newTrianglesFlag[20]= this->volumeID_;
5238 newTrianglesFlag[21]= originFlag[1];
5239 newTrianglesFlag[22]= this->volumeID_;
5240 newTrianglesFlag[23]= this->volumeID_;
5242 isInterfaceSurface[20] =
false;
5243 isInterfaceSurface[21] = interfaceSurface[1];
5244 isInterfaceSurface[22] =
false;
5245 isInterfaceSurface[23] =
false;
5247 newTriangleEdgeIDs[5]={30,31,33,30,32,34,31,32,35,33,34,35};
5249 (newElements)[6]={midPointInd[1],midPointInd[2],midPointInd[3],midPointInd[5]};
5251 (newEdges)[36] = {midPointInd[1] ,midPointInd[2]};
5252 (newEdges)[37] = {midPointInd[1] ,midPointInd[3]};
5253 (newEdges)[38] = {midPointInd[1] ,midPointInd[5]};
5254 (newEdges)[39] = {midPointInd[2] ,midPointInd[3]};
5255 (newEdges)[40] = {midPointInd[2] ,midPointInd[5]};
5256 (newEdges)[41] = {midPointInd[3] ,midPointInd[5]};
5258 edgeFlags[36]=originFlag[2];
5259 edgeFlags[37]=originFlag[0];
5260 edgeFlags[38]=originFlag[2];
5261 edgeFlags[39]=this->volumeID_;
5262 edgeFlags[40]=originFlag[2];
5263 edgeFlags[41]=originFlag[3];
5265 isInterfaceEdge[36] = interfaceSurface[2];
5266 isInterfaceEdge[37] = interfaceSurface[0];
5267 isInterfaceEdge[38] = interfaceSurface[2];
5268 isInterfaceEdge[39] =
false;
5269 isInterfaceEdge[40] = interfaceSurface[2];
5270 isInterfaceEdge[41] = interfaceSurface[3];
5272 predecessorElement[36] = -1;
5273 predecessorElement[37] = -1;
5274 predecessorElement[38] = -1;
5275 predecessorElement[39] = -1;
5276 predecessorElement[40] = -1;
5277 predecessorElement[41] = -1;
5280 newTriangles[24]= {midPointInd[1],midPointInd[2],midPointInd[3]};
5281 newTriangles[25]= {midPointInd[1],midPointInd[2],midPointInd[5]};
5282 newTriangles[26]= {midPointInd[1],midPointInd[3],midPointInd[5]};
5283 newTriangles[27]= {midPointInd[2],midPointInd[3],midPointInd[5]};
5285 newTrianglesFlag[24]= this->volumeID_;
5286 newTrianglesFlag[25]= originFlag[2];
5287 newTrianglesFlag[26]= this->volumeID_;
5288 newTrianglesFlag[27]= this->volumeID_;
5290 isInterfaceSurface[24] =
false;
5291 isInterfaceSurface[25] = interfaceSurface[2];
5292 isInterfaceSurface[26] =
false;
5293 isInterfaceSurface[27] =
false;
5295 newTriangleEdgeIDs[6]={36,37,39,36,38,40,37,38,41,39,40,41};
5298 (newElements)[7]={midPointInd[2],midPointInd[3],midPointInd[4],midPointInd[5]};
5300 (newEdges)[42] = {midPointInd[2] ,midPointInd[3]};
5301 (newEdges)[43] = {midPointInd[2] ,midPointInd[4]};
5302 (newEdges)[44] = {midPointInd[2] ,midPointInd[5]};
5303 (newEdges)[45] = {midPointInd[3] ,midPointInd[4]};
5304 (newEdges)[46] = {midPointInd[3] ,midPointInd[5]};
5305 (newEdges)[47] = {midPointInd[4] ,midPointInd[5]};
5307 edgeFlags[42]=this->volumeID_;
5308 edgeFlags[43]=originFlag[1];
5309 edgeFlags[44]=originFlag[2];
5310 edgeFlags[45]=originFlag[3];
5311 edgeFlags[46]=originFlag[3];
5312 edgeFlags[47]=originFlag[3];
5314 isInterfaceEdge[42] =
false;
5315 isInterfaceEdge[43] = interfaceSurface[1];
5316 isInterfaceEdge[44] = interfaceSurface[2];
5317 isInterfaceEdge[45] = interfaceSurface[3];
5318 isInterfaceEdge[46] = interfaceSurface[3];
5319 isInterfaceEdge[47] = interfaceSurface[3];
5321 predecessorElement[42] = -1;
5322 predecessorElement[43] = -1;
5323 predecessorElement[44] = -1;
5324 predecessorElement[45] = -1;
5325 predecessorElement[46] = -1;
5326 predecessorElement[47] = -1;
5329 newTriangles[28]= {midPointInd[2],midPointInd[3],midPointInd[4]};
5330 newTriangles[29]= {midPointInd[2],midPointInd[3],midPointInd[5]};
5331 newTriangles[30]= {midPointInd[2],midPointInd[4],midPointInd[5]};
5332 newTriangles[31]= {midPointInd[3],midPointInd[4],midPointInd[5]};
5334 newTrianglesFlag[28]= this->volumeID_;
5335 newTrianglesFlag[29]= this->volumeID_;
5336 newTrianglesFlag[30]= this->volumeID_;
5337 newTrianglesFlag[31]= originFlag[3];
5339 isInterfaceSurface[28] =
false;
5340 isInterfaceSurface[29] =
false;
5341 isInterfaceSurface[30] =
false;
5342 isInterfaceSurface[31] = interfaceSurface[3];
5344 newTriangleEdgeIDs[7]={42,43,45,42,44,46,43,44,47,45,46,47};
5352 int offsetElements = this->elementsC_->numberElements();
5353 int offsetEdges = this->edgeElements_->numberElements();
5354 for(
int i=0;i<8; i++){
5357 feNew.setFiniteElementRefinementType(
"regular");
5358 feNew.setPredecessorElement(indexElement);
5359 if(elements->getElement(indexElement).getFiniteElementRefinementType() ==
"irregular" || elements->getElement(indexElement).getFiniteElementRefinementType() ==
"irregularRegular" )
5360 feNew.setFiniteElementRefinementType(
"irregularRegular");
5362 this->elementsC_->addElement(feNew);
5364 this->elementsC_->switchElement(indexElement,feNew);
5368 for(
int i=0;i<48; i++){
5369 sort( newEdges.at(i).begin(), newEdges.at(i).end() );
5371 feNew.setInterfaceElement(isInterfaceEdge[i]);
5372 feNew.setPredecessorElement(predecessorElement[i]);
5374 this->edgeElements_->addEdge(feNew,i/6+offsetElements);
5377 this->edgeElements_->addEdge(feNew,indexElement);
5382 int offsetSurfaces =this->surfaceTriangleElements_->numberElements();
5383 int offsetSurface =0;
5384 for(
int i=0;i<32; i++){
5387 feNew.setInterfaceElement(isInterfaceSurface[i]);
5389 if(newTrianglesFlag[i]!=0 && newTrianglesFlag[i]!=this->volumeID_){
5390 if ( !this->elementsC_->getElement(i/4+offsetElements).subElementsInitialized() )
5391 this->elementsC_->getElement(i/4+offsetElements).initializeSubElements( this->FEType_, this->dim_ -1) ;
5392 this->elementsC_->getElement(i/4+offsetElements).addSubElement(feNew);
5394 this->surfaceTriangleElements_->addSurface(feNew, i/4+offsetElements);
5398 if(newTrianglesFlag[i]!=0 && newTrianglesFlag[i]!=this->volumeID_){
5399 if ( !this->elementsC_->getElement(indexElement).subElementsInitialized() )
5400 this->elementsC_->getElement(indexElement).initializeSubElements( this->FEType_, this->dim_ -1) ;
5401 this->elementsC_->getElement(indexElement).addSubElement(feNew);
5403 this->surfaceTriangleElements_->addSurface(feNew, indexElement);
5416 for(
int i=0;i<8; i++){
5418 element = this->elementsC_->getElement(i+offsetElements);
5421 element = this->elementsC_->getElement(indexElement);
5424 for(
int j=0; j<48 ; j++){
5425 FiniteElement feEdge = this->edgeElements_->getElement(j+offsetEdges);
5426 if(feEdge.getFlag() != this->volumeID_){
5428 element.addSubElement( feEdge );
5429 else if ( !element.subElementsInitialized() ){
5430 element.initializeSubElements(
"P1", 1 );
5431 element.addSubElement( feEdge );
5435 ElementsPtr_Type surfaces = element.getSubElements();
5437 surfaces->setToCorrectElement( feEdge );
5443 for (
int d=0; d<6; d++){
5445 edgeElements->getElement(edgeNumbers[d]).tagForRefinement();
5450 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::runtime_error,
"The Refinement Algorithm for the Dimension at hand is not available");