From: asozinov Date: Mon, 26 Aug 2024 15:40:48 +0000 (+0100) Subject: EDF 30254 - quadratic to biquadratic : several problems X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=91e1adb6872a47cf466763ac3094515cf92e79a8;p=modules%2Fsmesh.git EDF 30254 - quadratic to biquadratic : several problems Fixed problem when for volume with type BiQuadratic Pentahedron boundary elements for triangle side is quadratic and not bi-quadratic --- diff --git a/src/SMDS/SMDS_VolumeTool.cxx b/src/SMDS/SMDS_VolumeTool.cxx index 0742c2440..6781da059 100644 --- a/src/SMDS/SMDS_VolumeTool.cxx +++ b/src/SMDS/SMDS_VolumeTool.cxx @@ -274,9 +274,9 @@ static int QuadPyram_nbN [] = { 8, 6, 6, 6, 6 }; // N3 +----+----+ N5 +----+----+ // | |11 | | | | // | | | | | | Central nodes -// | +13 | QUADRATIC | 17 + | of bi-quadratic +// | +13 | QUADRATIC | 16 + | of bi-quadratic // | | | PENTAHEDRON | + | + | PENTAHEDRON -// 12+ | +14 + | 16 + +// 12+ | +14 + | 17 + // | | | | 18| | // | | | | | | // | + N1 | | + | @@ -304,8 +304,8 @@ static int QuadPenta_nbN [] = { 6, 6, 8, 8, 8 }; static int BiQuadPenta_F[5][9] = { // FORWARD { 0, 6, 1, 7, 2, 8, 0, 0, 0 }, { 3, 11,5, 10,4, 9, 3, 3, 3 }, - { 0, 12,3, 9, 4, 13,1, 6, 17}, //! - { 1, 13,4, 10,5, 14,2, 7, 16}, //! + { 0, 12,3, 9, 4, 13,1, 6, 16}, //! + { 1, 13,4, 10,5, 14,2, 7, 17}, //! { 0, 8, 2, 14,5, 11,3, 12,18} }; //! static int BiQuadPenta_RE[5][9] = { // REVERSED -> EXTERNAL { 0, 8, 2, 7, 1, 6, 0, 0, 0 }, @@ -1728,6 +1728,16 @@ int SMDS_VolumeTool::GetCenterNodeIndex( int faceIndex ) const return faceIndex + 19; } } + else if (myAllFacesNbNodes && myVolumeNodes.size() == 18) // element with 18 nodes + { + switch (faceIndex) { + case 2: return 15; + case 3: return 16; + case 4: return 17; + default: + return -2; + } + } return -1; } @@ -2448,7 +2458,6 @@ bool SMDS_VolumeTool::setFace( int faceIndex ) const { if ( !myAllFacesNodeIndices_F ) { - //std::cout << myVolumeNodes.size() << std::endl; // choose data for an element type switch ( myVolumeNodes.size() ) { case 4: diff --git a/src/SMESH/SMESH_MeshEditor.cxx b/src/SMESH/SMESH_MeshEditor.cxx index aaed9c013..6d22c14a6 100644 --- a/src/SMESH/SMESH_MeshEditor.cxx +++ b/src/SMESH/SMESH_MeshEditor.cxx @@ -9325,12 +9325,6 @@ smIdType SMESH_MeshEditor::convertElemToQuadratic(SMESHDS_SubMesh * theSm, void SMESH_MeshEditor::ConvertToQuadratic(const bool theForce3d, const bool theToBiQuad) { - /* - // remove medium nodes - for ( size_t i = nbCornerNodes; i < nodes.size(); ++i ) - if ( nodes[i]->NbInverseElements() == 0 ) - meshDS->RemoveFreeNode( nodes[i], theSm ); - */ //MESSAGE("ConvertToQuadratic "<< theForce3d << " " << theToBiQuad); SMESHDS_Mesh* meshDS = GetMeshDS(); @@ -13046,15 +13040,58 @@ int SMESH_MeshEditor::MakeBoundaryMesh(const TIDSortedElemSet& elements, if (iQuad) for ( inode = 1; inode < nbFaceNodes; inode += 2) nodes.push_back( nn[inode] ); // add medium nodes + + // for triangle face for Penta18 (BiQuadratic pentahedron) return -2 + // because we haven't center node on triangle side, but it's need for create biquadratic face int iCenter = vTool.GetCenterNodeIndex(iface); // for HEX27 - if ( iCenter > 0 ) - nodes.push_back( vTool.GetNodes()[ iCenter ] ); - if (const SMDS_MeshElement * f = aMesh->FindElement( nodes, - SMDSAbs_Face, /*noMedium=*/false )) - presentBndElems.push_back( f ); + // for triangle faces for Penta18 (BiQuadratic pentahedron) firstly check, exist face or not + // if not - create node in middle face + if (iCenter == -2) + { + SMDS_ElemIteratorPtr itF = nodes[0]->GetInverseElementIterator(SMDSAbs_Face); + bool isFound = false; + while (itF->more()) + { + const SMDS_MeshElement* e = itF->next(); + int nbNodesToCheck = e->NbNodes(); + if (nbNodesToCheck == (int)nodes.size() + 1) + { + for (size_t i = 1; e && i < nodes.size() - 1; ++i) + { + int nodeIndex = e->GetNodeIndex(nodes[i]); + if (nodeIndex < 0 || nodeIndex >= nbNodesToCheck) + e = 0; + } + if (e) + { + presentBndElems.push_back(e); + isFound = true; + } + } + } + + if (!isFound) + { + SMESH_MesherHelper aHelper(*myMesh); + double bc[3]; + vTool.GetFaceBaryCenter(iface, bc[0], bc[1], bc[2]); + auto aNodeC = aHelper.AddNode(bc[0], bc[1], bc[2]); + nodes.push_back(aNodeC); + missingBndElems.push_back(nodes); + } + } else - missingBndElems.push_back( nodes ); + { + if (iCenter > 0) + nodes.push_back(vTool.GetNodes()[iCenter]); + + if (const SMDS_MeshElement* f = aMesh->FindElement(nodes, + SMDSAbs_Face, /*noMedium=*/false)) + presentBndElems.push_back(f); + else + missingBndElems.push_back(nodes); + } if ( targetMesh != myMesh ) {