This commit is contained in:
eap 2009-09-15 08:46:22 +00:00
parent 4c604aa712
commit 8d7286fc5d

View File

@ -50,9 +50,9 @@ using namespace std;
SMESH_Gen::SMESH_Gen() SMESH_Gen::SMESH_Gen()
{ {
MESSAGE("SMESH_Gen::SMESH_Gen"); MESSAGE("SMESH_Gen::SMESH_Gen");
_localId = 0; _localId = 0;
_hypId = 0; _hypId = 0;
_segmentation = 10; _segmentation = 10;
} }
@ -64,7 +64,7 @@ SMESH_Gen::SMESH_Gen()
SMESH_Gen::~SMESH_Gen() SMESH_Gen::~SMESH_Gen()
{ {
MESSAGE("SMESH_Gen::~SMESH_Gen"); MESSAGE("SMESH_Gen::~SMESH_Gen");
} }
//============================================================================= //=============================================================================
@ -74,26 +74,26 @@ SMESH_Gen::~SMESH_Gen()
//============================================================================= //=============================================================================
/*SMESH_Hypothesis *SMESH_Gen::CreateHypothesis(const char *anHyp, int studyId) /*SMESH_Hypothesis *SMESH_Gen::CreateHypothesis(const char *anHyp, int studyId)
throw(SALOME_Exception) throw(SALOME_Exception)
{ {
MESSAGE("CreateHypothesis("<<anHyp<<","<<studyId<<")"); MESSAGE("CreateHypothesis("<<anHyp<<","<<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
StudyContextStruct *myStudyContext = GetStudyContext(studyId); StudyContextStruct *myStudyContext = GetStudyContext(studyId);
// create a new hypothesis object, store its ref. in studyContext // create a new hypothesis object, store its ref. in studyContext
SMESH_Hypothesis *myHypothesis = _hypothesisFactory.Create(anHyp, studyId); SMESH_Hypothesis *myHypothesis = _hypothesisFactory.Create(anHyp, studyId);
int hypId = myHypothesis->GetID(); int hypId = myHypothesis->GetID();
myStudyContext->mapHypothesis[hypId] = myHypothesis; myStudyContext->mapHypothesis[hypId] = myHypothesis;
SCRUTE(studyId); SCRUTE(studyId);
SCRUTE(hypId); SCRUTE(hypId);
// store hypothesis in SMESHDS document // store hypothesis in SMESHDS document
myStudyContext->myDocument->AddHypothesis(myHypothesis); myStudyContext->myDocument->AddHypothesis(myHypothesis);
return myHypothesis; return myHypothesis;
}*/ }*/
//============================================================================= //=============================================================================
@ -113,10 +113,10 @@ SMESH_Mesh* SMESH_Gen::CreateMesh(int theStudyId, bool theIsEmbeddedMode)
// create a new SMESH_mesh object // create a new SMESH_mesh object
SMESH_Mesh *aMesh = new SMESH_Mesh(_localId++, SMESH_Mesh *aMesh = new SMESH_Mesh(_localId++,
theStudyId, theStudyId,
this, this,
theIsEmbeddedMode, theIsEmbeddedMode,
aStudyContext->myDocument); aStudyContext->myDocument);
aStudyContext->mapMesh[_localId] = aMesh; aStudyContext->mapMesh[_localId] = aMesh;
return aMesh; return aMesh;
@ -131,8 +131,8 @@ SMESH_Mesh* SMESH_Gen::CreateMesh(int theStudyId, bool theIsEmbeddedMode)
bool SMESH_Gen::Compute(SMESH_Mesh & aMesh, bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
const TopoDS_Shape & aShape, const TopoDS_Shape & aShape,
const bool anUpward, const bool anUpward,
const ::MeshDimension aDim, const ::MeshDimension aDim,
TSetOfInt* aShapesId) TSetOfInt* aShapesId)
{ {
MESSAGE("SMESH_Gen::Compute"); MESSAGE("SMESH_Gen::Compute");
@ -166,7 +166,7 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
// clear compute state to not show previous compute errors // clear compute state to not show previous compute errors
// if preview invoked less dimension less than previous // if preview invoked less dimension less than previous
smToCompute->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE ); smToCompute->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE );
continue; continue;
} }
if (smToCompute->GetComputeState() == SMESH_subMesh::READY_TO_COMPUTE) if (smToCompute->GetComputeState() == SMESH_subMesh::READY_TO_COMPUTE)
@ -176,7 +176,7 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
if (smToCompute->GetComputeState() == SMESH_subMesh::FAILED_TO_COMPUTE) if (smToCompute->GetComputeState() == SMESH_subMesh::FAILED_TO_COMPUTE)
ret = false; ret = false;
else if ( aShapesId ) else if ( aShapesId )
aShapesId->insert( smToCompute->GetId() ); aShapesId->insert( smToCompute->GetId() );
} }
return ret; return ret;
} }
@ -201,7 +201,7 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
// check for preview dimension limitations // check for preview dimension limitations
if ( aShapesId && aShapeDim > (int)aDim ) if ( aShapesId && aShapeDim > (int)aDim )
continue; continue;
SMESH_Algo* algo = GetAlgo( aMesh, aSubShape ); SMESH_Algo* algo = GetAlgo( aMesh, aSubShape );
if ( algo && !algo->NeedDescretBoundary() ) if ( algo && !algo->NeedDescretBoundary() )
@ -209,11 +209,11 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
if ( algo->SupportSubmeshes() ) if ( algo->SupportSubmeshes() )
smWithAlgoSupportingSubmeshes.push_back( smToCompute ); smWithAlgoSupportingSubmeshes.push_back( smToCompute );
else else
{ {
smToCompute->ComputeStateEngine( SMESH_subMesh::COMPUTE ); smToCompute->ComputeStateEngine( SMESH_subMesh::COMPUTE );
if ( aShapesId ) if ( aShapesId )
aShapesId->insert( smToCompute->GetId() ); aShapesId->insert( smToCompute->GetId() );
} }
} }
} }
// ------------------------------------------------------------ // ------------------------------------------------------------
@ -240,14 +240,14 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
SMESH_subMesh* smToCompute = smIt->next(); SMESH_subMesh* smToCompute = smIt->next();
const TopoDS_Shape& aSubShape = smToCompute->GetSubShape(); const TopoDS_Shape& aSubShape = smToCompute->GetSubShape();
const int aShapeDim = GetShapeDim( aSubShape ); const int aShapeDim = GetShapeDim( aSubShape );
//if ( aSubShape.ShapeType() == TopAbs_VERTEX ) continue; //if ( aSubShape.ShapeType() == TopAbs_VERTEX ) continue;
if ( aShapeDim < 1 ) continue; if ( aShapeDim < 1 ) continue;
// check for preview dimension limitations // check for preview dimension limitations
if ( aShapesId && GetShapeDim( aSubShape.ShapeType() ) > (int)aDim ) if ( aShapesId && GetShapeDim( aSubShape.ShapeType() ) > (int)aDim )
continue; continue;
SMESH_HypoFilter filter( SMESH_HypoFilter::IsAlgo() ); SMESH_HypoFilter filter( SMESH_HypoFilter::IsAlgo() );
filter filter
.And( SMESH_HypoFilter::IsApplicableTo( aSubShape )) .And( SMESH_HypoFilter::IsApplicableTo( aSubShape ))
@ -267,14 +267,14 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
for ( subIt = smWithAlgoSupportingSubmeshes.rbegin(); subIt != subEnd; ++subIt ) for ( subIt = smWithAlgoSupportingSubmeshes.rbegin(); subIt != subEnd; ++subIt )
if ( sm->GetComputeState() == SMESH_subMesh::READY_TO_COMPUTE) if ( sm->GetComputeState() == SMESH_subMesh::READY_TO_COMPUTE)
{ {
const TopAbs_ShapeEnum aShType = sm->GetSubShape().ShapeType(); const TopAbs_ShapeEnum aShType = sm->GetSubShape().ShapeType();
// check for preview dimension limitations // check for preview dimension limitations
if ( aShapesId && GetShapeDim( aShType ) > (int)aDim ) if ( aShapesId && GetShapeDim( aShType ) > (int)aDim )
continue; continue;
sm->ComputeStateEngine( SMESH_subMesh::COMPUTE ); sm->ComputeStateEngine( SMESH_subMesh::COMPUTE );
if ( aShapesId ) if ( aShapesId )
aShapesId->insert( sm->GetId() ); aShapesId->insert( sm->GetId() );
} }
// ----------------------------------------------- // -----------------------------------------------
@ -297,8 +297,8 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
bool SMESH_Gen::Evaluate(SMESH_Mesh & aMesh, bool SMESH_Gen::Evaluate(SMESH_Mesh & aMesh,
const TopoDS_Shape & aShape, const TopoDS_Shape & aShape,
MapShapeNbElems& aResMap, MapShapeNbElems& aResMap,
const bool anUpward, const bool anUpward,
TSetOfInt* aShapesId) TSetOfInt* aShapesId)
{ {
MESSAGE("SMESH_Gen::Evaluate"); MESSAGE("SMESH_Gen::Evaluate");
@ -323,14 +323,14 @@ bool SMESH_Gen::Evaluate(SMESH_Mesh & aMesh,
//if ( !aMesh.HasShapeToMesh() && aShType == TopAbs_VERTEX ) //if ( !aMesh.HasShapeToMesh() && aShType == TopAbs_VERTEX )
// continue; // continue;
if ( !aMesh.HasShapeToMesh() ) { if ( !aMesh.HasShapeToMesh() ) {
if( aShType == TopAbs_VERTEX || aShType == TopAbs_WIRE || if( aShType == TopAbs_VERTEX || aShType == TopAbs_WIRE ||
aShType == TopAbs_SHELL ) aShType == TopAbs_SHELL )
continue; continue;
} }
smToCompute->Evaluate(aResMap); smToCompute->Evaluate(aResMap);
if( aShapesId ) if( aShapesId )
aShapesId->insert( smToCompute->GetId() ); aShapesId->insert( smToCompute->GetId() );
} }
return ret; return ret;
} }
@ -352,12 +352,12 @@ bool SMESH_Gen::Evaluate(SMESH_Mesh & aMesh,
if ( algo && !algo->NeedDescretBoundary() ) { if ( algo && !algo->NeedDescretBoundary() ) {
if ( algo->SupportSubmeshes() ) { if ( algo->SupportSubmeshes() ) {
smWithAlgoSupportingSubmeshes.push_back( smToCompute ); smWithAlgoSupportingSubmeshes.push_back( smToCompute );
} }
else { else {
smToCompute->Evaluate(aResMap); smToCompute->Evaluate(aResMap);
if ( aShapesId ) if ( aShapesId )
aShapesId->insert( smToCompute->GetId() ); aShapesId->insert( smToCompute->GetId() );
} }
} }
} }
// ------------------------------------------------------------ // ------------------------------------------------------------
@ -382,10 +382,10 @@ bool SMESH_Gen::Evaluate(SMESH_Mesh & aMesh,
SMESH_subMesh* smToCompute = smIt->next(); SMESH_subMesh* smToCompute = smIt->next();
const TopoDS_Shape& aSubShape = smToCompute->GetSubShape(); const TopoDS_Shape& aSubShape = smToCompute->GetSubShape();
const int aShapeDim = GetShapeDim( aSubShape ); const int aShapeDim = GetShapeDim( aSubShape );
if ( aShapeDim < 1 ) continue; if ( aShapeDim < 1 ) continue;
//const TopAbs_ShapeEnum aShType = smToCompute->GetSubShape().ShapeType(); //const TopAbs_ShapeEnum aShType = smToCompute->GetSubShape().ShapeType();
SMESH_HypoFilter filter( SMESH_HypoFilter::IsAlgo() ); SMESH_HypoFilter filter( SMESH_HypoFilter::IsAlgo() );
filter filter
@ -406,7 +406,7 @@ bool SMESH_Gen::Evaluate(SMESH_Mesh & aMesh,
for ( subIt = smWithAlgoSupportingSubmeshes.rbegin(); subIt != subEnd; ++subIt ) { for ( subIt = smWithAlgoSupportingSubmeshes.rbegin(); subIt != subEnd; ++subIt ) {
sm->Evaluate(aResMap); sm->Evaluate(aResMap);
if ( aShapesId ) if ( aShapesId )
aShapesId->insert( sm->GetId() ); aShapesId->insert( sm->GetId() );
} }
// ----------------------------------------------- // -----------------------------------------------
@ -493,7 +493,7 @@ static bool checkConformIgnoredAlgos(SMESH_Mesh& aMesh,
checkConformIgnoredAlgos (aMesh, (*revItSub).second, aGlobIgnoAlgo, checkConformIgnoredAlgos (aMesh, (*revItSub).second, aGlobIgnoAlgo,
algo, checkConform2, aCheckedMap, theErrors); algo, checkConform2, aCheckedMap, theErrors);
int key = (*revItSub).first; int key = (*revItSub).first;
SMESH_subMesh* sm = (*revItSub).second; SMESH_subMesh* sm = (*revItSub).second;
if ( aCheckedMap.find( key ) == aCheckedMap.end() ) if ( aCheckedMap.find( key ) == aCheckedMap.end() )
{ {
aCheckedMap[ key ] = sm; aCheckedMap[ key ] = sm;
@ -823,16 +823,16 @@ SMESH_Algo *SMESH_Gen::GetAlgo(SMESH_Mesh & aMesh,
StudyContextStruct *SMESH_Gen::GetStudyContext(int studyId) 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()) if (_mapStudyContext.find(studyId) == _mapStudyContext.end())
{ {
_mapStudyContext[studyId] = new StudyContextStruct; _mapStudyContext[studyId] = new StudyContextStruct;
_mapStudyContext[studyId]->myDocument = new SMESHDS_Document(studyId); _mapStudyContext[studyId]->myDocument = new SMESHDS_Document(studyId);
} }
StudyContextStruct *myStudyContext = _mapStudyContext[studyId]; StudyContextStruct *myStudyContext = _mapStudyContext[studyId];
// ASSERT(_mapStudyContext.find(studyId) != _mapStudyContext.end()); // ASSERT(_mapStudyContext.find(studyId) != _mapStudyContext.end());
return myStudyContext; return myStudyContext;
} }
// //============================================================================= // //=============================================================================
@ -897,6 +897,6 @@ int SMESH_Gen::GetShapeDim(const TopAbs_ShapeEnum & aShapeType)
int SMESH_Gen::GetANewId() int SMESH_Gen::GetANewId()
{ {
//MESSAGE("SMESH_Gen::GetANewId"); //MESSAGE("SMESH_Gen::GetANewId");
return _hypId++; return _hypId++;
} }