Regression of the test case patterns/A8

1) fix an error made during SMDS redesign
-      if (node->getshapeId() <0) {
+      if (node->getshapeId() <1) {
   2) fix an error of Clear() that not all fields are cleared
   3) create polyhedrons only if volume boundary is split by refinement
This commit is contained in:
eap 2011-02-09 13:29:33 +00:00
parent 4ebb8cfccc
commit 3c96a71bde

View File

@ -463,7 +463,7 @@ template <class TFaceIterator> bool areNodesBound( TFaceIterator & faceItr )
while ( nIt->more() ) while ( nIt->more() )
{ {
const SMDS_MeshNode* node = smdsNode( nIt->next() ); const SMDS_MeshNode* node = smdsNode( nIt->next() );
if (node->getshapeId() <0) { if (node->getshapeId() <1) {
return false; return false;
} }
} }
@ -3695,13 +3695,8 @@ bool SMESH_Pattern::
vector<int>& theQuantity) vector<int>& theQuantity)
{ {
bool makePoly = false; bool makePoly = false;
// cout << "FROM FACE NODES: " <<endl;
// for ( int i = 0; i < theNbBndNodes; ++i )
// cout << theBndNodes[ i ];
set< const SMDS_MeshNode* > bndNodeSet; set< const SMDS_MeshNode* > bndNodeSet( theBndNodes, theBndNodes + theNbBndNodes);
for ( int i = 0; i < theNbBndNodes; ++i )
bndNodeSet.insert( theBndNodes[ i ]);
map< TNodeSet, list< list< int > > >::iterator nn_IdList; map< TNodeSet, list< list< int > > >::iterator nn_IdList;
@ -3710,12 +3705,13 @@ bool SMESH_Pattern::
if ( !myIs2D ) { // for 2D, merge only edges if ( !myIs2D ) { // for 2D, merge only edges
nn_IdList = myIdsOnBoundary.find( bndNodeSet ); nn_IdList = myIdsOnBoundary.find( bndNodeSet );
if ( nn_IdList != myIdsOnBoundary.end() ) { if ( nn_IdList != myIdsOnBoundary.end() ) {
makePoly = true;
list< int > & faceIds = nn_IdList->second.front(); list< int > & faceIds = nn_IdList->second.front();
ids.insert( faceIds.begin(), faceIds.end() ); if ( !faceIds.empty() ) {
makePoly = true;
ids.insert( faceIds.begin(), faceIds.end() );
}
} }
} }
//bool hasIdsInFace = !ids.empty();
// add ids on links and bnd nodes // add ids on links and bnd nodes
int lastFreeId = Max( myXYZIdToNodeMap.rbegin()->first, theNodes.size() ); int lastFreeId = Max( myXYZIdToNodeMap.rbegin()->first, theNodes.size() );
@ -3731,22 +3727,26 @@ bool SMESH_Pattern::
bndId = nn_IdList->second.front().front(); bndId = nn_IdList->second.front().front();
ids.insert( bndId ); ids.insert( bndId );
} }
else else {
myXYZIdToNodeMap.insert( make_pair( bndId, theBndNodes[ iN ] )); myXYZIdToNodeMap.insert( make_pair( bndId, theBndNodes[ iN ] ));
}
faceDef.push_back( bndId ); faceDef.push_back( bndId );
// add ids on a link // add ids on a link
TNodeSet linkNodes; TNodeSet linkNodes;
linkNodes.insert( theBndNodes[ iN ]); linkNodes.insert( theBndNodes[ iN ]);
linkNodes.insert( theBndNodes[ iN + 1 == theNbBndNodes ? 0 : iN + 1 ]); linkNodes.insert( theBndNodes[ (iN + 1) % theNbBndNodes] );
nn_IdList = myIdsOnBoundary.find( linkNodes ); nn_IdList = myIdsOnBoundary.find( linkNodes );
if ( nn_IdList != myIdsOnBoundary.end() ) { if ( nn_IdList != myIdsOnBoundary.end() ) {
makePoly = true;
list< int > & linkIds = nn_IdList->second.front(); list< int > & linkIds = nn_IdList->second.front();
ids.insert( linkIds.begin(), linkIds.end() ); if ( !linkIds.empty() )
if ( isReversed( theBndNodes[ iN ], linkIds )) {
faceDef.insert( faceDef.end(), linkIds.begin(), linkIds.end() ); makePoly = true;
else ids.insert( linkIds.begin(), linkIds.end() );
faceDef.insert( faceDef.end(), linkIds.rbegin(), linkIds.rend() ); if ( isReversed( theBndNodes[ iN ], linkIds ))
faceDef.insert( faceDef.end(), linkIds.begin(), linkIds.end() );
else
faceDef.insert( faceDef.end(), linkIds.rbegin(), linkIds.rend() );
}
} }
} }
@ -3768,9 +3768,7 @@ bool SMESH_Pattern::
{ {
if ( !checkedVolDefs.insert( *pIdList ).second ) if ( !checkedVolDefs.insert( *pIdList ).second )
continue; // skip already checked volume definition continue; // skip already checked volume definition
vector< int > idVec; vector< int > idVec( (*pIdList)->begin(), (*pIdList)->end() );
idVec.reserve( (*pIdList)->size() );
idVec.insert( idVec.begin(), (*pIdList)->begin(), (*pIdList)->end() );
// loop on face defs of a volume // loop on face defs of a volume
SMDS_VolumeTool::VolumeType volType = vol.GetType( idVec.size() ); SMDS_VolumeTool::VolumeType volType = vol.GetType( idVec.size() );
if ( volType == SMDS_VolumeTool::UNKNOWN ) if ( volType == SMDS_VolumeTool::UNKNOWN )
@ -3800,7 +3798,7 @@ bool SMESH_Pattern::
} }
if ( !defsAdded ) { if ( !defsAdded ) {
theQuantity.push_back( faceDef.size() ); theQuantity.push_back( faceDef.size() );
theFaceDefs.splice( theFaceDefs.end(), faceDef, faceDef.begin(), faceDef.end() ); theFaceDefs.splice( theFaceDefs.end(), faceDef );
} }
return makePoly; return makePoly;
@ -3971,6 +3969,8 @@ bool SMESH_Pattern::MakeMesh(SMESH_Mesh* theMesh,
createElements( theMesh, nodesVector, myElemPointIDs, myElements ); createElements( theMesh, nodesVector, myElemPointIDs, myElements );
} }
aMeshDS->compactMesh();
// const map<int,SMESHDS_SubMesh*>& sm = aMeshDS->SubMeshes(); // const map<int,SMESHDS_SubMesh*>& sm = aMeshDS->SubMeshes();
// map<int,SMESHDS_SubMesh*>::const_iterator i_sm = sm.begin(); // map<int,SMESHDS_SubMesh*>::const_iterator i_sm = sm.begin();
// for ( ; i_sm != sm.end(); i_sm++ ) // for ( ; i_sm != sm.end(); i_sm++ )
@ -4551,6 +4551,17 @@ void SMESH_Pattern::Clear()
myShapeIDMap.Clear(); myShapeIDMap.Clear();
myShape.Nullify(); myShape.Nullify();
myNbKeyPntInBoundary.clear(); myNbKeyPntInBoundary.clear();
myXYZ.clear();
myElemXYZIDs.clear();
myXYZIdToNodeMap.clear();
myElements.clear();
myOrderedNodes.clear();
myPolyElems.clear();
myPolyElemXYZIDs.clear();
myPolyhedronQuantities.clear();
myIdsOnBoundary.clear();
myReverseConnectivity.clear();
} }
//======================================================================= //=======================================================================