X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESH%2FSMESH_Gen.cxx;h=360325e81b86a45d722ac68156e54074592975df;hb=c4bd4ff43b510056ee6a6b0ffdf8693c4adb1be5;hp=08c1dd868eccbee9de17cc3d60bbf5efe6481610;hpb=9f57d8b5e9fe0e998ff6e928eae3078254a031e4;p=modules%2Fsmesh.git diff --git a/src/SMESH/SMESH_Gen.cxx b/src/SMESH/SMESH_Gen.cxx index 08c1dd868..360325e81 100644 --- a/src/SMESH/SMESH_Gen.cxx +++ b/src/SMESH/SMESH_Gen.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -19,17 +19,20 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // SMESH SMESH : implementaion of SMESH idl descriptions // File : SMESH_Gen.cxx // Author : Paul RASCLE, EDF // Module : SMESH - +// +#define CHRONODEF #include "SMESH_Gen.hxx" #include "SMESH_subMesh.hxx" #include "SMESH_HypoFilter.hxx" #include "SMESHDS_Document.hxx" #include "SMDS_MeshElement.hxx" #include "SMDS_MeshNode.hxx" +#include "SMDS_Mesh.hxx" #include "utilities.h" #include "OpUtil.hxx" @@ -40,6 +43,8 @@ #include #include +#include "memoire.h" + using namespace std; //============================================================================= @@ -50,10 +55,17 @@ using namespace std; SMESH_Gen::SMESH_Gen() { - MESSAGE("SMESH_Gen::SMESH_Gen"); - _localId = 0; - _hypId = 0; - _segmentation = _nbSegments = 10; + 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 } //============================================================================= @@ -107,6 +119,7 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh, TSetOfInt* aShapesId) { MESSAGE("SMESH_Gen::Compute"); + MEMOSTAT; bool ret = true; @@ -142,7 +155,17 @@ 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 + _sm_current = NULL; +#endif + } // we check all the submeshes here and detect if any of them failed to compute if (smToCompute->GetComputeState() == SMESH_subMesh::FAILED_TO_COMPUTE) @@ -150,6 +173,7 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh, else if ( aShapesId ) aShapesId->insert( smToCompute->GetId() ); } + //aMesh.GetMeshDS()->Modified(); return ret; } else @@ -182,7 +206,15 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh, smWithAlgoSupportingSubmeshes.push_front( smToCompute ); 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 + _sm_current = NULL; +#endif if ( aShapesId ) aShapesId->insert( smToCompute->GetId() ); } @@ -190,7 +222,7 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh, } // ------------------------------------------------------------ - // sort list of meshes according to mesh order + // sort list of submeshes according to mesh order // ------------------------------------------------------------ aMesh.SortByMeshOrder( smWithAlgoSupportingSubmeshes ); @@ -252,7 +284,15 @@ 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_current = NULL; +#endif if ( aShapesId ) aShapesId->insert( sm->GetId() ); } @@ -264,10 +304,58 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh, } MESSAGE( "VSR - SMESH_Gen::Compute() finished, OK = " << ret); + MEMOSTAT; + + SMESHDS_Mesh *myMesh = aMesh.GetMeshDS(); + myMesh->adjustStructure(); + MESSAGE("*** compactMesh after compute"); + myMesh->compactMesh(); + //myMesh->adjustStructure(); + list listind = myMesh->SubMeshIndices(); + list::iterator it = listind.begin(); + int total = 0; + for(; it != listind.end(); ++it) + { + ::SMESHDS_SubMesh *subMesh = myMesh->MeshElements(*it); + total += subMesh->getSize(); + } + MESSAGE("total elements and nodes in submesh sets:" << total); + MESSAGE("Number of node objects " << SMDS_MeshNode::nbNodes); + MESSAGE("Number of cell objects " << SMDS_MeshCell::nbCells); + //myMesh->dumpGrid(); + //aMesh.GetMeshDS()->Modified(); return ret; } +#ifdef WITH_SMESH_CANCEL_COMPUTE +//============================================================================= +/*! + * Prepare Compute a mesh + */ +//============================================================================= +void SMESH_Gen::PrepareCompute(SMESH_Mesh & aMesh, + const TopoDS_Shape & aShape) +{ + _compute_canceled = false; + _sm_current = NULL; +} +//============================================================================= +/*! + * Cancel Compute a mesh + */ +//============================================================================= +void SMESH_Gen::CancelCompute(SMESH_Mesh & aMesh, + const TopoDS_Shape & aShape) +{ + _compute_canceled = true; + if(_sm_current) + { + _sm_current->ComputeStateEngine( SMESH_subMesh::COMPUTE_CANCELED ); + } +} +#endif + //============================================================================= /*! * Evaluate a mesh