#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <TopExp.hxx>
-#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
-#include <TopTools_ListOfShape.hxx>
-#include <TopTools_MapOfShape.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Compound.hxx>
#include <gp_Pnt.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopoDS_Iterator.hxx>
#include <Standard_OutOfMemory.hxx>
#include <Standard_ErrorHandler.hxx>
case TopAbs_SOLID:
{
//MESSAGE("solid");
- for (TopExp_Explorer exp(_subShape, TopAbs_FACE); exp.More();
- exp.Next())
- {
- InsertDependence(exp.Current());
+ if(_father->HasShapeToMesh()) {
+ for (TopExp_Explorer exp(_subShape, TopAbs_FACE); exp.More();
+ exp.Next())
+ {
+ InsertDependence(exp.Current());
+ }
}
break;
}
bool SMESH_subMesh::CanAddHypothesis(const SMESH_Hypothesis* theHypothesis) const
{
int aHypDim = theHypothesis->GetDim();
- int aShapeDim = SMESH_Gen::GetShapeDim(_subShape);
- if ( aHypDim <= aShapeDim )
- return true;
+ if(_father->HasShapeToMesh()) {
+ int aShapeDim = SMESH_Gen::GetShapeDim(_subShape);
+ if ( aHypDim <= aShapeDim )
+ return true;
+ }
+ else
+ //Only 3D hypothesis may be assigned to the mesh w/o geometry
+ return aHypDim == 3;
// if ( aHypDim < aShapeDim )
// return ( _father->IsMainShape( _subShape ));
// check if a shape needed by algo is present
// -------------------------------------------
algo = static_cast< SMESH_Algo* >( anHyp );
- if ( !_father->HasShapeToMesh() && algo->NeedShape() )
- return SMESH_Hypothesis::HYP_BAD_GEOMETRY;
+ if(_father->GetShapeToMesh() != SMESH_Mesh::PseudoShape())
+ if ( !_father->HasShapeToMesh() && algo->NeedShape() )
+ return SMESH_Hypothesis::HYP_BAD_GEOMETRY;
// ----------------------
// check mesh conformity
// ----------------------
if ( ! CanAddHypothesis( anHyp )) // check dimension
return SMESH_Hypothesis::HYP_BAD_DIM;
+ if(anHyp->GetDim() == 3 && !_father->HasShapeToMesh()
+ && event == ADD_ALGO) {
+ //Only NETGEN_3D and GHS3D_3D can be assigned to the Mesh w/o geometryy
+ bool isNetgen3D = (strcmp( "NETGEN_3D", anHyp->GetName()) == 0);
+ bool isGhs3d = (strcmp( "GHS3D_3D", anHyp->GetName()) == 0);
+ if( !isNetgen3D && !isGhs3d)
+ return SMESH_Hypothesis::HYP_BAD_DIM;
+ }
+
+
+
if ( /*!anHyp->IsAuxiliary() &&*/ GetSimilarAttached( _subShape, anHyp ) )
return SMESH_Hypothesis::HYP_ALREADY_EXIST;
if ( stateChange && oldAlgoState == HYP_OK ) { // hyp becomes KO
DeleteOwnListeners();
+ SetIsAlwaysComputed( false );
if (_subShape.ShapeType() == TopAbs_VERTEX ) {
// restore default states
_algoState = HYP_OK;
}
}
// compute
- CleanDependants();
- RemoveSubMeshElementsAndNodes();
+// CleanDependants(); for "UseExisting_*D" algos
+// RemoveSubMeshElementsAndNodes();
ret = false;
_computeState = FAILED_TO_COMPUTE;
_computeError = SMESH_ComputeError::New(COMPERR_OK,"",algo);
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
OCC_CATCH_SIGNALS;
#endif
- MemoryReserve aMemoryReserve;
algo->InitComputeError();
+ MemoryReserve aMemoryReserve;
+ SMDS_Mesh::CheckMemory();
if ( !_father->HasShapeToMesh() ) // no shape
{
SMESH_MesherHelper helper( *_father );
_computeError = algo->GetComputeError();
}
catch ( std::bad_alloc& exc ) {
- printf("std::bad_alloc\n");
+ printf("std::bad_alloc thrown inside algo->Compute()\n");
if ( _computeError ) {
_computeError->myName = COMPERR_MEMORY_PB;
//_computeError->myComment = exc.what();
throw exc;
}
catch ( Standard_OutOfMemory& exc ) {
- printf("Standard_OutOfMemory\n");
+ printf("Standard_OutOfMemory thrown inside algo->Compute()\n");
if ( _computeError ) {
_computeError->myName = COMPERR_MEMORY_PB;
//_computeError->myComment = exc.what();
if (ret)
{
_computeError.reset();
- //UpdateDependantsState( SUBMESH_COMPUTED ); // send event SUBMESH_COMPUTED
}
UpdateDependantsState( SUBMESH_COMPUTED ); // send event SUBMESH_COMPUTED
}
noErrors = false;
}
}
- if ( !theAlgo->OnlyUnaryInput() && !theShape.IsNull() &&
- theShape.ShapeType() == TopAbs_COMPOUND )
- {
- for (TopoDS_Iterator subIt( theShape ); subIt.More(); subIt.Next()) {
- SMESH_subMesh* sm = _father->GetSubMesh( subIt.Value() );
- if ( sm != this && !sm->CheckComputeError( theAlgo ))
- noErrors = false;
- }
- }
return noErrors;
}
map< EventListener*, EventListenerData* >::iterator l_d =
myEventListeners.find( listener );
if ( l_d != myEventListeners.end() ) {
- if ( l_d->second && l_d->second->IsDeletable() )
- delete l_d->second;
+ EventListenerData* curData = l_d->second;
+ if ( curData && curData != data && curData->IsDeletable() )
+ delete curData;
l_d->second = data;
}
else
eventType == SMESH_subMesh::COMPUTE_EVENT)
{
ASSERT( data->mySubMeshes.front() != subMesh );
+ list<SMESH_subMesh*>::iterator smIt = data->mySubMeshes.begin();
+ list<SMESH_subMesh*>::iterator smEnd = data->mySubMeshes.end();
switch ( event ) {
case SMESH_subMesh::CLEAN:
- data->mySubMeshes.front()->ComputeStateEngine( event );
+ for ( ; smIt != smEnd; ++ smIt)
+ (*smIt)->ComputeStateEngine( event );
break;
case SMESH_subMesh::COMPUTE:
if ( subMesh->GetComputeState() == SMESH_subMesh::COMPUTE_OK )
- data->mySubMeshes.front()->ComputeStateEngine( SMESH_subMesh::SUBMESH_COMPUTED );
+ for ( ; smIt != smEnd; ++ smIt)
+ (*smIt)->ComputeStateEngine( SMESH_subMesh::SUBMESH_COMPUTED );
break;
default:;
}