mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-04-08 10:57:26 +05:00
Changes needed for smooth working of algorithms that need no descrete boundaries:
- in SubMeshesComputed(), restrict checking to myDim-1 only - in AlgoStateEngine(), clean all submeshes in the current on REMOVE_ALGO event - in CleanDependsOn(), remove call to ComputeStateEngine to avoid repeatitive cleaning - in ComputeStateEngine(), call CleanDependsOn on the event modifying hyp or algo regardless of current compute state
This commit is contained in:
parent
a3d6485d92
commit
91ed159dc1
@ -186,11 +186,20 @@ bool SMESH_subMesh::SubMeshesComputed()
|
|||||||
//MESSAGE("SMESH_subMesh::SubMeshesComputed");
|
//MESSAGE("SMESH_subMesh::SubMeshesComputed");
|
||||||
const map < int, SMESH_subMesh * >&subMeshes = DependsOn();
|
const map < int, SMESH_subMesh * >&subMeshes = DependsOn();
|
||||||
|
|
||||||
|
int myDim = SMESH_Gen::GetShapeDim( _subShape );
|
||||||
|
int dimToCheck = myDim - 1;
|
||||||
bool subMeshesComputed = true;
|
bool subMeshesComputed = true;
|
||||||
map < int, SMESH_subMesh * >::const_iterator itsub;
|
map < int, SMESH_subMesh * >::const_iterator itsub;
|
||||||
for (itsub = subMeshes.begin(); itsub != subMeshes.end(); itsub++)
|
for (itsub = subMeshes.begin(); itsub != subMeshes.end(); itsub++)
|
||||||
{
|
{
|
||||||
SMESH_subMesh *sm = (*itsub).second;
|
SMESH_subMesh *sm = (*itsub).second;
|
||||||
|
const TopoDS_Shape & ss = sm->GetSubShape();
|
||||||
|
// MSV 07.04.2006: restrict checking to myDim-1 only. Ex., there is no sense
|
||||||
|
// in checking of existence of edges if the algo needs only faces. Moreover,
|
||||||
|
// degenerated edges may have no submesh, as after computing NETGEN_2D.
|
||||||
|
int dim = SMESH_Gen::GetShapeDim( ss );
|
||||||
|
if (dim < dimToCheck)
|
||||||
|
continue;
|
||||||
SMESHDS_SubMesh * ds = sm->GetSubMeshDS();
|
SMESHDS_SubMesh * ds = sm->GetSubMeshDS();
|
||||||
// PAL10974.
|
// PAL10974.
|
||||||
// There are some tricks with compute states, e.g. Penta_3D leaves
|
// There are some tricks with compute states, e.g. Penta_3D leaves
|
||||||
@ -201,7 +210,6 @@ bool SMESH_subMesh::SubMeshesComputed()
|
|||||||
(ds && ( ds->GetNodes()->more() || ds->GetElements()->more() )));
|
(ds && ( ds->GetNodes()->more() || ds->GetElements()->more() )));
|
||||||
if (!computeOk)
|
if (!computeOk)
|
||||||
{
|
{
|
||||||
const TopoDS_Shape & ss = sm->GetSubShape();
|
|
||||||
int type = ss.ShapeType();
|
int type = ss.ShapeType();
|
||||||
|
|
||||||
subMeshesComputed = false;
|
subMeshesComputed = false;
|
||||||
@ -634,6 +642,19 @@ SMESH_Hypothesis::Hypothesis_Status
|
|||||||
ret = SMESH_Hypothesis::HYP_CONCURENT;
|
ret = SMESH_Hypothesis::HYP_CONCURENT;
|
||||||
}
|
}
|
||||||
} // Serve Propagation of 1D hypothesis
|
} // Serve Propagation of 1D hypothesis
|
||||||
|
else // event == REMOVE_ALGO
|
||||||
|
{
|
||||||
|
SMESH_Algo* algo = dynamic_cast<SMESH_Algo*> (anHyp);
|
||||||
|
if (!algo->NeedDescretBoundary())
|
||||||
|
{
|
||||||
|
// 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
|
||||||
|
CleanDependants();
|
||||||
|
ComputeStateEngine( CLEAN );
|
||||||
|
CleanDependsOn();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------
|
// ------------------
|
||||||
@ -1038,9 +1059,6 @@ SMESH_Hypothesis::Hypothesis_Status
|
|||||||
void SMESH_subMesh::CleanDependsOn()
|
void SMESH_subMesh::CleanDependsOn()
|
||||||
{
|
{
|
||||||
//MESSAGE("SMESH_subMesh::CleanDependsOn");
|
//MESSAGE("SMESH_subMesh::CleanDependsOn");
|
||||||
// **** parcourir les ancetres dans l'ordre de dépendance
|
|
||||||
|
|
||||||
ComputeStateEngine(CLEAN);
|
|
||||||
|
|
||||||
const map < int, SMESH_subMesh * >&dependson = DependsOn();
|
const map < int, SMESH_subMesh * >&dependson = DependsOn();
|
||||||
map < int, SMESH_subMesh * >::const_iterator its;
|
map < int, SMESH_subMesh * >::const_iterator its;
|
||||||
@ -1169,10 +1187,12 @@ bool SMESH_subMesh::ComputeStateEngine(int event)
|
|||||||
case NOT_READY:
|
case NOT_READY:
|
||||||
switch (event)
|
switch (event)
|
||||||
{
|
{
|
||||||
case MODIF_HYP: // nothing to do
|
case MODIF_HYP:
|
||||||
break;
|
|
||||||
case MODIF_ALGO_STATE:
|
case MODIF_ALGO_STATE:
|
||||||
if (_algoState == HYP_OK)
|
algo = gen->GetAlgo((*_father), _subShape);
|
||||||
|
if (algo && !algo->NeedDescretBoundary())
|
||||||
|
CleanDependsOn(); // clean sub-meshes with event CLEAN
|
||||||
|
if (event == MODIF_ALGO_STATE && _algoState == HYP_OK)
|
||||||
{
|
{
|
||||||
_computeState = READY_TO_COMPUTE;
|
_computeState = READY_TO_COMPUTE;
|
||||||
}
|
}
|
||||||
@ -1205,11 +1225,14 @@ bool SMESH_subMesh::ComputeStateEngine(int event)
|
|||||||
case READY_TO_COMPUTE:
|
case READY_TO_COMPUTE:
|
||||||
switch (event)
|
switch (event)
|
||||||
{
|
{
|
||||||
case MODIF_HYP: // nothing to do
|
case MODIF_HYP:
|
||||||
break;
|
|
||||||
case MODIF_ALGO_STATE:
|
case MODIF_ALGO_STATE:
|
||||||
_computeState = NOT_READY;
|
|
||||||
algo = gen->GetAlgo((*_father), _subShape);
|
algo = gen->GetAlgo((*_father), _subShape);
|
||||||
|
if (algo && !algo->NeedDescretBoundary())
|
||||||
|
CleanDependsOn(); // clean sub-meshes with event CLEAN
|
||||||
|
if (event == MODIF_HYP)
|
||||||
|
break; // nothing else to do when MODIF_HYP
|
||||||
|
_computeState = NOT_READY;
|
||||||
if (algo)
|
if (algo)
|
||||||
{
|
{
|
||||||
ret = algo->CheckHypothesis((*_father), _subShape, hyp_status);
|
ret = algo->CheckHypothesis((*_father), _subShape, hyp_status);
|
||||||
@ -1240,16 +1263,18 @@ bool SMESH_subMesh::ComputeStateEngine(int event)
|
|||||||
// compute
|
// compute
|
||||||
CleanDependants();
|
CleanDependants();
|
||||||
RemoveSubMeshElementsAndNodes();
|
RemoveSubMeshElementsAndNodes();
|
||||||
try {
|
{
|
||||||
if (!algo->NeedDescretBoundary() && !algo->OnlyUnaryInput())
|
try {
|
||||||
ret = ApplyToCollection( algo, GetCollection( gen, algo ) );
|
if (!algo->NeedDescretBoundary() && !algo->OnlyUnaryInput())
|
||||||
else
|
ret = ApplyToCollection( algo, GetCollection( gen, algo ) );
|
||||||
ret = algo->Compute((*_father), _subShape);
|
else
|
||||||
}
|
ret = algo->Compute((*_father), _subShape);
|
||||||
catch (Standard_Failure) {
|
}
|
||||||
MESSAGE( "Exception in algo->Compute() ");
|
catch (Standard_Failure) {
|
||||||
ret = false;
|
MESSAGE( "Exception in algo->Compute() ");
|
||||||
}
|
ret = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!ret)
|
if (!ret)
|
||||||
{
|
{
|
||||||
MESSAGE("problem in algo execution: failed to compute");
|
MESSAGE("problem in algo execution: failed to compute");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user