From: eap Date: Sat, 13 Nov 2010 08:59:22 +0000 (+0000) Subject: 0020973: EDF 1554 GHS3DPLUGIN: Make possible to have a mixed mesh hexa-tetra with... X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7fbe94d5b4789e2d9356196b26d5ef1d6036dc6c;p=modules%2Fsmesh.git 0020973: EDF 1554 GHS3DPLUGIN: Make possible to have a mixed mesh hexa-tetra with GHS3D re-check adjacent pyramids after fixing intersection with non-adjacent one --- diff --git a/src/StdMeshers/StdMeshers_QuadToTriaAdaptor.cxx b/src/StdMeshers/StdMeshers_QuadToTriaAdaptor.cxx index 3ae9552d9..8e2718dd0 100644 --- a/src/StdMeshers/StdMeshers_QuadToTriaAdaptor.cxx +++ b/src/StdMeshers/StdMeshers_QuadToTriaAdaptor.cxx @@ -46,7 +46,7 @@ using namespace std; enum EQuadNature { NOT_QUAD, QUAD, DEGEN_QUAD }; - // std-like iterator used to get coordinates of nodes of mesh element +// std-like iterator used to get coordinates of nodes of mesh element typedef SMDS_StdIterator< SMESH_MeshEditor::TNodeXYZ, SMDS_ElemIteratorPtr > TXyzIterator; namespace @@ -60,7 +60,7 @@ namespace */ //================================================================================ - class SMDS_EXPORT Q2TAdaptor_Triangle : public SMDS_MeshFace + class STDMESHERS_EXPORT Q2TAdaptor_Triangle : public SMDS_MeshFace { const SMDS_MeshNode* _nodes[3]; public: @@ -183,7 +183,7 @@ namespace //================================================================================ /*! * \brief Return true if two adjacent pyramids are too close one to another - * so that a tetrahedron to built between them whoul have too poor quality + * so that a tetrahedron to built between them would have too poor quality */ //================================================================================ @@ -228,7 +228,7 @@ namespace // Check angle between normals double angle = nI.Angle( nJ ); - bool tooClose = ( angle < 10 * PI180 ); + bool tooClose = ( angle < 15 * PI180 ); // Check if pyramids collide bool isOutI, isOutJ; @@ -315,8 +315,14 @@ namespace } } if ( !mergedPyrams.empty() ) - for (TIDSortedElemSet::iterator prm = mergedPyrams.begin(); prm != mergedPyrams.end(); ++prm) + { + TIDSortedElemSet::iterator prm; +// for (prm = mergedPyrams.begin(); prm != mergedPyrams.end(); ++prm) +// MergeAdjacent( *prm, mesh, nodesToMove ); + + for (prm = adjacentPyrams.begin(); prm != adjacentPyrams.end(); ++prm) MergeAdjacent( *prm, mesh, nodesToMove ); + } } } @@ -327,7 +333,7 @@ namespace //================================================================================ StdMeshers_QuadToTriaAdaptor::StdMeshers_QuadToTriaAdaptor(): - myElemSearcher(0) + myElemSearcher(0), myNbTriangles(0) { } @@ -574,9 +580,11 @@ int StdMeshers_QuadToTriaAdaptor::Preparation(const SMDS_MeshElement* face gp_Vec& VNorm, const SMDS_MeshElement** volumes) { - if( face->NbNodes() != ( face->IsQuadratic() ? 8 : 4 )) - if( face->NbNodes() != 4 ) - return NOT_QUAD; + if( face->NbCornerNodes() != 4 ) + { + myNbTriangles += int( face->NbCornerNodes() == 3 ); + return NOT_QUAD; + } int i = 0; gp_XYZ xyzC(0., 0., 0.); @@ -690,6 +698,8 @@ bool StdMeshers_QuadToTriaAdaptor::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape { myResMap.clear(); myPyramids.clear(); + myNbTriangles = 0; + myShape = aShape; SMESHDS_Mesh * meshDS = aMesh.GetMeshDS(); SMESH_MesherHelper helper(aMesh); @@ -1138,6 +1148,10 @@ bool StdMeshers_QuadToTriaAdaptor::Compute2ndPart(SMESH_Mesh& aMesh) nodesToMove.insert( aNode1 ); nodesToMove.insert( aNode2 ); } + // fix intersections that could appear after apex movement + MergeAdjacent( PrmI, aMesh, nodesToMove ); + MergeAdjacent( PrmJ, aMesh, nodesToMove ); + } // end if(hasInt) } // loop on suspectPyrams } // loop on 4 base nodes of PrmI @@ -1159,7 +1173,7 @@ bool StdMeshers_QuadToTriaAdaptor::Compute2ndPart(SMESH_Mesh& aMesh) if ( q2t->first == q2tPrev->first ) q2tPrev->second.splice( q2tPrev->second.end(), q2t->second ); } - // delete removed triangles + // delete removed triangles and count resulting nb of triangles for ( q2t = myResMap.begin(); q2t != myResMap.end(); ++q2t ) { TTriaList & trias = q2t->second; @@ -1167,7 +1181,7 @@ bool StdMeshers_QuadToTriaAdaptor::Compute2ndPart(SMESH_Mesh& aMesh) if ( ((const Q2TAdaptor_Triangle*) *tri)->IsRemoved() ) delete *tri, trias.erase( tri++ ); else - tri++; + tri++, myNbTriangles++; } myPyramids.clear(); // no more needed