mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-30 19:30:35 +05:00
fix failure of non-regression test SMESH_TEST/Grids/smesh/mesh_Projection_2D/A0
Allow assigning "3D Extrusion" algo to a computed 2D mesh w/o clearing existing 2D elements - void cleanDependsOn( bool keepSupportedsubMeshes = false ); + void cleanDependsOn( SMESH_Algo* algoRequiringCleaning=0 );
This commit is contained in:
parent
3fa0d8a978
commit
6444728ac0
@ -647,7 +647,7 @@ SMESH_Hypothesis::Hypothesis_Status
|
|||||||
|
|
||||||
int oldAlgoState = _algoState;
|
int oldAlgoState = _algoState;
|
||||||
bool modifiedHyp = (event == MODIF_HYP); // if set to true, force event MODIF_ALGO_STATE
|
bool modifiedHyp = (event == MODIF_HYP); // if set to true, force event MODIF_ALGO_STATE
|
||||||
bool needFullClean = false, subMeshesSupported = false;
|
SMESH_Algo* algoRequiringCleaning = 0;
|
||||||
|
|
||||||
bool isApplicableHyp = IsApplicableHypotesis( anHyp );
|
bool isApplicableHyp = IsApplicableHypotesis( anHyp );
|
||||||
|
|
||||||
@ -671,7 +671,8 @@ SMESH_Hypothesis::Hypothesis_Status
|
|||||||
filter.Or( SMESH_HypoFilter::HasType( algo->GetType()+1 ));
|
filter.Or( SMESH_HypoFilter::HasType( algo->GetType()+1 ));
|
||||||
filter.Or( SMESH_HypoFilter::HasType( algo->GetType()+2 ));
|
filter.Or( SMESH_HypoFilter::HasType( algo->GetType()+2 ));
|
||||||
if ( SMESH_Algo * curAlgo = (SMESH_Algo*)_father->GetHypothesis(_subShape, filter, true ))
|
if ( SMESH_Algo * curAlgo = (SMESH_Algo*)_father->GetHypothesis(_subShape, filter, true ))
|
||||||
needFullClean = ( !curAlgo->NeedDiscreteBoundary() );
|
if ( !curAlgo->NeedDiscreteBoundary() )
|
||||||
|
algoRequiringCleaning = curAlgo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -702,13 +703,7 @@ SMESH_Hypothesis::Hypothesis_Status
|
|||||||
{
|
{
|
||||||
algo = dynamic_cast<SMESH_Algo*> (anHyp);
|
algo = dynamic_cast<SMESH_Algo*> (anHyp);
|
||||||
if (!algo->NeedDiscreteBoundary())
|
if (!algo->NeedDiscreteBoundary())
|
||||||
{
|
algoRequiringCleaning = algo;
|
||||||
// clean all mesh in the tree of the current submesh;
|
|
||||||
// we must perform it now because later
|
|
||||||
// we will have no information about the type of the removed algo
|
|
||||||
needFullClean = true;
|
|
||||||
subMeshesSupported = algo->SupportSubmeshes();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -990,10 +985,7 @@ SMESH_Hypothesis::Hypothesis_Status
|
|||||||
// CLEAN was not called at event REMOVE_ALGO because the algo is not applicable to SOLID.
|
// CLEAN was not called at event REMOVE_ALGO because the algo is not applicable to SOLID.
|
||||||
algo = dynamic_cast<SMESH_Algo*> (anHyp);
|
algo = dynamic_cast<SMESH_Algo*> (anHyp);
|
||||||
if (!algo->NeedDiscreteBoundary())
|
if (!algo->NeedDiscreteBoundary())
|
||||||
{
|
algoRequiringCleaning = algo;
|
||||||
needFullClean = true;
|
|
||||||
subMeshesSupported = algo->SupportSubmeshes();
|
|
||||||
}
|
|
||||||
algo = GetAlgo();
|
algo = GetAlgo();
|
||||||
if (algo == NULL) // no more applying algo on father
|
if (algo == NULL) // no more applying algo on father
|
||||||
{
|
{
|
||||||
@ -1069,10 +1061,10 @@ SMESH_Hypothesis::Hypothesis_Status
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( needFullClean ) {
|
if ( algoRequiringCleaning ) {
|
||||||
// added or removed algo is all-dimensional
|
// added or removed algo is all-dimensional
|
||||||
ComputeStateEngine( CLEAN );
|
ComputeStateEngine( CLEAN );
|
||||||
cleanDependsOn( subMeshesSupported );
|
cleanDependsOn( algoRequiringCleaning );
|
||||||
ComputeSubMeshStateEngine( CHECK_COMPUTE_STATE );
|
ComputeSubMeshStateEngine( CHECK_COMPUTE_STATE );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1174,12 +1166,12 @@ SMESH_Hypothesis::Hypothesis_Status
|
|||||||
//================================================================================
|
//================================================================================
|
||||||
/*!
|
/*!
|
||||||
* \brief Remove elements from sub-meshes.
|
* \brief Remove elements from sub-meshes.
|
||||||
* \param keepSupportedsubMeshes - if true, the sub-meshes computed using more
|
* \param algoRequiringCleaning - an all-dimensional algorithm whose presence
|
||||||
* local algorithms are not cleaned
|
* causes the cleaning.
|
||||||
*/
|
*/
|
||||||
//================================================================================
|
//================================================================================
|
||||||
|
|
||||||
void SMESH_subMesh::cleanDependsOn( bool keepSupportedsubMeshes )
|
void SMESH_subMesh::cleanDependsOn( SMESH_Algo* algoRequiringCleaning/*=0*/ )
|
||||||
{
|
{
|
||||||
SMESH_subMeshIteratorPtr smIt = getDependsOnIterator(false,
|
SMESH_subMeshIteratorPtr smIt = getDependsOnIterator(false,
|
||||||
/*complexShapeFirst=*/true);
|
/*complexShapeFirst=*/true);
|
||||||
@ -1188,34 +1180,53 @@ void SMESH_subMesh::cleanDependsOn( bool keepSupportedsubMeshes )
|
|||||||
while ( smIt->more() )
|
while ( smIt->more() )
|
||||||
smIt->next()->ComputeStateEngine(CHECK_COMPUTE_STATE);
|
smIt->next()->ComputeStateEngine(CHECK_COMPUTE_STATE);
|
||||||
}
|
}
|
||||||
else if ( !keepSupportedsubMeshes )
|
else if ( !algoRequiringCleaning || !algoRequiringCleaning->SupportSubmeshes() )
|
||||||
{
|
{
|
||||||
while ( smIt->more() )
|
while ( smIt->more() )
|
||||||
smIt->next()->ComputeStateEngine(CLEAN);
|
smIt->next()->ComputeStateEngine(CLEAN);
|
||||||
}
|
}
|
||||||
else
|
else if ( algoRequiringCleaning && algoRequiringCleaning->SupportSubmeshes() )
|
||||||
{
|
{
|
||||||
|
SMESHDS_Mesh* meshDS = _father->GetMeshDS();
|
||||||
|
|
||||||
// find sub-meshes to keep elements on
|
// find sub-meshes to keep elements on
|
||||||
set< SMESH_subMesh* > smToKeep;
|
set< SMESH_subMesh* > smToKeep;
|
||||||
SMESHDS_Mesh* meshDS = _father->GetMeshDS();
|
TopAbs_ShapeEnum prevShapeType = TopAbs_SHAPE;
|
||||||
|
bool toKeepPrevShapeType = false;
|
||||||
while ( smIt->more() )
|
while ( smIt->more() )
|
||||||
{
|
{
|
||||||
SMESH_subMesh* sm = smIt->next();
|
SMESH_subMesh* sm = smIt->next();
|
||||||
if ( sm->IsEmpty() ) continue;
|
sm->ComputeStateEngine(CHECK_COMPUTE_STATE);
|
||||||
|
if ( !sm->IsEmpty() )
|
||||||
// look for an algo assigned to sm
|
|
||||||
bool algoFound = false;
|
|
||||||
const list<const SMESHDS_Hypothesis*>& hyps = meshDS->GetHypothesis( sm->_subShape );
|
|
||||||
list<const SMESHDS_Hypothesis*>::const_iterator h = hyps.begin();
|
|
||||||
for ( ; ( !algoFound && h != hyps.end() ); ++h )
|
|
||||||
algoFound = ((*h)->GetType() != SMESHDS_Hypothesis::PARAM_ALGO );
|
|
||||||
|
|
||||||
// remember all sub-meshes of sm
|
|
||||||
if ( algoFound )
|
|
||||||
{
|
{
|
||||||
SMESH_subMeshIteratorPtr smIt2 = getDependsOnIterator(false,true);
|
const bool sameShapeType = ( prevShapeType == sm->GetSubShape().ShapeType() );
|
||||||
while ( smIt2->more() )
|
bool keepSubMeshes = ( sameShapeType && toKeepPrevShapeType );
|
||||||
smToKeep.insert( smIt2->next() );
|
if ( !sameShapeType )
|
||||||
|
{
|
||||||
|
// check if the algo allows presence of global algos of dimension the algo
|
||||||
|
// can generate it-self
|
||||||
|
int shapeDim = SMESH_Gen::GetShapeDim( sm->GetSubShape() );
|
||||||
|
keepSubMeshes = algoRequiringCleaning->NeedLowerHyps( shapeDim );
|
||||||
|
prevShapeType = sm->GetSubShape().ShapeType();
|
||||||
|
toKeepPrevShapeType = keepSubMeshes;
|
||||||
|
}
|
||||||
|
if ( !keepSubMeshes )
|
||||||
|
{
|
||||||
|
// look for an algo assigned to sm
|
||||||
|
bool algoFound = false;
|
||||||
|
const list<const SMESHDS_Hypothesis*>& hyps = meshDS->GetHypothesis( sm->_subShape );
|
||||||
|
list<const SMESHDS_Hypothesis*>::const_iterator h = hyps.begin();
|
||||||
|
for ( ; ( !algoFound && h != hyps.end() ); ++h )
|
||||||
|
algoFound = ((*h)->GetType() != SMESHDS_Hypothesis::PARAM_ALGO );
|
||||||
|
keepSubMeshes = algoFound;
|
||||||
|
}
|
||||||
|
// remember all sub-meshes of sm
|
||||||
|
if ( keepSubMeshes )
|
||||||
|
{
|
||||||
|
SMESH_subMeshIteratorPtr smIt2 = getDependsOnIterator(false,true);
|
||||||
|
while ( smIt2->more() )
|
||||||
|
smToKeep.insert( smIt2->next() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// remove elements
|
// remove elements
|
||||||
@ -1377,7 +1388,7 @@ bool SMESH_subMesh::ComputeStateEngine(int event)
|
|||||||
case MODIF_ALGO_STATE:
|
case MODIF_ALGO_STATE:
|
||||||
algo = GetAlgo();
|
algo = GetAlgo();
|
||||||
if (algo && !algo->NeedDiscreteBoundary())
|
if (algo && !algo->NeedDiscreteBoundary())
|
||||||
cleanDependsOn( algo->SupportSubmeshes() ); // clean sub-meshes with event CLEAN
|
cleanDependsOn( algo ); // clean sub-meshes with event CLEAN
|
||||||
if ( _algoState == HYP_OK )
|
if ( _algoState == HYP_OK )
|
||||||
_computeState = READY_TO_COMPUTE;
|
_computeState = READY_TO_COMPUTE;
|
||||||
break;
|
break;
|
||||||
@ -1423,7 +1434,7 @@ bool SMESH_subMesh::ComputeStateEngine(int event)
|
|||||||
if (algo)
|
if (algo)
|
||||||
{
|
{
|
||||||
if (!algo->NeedDiscreteBoundary())
|
if (!algo->NeedDiscreteBoundary())
|
||||||
cleanDependsOn( algo->SupportSubmeshes() ); // clean sub-meshes with event CLEAN
|
cleanDependsOn( algo ); // clean sub-meshes with event CLEAN
|
||||||
if ( _algoState == HYP_OK )
|
if ( _algoState == HYP_OK )
|
||||||
_computeState = READY_TO_COMPUTE;
|
_computeState = READY_TO_COMPUTE;
|
||||||
}
|
}
|
||||||
@ -1649,7 +1660,7 @@ bool SMESH_subMesh::ComputeStateEngine(int event)
|
|||||||
ComputeStateEngine( CLEAN );
|
ComputeStateEngine( CLEAN );
|
||||||
algo = GetAlgo();
|
algo = GetAlgo();
|
||||||
if (algo && !algo->NeedDiscreteBoundary())
|
if (algo && !algo->NeedDiscreteBoundary())
|
||||||
cleanDependsOn( algo->SupportSubmeshes() ); // clean sub-meshes with event CLEAN
|
cleanDependsOn( algo ); // clean sub-meshes with event CLEAN
|
||||||
break;
|
break;
|
||||||
case COMPUTE: // nothing to do
|
case COMPUTE: // nothing to do
|
||||||
break;
|
break;
|
||||||
@ -1704,7 +1715,7 @@ bool SMESH_subMesh::ComputeStateEngine(int event)
|
|||||||
ComputeStateEngine( CLEAN );
|
ComputeStateEngine( CLEAN );
|
||||||
algo = GetAlgo();
|
algo = GetAlgo();
|
||||||
if (algo && !algo->NeedDiscreteBoundary())
|
if (algo && !algo->NeedDiscreteBoundary())
|
||||||
cleanDependsOn( algo->SupportSubmeshes() ); // clean sub-meshes with event CLEAN
|
cleanDependsOn( algo ); // clean sub-meshes with event CLEAN
|
||||||
if (_algoState == HYP_OK)
|
if (_algoState == HYP_OK)
|
||||||
_computeState = READY_TO_COMPUTE;
|
_computeState = READY_TO_COMPUTE;
|
||||||
else
|
else
|
||||||
|
@ -273,7 +273,7 @@ protected:
|
|||||||
void updateDependantsState(const compute_event theEvent);
|
void updateDependantsState(const compute_event theEvent);
|
||||||
void updateSubMeshState(const compute_state theState);
|
void updateSubMeshState(const compute_state theState);
|
||||||
void cleanDependants();
|
void cleanDependants();
|
||||||
void cleanDependsOn( bool keepSupportedsubMeshes = false );
|
void cleanDependsOn( SMESH_Algo* algoRequiringCleaning=0 );
|
||||||
void setAlgoState(algo_state state);
|
void setAlgoState(algo_state state);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
Loading…
Reference in New Issue
Block a user