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
This commit is contained in:
eap 2010-11-13 08:59:22 +00:00
parent b812db1dd3
commit 7fbe94d5b4

View File

@ -46,7 +46,7 @@ using namespace std;
enum EQuadNature { NOT_QUAD, QUAD, DEGEN_QUAD }; 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; typedef SMDS_StdIterator< SMESH_MeshEditor::TNodeXYZ, SMDS_ElemIteratorPtr > TXyzIterator;
namespace 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]; const SMDS_MeshNode* _nodes[3];
public: public:
@ -183,7 +183,7 @@ namespace
//================================================================================ //================================================================================
/*! /*!
* \brief Return true if two adjacent pyramids are too close one to another * \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 // Check angle between normals
double angle = nI.Angle( nJ ); double angle = nI.Angle( nJ );
bool tooClose = ( angle < 10 * PI180 ); bool tooClose = ( angle < 15 * PI180 );
// Check if pyramids collide // Check if pyramids collide
bool isOutI, isOutJ; bool isOutI, isOutJ;
@ -315,9 +315,15 @@ namespace
} }
} }
if ( !mergedPyrams.empty() ) 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 ); MergeAdjacent( *prm, mesh, nodesToMove );
} }
}
} }
//================================================================================ //================================================================================
@ -327,7 +333,7 @@ namespace
//================================================================================ //================================================================================
StdMeshers_QuadToTriaAdaptor::StdMeshers_QuadToTriaAdaptor(): 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, gp_Vec& VNorm,
const SMDS_MeshElement** volumes) const SMDS_MeshElement** volumes)
{ {
if( face->NbNodes() != ( face->IsQuadratic() ? 8 : 4 )) if( face->NbCornerNodes() != 4 )
if( face->NbNodes() != 4 ) {
myNbTriangles += int( face->NbCornerNodes() == 3 );
return NOT_QUAD; return NOT_QUAD;
}
int i = 0; int i = 0;
gp_XYZ xyzC(0., 0., 0.); gp_XYZ xyzC(0., 0., 0.);
@ -690,6 +698,8 @@ bool StdMeshers_QuadToTriaAdaptor::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape
{ {
myResMap.clear(); myResMap.clear();
myPyramids.clear(); myPyramids.clear();
myNbTriangles = 0;
myShape = aShape;
SMESHDS_Mesh * meshDS = aMesh.GetMeshDS(); SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
SMESH_MesherHelper helper(aMesh); SMESH_MesherHelper helper(aMesh);
@ -1138,6 +1148,10 @@ bool StdMeshers_QuadToTriaAdaptor::Compute2ndPart(SMESH_Mesh& aMesh)
nodesToMove.insert( aNode1 ); nodesToMove.insert( aNode1 );
nodesToMove.insert( aNode2 ); nodesToMove.insert( aNode2 );
} }
// fix intersections that could appear after apex movement
MergeAdjacent( PrmI, aMesh, nodesToMove );
MergeAdjacent( PrmJ, aMesh, nodesToMove );
} // end if(hasInt) } // end if(hasInt)
} // loop on suspectPyrams } // loop on suspectPyrams
} // loop on 4 base nodes of PrmI } // loop on 4 base nodes of PrmI
@ -1159,7 +1173,7 @@ bool StdMeshers_QuadToTriaAdaptor::Compute2ndPart(SMESH_Mesh& aMesh)
if ( q2t->first == q2tPrev->first ) if ( q2t->first == q2tPrev->first )
q2tPrev->second.splice( q2tPrev->second.end(), q2t->second ); 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 ) for ( q2t = myResMap.begin(); q2t != myResMap.end(); ++q2t )
{ {
TTriaList & trias = q2t->second; TTriaList & trias = q2t->second;
@ -1167,7 +1181,7 @@ bool StdMeshers_QuadToTriaAdaptor::Compute2ndPart(SMESH_Mesh& aMesh)
if ( ((const Q2TAdaptor_Triangle*) *tri)->IsRemoved() ) if ( ((const Q2TAdaptor_Triangle*) *tri)->IsRemoved() )
delete *tri, trias.erase( tri++ ); delete *tri, trias.erase( tri++ );
else else
tri++; tri++, myNbTriangles++;
} }
myPyramids.clear(); // no more needed myPyramids.clear(); // no more needed