本文整理汇总了C++中SMESH_subMesh::GetId方法的典型用法代码示例。如果您正苦于以下问题:C++ SMESH_subMesh::GetId方法的具体用法?C++ SMESH_subMesh::GetId怎么用?C++ SMESH_subMesh::GetId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SMESH_subMesh
的用法示例。
在下文中一共展示了SMESH_subMesh::GetId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Evaluate
bool SMESH_Gen::Evaluate(SMESH_Mesh & aMesh,
const TopoDS_Shape & aShape,
MapShapeNbElems& aResMap,
const bool anUpward,
TSetOfInt* aShapesId)
{
MESSAGE("SMESH_Gen::Evaluate");
bool ret = true;
SMESH_subMesh *sm = aMesh.GetSubMesh(aShape);
const bool includeSelf = true;
const bool complexShapeFirst = true;
SMESH_subMeshIteratorPtr smIt;
if ( anUpward ) { // is called from below code here
// -----------------------------------------------
// mesh all the sub-shapes starting from vertices
// -----------------------------------------------
smIt = sm->getDependsOnIterator(includeSelf, !complexShapeFirst);
while ( smIt->more() ) {
SMESH_subMesh* smToCompute = smIt->next();
// do not mesh vertices of a pseudo shape
const TopAbs_ShapeEnum shapeType = smToCompute->GetSubShape().ShapeType();
//if ( !aMesh.HasShapeToMesh() && shapeType == TopAbs_VERTEX )
// continue;
if ( !aMesh.HasShapeToMesh() ) {
if( shapeType == TopAbs_VERTEX || shapeType == TopAbs_WIRE ||
shapeType == TopAbs_SHELL )
continue;
}
smToCompute->Evaluate(aResMap);
if( aShapesId )
aShapesId->insert( smToCompute->GetId() );
}
return ret;
}
else {
// -----------------------------------------------------------------
// apply algos that DO NOT require Discreteized boundaries and DO NOT
// support sub-meshes, starting from the most complex shapes
// and collect sub-meshes with algos that DO support sub-meshes
// -----------------------------------------------------------------
list< SMESH_subMesh* > smWithAlgoSupportingSubmeshes;
smIt = sm->getDependsOnIterator(includeSelf, complexShapeFirst);
while ( smIt->more() ) {
SMESH_subMesh* smToCompute = smIt->next();
const TopoDS_Shape& aSubShape = smToCompute->GetSubShape();
const int aShapeDim = GetShapeDim( aSubShape );
if ( aShapeDim < 1 ) break;
SMESH_Algo* algo = GetAlgo( smToCompute );
if ( algo && !algo->NeedDiscreteBoundary() ) {
if ( algo->SupportSubmeshes() ) {
smWithAlgoSupportingSubmeshes.push_front( smToCompute );
}
else {
smToCompute->Evaluate(aResMap);
if ( aShapesId )
aShapesId->insert( smToCompute->GetId() );
}
}
}
// ------------------------------------------------------------
// sort list of meshes according to mesh order
// ------------------------------------------------------------
std::vector< SMESH_subMesh* > smVec( smWithAlgoSupportingSubmeshes.begin(),
smWithAlgoSupportingSubmeshes.end() );
aMesh.SortByMeshOrder( smVec );
// ------------------------------------------------------------
// compute sub-meshes under shapes with algos that DO NOT require
// Discreteized boundaries and DO support sub-meshes
// ------------------------------------------------------------
// start from lower shapes
for ( size_t i = 0; i < smVec.size(); ++i )
{
sm = smVec[i];
// get a shape the algo is assigned to
TopoDS_Shape algoShape;
if ( !GetAlgo( sm, & algoShape ))
continue; // strange...
// look for more local algos
smIt = sm->getDependsOnIterator(!includeSelf, !complexShapeFirst);
while ( smIt->more() ) {
SMESH_subMesh* smToCompute = smIt->next();
const TopoDS_Shape& aSubShape = smToCompute->GetSubShape();
const int aShapeDim = GetShapeDim( aSubShape );
if ( aShapeDim < 1 ) continue;
SMESH_HypoFilter filter( SMESH_HypoFilter::IsAlgo() );
filter
.And( SMESH_HypoFilter::IsApplicableTo( aSubShape ))
//.........这里部分代码省略.........
示例2: Compute
bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
const TopoDS_Shape & aShape,
const bool aShapeOnly /*=false*/,
const bool anUpward /*=false*/,
const ::MeshDimension aDim /*=::MeshDim_3D*/,
TSetOfInt* aShapesId /*=0*/)
{
MESSAGE("SMESH_Gen::Compute");
MEMOSTAT;
bool ret = true;
SMESH_subMesh *sm = aMesh.GetSubMesh(aShape);
const bool includeSelf = true;
const bool complexShapeFirst = true;
const int globalAlgoDim = 100;
SMESH_subMeshIteratorPtr smIt;
// Fix of Issue 22150. Due to !BLSURF->OnlyUnaryInput(), BLSURF computes edges
// that must be computed by Projection 1D-2D when Projection asks to compute
// one face only.
SMESH_subMesh::compute_event computeEvent =
aShapeOnly ? SMESH_subMesh::COMPUTE_SUBMESH : SMESH_subMesh::COMPUTE;
if ( anUpward ) // is called from the below code in this method
{
// ===============================================
// Mesh all the sub-shapes starting from vertices
// ===============================================
smIt = sm->getDependsOnIterator(includeSelf, !complexShapeFirst);
while ( smIt->more() )
{
SMESH_subMesh* smToCompute = smIt->next();
// do not mesh vertices of a pseudo shape
const TopoDS_Shape& shape = smToCompute->GetSubShape();
const TopAbs_ShapeEnum shapeType = shape.ShapeType();
if ( !aMesh.HasShapeToMesh() && shapeType == TopAbs_VERTEX )
continue;
// check for preview dimension limitations
if ( aShapesId && GetShapeDim( shapeType ) > (int)aDim )
{
// clear compute state not to show previous compute errors
// if preview invoked less dimension less than previous
smToCompute->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE );
continue;
}
if (smToCompute->GetComputeState() == SMESH_subMesh::READY_TO_COMPUTE)
{
if (_compute_canceled)
return false;
setCurrentSubMesh( smToCompute );
smToCompute->ComputeStateEngine( computeEvent );
setCurrentSubMesh( NULL );
}
// we check all the sub-meshes here and detect if any of them failed to compute
if (smToCompute->GetComputeState() == SMESH_subMesh::FAILED_TO_COMPUTE &&
( shapeType != TopAbs_EDGE || !SMESH_Algo::isDegenerated( TopoDS::Edge( shape ))))
ret = false;
else if ( aShapesId )
aShapesId->insert( smToCompute->GetId() );
}
//aMesh.GetMeshDS()->Modified();
return ret;
}
else
{
// ================================================================
// Apply algos that do NOT require discreteized boundaries
// ("all-dimensional") and do NOT support sub-meshes, starting from
// the most complex shapes and collect sub-meshes with algos that
// DO support sub-meshes
// ================================================================
list< SMESH_subMesh* > smWithAlgoSupportingSubmeshes[4]; // for each dim
// map to sort sm with same dim algos according to dim of
// the shape the algo assigned to (issue 0021217).
// Other issues influenced the algo applying order:
// 21406, 21556, 21893, 20206
multimap< int, SMESH_subMesh* > shDim2sm;
multimap< int, SMESH_subMesh* >::reverse_iterator shDim2smIt;
TopoDS_Shape algoShape;
int prevShapeDim = -1, aShapeDim;
smIt = sm->getDependsOnIterator(includeSelf, complexShapeFirst);
while ( smIt->more() )
{
SMESH_subMesh* smToCompute = smIt->next();
if ( smToCompute->GetComputeState() != SMESH_subMesh::READY_TO_COMPUTE )
continue;
const TopoDS_Shape& aSubShape = smToCompute->GetSubShape();
aShapeDim = GetShapeDim( aSubShape );
//.........这里部分代码省略.........