*/
//=============================================================================
-bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
- const TopoDS_Shape & aShape,
- const bool anUpward)
+bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
+ const TopoDS_Shape & aShape,
+ const bool anUpward,
+ const ::MeshDimension aDim,
+ TSetOfInt* aShapesId)
{
MESSAGE("SMESH_Gen::Compute");
SMESH_subMesh* smToCompute = smIt->next();
// do not mesh vertices of a pseudo shape
- if ( !aMesh.HasShapeToMesh() &&
- smToCompute->GetSubShape().ShapeType() == TopAbs_VERTEX )
+ const TopAbs_ShapeEnum aShType = smToCompute->GetSubShape().ShapeType();
+ if ( !aMesh.HasShapeToMesh() && aShType == TopAbs_VERTEX )
continue;
+ // check for preview dimension limitations
+ if ( aShapesId && GetShapeDim( aShType ) > (int)aDim )
+ continue;
+
if (smToCompute->GetComputeState() == SMESH_subMesh::READY_TO_COMPUTE)
smToCompute->ComputeStateEngine( SMESH_subMesh::COMPUTE );
// we check all the submeshes here and detect if any of them failed to compute
if (smToCompute->GetComputeState() == SMESH_subMesh::FAILED_TO_COMPUTE)
ret = false;
+ else if ( aShapesId )
+ aShapesId->insert( smToCompute->GetId() );
}
return ret;
}
continue;
const TopoDS_Shape& aSubShape = smToCompute->GetSubShape();
- if ( GetShapeDim( aSubShape ) < 1 ) break;
+ const int aShapeDim = GetShapeDim( aSubShape );
+ if ( aShapeDim < 1 ) break;
+
+ // check for preview dimension limitations
+ if ( aShapesId && aShapeDim > (int)aDim )
+ continue;
SMESH_Algo* algo = GetAlgo( aMesh, aSubShape );
if ( algo && !algo->NeedDescretBoundary() )
if ( algo->SupportSubmeshes() )
smWithAlgoSupportingSubmeshes.push_back( smToCompute );
else
+ {
smToCompute->ComputeStateEngine( SMESH_subMesh::COMPUTE );
+ if ( aShapesId )
+ aShapesId->insert( smToCompute->GetId() );
+ }
}
}
// ------------------------------------------------------------
SMESH_subMesh* smToCompute = smIt->next();
const TopoDS_Shape& aSubShape = smToCompute->GetSubShape();
- if ( aSubShape.ShapeType() == TopAbs_VERTEX ) continue;
-
+ const int aShapeDim = GetShapeDim( aSubShape );
+ //if ( aSubShape.ShapeType() == TopAbs_VERTEX ) continue;
+ if ( aShapeDim < 1 ) continue;
+
+ // check for preview dimension limitations
+ if ( aShapesId && GetShapeDim( aSubShape.ShapeType() ) > (int)aDim )
+ continue;
+
SMESH_HypoFilter filter( SMESH_HypoFilter::IsAlgo() );
filter
.And( SMESH_HypoFilter::IsApplicableTo( aSubShape ))
SMESH_Hypothesis::Hypothesis_Status status;
if ( subAlgo->CheckHypothesis( aMesh, aSubShape, status ))
// mesh a lower smToCompute starting from vertices
- Compute( aMesh, aSubShape, /*anUpward=*/true );
+ Compute( aMesh, aSubShape, /*anUpward=*/true, aDim, aShapesId );
}
}
}
// ----------------------------------------------------------
for ( subIt = smWithAlgoSupportingSubmeshes.rbegin(); subIt != subEnd; ++subIt )
if ( sm->GetComputeState() == SMESH_subMesh::READY_TO_COMPUTE)
+ {
+ const TopAbs_ShapeEnum aShType = sm->GetSubShape().ShapeType();
+ // check for preview dimension limitations
+ if ( aShapesId && GetShapeDim( aShType ) > (int)aDim )
+ continue;
+
sm->ComputeStateEngine( SMESH_subMesh::COMPUTE );
+ if ( aShapesId )
+ aShapesId->insert( sm->GetId() );
+ }
// -----------------------------------------------
// mesh the rest subshapes starting from vertices
// -----------------------------------------------
- ret = Compute( aMesh, aShape, /*anUpward=*/true );
+ ret = Compute( aMesh, aShape, /*anUpward=*/true, aDim, aShapesId );
}
MESSAGE( "VSR - SMESH_Gen::Compute() finished, OK = " << ret);
if ( dim.empty() )
{
dim.resize( TopAbs_SHAPE, -1 );
- dim[ TopAbs_COMPOUND ] = 3;
- dim[ TopAbs_COMPSOLID ] = 3;
- dim[ TopAbs_SOLID ] = 3;
- dim[ TopAbs_SHELL ] = 3;
- dim[ TopAbs_FACE ] = 2;
- dim[ TopAbs_WIRE ] = 1;
- dim[ TopAbs_EDGE ] = 1;
- dim[ TopAbs_VERTEX ] = 0;
+ dim[ TopAbs_COMPOUND ] = MeshDim_3D;
+ dim[ TopAbs_COMPSOLID ] = MeshDim_3D;
+ dim[ TopAbs_SOLID ] = MeshDim_3D;
+ dim[ TopAbs_SHELL ] = MeshDim_3D;
+ dim[ TopAbs_FACE ] = MeshDim_2D;
+ dim[ TopAbs_WIRE ] = MeshDim_1D;
+ dim[ TopAbs_EDGE ] = MeshDim_1D;
+ dim[ TopAbs_VERTEX ] = MeshDim_0D;
}
return dim[ aShapeType ];
}