X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESH%2FSMESH_Gen.cxx;h=2e79fb278b6c6b63b05e59ad8613da60425905a8;hb=bd4cadfcf065d6c5079ca6edd42d3ffd69402a83;hp=10ec57e1fa5556160a6fa1f08c0eacb5b1d66169;hpb=2daa321efae3d0c6ce41199fa5a2482630d505d9;p=modules%2Fsmesh.git diff --git a/src/SMESH/SMESH_Gen.cxx b/src/SMESH/SMESH_Gen.cxx index 10ec57e1f..2e79fb278 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,11 +43,13 @@ #include #include +#include "memoire.h" + using namespace std; //============================================================================= /*! - * default constructor: + * Constructor */ //============================================================================= @@ -53,52 +58,27 @@ SMESH_Gen::SMESH_Gen() MESSAGE("SMESH_Gen::SMESH_Gen"); _localId = 0; _hypId = 0; - _segmentation = 10; + _segmentation = _nbSegments = 10; + SMDS_Mesh::_meshList.clear(); + MESSAGE(SMDS_Mesh::_meshList.size()); + _counters = new counters(100); } //============================================================================= /*! - * + * Destructor */ //============================================================================= SMESH_Gen::~SMESH_Gen() { - MESSAGE("SMESH_Gen::~SMESH_Gen"); + MESSAGE("SMESH_Gen::~SMESH_Gen"); } //============================================================================= /*! - * - */ -//============================================================================= - -/*SMESH_Hypothesis *SMESH_Gen::CreateHypothesis(const char *anHyp, int studyId) - throw(SALOME_Exception) -{ - - MESSAGE("CreateHypothesis("<GetID(); - myStudyContext->mapHypothesis[hypId] = myHypothesis; - SCRUTE(studyId); - SCRUTE(hypId); - - // store hypothesis in SMESHDS document - - myStudyContext->myDocument->AddHypothesis(myHypothesis); - return myHypothesis; -}*/ - -//============================================================================= -/*! - * + * Creates a mesh in a study. + * if (theIsEmbeddedMode) { mesh modification commands are not logged } */ //============================================================================= @@ -135,6 +115,7 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh, TSetOfInt* aShapesId) { MESSAGE("SMESH_Gen::Compute"); + MEMOSTAT; bool ret = true; @@ -178,6 +159,7 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh, else if ( aShapesId ) aShapesId->insert( smToCompute->GetId() ); } + //aMesh.GetMeshDS()->Modified(); return ret; } else @@ -207,7 +189,7 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh, if ( algo && !algo->NeedDescretBoundary() ) { if ( algo->SupportSubmeshes() ) - smWithAlgoSupportingSubmeshes.push_back( smToCompute ); + smWithAlgoSupportingSubmeshes.push_front( smToCompute ); else { smToCompute->ComputeStateEngine( SMESH_subMesh::COMPUTE ); @@ -216,13 +198,19 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh, } } } + + // ------------------------------------------------------------ + // sort list of submeshes according to mesh order + // ------------------------------------------------------------ + aMesh.SortByMeshOrder( smWithAlgoSupportingSubmeshes ); + // ------------------------------------------------------------ // compute submeshes under shapes with algos that DO NOT require // descretized boundaries and DO support submeshes // ------------------------------------------------------------ - list< SMESH_subMesh* >::reverse_iterator subIt, subEnd; - subIt = smWithAlgoSupportingSubmeshes.rbegin(); - subEnd = smWithAlgoSupportingSubmeshes.rend(); + list< SMESH_subMesh* >::iterator subIt, subEnd; + subIt = smWithAlgoSupportingSubmeshes.begin(); + subEnd = smWithAlgoSupportingSubmeshes.end(); // start from lower shapes for ( ; subIt != subEnd; ++subIt ) { @@ -264,7 +252,7 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh, // ---------------------------------------------------------- // apply the algos that do not require descretized boundaries // ---------------------------------------------------------- - for ( subIt = smWithAlgoSupportingSubmeshes.rbegin(); subIt != subEnd; ++subIt ) + for ( subIt = smWithAlgoSupportingSubmeshes.begin(); subIt != subEnd; ++subIt ) { sm = *subIt; if ( sm->GetComputeState() == SMESH_subMesh::READY_TO_COMPUTE) @@ -286,6 +274,26 @@ 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; } @@ -353,7 +361,7 @@ bool SMESH_Gen::Evaluate(SMESH_Mesh & aMesh, SMESH_Algo* algo = GetAlgo( aMesh, aSubShape ); if ( algo && !algo->NeedDescretBoundary() ) { if ( algo->SupportSubmeshes() ) { - smWithAlgoSupportingSubmeshes.push_back( smToCompute ); + smWithAlgoSupportingSubmeshes.push_front( smToCompute ); } else { smToCompute->Evaluate(aResMap); @@ -362,13 +370,19 @@ bool SMESH_Gen::Evaluate(SMESH_Mesh & aMesh, } } } + + // ------------------------------------------------------------ + // sort list of meshes according to mesh order + // ------------------------------------------------------------ + aMesh.SortByMeshOrder( smWithAlgoSupportingSubmeshes ); + // ------------------------------------------------------------ // compute submeshes under shapes with algos that DO NOT require // descretized boundaries and DO support submeshes // ------------------------------------------------------------ - list< SMESH_subMesh* >::reverse_iterator subIt, subEnd; - subIt = smWithAlgoSupportingSubmeshes.rbegin(); - subEnd = smWithAlgoSupportingSubmeshes.rend(); + list< SMESH_subMesh* >::iterator subIt, subEnd; + subIt = smWithAlgoSupportingSubmeshes.begin(); + subEnd = smWithAlgoSupportingSubmeshes.end(); // start from lower shapes for ( ; subIt != subEnd; ++subIt ) { sm = *subIt; @@ -405,7 +419,7 @@ bool SMESH_Gen::Evaluate(SMESH_Mesh & aMesh, // ---------------------------------------------------------- // apply the algos that do not require descretized boundaries // ---------------------------------------------------------- - for ( subIt = smWithAlgoSupportingSubmeshes.rbegin(); subIt != subEnd; ++subIt ) + for ( subIt = smWithAlgoSupportingSubmeshes.begin(); subIt != subEnd; ++subIt ) { sm = *subIt; sm->Evaluate(aResMap); @@ -774,7 +788,7 @@ bool SMESH_Gen::IsGlobalHypothesis(const SMESH_Hypothesis* theHyp, SMESH_Mesh& a //============================================================================= /*! - * + * Finds algo to mesh a shape. Optionally returns a shape the found algo is bound to */ //============================================================================= @@ -782,7 +796,6 @@ SMESH_Algo *SMESH_Gen::GetAlgo(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, TopoDS_Shape* assignedTo) { - SMESH_HypoFilter filter( SMESH_HypoFilter::IsAlgo() ); filter.And( filter.IsApplicableTo( aShape )); @@ -791,59 +804,28 @@ SMESH_Algo *SMESH_Gen::GetAlgo(SMESH_Mesh & aMesh, //============================================================================= /*! - * + * Returns StudyContextStruct for a study */ //============================================================================= StudyContextStruct *SMESH_Gen::GetStudyContext(int studyId) { - // Get studyContext, create it if it does'nt exist, with a SMESHDS_Document + // Get studyContext, create it if it does'nt exist, with a SMESHDS_Document - if (_mapStudyContext.find(studyId) == _mapStudyContext.end()) - { - _mapStudyContext[studyId] = new StudyContextStruct; - _mapStudyContext[studyId]->myDocument = new SMESHDS_Document(studyId); - } - StudyContextStruct *myStudyContext = _mapStudyContext[studyId]; -// ASSERT(_mapStudyContext.find(studyId) != _mapStudyContext.end()); - return myStudyContext; + if (_mapStudyContext.find(studyId) == _mapStudyContext.end()) + { + _mapStudyContext[studyId] = new StudyContextStruct; + _mapStudyContext[studyId]->myDocument = new SMESHDS_Document(studyId); + } + StudyContextStruct *myStudyContext = _mapStudyContext[studyId]; + return myStudyContext; } -// //============================================================================= -// /*! -// * -// */ -// //============================================================================= - -// void SMESH_Gen::Save(int studyId, const char *aUrlOfFile) -// { -// } - -// //============================================================================= -// /*! -// * -// */ -// //============================================================================= - -// void SMESH_Gen::Load(int studyId, const char *aUrlOfFile) -// { -// } - -// //============================================================================= -// /*! -// * -// */ -// //============================================================================= - -// void SMESH_Gen::Close(int studyId) -// { -// } - -//============================================================================= +//================================================================================ /*! - * + * \brief Return shape dimension by TopAbs_ShapeEnum */ -//============================================================================= +//================================================================================ int SMESH_Gen::GetShapeDim(const TopAbs_ShapeEnum & aShapeType) { @@ -865,12 +847,11 @@ int SMESH_Gen::GetShapeDim(const TopAbs_ShapeEnum & aShapeType) //============================================================================= /*! - * + * Genarate a new id unique withing this Gen */ //============================================================================= int SMESH_Gen::GetANewId() { - //MESSAGE("SMESH_Gen::GetANewId"); - return _hypId++; + return _hypId++; }