本文整理汇总了C++中SMESHDS_Mesh::RemoveNode方法的典型用法代码示例。如果您正苦于以下问题:C++ SMESHDS_Mesh::RemoveNode方法的具体用法?C++ SMESHDS_Mesh::RemoveNode怎么用?C++ SMESHDS_Mesh::RemoveNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SMESHDS_Mesh
的用法示例。
在下文中一共展示了SMESHDS_Mesh::RemoveNode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: error
bool StdMeshers_CompositeSegment_1D::Compute(SMESH_Mesh & aMesh,
const TopoDS_Shape & aShape)
{
TopoDS_Edge edge = TopoDS::Edge( aShape );
SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
// Get edges to be discretized as a whole
TopoDS_Face nullFace;
auto_ptr< StdMeshers_FaceSide > side( GetFaceSide(aMesh, edge, nullFace, true ));
//side->dump("IN COMPOSITE SEG");
if ( side->NbEdges() < 2 )
return StdMeshers_Regular_1D::Compute( aMesh, aShape );
// update segment lenght computed by StdMeshers_AutomaticLength
const list <const SMESHDS_Hypothesis * > & hyps = GetUsedHypothesis(aMesh, aShape);
if ( !hyps.empty() ) {
StdMeshers_AutomaticLength * autoLenHyp = const_cast<StdMeshers_AutomaticLength *>
(dynamic_cast <const StdMeshers_AutomaticLength * >(hyps.front()));
if ( autoLenHyp )
_value[ BEG_LENGTH_IND ]= autoLenHyp->GetLength( &aMesh, side->Length() );
}
// Compute node parameters
auto_ptr< BRepAdaptor_CompCurve > C3d ( side->GetCurve3d() );
double f = C3d->FirstParameter(), l = C3d->LastParameter();
list< double > params;
if ( !computeInternalParameters ( aMesh, *C3d, side->Length(), f, l, params, false ))
return false;
// Redistribute parameters near ends
TopoDS_Vertex VFirst = side->FirstVertex();
TopoDS_Vertex VLast = side->LastVertex();
redistributeNearVertices( aMesh, *C3d, side->Length(), params, VFirst, VLast );
params.push_front(f);
params.push_back(l);
int nbNodes = params.size();
// Create mesh
const SMDS_MeshNode * nFirst = SMESH_Algo::VertexNode( VFirst, meshDS );
const SMDS_MeshNode * nLast = SMESH_Algo::VertexNode( VLast, meshDS );
if (!nFirst)
return error(COMPERR_BAD_INPUT_MESH, TComm("No node on vertex ")
<<meshDS->ShapeToIndex(VFirst));
if (!nLast)
return error(COMPERR_BAD_INPUT_MESH, TComm("No node on vertex ")
<<meshDS->ShapeToIndex(VLast));
vector<const SMDS_MeshNode*> nodes( nbNodes, (const SMDS_MeshNode*)0 );
nodes.front() = nFirst;
nodes.back() = nLast;
// create internal nodes
list< double >::iterator parIt = params.begin();
double prevPar = *parIt;
Standard_Real u;
for ( int iN = 0; parIt != params.end(); ++iN, ++parIt)
{
if ( !nodes[ iN ] ) {
gp_Pnt p = C3d->Value( *parIt );
SMDS_MeshNode* n = meshDS->AddNode( p.X(), p.Y(), p.Z());
C3d->Edge( *parIt, edge, u );
meshDS->SetNodeOnEdge( n, edge, u );
// cout << "new NODE: par="<<*parIt<<" ePar="<<u<<" e="<<edge.TShape().operator->()
// << " " << n << endl;
nodes[ iN ] = n;
}
// create edges
if ( iN ) {
double mPar = ( prevPar + *parIt )/2;
if ( _quadraticMesh ) {
// create medium node
double segLen = GCPnts_AbscissaPoint::Length(*C3d, prevPar, *parIt);
GCPnts_AbscissaPoint ruler( *C3d, segLen/2., prevPar );
if ( ruler.IsDone() )
mPar = ruler.Parameter();
gp_Pnt p = C3d->Value( mPar );
SMDS_MeshNode* n = meshDS->AddNode( p.X(), p.Y(), p.Z());
//cout << "new NODE "<< n << endl;
meshDS->SetNodeOnEdge( n, edge, u );
SMDS_MeshEdge * seg = meshDS->AddEdge(nodes[ iN-1 ], nodes[ iN ], n);
meshDS->SetMeshElementOnShape(seg, edge);
}
else {
C3d->Edge( mPar, edge, u );
SMDS_MeshEdge * seg = meshDS->AddEdge(nodes[ iN-1 ], nodes[ iN ]);
meshDS->SetMeshElementOnShape(seg, edge);
}
}
prevPar = *parIt;
}
// remove nodes on internal vertices
for ( int iE = 1; iE < side->NbEdges(); ++iE )
{
TopoDS_Vertex V = side->FirstVertex( iE );
while ( const SMDS_MeshNode * n = SMESH_Algo::VertexNode( V, meshDS ))
meshDS->RemoveNode( n );
//.........这里部分代码省略.........