mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-11-15 10:08:34 +05:00
rewrite GetAlgoState() and functions it calls using a new util for
iteration over SMESH_submesh'es (SMESH_subMeshIterator)
This commit is contained in:
parent
10c15ac1c2
commit
aad1e960d8
@ -434,7 +434,7 @@ static bool checkConformIgnoredAlgos(SMESH_Mesh& aMesh,
|
|||||||
const SMESH_Algo* aGlobIgnoAlgo,
|
const SMESH_Algo* aGlobIgnoAlgo,
|
||||||
const SMESH_Algo* aLocIgnoAlgo,
|
const SMESH_Algo* aLocIgnoAlgo,
|
||||||
bool & checkConform,
|
bool & checkConform,
|
||||||
map<int, SMESH_subMesh*>& aCheckedMap,
|
set<SMESH_subMesh*>& aCheckedMap,
|
||||||
list< SMESH_Gen::TAlgoStateError > & theErrors)
|
list< SMESH_Gen::TAlgoStateError > & theErrors)
|
||||||
{
|
{
|
||||||
ASSERT( aSubMesh );
|
ASSERT( aSubMesh );
|
||||||
@ -489,19 +489,15 @@ static bool checkConformIgnoredAlgos(SMESH_Mesh& aMesh,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// sub-algos will be hidden by a local <algo>
|
// sub-algos will be hidden by a local <algo>
|
||||||
const map<int, SMESH_subMesh*>& smMap = aSubMesh->DependsOn();
|
SMESH_subMeshIteratorPtr revItSub =
|
||||||
map<int, SMESH_subMesh*>::const_reverse_iterator revItSub;
|
aSubMesh->getDependsOnIterator( /*includeSelf=*/false, /*complexShapeFirst=*/true);
|
||||||
bool checkConform2 = false;
|
bool checkConform2 = false;
|
||||||
for ( revItSub = smMap.rbegin(); revItSub != smMap.rend(); revItSub++)
|
while ( revItSub->more() )
|
||||||
{
|
{
|
||||||
checkConformIgnoredAlgos (aMesh, (*revItSub).second, aGlobIgnoAlgo,
|
SMESH_subMesh* sm = revItSub->next();
|
||||||
|
checkConformIgnoredAlgos (aMesh, sm, aGlobIgnoAlgo,
|
||||||
algo, checkConform2, aCheckedMap, theErrors);
|
algo, checkConform2, aCheckedMap, theErrors);
|
||||||
int key = (*revItSub).first;
|
aCheckedMap.insert( sm );
|
||||||
SMESH_subMesh* sm = (*revItSub).second;
|
|
||||||
if ( aCheckedMap.find( key ) == aCheckedMap.end() )
|
|
||||||
{
|
|
||||||
aCheckedMap[ key ] = sm;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -522,7 +518,7 @@ static bool checkMissing(SMESH_Gen* aGen,
|
|||||||
const int aTopAlgoDim,
|
const int aTopAlgoDim,
|
||||||
bool* globalChecked,
|
bool* globalChecked,
|
||||||
const bool checkNoAlgo,
|
const bool checkNoAlgo,
|
||||||
map<int, SMESH_subMesh*>& aCheckedMap,
|
set<SMESH_subMesh*>& aCheckedMap,
|
||||||
list< SMESH_Gen::TAlgoStateError > & theErrors)
|
list< SMESH_Gen::TAlgoStateError > & theErrors)
|
||||||
{
|
{
|
||||||
if ( aSubMesh->GetSubShape().ShapeType() == TopAbs_VERTEX)
|
if ( aSubMesh->GetSubShape().ShapeType() == TopAbs_VERTEX)
|
||||||
@ -595,15 +591,13 @@ static bool checkMissing(SMESH_Gen* aGen,
|
|||||||
if (!algo->NeedDescretBoundary() || isTopLocalAlgo)
|
if (!algo->NeedDescretBoundary() || isTopLocalAlgo)
|
||||||
{
|
{
|
||||||
bool checkNoAlgo2 = ( algo->NeedDescretBoundary() );
|
bool checkNoAlgo2 = ( algo->NeedDescretBoundary() );
|
||||||
const map<int, SMESH_subMesh*>& subMeshes = aSubMesh->DependsOn();
|
SMESH_subMeshIteratorPtr itsub = aSubMesh->getDependsOnIterator( /*includeSelf=*/false,
|
||||||
map<int, SMESH_subMesh*>::const_iterator itsub;
|
/*complexShapeFirst=*/false);
|
||||||
for (itsub = subMeshes.begin(); itsub != subMeshes.end(); itsub++)
|
while ( itsub->more() )
|
||||||
{
|
{
|
||||||
// sub-meshes should not be checked further more
|
// sub-meshes should not be checked further more
|
||||||
int key = (*itsub).first;
|
SMESH_subMesh* sm = itsub->next();
|
||||||
SMESH_subMesh* sm = (*itsub).second;
|
aCheckedMap.insert( sm );
|
||||||
if ( aCheckedMap.find( key ) == aCheckedMap.end() )
|
|
||||||
aCheckedMap[ key ] = sm;
|
|
||||||
|
|
||||||
if (isTopLocalAlgo)
|
if (isTopLocalAlgo)
|
||||||
{
|
{
|
||||||
@ -697,39 +691,25 @@ bool SMESH_Gen::GetAlgoState(SMESH_Mesh& theMesh,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const map<int, SMESH_subMesh*>& smMap = sm->DependsOn();
|
set<SMESH_subMesh*> aCheckedSubs;
|
||||||
map<int, SMESH_subMesh*>::const_reverse_iterator revItSub = smMap.rbegin();
|
|
||||||
map<int, SMESH_subMesh*> aCheckedMap;
|
|
||||||
bool checkConform = ( !theMesh.IsNotConformAllowed() );
|
bool checkConform = ( !theMesh.IsNotConformAllowed() );
|
||||||
int aKey = 1;
|
|
||||||
SMESH_subMesh* smToCheck = sm;
|
|
||||||
|
|
||||||
// loop on theShape and its sub-shapes
|
// loop on theShape and its sub-shapes
|
||||||
while ( smToCheck )
|
SMESH_subMeshIteratorPtr revItSub = sm->getDependsOnIterator( /*includeSelf=*/true,
|
||||||
|
/*complexShapeFirst=*/true);
|
||||||
|
while ( revItSub->more() )
|
||||||
{
|
{
|
||||||
|
SMESH_subMesh* smToCheck = revItSub->next();
|
||||||
if ( smToCheck->GetSubShape().ShapeType() == TopAbs_VERTEX)
|
if ( smToCheck->GetSubShape().ShapeType() == TopAbs_VERTEX)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if ( aCheckedMap.find( aKey ) == aCheckedMap.end() )
|
if ( aCheckedSubs.insert( smToCheck ).second ) // not yet checked
|
||||||
if (!checkConformIgnoredAlgos (theMesh, smToCheck, aGlobIgnoAlgo,
|
if (!checkConformIgnoredAlgos (theMesh, smToCheck, aGlobIgnoAlgo,
|
||||||
0, checkConform, aCheckedMap, theErrors))
|
0, checkConform, aCheckedSubs, theErrors))
|
||||||
ret = false;
|
ret = false;
|
||||||
|
|
||||||
if ( smToCheck->GetAlgoState() != SMESH_subMesh::NO_ALGO )
|
if ( smToCheck->GetAlgoState() != SMESH_subMesh::NO_ALGO )
|
||||||
hasAlgo = true;
|
hasAlgo = true;
|
||||||
|
|
||||||
// next subMesh
|
|
||||||
if (revItSub != smMap.rend())
|
|
||||||
{
|
|
||||||
aKey = (*revItSub).first;
|
|
||||||
smToCheck = (*revItSub).second;
|
|
||||||
revItSub++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
smToCheck = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------
|
// ----------------------------------------------------------------
|
||||||
@ -749,36 +729,26 @@ bool SMESH_Gen::GetAlgoState(SMESH_Mesh& theMesh,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
aCheckedMap.clear();
|
|
||||||
smToCheck = sm;
|
|
||||||
revItSub = smMap.rbegin();
|
|
||||||
bool checkNoAlgo = theMesh.HasShapeToMesh() ? bool( aTopAlgoDim ) : false;
|
bool checkNoAlgo = theMesh.HasShapeToMesh() ? bool( aTopAlgoDim ) : false;
|
||||||
bool globalChecked[] = { false, false, false, false };
|
bool globalChecked[] = { false, false, false, false };
|
||||||
|
|
||||||
// loop on theShape and its sub-shapes
|
// loop on theShape and its sub-shapes
|
||||||
while ( smToCheck )
|
aCheckedSubs.clear();
|
||||||
|
revItSub = sm->getDependsOnIterator( /*includeSelf=*/true, /*complexShapeFirst=*/true);
|
||||||
|
while ( revItSub->more() )
|
||||||
{
|
{
|
||||||
|
SMESH_subMesh* smToCheck = revItSub->next();
|
||||||
if ( smToCheck->GetSubShape().ShapeType() == TopAbs_VERTEX)
|
if ( smToCheck->GetSubShape().ShapeType() == TopAbs_VERTEX)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if ( aCheckedMap.find( aKey ) == aCheckedMap.end() )
|
if ( aCheckedSubs.insert( smToCheck ).second ) // not yet checked
|
||||||
if (!checkMissing (this, theMesh, smToCheck, aTopAlgoDim,
|
if (!checkMissing (this, theMesh, smToCheck, aTopAlgoDim,
|
||||||
globalChecked, checkNoAlgo, aCheckedMap, theErrors))
|
globalChecked, checkNoAlgo, aCheckedSubs, theErrors))
|
||||||
{
|
{
|
||||||
ret = false;
|
ret = false;
|
||||||
if (smToCheck->GetAlgoState() == SMESH_subMesh::NO_ALGO )
|
if (smToCheck->GetAlgoState() == SMESH_subMesh::NO_ALGO )
|
||||||
checkNoAlgo = false;
|
checkNoAlgo = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// next subMesh
|
|
||||||
if (revItSub != smMap.rend())
|
|
||||||
{
|
|
||||||
aKey = (*revItSub).first;
|
|
||||||
smToCheck = (*revItSub).second;
|
|
||||||
revItSub++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
smToCheck = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !hasAlgo ) {
|
if ( !hasAlgo ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user