From 71b66afd043b8178caac7b4d53553407cda59987 Mon Sep 17 00:00:00 2001 From: eap Date: Wed, 6 Mar 2013 13:34:53 +0000 Subject: [PATCH] 022150: [CEA 789] Projection_1D2D not taken into account by BLSURF enum compute_event { ... + COMPUTE_SUBMESH --- src/SMESH/SMESH_Gen.cxx | 45 +++++++++++++++---------------------- src/SMESH/SMESH_subMesh.cxx | 29 ++++++++++++++---------- src/SMESH/SMESH_subMesh.hxx | 2 +- 3 files changed, 36 insertions(+), 40 deletions(-) diff --git a/src/SMESH/SMESH_Gen.cxx b/src/SMESH/SMESH_Gen.cxx index 2e8a96307..44e5a46d3 100644 --- a/src/SMESH/SMESH_Gen.cxx +++ b/src/SMESH/SMESH_Gen.cxx @@ -63,18 +63,16 @@ using namespace std; SMESH_Gen::SMESH_Gen() { - MESSAGE("SMESH_Gen::SMESH_Gen"); - _localId = 0; - _hypId = 0; - _segmentation = _nbSegments = 10; - SMDS_Mesh::_meshList.clear(); - MESSAGE(SMDS_Mesh::_meshList.size()); - //_counters = new counters(100); -#ifdef WITH_SMESH_CANCEL_COMPUTE - _compute_canceled = false; - _sm_current = NULL; -#endif - //vtkDebugLeaks::SetExitError(0); + MESSAGE("SMESH_Gen::SMESH_Gen"); + _localId = 0; + _hypId = 0; + _segmentation = _nbSegments = 10; + SMDS_Mesh::_meshList.clear(); + MESSAGE(SMDS_Mesh::_meshList.size()); + //_counters = new counters(100); + _compute_canceled = false; + _sm_current = NULL; + //vtkDebugLeaks::SetExitError(0); } //============================================================================= @@ -145,6 +143,11 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh, const int globalAlgoDim = 100; SMESH_subMeshIteratorPtr smIt; + SMESH_subMesh::compute_event computeEvent; + if ( !anUpward && aShape.IsSame( aMesh.GetShapeToMesh() )) + computeEvent = SMESH_subMesh::COMPUTE; + else + computeEvent = SMESH_subMesh::COMPUTE_SUBMESH; if ( anUpward ) // is called from below code here { @@ -172,15 +175,11 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh, if (smToCompute->GetComputeState() == SMESH_subMesh::READY_TO_COMPUTE) { -#ifdef WITH_SMESH_CANCEL_COMPUTE if (_compute_canceled) return false; _sm_current = smToCompute; -#endif - smToCompute->ComputeStateEngine( SMESH_subMesh::COMPUTE ); -#ifdef WITH_SMESH_CANCEL_COMPUTE + smToCompute->ComputeStateEngine( computeEvent ); _sm_current = NULL; -#endif } // we check all the submeshes here and detect if any of them failed to compute @@ -258,15 +257,11 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh, } else { -#ifdef WITH_SMESH_CANCEL_COMPUTE if (_compute_canceled) return false; _sm_current = smToCompute; -#endif - smToCompute->ComputeStateEngine( SMESH_subMesh::COMPUTE ); -#ifdef WITH_SMESH_CANCEL_COMPUTE + smToCompute->ComputeStateEngine( computeEvent ); _sm_current = NULL; -#endif if ( aShapesId ) aShapesId->insert( smToCompute->GetId() ); } @@ -342,15 +337,11 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh, if ( aShapesId && GetShapeDim( aShType ) > (int)aDim ) continue; -#ifdef WITH_SMESH_CANCEL_COMPUTE if (_compute_canceled) return false; _sm_current = sm; -#endif - sm->ComputeStateEngine( SMESH_subMesh::COMPUTE ); -#ifdef WITH_SMESH_CANCEL_COMPUTE + sm->ComputeStateEngine( computeEvent ); _sm_current = NULL; -#endif if ( aShapesId ) aShapesId->insert( sm->GetId() ); } diff --git a/src/SMESH/SMESH_subMesh.cxx b/src/SMESH/SMESH_subMesh.cxx index 08b033dc9..2049d5ff6 100644 --- a/src/SMESH/SMESH_subMesh.cxx +++ b/src/SMESH/SMESH_subMesh.cxx @@ -1336,6 +1336,7 @@ bool SMESH_subMesh::ComputeStateEngine(int event) switch ( event ) { case MODIF_ALGO_STATE: case COMPUTE: + case COMPUTE_SUBMESH: //case COMPUTE_CANCELED: case CLEAN: //case SUBMESH_COMPUTED: @@ -1393,11 +1394,10 @@ bool SMESH_subMesh::ComputeStateEngine(int event) _computeState = READY_TO_COMPUTE; break; case COMPUTE: // nothing to do + case COMPUTE_SUBMESH: break; -#ifdef WITH_SMESH_CANCEL_COMPUTE - case COMPUTE_CANCELED: // nothing to do + case COMPUTE_CANCELED: // nothing to do break; -#endif case CLEAN: cleanDependants(); removeSubMeshElementsAndNodes(); @@ -1440,6 +1440,7 @@ bool SMESH_subMesh::ComputeStateEngine(int event) } break; case COMPUTE: + case COMPUTE_SUBMESH: { algo = GetAlgo(); ASSERT(algo); @@ -1455,10 +1456,16 @@ bool SMESH_subMesh::ComputeStateEngine(int event) // check submeshes needed if (_father->HasShapeToMesh() ) { bool subComputed = false, subFailed = false; - if (!algo->OnlyUnaryInput()) - shape = getCollection( gen, algo, subComputed, subFailed ); - else + if (!algo->OnlyUnaryInput()) { + if ( event == COMPUTE && + ( algo->NeedDiscreteBoundary() || algo->SupportSubmeshes() )) + shape = getCollection( gen, algo, subComputed, subFailed ); + else + subComputed = SubMeshesComputed( & subFailed ); + } + else { subComputed = SubMeshesComputed(); + } ret = ( algo->NeedDiscreteBoundary() ? subComputed : algo->SupportSubmeshes() ? !subFailed : ( !subComputed || _father->IsNotConformAllowed() )); @@ -1607,10 +1614,8 @@ bool SMESH_subMesh::ComputeStateEngine(int event) } } break; -#ifdef WITH_SMESH_CANCEL_COMPUTE case COMPUTE_CANCELED: // nothing to do break; -#endif case CLEAN: cleanDependants(); removeSubMeshElementsAndNodes(); @@ -1664,10 +1669,8 @@ bool SMESH_subMesh::ComputeStateEngine(int event) break; case COMPUTE: // nothing to do break; -#ifdef WITH_SMESH_CANCEL_COMPUTE - case COMPUTE_CANCELED: // nothing to do + case COMPUTE_CANCELED: // nothing to do break; -#endif case CLEAN: cleanDependants(); // clean sub-meshes, dependant on this one, with event CLEAN removeSubMeshElementsAndNodes(); @@ -1721,7 +1724,8 @@ bool SMESH_subMesh::ComputeStateEngine(int event) else _computeState = NOT_READY; break; - case COMPUTE: // nothing to do + case COMPUTE: // nothing to do + case COMPUTE_SUBMESH: break; case COMPUTE_CANCELED: { @@ -2369,6 +2373,7 @@ void SMESH_subMeshEventListener::ProcessEvent(const int event, (*smIt)->ComputeStateEngine( event ); break; case SMESH_subMesh::COMPUTE: + case SMESH_subMesh::COMPUTE_SUBMESH: if ( subMesh->GetComputeState() == SMESH_subMesh::COMPUTE_OK ) for ( ; smIt != smEnd; ++ smIt) (*smIt)->ComputeStateEngine( SMESH_subMesh::SUBMESH_COMPUTED ); diff --git a/src/SMESH/SMESH_subMesh.hxx b/src/SMESH/SMESH_subMesh.hxx index 669ef7164..5e0abcd72 100644 --- a/src/SMESH/SMESH_subMesh.hxx +++ b/src/SMESH/SMESH_subMesh.hxx @@ -107,7 +107,7 @@ class SMESH_EXPORT SMESH_subMesh }; enum compute_event { - MODIF_ALGO_STATE, COMPUTE, COMPUTE_CANCELED, + MODIF_ALGO_STATE, COMPUTE, COMPUTE_SUBMESH, COMPUTE_CANCELED, CLEAN, SUBMESH_COMPUTED, SUBMESH_RESTORED, SUBMESH_LOADED, MESH_ENTITY_REMOVED, CHECK_COMPUTE_STATE };