Class corresponding to a meshed composite face of a box. More...
Public Types | |
| typedef SMDS_SetIterator < const _QuadFaceGrid &, TChildren::const_iterator > | TChildIterator |
Public Member Functions | |
| _QuadFaceGrid () | |
| constructor of non-initialized _QuadFaceGrid | |
| bool | Init (const TopoDS_Face &f) |
| < initialization | |
| bool | AddContinuousFace (const _QuadFaceGrid &f) |
| Try to set the side as bottom hirizontal side. | |
| bool | SetBottomSide (const _FaceSide &side, int *sideIndex=0) |
| Return face adjacent to i-th side of this face. | |
| _QuadFaceGrid * | FindAdjacentForSide (int i, vector< _QuadFaceGrid > &faces) const |
| Return face adjacent to i-th side of this face, (0<i<4) | |
| void | ReverseEdges () |
| < Reverse edges in order to have the bottom edge going along axes of the unit box | |
| bool | IsComplex () const |
| TChildIterator | GetChildren () const |
| bool | LoadGrid (SMESH_Mesh &mesh) |
| < Load nodes of a mesh | |
| int | GetNbHoriSegments (SMESH_Mesh &mesh, bool withBrothers=false) const |
| Return number of segments on the vertical sides. | |
| int | GetNbVertSegments (SMESH_Mesh &mesh, bool withBrothers=false) const |
| Return a node by its position. | |
| const SMDS_MeshNode * | GetNode (int iHori, int iVert) const |
| Return node coordinates by its position. | |
| gp_XYZ | GetXYZ (int iHori, int iVert) const |
| Return node coordinates by its position. | |
| const _FaceSide & | GetSide (int i) const |
| < Return i-th face side (0<i<4) | |
| TopoDS_Face | GetFace () const |
| Return normal to the face at vertex v. | |
| bool | GetNormal (const TopoDS_Vertex &v, gp_Vec &n) const |
| Return normal to the face at vertex v. | |
| SMESH_ComputeErrorPtr | GetError () const |
| void | SetID (EBoxSides id) |
| void | DumpGrid () const |
| Dumps coordinates of grid nodes. | |
| void | DumpVertices () const |
| Dump vertices. | |
Private Types | |
| typedef list< _QuadFaceGrid > | TChildren |
Private Member Functions | |
| bool | error (const std::string &text, int code=COMPERR_ALGO_FAILED) |
| bool | error (const SMESH_ComputeErrorPtr &err) |
| bool | loadCompositeGrid (SMESH_Mesh &mesh) |
| Fill myGrid with nodes of patches. | |
| bool | fillGrid (SMESH_Mesh &theMesh, vector< const SMDS_MeshNode * > &theGrid, const _Indexer &theIndexer, int theX, int theY) |
| Store nodes of a simple face into grid starting from (x,y) position. | |
| bool | locateChildren () |
| Find out mutual location of children: find their right and up brothers. | |
| void | setBrothers (set< _QuadFaceGrid * > ¬LocatedBrothers) |
| Find right an upper brothers among notLocatedBrothers. | |
Private Attributes | |
| TopoDS_Face | myFace |
| _FaceSide | mySides |
| bool | myReverse |
| TChildren | myChildren |
| _QuadFaceGrid * | myLeftBottomChild |
| _QuadFaceGrid * | myRightBrother |
| _QuadFaceGrid * | myUpBrother |
| _Indexer | myIndexer |
| vector< const SMDS_MeshNode * > | myGrid |
| SMESH_ComputeErrorPtr | myError |
| EBoxSides | myID |
Class corresponding to a meshed composite face of a box.
Provides simplified access to it's sub-mesh data.
Definition at line 140 of file StdMeshers_CompositeHexa_3D.cxx.
| typedef SMDS_SetIterator< const _QuadFaceGrid&, TChildren::const_iterator > _QuadFaceGrid.TChildIterator |
Definition at line 165 of file StdMeshers_CompositeHexa_3D.cxx.
typedef list< _QuadFaceGrid > _QuadFaceGrid.TChildren [private] |
Definition at line 142 of file StdMeshers_CompositeHexa_3D.cxx.
| _QuadFaceGrid::_QuadFaceGrid | ( | ) |
constructor of non-initialized _QuadFaceGrid
Definition at line 723 of file StdMeshers_CompositeHexa_3D.cxx.
: myReverse(false), myRightBrother(0), myUpBrother(0), myIndexer(0,0), myID(B_UNDEFINED) { }
| bool _QuadFaceGrid::AddContinuousFace | ( | const _QuadFaceGrid & | f | ) |
Try to set the side as bottom hirizontal side.
Try to unite self with other ordinary face.
Definition at line 796 of file StdMeshers_CompositeHexa_3D.cxx.
References _FaceSide.AppendSide(), _FaceSide.Contain(), DUMP_VERT, _FaceSide.FirstVertex(), GetNormal(), _FaceSide.GetSide(), GetSide(), _FaceSide.LastVertex(), myChildren, myFace, mySides, SMESH_AdvancedEditor.n1, SMESH_AdvancedEditor.n2, _FaceSide.NbVertices(), PI, and _FaceSide.Vertex().
{
for ( int i = 0; i < 4; ++i ) {
const _FaceSide& otherSide = other.GetSide( i );
int iMyCommon;
if ( mySides.Contain( otherSide, &iMyCommon ) ) {
// check if normals of two faces are collinear at all vertices of a otherSide
const double angleTol = PI / 180 / 2;
int iV, nbV = otherSide.NbVertices(), nbCollinear = 0;
for ( iV = 0; iV < nbV; ++iV )
{
TopoDS_Vertex v = otherSide.Vertex( iV );
gp_Vec n1, n2;
if ( !GetNormal( v, n1 ) || !other.GetNormal( v, n2 ))
continue;
if ( n1 * n2 < 0 )
n1.Reverse();
if ( n1.Angle(n2) < angleTol )
nbCollinear++;
else
break;
}
if ( nbCollinear > 1 ) { // this face becomes composite if not yet is
DUMP_VERT("Cont 1", mySides.GetSide(iMyCommon)->FirstVertex());
DUMP_VERT("Cont 2", mySides.GetSide(iMyCommon)->LastVertex());
DUMP_VERT("Cont 3", otherSide.FirstVertex());
DUMP_VERT("Cont 4", otherSide.LastVertex());
if ( myChildren.empty() ) {
myChildren.push_back( *this );
myFace.Nullify();
}
myChildren.push_back( other );
int otherBottomIndex = ( 4 + i - iMyCommon + 2 ) % 4;
myChildren.back().SetBottomSide( other.GetSide( otherBottomIndex ));
// collect vertices in mySides
mySides.AppendSide( other.GetSide(0) );
mySides.AppendSide( other.GetSide(1) );
mySides.AppendSide( other.GetSide(2) );
mySides.AppendSide( other.GetSide(3) );
return true;
}
}
}
return false;
}
| void _QuadFaceGrid::DumpGrid | ( | ) | const |
Dumps coordinates of grid nodes.
Definition at line 1350 of file StdMeshers_CompositeHexa_3D.cxx.
References _Indexer._xSize, _Indexer._ySize, myChildren, myGrid, myID, myIndexer, SMESH_reg.names, SetID(), SMDS_MeshNode.X(), ex13_hole1partial.x, SMDS_MeshNode.Y(), ex13_hole1partial.y, and SMDS_MeshNode.Z().
Referenced by loadCompositeGrid(), and LoadGrid().
{
#ifdef DEB_GRID
const char* names[] = { "B_BOTTOM", "B_RIGHT", "B_TOP", "B_LEFT", "B_FRONT", "B_BACK" };
cout << "****** Face " << names[ myID ] << endl;
if ( myChildren.empty() || !myGrid.empty() )
{
cout << "x size: " << myIndexer._xSize << "; y size: " << myIndexer._ySize << endl;
for ( int y = 0; y < myIndexer._ySize; ++y ) {
cout << "-- row " << y << endl;
for ( int x = 0; x < myIndexer._xSize; ++x ) {
const SMDS_MeshNode* n = myGrid[ myIndexer( x, y ) ];
cout << x << " ( " << n->X() << ", " << n->Y() << ", " << n->Z() << " )" << endl;
}
}
}
else
{
cout << "Nb children: " << myChildren.size() << endl;
TChildren::const_iterator child = myChildren.begin(), childEnd = myChildren.end();
for ( int i=0; child != childEnd; ++child, ++i ) {
cout << " *** SUBFACE " << i+1 << endl;
((_QuadFaceGrid&)(*child)).SetID( myID );
child->DumpGrid();
}
}
#endif
}
| void _QuadFaceGrid::DumpVertices | ( | ) | const |
Dump vertices.
Definition at line 1386 of file StdMeshers_CompositeHexa_3D.cxx.
References B_BACK, B_BOTTOM, _FaceSide.Dump(), _FaceSide.GetSide(), myChildren, myID, mySides, SMESH_reg.names, and SetID().
Referenced by ReverseEdges().
{
#ifdef DEB_FACES
cout << "****** Face ";
const char* names[] = { "B_BOTTOM", "B_RIGHT", "B_TOP", "B_LEFT", "B_FRONT", "B_BACK" };
if ( myID >= B_BOTTOM && myID < B_BACK )
cout << names[ myID ] << endl;
else
cout << "UNDEFINED" << endl;
if ( myChildren.empty() )
{
for ( int i = 0; i < 4; ++i )
{
cout << " Side "; mySides.GetSide( i )->Dump();
}
}
else
{
cout << "-- Nb children: " << myChildren.size() << endl;
TChildren::const_iterator child = myChildren.begin(), childEnd = myChildren.end();
for ( int i=0; child != childEnd; ++child, ++i ) {
cout << " *** SUBFACE " << i+1 << endl;
((_QuadFaceGrid&)(*child)).SetID( myID );
child->DumpVertices();
}
}
#endif
}
Definition at line 208 of file StdMeshers_CompositeHexa_3D.cxx.
References myError, and SMESH_ComputeError.New().
Referenced by fillGrid(), loadCompositeGrid(), LoadGrid(), and locateChildren().
{ myError = SMESH_ComputeError::New( code, text ); return false; }
| bool _QuadFaceGrid.error | ( | const SMESH_ComputeErrorPtr & | err | ) | [private] |
| bool _QuadFaceGrid::fillGrid | ( | SMESH_Mesh & | theMesh, |
| vector< const SMDS_MeshNode * > & | theGrid, | ||
| const _Indexer & | theIndexer, | ||
| int | theX, | ||
| int | theY | ||
| ) | [private] |
Store nodes of a simple face into grid starting from (x,y) position.
Definition at line 1206 of file StdMeshers_CompositeHexa_3D.cxx.
References _Indexer._xSize, _Indexer._ySize, error(), fillGrid(), GetError(), LoadGrid(), myGrid, myIndexer, myReverse, myRightBrother, myUpBrother, ex13_hole1partial.x, and ex13_hole1partial.y.
Referenced by fillGrid(), and loadCompositeGrid().
{
if ( myGrid.empty() && !LoadGrid( theMesh ))
return false;
// store my own grid in the global grid
int fromX = myReverse ? theX - myIndexer._xSize: theX;
for ( int i = 0, x = fromX; i < myIndexer._xSize; ++i, ++x )
for ( int j = 0, y = theY; j < myIndexer._ySize; ++j, ++y )
theGrid[ theIndexer( x, y )] = myGrid[ myIndexer( i, j )];
// store grids of my right and upper brothers
if ( myRightBrother )
{
if ( myReverse )
fromX += 1;
else
fromX += myIndexer._xSize - 1;
if ( !myRightBrother->fillGrid( theMesh, theGrid, theIndexer, fromX, theY ))
return error( myRightBrother->GetError() );
}
if ( myUpBrother )
{
if ( !myUpBrother->fillGrid( theMesh, theGrid, theIndexer,
theX, theY + myIndexer._ySize - 1))
return error( myUpBrother->GetError() );
}
return true;
}
| _QuadFaceGrid * _QuadFaceGrid::FindAdjacentForSide | ( | int | i, |
| vector< _QuadFaceGrid > & | faces | ||
| ) | const |
Return face adjacent to i-th side of this face, (0<i<4)
Definition at line 889 of file StdMeshers_CompositeHexa_3D.cxx.
References GetSide(), and SetBottomSide().
Referenced by StdMeshers_CompositeHexa_3D.Compute(), and StdMeshers_CompositeHexa_3D.Evaluate().
{
for ( int iF = 0; iF < faces.size(); ++iF ) {
_QuadFaceGrid* f = &faces[ iF ];
if ( f != this && f->SetBottomSide( GetSide( i )))
return f;
}
return (_QuadFaceGrid*) 0;
}
| TChildIterator _QuadFaceGrid.GetChildren | ( | ) | const |
Definition at line 167 of file StdMeshers_CompositeHexa_3D.cxx.
References myChildren.
Referenced by StdMeshers_CompositeHexa_3D.Compute(), StdMeshers_CompositeHexa_3D.Evaluate(), and GetNb2d().
{ return TChildIterator( myChildren.begin(), myChildren.end()); }
| SMESH_ComputeErrorPtr _QuadFaceGrid.GetError | ( | ) | const |
Definition at line 198 of file StdMeshers_CompositeHexa_3D.cxx.
References myError.
Referenced by StdMeshers_CompositeHexa_3D.Compute(), fillGrid(), and loadCompositeGrid().
{ return myError; }
| TopoDS_Face _QuadFaceGrid.GetFace | ( | ) | const |
Return normal to the face at vertex v.
Definition at line 193 of file StdMeshers_CompositeHexa_3D.cxx.
References myFace.
Referenced by StdMeshers_CompositeHexa_3D.Evaluate(), and GetNb2d().
| int _QuadFaceGrid::GetNbHoriSegments | ( | SMESH_Mesh & | mesh, |
| bool | withBrothers = false |
||
| ) | const |
Return number of segments on the vertical sides.
Return number of segments on the hirizontal sides.
Definition at line 1249 of file StdMeshers_CompositeHexa_3D.cxx.
References GetNbHoriSegments(), _FaceSide.GetNbSegments(), _FaceSide.GetSide(), myLeftBottomChild, myRightBrother, mySides, and Q_BOTTOM.
Referenced by StdMeshers_CompositeHexa_3D.Compute(), GetNbHoriSegments(), and loadCompositeGrid().
{
int nbSegs = 0;
if ( myLeftBottomChild )
{
nbSegs += myLeftBottomChild->GetNbHoriSegments( mesh, true );
}
else
{
nbSegs = mySides.GetSide( Q_BOTTOM )->GetNbSegments(mesh);
if ( withBrothers && myRightBrother )
nbSegs += myRightBrother->GetNbHoriSegments( mesh, withBrothers );
}
return nbSegs;
}
| int _QuadFaceGrid::GetNbVertSegments | ( | SMESH_Mesh & | mesh, |
| bool | withBrothers = false |
||
| ) | const |
Return a node by its position.
Return number of segments on the vertical sides.
Definition at line 1271 of file StdMeshers_CompositeHexa_3D.cxx.
References _FaceSide.GetNbSegments(), GetNbVertSegments(), _FaceSide.GetSide(), myLeftBottomChild, mySides, myUpBrother, and Q_LEFT.
Referenced by StdMeshers_CompositeHexa_3D.Compute(), GetNbVertSegments(), and loadCompositeGrid().
{
int nbSegs = 0;
if ( myLeftBottomChild )
{
nbSegs += myLeftBottomChild->GetNbVertSegments( mesh, true );
}
else
{
nbSegs = mySides.GetSide( Q_LEFT )->GetNbSegments(mesh);
if ( withBrothers && myUpBrother )
nbSegs += myUpBrother->GetNbVertSegments( mesh, withBrothers );
}
return nbSegs;
}
| const SMDS_MeshNode * _QuadFaceGrid::GetNode | ( | int | iHori, |
| int | iVert | ||
| ) | const |
Return node coordinates by its position.
Return a node by its position.
Definition at line 1293 of file StdMeshers_CompositeHexa_3D.cxx.
References myGrid, and myIndexer.
Referenced by StdMeshers_CompositeHexa_3D.Compute().
| bool _QuadFaceGrid::GetNormal | ( | const TopoDS_Vertex & | v, |
| gp_Vec & | n | ||
| ) | const |
Return normal to the face at vertex v.
Definition at line 1316 of file StdMeshers_CompositeHexa_3D.cxx.
References _FaceSide.Contain(), myChildren, myFace, and mySides.
Referenced by AddContinuousFace().
{
if ( myChildren.empty() )
{
if ( mySides.Contain( v )) {
try {
gp_Pnt2d uv = BRep_Tool::Parameters( v, myFace );
BRepAdaptor_Surface surface( myFace );
gp_Pnt p; gp_Vec d1u, d1v;
surface.D1( uv.X(), uv.Y(), p, d1u, d1v );
n = d1u.Crossed( d1v );
return true;
}
catch (Standard_Failure) {
return false;
}
}
}
else
{
TChildren::const_iterator child = myChildren.begin(), childEnd = myChildren.end();
for ( ; child != childEnd; ++child )
if ( child->GetNormal( v, n ))
return true;
}
return false;
}
< Return i-th face side (0<i<4)
Return i-th side.
Return it's face, NULL if it is composite
Definition at line 905 of file StdMeshers_CompositeHexa_3D.cxx.
References GetSide(), _FaceSide.GetSide(), locateChildren(), myChildren, myLeftBottomChild, myRightBrother, mySides, myUpBrother, Q_BOTTOM, Q_LEFT, Q_RIGHT, and Q_TOP.
Referenced by AddContinuousFace(), StdMeshers_CompositeHexa_3D.Compute(), StdMeshers_CompositeHexa_3D.Evaluate(), FindAdjacentForSide(), GetSide(), locateChildren(), and setBrothers().
{
if ( myChildren.empty() )
return *mySides.GetSide(i);
_QuadFaceGrid* me = const_cast<_QuadFaceGrid*>(this);
if ( !me->locateChildren() || !myLeftBottomChild )
return *mySides.GetSide(i);
const _QuadFaceGrid* child = myLeftBottomChild;
switch ( i ){
case Q_BOTTOM:
case Q_LEFT:
break;
case Q_RIGHT:
while ( child->myRightBrother )
child = child->myRightBrother;
break;
case Q_TOP:
while ( child->myUpBrother )
child = child->myUpBrother;
break;
default: ;
}
return child->GetSide( i );
}
Return node coordinates by its position.
Definition at line 1304 of file StdMeshers_CompositeHexa_3D.cxx.
References myGrid, myIndexer, SMDS_MeshNode.X(), SMDS_MeshNode.Y(), and SMDS_MeshNode.Z().
Referenced by StdMeshers_CompositeHexa_3D.Compute().
| bool _QuadFaceGrid::Init | ( | const TopoDS_Face & | f | ) |
< initialization
Initialization.
try to unite self with other face
Definition at line 734 of file StdMeshers_CompositeHexa_3D.cxx.
References _FaceSide.AppendSide(), SMESH_Block.GetOrderedEdges(), _FaceSide.GetSide(), SMESH_Algo.IsContinuous(), myChildren, myFace, myGrid, myLeftBottomChild, myReverse, myRightBrother, mySides, myUpBrother, Q_BOTTOM, Q_LEFT, Q_RIGHT, Q_TOP, _FaceSide.SetID(), and _FaceSide.size().
Referenced by StdMeshers_CompositeHexa_3D.Compute(), and StdMeshers_CompositeHexa_3D.Evaluate().
{
myFace = f;
mySides = _FaceSide();
myReverse = false;
myLeftBottomChild = myRightBrother = myUpBrother = 0;
myChildren.clear();
myGrid.clear();
//if ( myFace.Orientation() != TopAbs_FORWARD )
//myFace.Reverse();
TopoDS_Vertex V;
list< TopoDS_Edge > edges;
list< int > nbEdgesInWire;
int nbWire = SMESH_Block::GetOrderedEdges (myFace, V, edges, nbEdgesInWire);
if ( nbWire != 1 )
return false;
list< TopoDS_Edge >::iterator edgeIt = edges.begin();
if ( nbEdgesInWire.front() == 4 ) // exactly 4 edges
{
for ( ; edgeIt != edges.end(); ++edgeIt )
mySides.AppendSide( _FaceSide( *edgeIt ));
}
else if ( nbEdgesInWire.front() > 4 ) { // more than 4 edges - try to unite some
list< TopoDS_Edge > sideEdges;
while ( !edges.empty()) {
sideEdges.clear();
sideEdges.splice( sideEdges.end(), edges, edges.begin());// edges.front()->sideEdges.back()
while ( !edges.empty() ) {
if ( SMESH_Algo::IsContinuous( sideEdges.back(), edges.front() )) {
sideEdges.splice( sideEdges.end(), edges, edges.begin());
}
else if ( SMESH_Algo::IsContinuous( sideEdges.front(), edges.back() )) {
sideEdges.splice( sideEdges.begin(), edges, --edges.end());
}
else {
break;
}
}
mySides.AppendSide( _FaceSide( sideEdges ));
}
}
if (mySides.size() != 4)
return false;
#ifdef _DEBUG_
mySides.GetSide( Q_BOTTOM )->SetID( Q_BOTTOM );
mySides.GetSide( Q_RIGHT )->SetID( Q_RIGHT );
mySides.GetSide( Q_TOP )->SetID( Q_TOP );
mySides.GetSide( Q_LEFT )->SetID( Q_LEFT );
#endif
return true;
}
| bool _QuadFaceGrid.IsComplex | ( | ) | const |
Definition at line 163 of file StdMeshers_CompositeHexa_3D.cxx.
References myChildren.
Referenced by StdMeshers_CompositeHexa_3D.Compute(), and StdMeshers_CompositeHexa_3D.Evaluate().
{ return !myChildren.empty(); }
| bool _QuadFaceGrid::loadCompositeGrid | ( | SMESH_Mesh & | mesh | ) | [private] |
Fill myGrid with nodes of patches.
Definition at line 1131 of file StdMeshers_CompositeHexa_3D.cxx.
References _Indexer._xSize, _Indexer._ySize, DumpGrid(), error(), fillGrid(), GetError(), GetNbHoriSegments(), GetNbVertSegments(), locateChildren(), myGrid, myIndexer, myLeftBottomChild, myReverse, and _Indexer.size().
Referenced by LoadGrid().
{
// Find out mutual location of children: find their right and up brothers
if ( !locateChildren() )
return false;
// Load nodes according to mutual location of children
// grid size
myIndexer._xSize = 1 + myLeftBottomChild->GetNbHoriSegments(mesh, /*withBrothers=*/true);
myIndexer._ySize = 1 + myLeftBottomChild->GetNbVertSegments(mesh, /*withBrothers=*/true);
myGrid.resize( myIndexer.size() );
int fromX = myReverse ? myIndexer._xSize : 0;
if (!myLeftBottomChild->fillGrid( mesh, myGrid, myIndexer, fromX, 0 ))
return error( myLeftBottomChild->GetError() );
DumpGrid();
return true;
}
| bool _QuadFaceGrid::LoadGrid | ( | SMESH_Mesh & | mesh | ) |
< Load nodes of a mesh
Load nodes of a mesh.
Return number of segments on the hirizontal sides
Definition at line 968 of file StdMeshers_CompositeHexa_3D.cxx.
References _Indexer._xSize, _Indexer._ySize, SMESHDS_Mesh.AddNode(), SMESHDS_SubMesh.Contains(), DumpGrid(), ERR_LI, error(), SMESH_MeshEditor.FindFaceInSet(), SMESHDS_SubMesh.GetElements(), SMESH_Mesh.GetMeshDS(), _FaceSide.GetNbSegments(), SMDS_MeshElement.GetNode(), SMDS_MeshElement.GetNodeIndex(), _FaceSide.GetSide(), SMESH_Mesh.GetSubMesh(), SMESH_subMesh.GetSubMeshDS(), loadCompositeGrid(), myChildren, myFace, myGrid, myID, myIndexer, myReverse, mySides, SMDS_MeshElement.NbNodes(), Q_BOTTOM, Q_LEFT, SMESHDS_Mesh.RemoveNode(), _Indexer.size(), and _FaceSide.StoreNodes().
Referenced by StdMeshers_CompositeHexa_3D.Compute(), and fillGrid().
{
if ( !myChildren.empty() )
{
// Let child faces load their grids
TChildren::iterator child = myChildren.begin(), childEnd = myChildren.end();
for ( ; child != childEnd; ++child ) {
child->SetID( myID );
if ( !child->LoadGrid( mesh ) )
return error( child->GetError() );
}
// Fill myGrid with nodes of patches
return loadCompositeGrid( mesh );
}
// ---------------------------------------
// Fill myGrid with nodes bound to myFace
// ---------------------------------------
if ( !myGrid.empty() )
return true;
SMESHDS_SubMesh* faceSubMesh = mesh.GetSubMesh( myFace )->GetSubMeshDS();
// check that all faces are quadrangular
SMDS_ElemIteratorPtr fIt = faceSubMesh->GetElements();
while ( fIt->more() )
if ( fIt->next()->NbNodes() % 4 > 0 )
return error("Non-quadrangular mesh faces are not allowed on sides of a composite block");
myIndexer._xSize = 1 + mySides.GetSide( Q_BOTTOM )->GetNbSegments( mesh );
myIndexer._ySize = 1 + mySides.GetSide( Q_LEFT )->GetNbSegments( mesh );
myGrid.resize( myIndexer.size() );
// strore nodes bound to the bottom edge
mySides.GetSide( Q_BOTTOM )->StoreNodes( mesh, myGrid, myReverse );
// store the rest nodes row by row
const SMDS_MeshNode* dummy = mesh.GetMeshDS()->AddNode(0,0,0);
const SMDS_MeshElement* firstQuad = dummy; // most left face above the last row of found nodes
int nbFoundNodes = myIndexer._xSize;
while ( nbFoundNodes != myGrid.size() )
{
// first and last nodes of the last filled row of nodes
const SMDS_MeshNode* n1down = myGrid[ nbFoundNodes - myIndexer._xSize ];
const SMDS_MeshNode* n2down = myGrid[ nbFoundNodes - myIndexer._xSize + 1];
const SMDS_MeshNode* n1downLast = myGrid[ nbFoundNodes-1 ];
// find the first face above the row by the first two left nodes
//
// n1up n2up
// o---o
// | |
// o---o o o o o
//n1down n2down
//
TIDSortedElemSet emptySet, avoidSet;
avoidSet.insert( firstQuad );
firstQuad = SMESH_MeshEditor::FindFaceInSet( n1down, n2down, emptySet, avoidSet);
while ( firstQuad && !faceSubMesh->Contains( firstQuad )) {
avoidSet.insert( firstQuad );
firstQuad = SMESH_MeshEditor::FindFaceInSet( n1down, n2down, emptySet, avoidSet);
}
if ( !firstQuad || !faceSubMesh->Contains( firstQuad ))
return error(ERR_LI("Error in _QuadFaceGrid::LoadGrid()"));
// find the node of quad bound to the left geom edge
int i2down = firstQuad->GetNodeIndex( n2down );
const SMDS_MeshNode* n1up = firstQuad->GetNode(( i2down+2 ) % 4 );
myGrid[ nbFoundNodes++ ] = n1up;
// the 4-the node of the first quad
int i1down = firstQuad->GetNodeIndex( n1down );
const SMDS_MeshNode* n2up = firstQuad->GetNode(( i1down+2 ) % 4 );
myGrid[ nbFoundNodes++ ] = n2up;
n1down = n2down;
n1up = n2up;
const SMDS_MeshElement* quad = firstQuad;
// find the rest nodes by remaining faces above the row
//
// n1up
// o---o--o
// | | | ->
// o---o--o o o o
// n1downLast
//
while ( n1down != n1downLast )
{
// next face
avoidSet.clear(); avoidSet.insert( quad );
quad = SMESH_MeshEditor::FindFaceInSet( n1down, n1up, emptySet, avoidSet );
if ( !quad || quad->NbNodes() % 4 > 0)
return error(ERR_LI("Error in _QuadFaceGrid::LoadGrid()"));
// next node
if ( quad->GetNode( i1down ) != n1down ) // check already found index
i1down = quad->GetNodeIndex( n1down );
n2up = quad->GetNode(( i1down+2 ) % 4 );
myGrid[ nbFoundNodes++ ] = n2up;
n1down = myGrid[ nbFoundNodes - myIndexer._xSize - 1 ];
n1up = n2up;
}
}
mesh.GetMeshDS()->RemoveNode(dummy);
DumpGrid(); // debug
return true;
}
| bool _QuadFaceGrid::locateChildren | ( | ) | [private] |
Find out mutual location of children: find their right and up brothers.
Definition at line 1087 of file StdMeshers_CompositeHexa_3D.cxx.
References DUMP_VERT, ERR_LI, error(), _FaceSide.FirstVertex(), GetSide(), myChildren, myLeftBottomChild, Q_BOTTOM, and setBrothers().
Referenced by GetSide(), and loadCompositeGrid().
{
if ( myLeftBottomChild )
return true;
TChildren::iterator child = myChildren.begin(), childEnd = myChildren.end();
// find a child sharing it's first bottom vertex with no other brother
myLeftBottomChild = 0;
for ( ; !myLeftBottomChild && child != childEnd; ++child )
{
TopoDS_Vertex leftVertex = child->GetSide( Q_BOTTOM ).FirstVertex();
bool sharedVertex = false;
TChildren::iterator otherChild = myChildren.begin();
for ( ; otherChild != childEnd && !sharedVertex; ++otherChild )
if ( otherChild != child )
sharedVertex = otherChild->mySides.Contain( leftVertex );
if ( !sharedVertex ) {
myLeftBottomChild = & (*child);
DUMP_VERT("0 left bottom Vertex: ",leftVertex );
}
}
if (!myLeftBottomChild)
return error(ERR_LI("Error in locateChildren()"));
set< _QuadFaceGrid* > notLocatedChilren;
for (child = myChildren.begin() ; child != childEnd; ++child )
notLocatedChilren.insert( & (*child));
// connect myLeftBottomChild to it's right and upper brothers
notLocatedChilren.erase( myLeftBottomChild );
myLeftBottomChild->setBrothers( notLocatedChilren );
if ( !notLocatedChilren.empty() )
return error(ERR_LI("Error in locateChildren()"));
return true;
}
| void _QuadFaceGrid::ReverseEdges | ( | ) |
< Reverse edges in order to have the bottom edge going along axes of the unit box
Reverse edges in order to have them oriented along axes of the unit box.
Definition at line 938 of file StdMeshers_CompositeHexa_3D.cxx.
References DumpVertices(), myChildren, and myReverse.
Referenced by StdMeshers_CompositeHexa_3D.Compute().
{
myReverse = !myReverse;
// #ifdef DEB_FACES
// if ( !myFace.IsNull() )
// TopAbs::Print(myFace.Orientation(), cout);
// #endif
if ( myChildren.empty() )
{
// mySides.GetSide( e1 )->Reverse();
// mySides.GetSide( e2 )->Reverse();
DumpVertices();
}
else
{
DumpVertices();
TChildren::iterator child = myChildren.begin(), childEnd = myChildren.end();
for ( ; child != childEnd; ++child )
child->ReverseEdges( /*e1, e2*/ );
}
}
Return face adjacent to i-th side of this face.
Try to set the side as bottom hirizontal side.
Definition at line 848 of file StdMeshers_CompositeHexa_3D.cxx.
References _FaceSide.Contain(), myChildren, myLeftBottomChild, myRightBrother, mySides, myUpBrother, and _FaceSide.SetBottomSide().
Referenced by StdMeshers_CompositeHexa_3D.Compute(), StdMeshers_CompositeHexa_3D.Evaluate(), and FindAdjacentForSide().
{
myLeftBottomChild = myRightBrother = myUpBrother = 0;
int myBottomIndex;
if ( myChildren.empty() )
{
if ( mySides.Contain( bottom, &myBottomIndex )) {
mySides.SetBottomSide( myBottomIndex );
if ( sideIndex )
*sideIndex = myBottomIndex;
return true;
}
}
else
{
TChildren::iterator childFace = myChildren.begin(), childEnd = myChildren.end();
for ( ; childFace != childEnd; ++childFace )
{
if ( childFace->SetBottomSide( bottom, &myBottomIndex ))
{
TChildren::iterator orientedCild = childFace;
for ( childFace = myChildren.begin(); childFace != childEnd; ++childFace ) {
if ( childFace != orientedCild )
childFace->SetBottomSide( childFace->GetSide( myBottomIndex ));
}
if ( sideIndex )
*sideIndex = myBottomIndex;
return true;
}
}
}
return false;
}
| void _QuadFaceGrid::setBrothers | ( | set< _QuadFaceGrid * > & | notLocatedBrothers | ) | [private] |
Find right an upper brothers among notLocatedBrothers.
Definition at line 1160 of file StdMeshers_CompositeHexa_3D.cxx.
References DUMP_VERT, _FaceSide.FirstVertex(), GetSide(), _FaceSide.LastVertex(), myRightBrother, myUpBrother, Q_BOTTOM, Q_LEFT, and setBrothers().
Referenced by locateChildren(), and setBrothers().
{
if ( !notLocatedBrothers.empty() )
{
// find right brother
TopoDS_Vertex rightVertex = GetSide( Q_BOTTOM ).LastVertex();
DUMP_VERT("1 right bottom Vertex: ",rightVertex );
set< _QuadFaceGrid* >::iterator brIt, brEnd = notLocatedBrothers.end();
for ( brIt = notLocatedBrothers.begin(); !myRightBrother && brIt != brEnd; ++brIt )
{
_QuadFaceGrid* brother = *brIt;
TopoDS_Vertex brotherLeftVertex = brother->GetSide( Q_BOTTOM ).FirstVertex();
DUMP_VERT( "brother left bottom: ", brotherLeftVertex );
if ( rightVertex.IsSame( brotherLeftVertex )) {
myRightBrother = brother;
notLocatedBrothers.erase( myRightBrother );
}
}
// find upper brother
TopoDS_Vertex upVertex = GetSide( Q_LEFT ).FirstVertex();
DUMP_VERT("1 left up Vertex: ",upVertex);
brIt = notLocatedBrothers.begin(), brEnd = notLocatedBrothers.end();
for ( ; !myUpBrother && brIt != brEnd; ++brIt )
{
_QuadFaceGrid* brother = *brIt;
TopoDS_Vertex brotherLeftVertex = brother->GetSide( Q_BOTTOM ).FirstVertex();
DUMP_VERT("brother left bottom: ", brotherLeftVertex);
if ( upVertex.IsSame( brotherLeftVertex )) {
myUpBrother = brother;
notLocatedBrothers.erase( myUpBrother );
}
}
// recursive call
if ( myRightBrother )
myRightBrother->setBrothers( notLocatedBrothers );
if ( myUpBrother )
myUpBrother->setBrothers( notLocatedBrothers );
}
}
| void _QuadFaceGrid.SetID | ( | EBoxSides | id | ) |
Definition at line 200 of file StdMeshers_CompositeHexa_3D.cxx.
References myID.
Referenced by StdMeshers_CompositeHexa_3D.Compute(), DumpGrid(), and DumpVertices().
{ myID = id; }
TChildren _QuadFaceGrid.myChildren [private] |
Definition at line 230 of file StdMeshers_CompositeHexa_3D.cxx.
Referenced by AddContinuousFace(), DumpGrid(), DumpVertices(), GetChildren(), GetNormal(), GetSide(), Init(), IsComplex(), LoadGrid(), locateChildren(), ReverseEdges(), and SetBottomSide().
SMESH_ComputeErrorPtr _QuadFaceGrid.myError [private] |
Definition at line 239 of file StdMeshers_CompositeHexa_3D.cxx.
Referenced by error(), and GetError().
TopoDS_Face _QuadFaceGrid.myFace [private] |
Definition at line 226 of file StdMeshers_CompositeHexa_3D.cxx.
Referenced by AddContinuousFace(), GetFace(), GetNormal(), Init(), and LoadGrid().
vector<const SMDS_MeshNode*> _QuadFaceGrid.myGrid [private] |
Definition at line 237 of file StdMeshers_CompositeHexa_3D.cxx.
Referenced by DumpGrid(), fillGrid(), GetNode(), GetXYZ(), Init(), loadCompositeGrid(), and LoadGrid().
EBoxSides _QuadFaceGrid.myID [private] |
Definition at line 241 of file StdMeshers_CompositeHexa_3D.cxx.
Referenced by DumpGrid(), DumpVertices(), LoadGrid(), and SetID().
_Indexer _QuadFaceGrid.myIndexer [private] |
Definition at line 236 of file StdMeshers_CompositeHexa_3D.cxx.
Referenced by DumpGrid(), fillGrid(), GetNode(), GetXYZ(), loadCompositeGrid(), and LoadGrid().
_QuadFaceGrid* _QuadFaceGrid.myLeftBottomChild [private] |
Definition at line 232 of file StdMeshers_CompositeHexa_3D.cxx.
Referenced by GetNbHoriSegments(), GetNbVertSegments(), GetSide(), Init(), loadCompositeGrid(), locateChildren(), and SetBottomSide().
bool _QuadFaceGrid.myReverse [private] |
Definition at line 228 of file StdMeshers_CompositeHexa_3D.cxx.
Referenced by fillGrid(), Init(), loadCompositeGrid(), LoadGrid(), and ReverseEdges().
_QuadFaceGrid* _QuadFaceGrid.myRightBrother [private] |
Definition at line 233 of file StdMeshers_CompositeHexa_3D.cxx.
Referenced by fillGrid(), GetNbHoriSegments(), GetSide(), Init(), SetBottomSide(), and setBrothers().
_FaceSide _QuadFaceGrid.mySides [private] |
Definition at line 227 of file StdMeshers_CompositeHexa_3D.cxx.
Referenced by AddContinuousFace(), DumpVertices(), GetNbHoriSegments(), GetNbVertSegments(), GetNormal(), GetSide(), Init(), LoadGrid(), and SetBottomSide().
_QuadFaceGrid* _QuadFaceGrid.myUpBrother [private] |
Definition at line 234 of file StdMeshers_CompositeHexa_3D.cxx.
Referenced by fillGrid(), GetNbVertSegments(), GetSide(), Init(), SetBottomSide(), and setBrothers().