Wrapper of a composite or an ordinary edge. More...
Public Member Functions | |
| _FaceSide (const _FaceSide &other) | |
| _FaceSide (const TopoDS_Edge &edge=TopoDS_Edge()) | |
| Construct a face side of one edge. | |
| _FaceSide (const list< TopoDS_Edge > &edges) | |
| Construct a face side of several edges. | |
| _FaceSide * | GetSide (const int i) |
| const _FaceSide * | GetSide (const int i) const |
| int | size () |
| int | NbVertices () const |
| TopoDS_Vertex | FirstVertex () const |
| TopoDS_Vertex | LastVertex () const |
| TopoDS_Vertex | Vertex (int i) const |
| bool | Contain (const _FaceSide &side, int *which=0) const |
| bool | Contain (const TopoDS_Vertex &vertex) const |
| void | AppendSide (const _FaceSide &side) |
| void | SetBottomSide (int i) |
| int | GetNbSegments (SMESH_Mesh &mesh) const |
| bool | StoreNodes (SMESH_Mesh &mesh, vector< const SMDS_MeshNode * > &myGrid, bool reverse) |
| void | SetID (EQuadSides id) |
| void | Dump () const |
Static Public Member Functions | |
| static const TopoDS_TShape * | ptr (const TopoDS_Shape &theShape) |
Private Attributes | |
| TopoDS_Edge | myEdge |
| list< _FaceSide > | myChildren |
| int | myNbChildren |
| TopTools_MapOfShape | myVertices |
| EQuadSides | myID |
Wrapper of a composite or an ordinary edge.
Definition at line 99 of file StdMeshers_CompositeHexa_3D.cxx.
| _FaceSide::_FaceSide | ( | const _FaceSide & | other | ) |
Definition at line 1421 of file StdMeshers_CompositeHexa_3D.cxx.
References myChildren, myEdge, myID, myNbChildren, and myVertices.
Referenced by _FaceSide().
{
myEdge = other.myEdge;
myChildren = other.myChildren;
myNbChildren = other.myNbChildren;
myVertices.Assign( other.myVertices );
myID = other.myID;
}
| _FaceSide::_FaceSide | ( | const TopoDS_Edge & | edge = TopoDS_Edge() | ) |
Construct a face side of one edge.
Definition at line 1436 of file StdMeshers_CompositeHexa_3D.cxx.
References myVertices.
: myEdge( edge ), myNbChildren(0) { if ( !edge.IsNull() ) for ( TopExp_Explorer exp( edge, TopAbs_VERTEX ); exp.More(); exp.Next() ) //myVertices.insert( ptr ( exp.Current() )); myVertices.Add( exp.Current() ); }
| _FaceSide::_FaceSide | ( | const list< TopoDS_Edge > & | edges | ) |
Construct a face side of several edges.
Definition at line 1451 of file StdMeshers_CompositeHexa_3D.cxx.
References _FaceSide(), SMESH_test.edge, myChildren, myNbChildren, myVertices, and Q_CHILD.
: myNbChildren(0) { list<TopoDS_Edge>::const_iterator edge = edges.begin(), eEnd = edges.end(); for ( ; edge != eEnd; ++edge ) { myChildren.push_back( _FaceSide( *edge )); myNbChildren++; // myVertices.insert( myChildren.back().myVertices.begin(), // myChildren.back().myVertices.end() ); myVertices.Add( myChildren.back().FirstVertex() ); myVertices.Add( myChildren.back().LastVertex() ); myChildren.back().SetID( Q_CHILD ); // not to splice them } }
| void _FaceSide::AppendSide | ( | const _FaceSide & | side | ) |
Definition at line 1594 of file StdMeshers_CompositeHexa_3D.cxx.
References myChildren, myEdge, myID, myNbChildren, myVertices, and Q_PARENT.
Referenced by _QuadFaceGrid.AddContinuousFace(), and _QuadFaceGrid.Init().
{
if ( !myEdge.IsNull() )
{
myChildren.push_back( *this );
myNbChildren = 1;
myEdge.Nullify();
}
myChildren.push_back( side );
myNbChildren++;
//myVertices.insert( side.myVertices.begin(), side.myVertices.end() );
TopTools_MapIteratorOfMapOfShape vIt ( side.myVertices );
for ( ; vIt.More(); vIt.Next() )
myVertices.Add( vIt.Key() );
myID = Q_PARENT;
myChildren.back().SetID( EQuadSides( myNbChildren-1 ));
}
Definition at line 1553 of file StdMeshers_CompositeHexa_3D.cxx.
References myChildren, and myVertices.
Referenced by _QuadFaceGrid.AddContinuousFace(), _QuadFaceGrid.GetNormal(), and _QuadFaceGrid.SetBottomSide().
{
if ( !which || myChildren.empty() )
{
if ( which )
*which = 0;
int nbCommon = 0;
// set<const TopoDS_TShape*>::iterator v, vEnd = side.myVertices.end();
// for ( v = side.myVertices.begin(); v != vEnd; ++v )
// nbCommon += ( myVertices.find( *v ) != myVertices.end() );
TopTools_MapIteratorOfMapOfShape vIt ( side.myVertices );
for ( ; vIt.More(); vIt.Next() )
nbCommon += ( myVertices.Contains( vIt.Key() ));
return (nbCommon > 1);
}
list< _FaceSide >::const_iterator mySide = myChildren.begin(), sideEnd = myChildren.end();
for ( int i = 0; mySide != sideEnd; ++mySide, ++i ) {
if ( mySide->Contain( side )) {
*which = i;
return true;
}
}
return false;
}
| bool _FaceSide::Contain | ( | const TopoDS_Vertex & | vertex | ) | const |
Definition at line 1583 of file StdMeshers_CompositeHexa_3D.cxx.
References myVertices.
{
return myVertices.Contains( vertex );
// return myVertices.find( ptr( vertex )) != myVertices.end();
}
| void _FaceSide::Dump | ( | ) | const |
Definition at line 1712 of file StdMeshers_CompositeHexa_3D.cxx.
References FirstVertex(), LastVertex(), myChildren, myID, ptr(), Q_BOTTOM, and Q_PARENT.
Referenced by _QuadFaceGrid.DumpVertices().
{
if ( myChildren.empty() )
{
const char* sideNames[] = { "Q_BOTTOM", "Q_RIGHT", "Q_TOP", "Q_LEFT", "Q_CHILD", "Q_PARENT" };
if ( myID >= Q_BOTTOM && myID < Q_PARENT )
cout << sideNames[ myID ] << endl;
else
cout << "<UNDEFINED ID>" << endl;
TopoDS_Vertex f = FirstVertex();
TopoDS_Vertex l = LastVertex();
gp_Pnt pf = BRep_Tool::Pnt(f);
gp_Pnt pl = BRep_Tool::Pnt(l);
cout << "\t ( "<< ptr( f ) << " - " << ptr( l )<< " )"
<< "\t ( "<< pf.X()<<", "<<pf.Y()<<", "<<pf.Z()<<" ) - "
<< " ( "<< pl.X()<<", "<<pl.Y()<<", "<<pl.Z()<<" )"<<endl;
}
else
{
list< _FaceSide >::const_iterator side = myChildren.begin(), sideEnd = myChildren.end();
for ( ; side != sideEnd; ++side ) {
side->Dump();
cout << "\t";
}
}
}
| TopoDS_Vertex _FaceSide::FirstVertex | ( | ) | const |
Definition at line 1511 of file StdMeshers_CompositeHexa_3D.cxx.
References myChildren, and myEdge.
Referenced by _QuadFaceGrid.AddContinuousFace(), Dump(), _QuadFaceGrid.locateChildren(), _QuadFaceGrid.setBrothers(), and Vertex().
{
if ( myChildren.empty() )
return TopExp::FirstVertex( myEdge, Standard_True );
return myChildren.front().FirstVertex();
}
| int _FaceSide::GetNbSegments | ( | SMESH_Mesh & | mesh | ) | const |
Definition at line 1638 of file StdMeshers_CompositeHexa_3D.cxx.
References SMESH_Mesh.GetSubMesh(), SMESH_subMesh.GetSubMeshDS(), myChildren, myEdge, and SMESHDS_SubMesh.NbElements().
Referenced by _QuadFaceGrid.GetNbHoriSegments(), _QuadFaceGrid.GetNbVertSegments(), and _QuadFaceGrid.LoadGrid().
{
int nb = 0;
if ( myChildren.empty() )
{
nb = mesh.GetSubMesh(myEdge)->GetSubMeshDS()->NbElements();
}
else
{
list< _FaceSide >::const_iterator side = myChildren.begin(), sideEnd = myChildren.end();
for ( ; side != sideEnd; ++side )
nb += side->GetNbSegments(mesh);
}
return nb;
}
Definition at line 1471 of file StdMeshers_CompositeHexa_3D.cxx.
References myChildren, and myNbChildren.
Referenced by _QuadFaceGrid.AddContinuousFace(), _QuadFaceGrid.DumpVertices(), _QuadFaceGrid.GetNbHoriSegments(), _QuadFaceGrid.GetNbVertSegments(), GetSide(), _QuadFaceGrid.GetSide(), _QuadFaceGrid.Init(), _QuadFaceGrid.LoadGrid(), and Vertex().
{
if ( i >= myNbChildren )
return 0;
list< _FaceSide >::iterator side = myChildren.begin();
if ( i )
std::advance( side, i );
return & (*side);
}
Definition at line 1487 of file StdMeshers_CompositeHexa_3D.cxx.
References GetSide().
| TopoDS_Vertex _FaceSide::LastVertex | ( | ) | const |
Definition at line 1524 of file StdMeshers_CompositeHexa_3D.cxx.
References myChildren, and myEdge.
Referenced by _QuadFaceGrid.AddContinuousFace(), Dump(), _QuadFaceGrid.setBrothers(), and Vertex().
{
if ( myChildren.empty() )
return TopExp::LastVertex( myEdge, Standard_True );
return myChildren.back().LastVertex();
}
| int _FaceSide::NbVertices | ( | ) | const |
Definition at line 1497 of file StdMeshers_CompositeHexa_3D.cxx.
References myChildren, myNbChildren, and myVertices.
Referenced by _QuadFaceGrid.AddContinuousFace().
{
if ( myChildren.empty() )
return myVertices.Extent();
// return myVertices.size();
return myNbChildren + 1;
}
| static const TopoDS_TShape* _FaceSide.ptr | ( | const TopoDS_Shape & | theShape | ) | [static] |
Definition at line 119 of file StdMeshers_CompositeHexa_3D.cxx.
Referenced by Dump().
{ return theShape.TShape().operator->(); }
| void _FaceSide::SetBottomSide | ( | int | i | ) |
Definition at line 1618 of file StdMeshers_CompositeHexa_3D.cxx.
References myChildren, myID, and Q_PARENT.
Referenced by _QuadFaceGrid.SetBottomSide().
{
if ( i > 0 && myID == Q_PARENT ) {
list< _FaceSide >::iterator sideEnd, side = myChildren.begin();
std::advance( side, i );
myChildren.splice( myChildren.begin(), myChildren, side, myChildren.end() );
side = myChildren.begin(), sideEnd = myChildren.end();
for ( int i = 0; side != sideEnd; ++side, ++i ) {
side->SetID( EQuadSides(i) );
side->SetBottomSide(i);
}
}
}
| void _FaceSide.SetID | ( | EQuadSides | id | ) |
Definition at line 118 of file StdMeshers_CompositeHexa_3D.cxx.
References myID.
Referenced by _QuadFaceGrid.Init().
{ myID = id; }
| int _FaceSide.size | ( | ) |
Definition at line 107 of file StdMeshers_CompositeHexa_3D.cxx.
References myChildren.
Referenced by _QuadFaceGrid.Init().
{ return myChildren.size(); }
| bool _FaceSide::StoreNodes | ( | SMESH_Mesh & | mesh, |
| vector< const SMDS_MeshNode * > & | myGrid, | ||
| bool | reverse | ||
| ) |
Definition at line 1659 of file StdMeshers_CompositeHexa_3D.cxx.
References SMESH_test.edge, SMESH_Mesh.GetMeshDS(), SMESH_Algo.GetSortedNodesOnEdge(), myChildren, myEdge, and SMESH_AdvancedEditor.nodes.
Referenced by _QuadFaceGrid.LoadGrid().
{
list< TopoDS_Edge > edges;
if ( myChildren.empty() )
{
edges.push_back( myEdge );
}
else
{
list< _FaceSide >::const_iterator side = myChildren.begin(), sideEnd = myChildren.end();
for ( ; side != sideEnd; ++side )
if ( reverse )
edges.push_front( side->myEdge );
else
edges.push_back ( side->myEdge );
}
int nbNodes = 0;
list< TopoDS_Edge >::iterator edge = edges.begin(), eEnd = edges.end();
for ( ; edge != eEnd; ++edge )
{
map< double, const SMDS_MeshNode* > nodes;
bool ok = SMESH_Algo::GetSortedNodesOnEdge( mesh.GetMeshDS(),
*edge,
/*ignoreMediumNodes=*/true,
nodes);
if ( !ok ) return false;
bool forward = ( edge->Orientation() == TopAbs_FORWARD );
if ( reverse ) forward = !forward;
if ( forward )
{
map< double, const SMDS_MeshNode* >::iterator u_node, nEnd = nodes.end();
for ( u_node = nodes.begin(); u_node != nEnd; ++u_node )
myGrid[ nbNodes++ ] = u_node->second;
}
else
{
map< double, const SMDS_MeshNode* >::reverse_iterator u_node, nEnd = nodes.rend();
for ( u_node = nodes.rbegin(); u_node != nEnd; ++u_node )
myGrid[ nbNodes++ ] = u_node->second;
}
nbNodes--; // node on vertex present in two adjacent edges
}
return nbNodes > 0;
}
| TopoDS_Vertex _FaceSide::Vertex | ( | int | i | ) | const |
Definition at line 1537 of file StdMeshers_CompositeHexa_3D.cxx.
References FirstVertex(), GetSide(), LastVertex(), myChildren, and myNbChildren.
Referenced by _QuadFaceGrid.AddContinuousFace().
{
if ( myChildren.empty() )
return i ? LastVertex() : FirstVertex();
if ( i >= myNbChildren )
return myChildren.back().LastVertex();
return GetSide(i)->FirstVertex();
}
list< _FaceSide > _FaceSide.myChildren [private] |
Definition at line 127 of file StdMeshers_CompositeHexa_3D.cxx.
Referenced by _FaceSide(), AppendSide(), Contain(), Dump(), FirstVertex(), GetNbSegments(), GetSide(), LastVertex(), NbVertices(), SetBottomSide(), size(), StoreNodes(), and Vertex().
TopoDS_Edge _FaceSide.myEdge [private] |
Definition at line 126 of file StdMeshers_CompositeHexa_3D.cxx.
Referenced by _FaceSide(), AppendSide(), FirstVertex(), GetNbSegments(), LastVertex(), and StoreNodes().
EQuadSides _FaceSide.myID [private] |
Definition at line 133 of file StdMeshers_CompositeHexa_3D.cxx.
Referenced by _FaceSide(), AppendSide(), Dump(), SetBottomSide(), and SetID().
int _FaceSide.myNbChildren [private] |
Definition at line 128 of file StdMeshers_CompositeHexa_3D.cxx.
Referenced by _FaceSide(), AppendSide(), GetSide(), NbVertices(), and Vertex().
TopTools_MapOfShape _FaceSide.myVertices [private] |
Definition at line 131 of file StdMeshers_CompositeHexa_3D.cxx.
Referenced by _FaceSide(), AppendSide(), Contain(), and NbVertices().