Computes hexahedral mesh on a box with composite sides. More...
#include <StdMeshers_CompositeHexa_3D.hxx>

Public Member Functions | |
| StdMeshers_CompositeHexa_3D (int hypId, int studyId, SMESH_Gen *gen) | |
| Constructor. | |
| virtual bool | Compute (SMESH_Mesh &aMesh, const TopoDS_Shape &aShape) |
| Computes hexahedral mesh on a box with composite sides. | |
| virtual bool | Evaluate (SMESH_Mesh &aMesh, const TopoDS_Shape &aShape, MapShapeNbElems &aResMap) |
| Evaluate. | |
| virtual bool | CheckHypothesis (SMESH_Mesh &aMesh, const TopoDS_Shape &aShape, Hypothesis_Status &aStatus) |
| always return true | |
| virtual std::ostream & | SaveTo (std::ostream &save) |
| Saves nothing in a stream. | |
| virtual std::istream & | LoadFrom (std::istream &load) |
| Loads nothing from a stream. | |
| const std::vector< std::string > & | GetCompatibleHypothesis () |
| Returns all types of compatible hypotheses. | |
| virtual bool | CheckHypothesis (SMESH_Mesh &aMesh, const TopoDS_Shape &aShape, SMESH_Hypothesis::Hypothesis_Status &aStatus)=0 |
| Check hypothesis definition to mesh a shape. | |
| virtual bool | Compute (SMESH_Mesh &aMesh, SMESH_MesherHelper *aHelper) |
| Computes mesh without geometry. | |
| virtual const std::list< const SMESHDS_Hypothesis * > & | GetUsedHypothesis (SMESH_Mesh &aMesh, const TopoDS_Shape &aShape, const bool ignoreAuxiliary=true) |
| Returns a list of compatible hypotheses used to mesh a shape. | |
| const list< const SMESHDS_Hypothesis * > & | GetAppliedHypothesis (SMESH_Mesh &aMesh, const TopoDS_Shape &aShape, const bool ignoreAuxiliary=true) |
| Returns a list of compatible hypotheses assigned to a shape in a mesh. | |
| bool | InitCompatibleHypoFilter (SMESH_HypoFilter &theFilter, const bool ignoreAuxiliary) const |
| Make the filter recognize only compatible hypotheses. | |
| virtual bool | SetParametersByMesh (const SMESH_Mesh *theMesh, const TopoDS_Shape &theShape) |
| Just return false as the algorithm does not hold parameters values. | |
| virtual bool | SetParametersByDefaults (const TDefaults &dflts, const SMESH_Mesh *theMesh=0) |
| SMESH_ComputeErrorPtr | GetComputeError () const |
| return compute error | |
| void | InitComputeError () |
| initialize compute error | |
| bool | OnlyUnaryInput () const |
| bool | NeedDescretBoundary () const |
| bool | NeedShape () const |
| bool | SupportSubmeshes () const |
| virtual void | SetEventListener (SMESH_subMesh *subMesh) |
| Sets event listener to submeshes if necessary. | |
| virtual void | SubmeshRestored (SMESH_subMesh *subMesh) |
| Allow algo to do something after persistent restoration. | |
Static Public Member Functions | |
| static bool | GetNodeParamOnEdge (const SMESHDS_Mesh *theMesh, const TopoDS_Edge &theEdge, std::vector< double > &theParams) |
| Fill vector of node parameters on geometrical edge, including vertex nodes. | |
| static bool | GetSortedNodesOnEdge (const SMESHDS_Mesh *theMesh, const TopoDS_Edge &theEdge, const bool ignoreMediumNodes, std::map< double, const SMDS_MeshNode * > &theNodes) |
| Fill map of node parameter on geometrical edge to node it-self. | |
| static bool | IsReversedSubMesh (const TopoDS_Face &theFace, SMESHDS_Mesh *theMeshDS) |
| Find out elements orientation on a geometrical face. | |
| static double | EdgeLength (const TopoDS_Edge &E) |
| Compute length of an edge. | |
| static bool | FaceNormal (const SMDS_MeshElement *F, gp_XYZ &normal, bool normalized=true) |
| Calculate normal of a mesh face. | |
| static GeomAbs_Shape | Continuity (TopoDS_Edge E1, TopoDS_Edge E2) |
| Return continuity of two edges. | |
| static bool | IsContinuous (const TopoDS_Edge &E1, const TopoDS_Edge &E2) |
| Return true if an edge can be considered as a continuation of another. | |
| static const SMDS_MeshNode * | VertexNode (const TopoDS_Vertex &V, const SMESHDS_Mesh *meshDS) |
| Return the node built on a vertex. | |
| static std::vector< const SMDS_MeshNode * > | GetCommonNodes (const SMDS_MeshElement *e1, const SMDS_MeshElement *e2) |
| Return nodes common to two elements. | |
Protected Member Functions | |
| bool | error (int error, const SMESH_Comment &comment="") |
| store error and comment and then return ( error == COMPERR_OK ) | |
| bool | error (const SMESH_Comment &comment="") |
| store COMPERR_ALGO_FAILED error and comment and then return false | |
| bool | error (SMESH_ComputeErrorPtr error) |
| store error and return error->IsOK() | |
| void | addBadInputElement (const SMDS_MeshElement *elem) |
| store a bad input element preventing computation, which may be a temporary one i.e. | |
Protected Attributes | |
| std::vector< std::string > | _compatibleHypothesis |
| std::list< const SMESHDS_Hypothesis * > | _appliedHypList |
| std::list< const SMESHDS_Hypothesis * > | _usedHypList |
| bool | _onlyUnaryInput |
| bool | _requireDescretBoundary |
| bool | _requireShape |
| bool | _supportSubmeshes |
| bool | _quadraticMesh |
| int | _error |
| SMESH_ComputeErrorName or anything algo specific. | |
| std::string | _comment |
| any text explaining what is wrong in Compute() | |
| std::list< const SMDS_MeshElement * > | _badInputElements |
| to explain COMPERR_BAD_INPUT_MESH | |
Computes hexahedral mesh on a box with composite sides.
The algorithm expects faces of a box to be meshed with quadrangles so that opposite box sides have equal number of quadrangles.
Definition at line 41 of file StdMeshers_CompositeHexa_3D.hxx.
| StdMeshers_CompositeHexa_3D::StdMeshers_CompositeHexa_3D | ( | int | hypId, |
| int | studyId, | ||
| SMESH_Gen * | gen | ||
| ) |
Constructor.
Definition at line 250 of file StdMeshers_CompositeHexa_3D.cxx.
:SMESH_3D_Algo(hypId, studyId, gen) { _name = "CompositeHexa_3D"; _shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID); // 1 bit /shape type }
| void SMESH_Algo::addBadInputElement | ( | const SMDS_MeshElement * | elem | ) | [protected, inherited] |
store a bad input element preventing computation, which may be a temporary one i.e.
not residing the mesh, then it will be deleted by InitComputeError()
Definition at line 674 of file SMESH_Algo.cxx.
{
if ( elem )
_badInputElements.push_back( elem );
}
| bool StdMeshers_CompositeHexa_3D::CheckHypothesis | ( | SMESH_Mesh & | aMesh, |
| const TopoDS_Shape & | aShape, | ||
| Hypothesis_Status & | aStatus | ||
| ) | [virtual] |
always return true
Definition at line 263 of file StdMeshers_CompositeHexa_3D.cxx.
References SMESH.HYP_OK.
{
aStatus = HYP_OK;
return true;
}
| virtual bool SMESH_Algo.CheckHypothesis | ( | SMESH_Mesh & | aMesh, |
| const TopoDS_Shape & | aShape, | ||
| SMESH_Hypothesis::Hypothesis_Status & | aStatus | ||
| ) | [pure virtual, inherited] |
Check hypothesis definition to mesh a shape.
| aMesh | - the mesh |
| aShape | - the shape |
| aStatus | - check result |
| bool | - true if hypothesis is well defined |
Implemented in StdMeshers_Hexa_3D, StdMeshers_Import_1D, StdMeshers_Import_1D2D, StdMeshers_MEFISTO_2D, StdMeshers_Prism_3D, StdMeshers_Projection_1D, StdMeshers_Projection_2D, StdMeshers_Projection_3D, StdMeshers_Quadrangle_2D, StdMeshers_RadialPrism_3D, StdMeshers_RadialQuadrangle_1D2D, StdMeshers_Regular_1D, StdMeshers_SegmentAroundVertex_0D, StdMeshers_UseExisting_2D, and StdMeshers_UseExisting_1D.
| virtual bool SMESH_Algo.Compute | ( | SMESH_Mesh & | aMesh, |
| SMESH_MesherHelper * | aHelper | ||
| ) | [virtual, inherited] |
Computes mesh without geometry.
| aMesh | - the mesh |
| aHelper | - helper that must be used for adding elements to |
| bool | - is a success |
The method is called if ( !aMesh->HasShapeToMesh() )
Reimplemented in StdMeshers_Hexa_3D, and StdMeshers_HexaFromSkin_3D.
| bool StdMeshers_CompositeHexa_3D::Compute | ( | SMESH_Mesh & | theMesh, |
| const TopoDS_Shape & | theShape | ||
| ) | [virtual] |
Computes hexahedral mesh on a box with composite sides.
| aMesh | - mesh to compute |
| aShape | - shape to mesh |
| bool | - succes sign |
Implements SMESH_Algo.
Definition at line 280 of file StdMeshers_CompositeHexa_3D.cxx.
References SMESH_Algo._quadraticMesh, SMESH_MesherHelper.AddNode(), SMESH_MesherHelper.AddVolume(), B_BACK, B_BOTTOM, B_FRONT, B_LEFT, B_RIGHT, B_TOP, COMPERR_BAD_SHAPE, ERR_LI, SMESH_Algo.error(), _QuadFaceGrid.FindAdjacentForSide(), _QuadFaceGrid.GetChildren(), _QuadFaceGrid.GetError(), _QuadFaceGrid.GetNbHoriSegments(), _QuadFaceGrid.GetNbVertSegments(), _QuadFaceGrid.GetNode(), _QuadFaceGrid.GetSide(), _QuadFaceGrid.GetXYZ(), SMESH_Block.ID_E00z, SMESH_Block.ID_E01z, SMESH_Block.ID_E0y0, SMESH_Block.ID_E0y1, SMESH_Block.ID_E10z, SMESH_Block.ID_E11z, SMESH_Block.ID_E1y0, SMESH_Block.ID_E1y1, SMESH_Block.ID_Ex00, SMESH_Block.ID_Ex01, SMESH_Block.ID_Ex10, SMESH_Block.ID_Ex11, SMESH_Block.ID_F0yz, SMESH_Block.ID_F1yz, SMESH_Block.ID_Fx0z, SMESH_Block.ID_Fx1z, SMESH_Block.ID_Fxy0, SMESH_Block.ID_Fxy1, SMESH_Block.ID_Shell, SMESH_Block.ID_V000, SMESH_Block.ID_V001, SMESH_Block.ID_V010, SMESH_Block.ID_V011, SMESH_Block.ID_V100, SMESH_Block.ID_V101, SMESH_Block.ID_V110, SMESH_Block.ID_V111, batchmode_smesh.Init(), _QuadFaceGrid.Init(), _QuadFaceGrid.IsComplex(), SMESH_MesherHelper.IsQuadraticSubMesh(), _QuadFaceGrid.LoadGrid(), SMDS_SetIterator< VALUE, VALUE_SET_ITERATOR, ACCESOR >.more(), SMDS_SetIterator< VALUE, VALUE_SET_ITERATOR, ACCESOR >.next(), Q_BOTTOM, Q_LEFT, Q_RIGHT, Q_TOP, _QuadFaceGrid.ReverseEdges(), _QuadFaceGrid.SetBottomSide(), SMESH_MesherHelper.SetElementsOnShape(), _QuadFaceGrid.SetID(), SMESH_Block.ShellPoint(), _Indexer.size(), ex13_hole1partial.x, and ex13_hole1partial.y.
{
SMESH_MesherHelper helper( theMesh );
_quadraticMesh = helper.IsQuadraticSubMesh( theShape );
helper.SetElementsOnShape( true );
// -------------------------
// Try to find 6 side faces
// -------------------------
vector< _QuadFaceGrid > boxFaces; boxFaces.reserve( 6 );
TopExp_Explorer exp;
int iFace, nbFaces = 0;
for ( exp.Init(theShape, TopAbs_FACE); exp.More(); exp.Next(), ++nbFaces )
{
_QuadFaceGrid f;
if ( !f.Init( TopoDS::Face( exp.Current() )))
return error (COMPERR_BAD_SHAPE);
bool isContinuous = false;
for ( int i=0; i < boxFaces.size() && !isContinuous; ++i )
isContinuous = boxFaces[ i ].AddContinuousFace( f );
if ( !isContinuous )
boxFaces.push_back( f );
}
// Check what we have
if ( boxFaces.size() != 6 && nbFaces != 6)
return error
(COMPERR_BAD_SHAPE,
SMESH_Comment("Can't find 6 sides of a box. Number of found sides - ")<<boxFaces.size());
if ( boxFaces.size() != 6 && nbFaces == 6 ) { // strange ordinary box with continuous faces
boxFaces.resize( 6 );
iFace = 0;
for ( exp.Init(theShape, TopAbs_FACE); exp.More(); exp.Next(), ++iFace )
boxFaces[ iFace ].Init( TopoDS::Face( exp.Current() ) );
}
// ----------------------------------------
// Find out position of faces within a box
// ----------------------------------------
_QuadFaceGrid *fBottom, *fTop, *fFront, *fBack, *fLeft, *fRight;
// start from a bottom face
fBottom = &boxFaces[0];
// find vertical faces
fFront = fBottom->FindAdjacentForSide( Q_BOTTOM, boxFaces );
fLeft = fBottom->FindAdjacentForSide( Q_RIGHT, boxFaces );
fBack = fBottom->FindAdjacentForSide( Q_TOP, boxFaces );
fRight = fBottom->FindAdjacentForSide( Q_LEFT, boxFaces );
// check the found
if ( !fFront || !fBack || !fLeft || !fRight )
return error(COMPERR_BAD_SHAPE);
// top face
fTop = 0;
for ( int i=1; i < boxFaces.size() && !fTop; ++i ) {
fTop = & boxFaces[ i ];
if ( fTop==fFront || fTop==fLeft || fTop==fBack || fTop==fRight )
fTop = 0;
}
// set bottom of the top side
if ( !fTop->SetBottomSide( fFront->GetSide( Q_TOP ) )) {
if ( !fFront->IsComplex() )
return error( ERR_LI("Error in StdMeshers_CompositeHexa_3D::Compute()"));
else {
_QuadFaceGrid::TChildIterator chIt = fFront->GetChildren();
while ( chIt.more() ) {
const _QuadFaceGrid& frontChild = chIt.next();
if ( fTop->SetBottomSide( frontChild.GetSide( Q_TOP )))
break;
}
}
}
if ( !fTop )
return error(COMPERR_BAD_SHAPE);
fBottom->SetID( B_BOTTOM );
fBack ->SetID( B_BACK );
fLeft ->SetID( B_LEFT );
fFront ->SetID( B_FRONT );
fRight ->SetID( B_RIGHT );
fTop ->SetID( B_TOP );
// orient bottom egde of faces along axes of the unit box
fBottom->ReverseEdges();
fBack ->ReverseEdges();
fLeft ->ReverseEdges();
// ------------------------------------------
// Fill columns of nodes with existing nodes
// ------------------------------------------
// let faces load their grids
if ( !fBottom->LoadGrid( theMesh )) return error( fBottom->GetError() );
if ( !fBack ->LoadGrid( theMesh )) return error( fBack ->GetError() );
if ( !fLeft ->LoadGrid( theMesh )) return error( fLeft ->GetError() );
if ( !fFront ->LoadGrid( theMesh )) return error( fFront ->GetError() );
if ( !fRight ->LoadGrid( theMesh )) return error( fRight ->GetError() );
if ( !fTop ->LoadGrid( theMesh )) return error( fTop ->GetError() );
int x, xSize = fBottom->GetNbHoriSegments(theMesh) + 1, X = xSize - 1;
int y, ySize = fBottom->GetNbVertSegments(theMesh) + 1, Y = ySize - 1;
int z, zSize = fFront ->GetNbVertSegments(theMesh) + 1, Z = zSize - 1;
_Indexer colIndex( xSize, ySize );
vector< vector< const SMDS_MeshNode* > > columns( colIndex.size() );
// fill node columns by front and back box sides
for ( x = 0; x < xSize; ++x ) {
vector< const SMDS_MeshNode* >& column0 = columns[ colIndex( x, 0 )];
vector< const SMDS_MeshNode* >& column1 = columns[ colIndex( x, Y )];
column0.resize( zSize );
column1.resize( zSize );
for ( z = 0; z < zSize; ++z ) {
column0[ z ] = fFront->GetNode( x, z );
column1[ z ] = fBack ->GetNode( x, z );
}
}
// fill node columns by left and right box sides
for ( y = 1; y < ySize-1; ++y ) {
vector< const SMDS_MeshNode* >& column0 = columns[ colIndex( 0, y )];
vector< const SMDS_MeshNode* >& column1 = columns[ colIndex( X, y )];
column0.resize( zSize );
column1.resize( zSize );
for ( z = 0; z < zSize; ++z ) {
column0[ z ] = fLeft ->GetNode( y, z );
column1[ z ] = fRight->GetNode( y, z );
}
}
// get nodes from top and bottom box sides
for ( x = 1; x < xSize-1; ++x ) {
for ( y = 1; y < ySize-1; ++y ) {
vector< const SMDS_MeshNode* >& column = columns[ colIndex( x, y )];
column.resize( zSize );
column.front() = fBottom->GetNode( x, y );
column.back() = fTop ->GetNode( x, y );
}
}
// ----------------------------
// Add internal nodes of a box
// ----------------------------
// projection points of internal nodes on box subshapes by which
// coordinates of internal nodes are computed
vector<gp_XYZ> pointsOnShapes( SMESH_Block::ID_Shell );
// projections on vertices are constant
pointsOnShapes[ SMESH_Block::ID_V000 ] = fBottom->GetXYZ( 0, 0 );
pointsOnShapes[ SMESH_Block::ID_V100 ] = fBottom->GetXYZ( X, 0 );
pointsOnShapes[ SMESH_Block::ID_V010 ] = fBottom->GetXYZ( 0, Y );
pointsOnShapes[ SMESH_Block::ID_V110 ] = fBottom->GetXYZ( X, Y );
pointsOnShapes[ SMESH_Block::ID_V001 ] = fTop->GetXYZ( 0, 0 );
pointsOnShapes[ SMESH_Block::ID_V101 ] = fTop->GetXYZ( X, 0 );
pointsOnShapes[ SMESH_Block::ID_V011 ] = fTop->GetXYZ( 0, Y );
pointsOnShapes[ SMESH_Block::ID_V111 ] = fTop->GetXYZ( X, Y );
for ( x = 1; x < xSize-1; ++x )
{
gp_XYZ params; // normalized parameters of internal node within a unit box
params.SetCoord( 1, x / double(X) );
for ( y = 1; y < ySize-1; ++y )
{
params.SetCoord( 2, y / double(Y) );
// column to fill during z loop
vector< const SMDS_MeshNode* >& column = columns[ colIndex( x, y )];
// points projections on horizontal edges
pointsOnShapes[ SMESH_Block::ID_Ex00 ] = fBottom->GetXYZ( x, 0 );
pointsOnShapes[ SMESH_Block::ID_Ex10 ] = fBottom->GetXYZ( x, Y );
pointsOnShapes[ SMESH_Block::ID_E0y0 ] = fBottom->GetXYZ( 0, y );
pointsOnShapes[ SMESH_Block::ID_E1y0 ] = fBottom->GetXYZ( X, y );
pointsOnShapes[ SMESH_Block::ID_Ex01 ] = fTop->GetXYZ( x, 0 );
pointsOnShapes[ SMESH_Block::ID_Ex11 ] = fTop->GetXYZ( x, Y );
pointsOnShapes[ SMESH_Block::ID_E0y1 ] = fTop->GetXYZ( 0, y );
pointsOnShapes[ SMESH_Block::ID_E1y1 ] = fTop->GetXYZ( X, y );
// points projections on horizontal faces
pointsOnShapes[ SMESH_Block::ID_Fxy0 ] = fBottom->GetXYZ( x, y );
pointsOnShapes[ SMESH_Block::ID_Fxy1 ] = fTop ->GetXYZ( x, y );
for ( z = 1; z < zSize-1; ++z ) // z loop
{
params.SetCoord( 3, z / double(Z) );
// point projections on vertical edges
pointsOnShapes[ SMESH_Block::ID_E00z ] = fFront->GetXYZ( 0, z );
pointsOnShapes[ SMESH_Block::ID_E10z ] = fFront->GetXYZ( X, z );
pointsOnShapes[ SMESH_Block::ID_E01z ] = fBack->GetXYZ( 0, z );
pointsOnShapes[ SMESH_Block::ID_E11z ] = fBack->GetXYZ( X, z );
// point projections on vertical faces
pointsOnShapes[ SMESH_Block::ID_Fx0z ] = fFront->GetXYZ( x, z );
pointsOnShapes[ SMESH_Block::ID_Fx1z ] = fBack ->GetXYZ( x, z );
pointsOnShapes[ SMESH_Block::ID_F0yz ] = fLeft ->GetXYZ( y, z );
pointsOnShapes[ SMESH_Block::ID_F1yz ] = fRight->GetXYZ( y, z );
// compute internal node coordinates
gp_XYZ coords;
SMESH_Block::ShellPoint( params, pointsOnShapes, coords );
column[ z ] = helper.AddNode( coords.X(), coords.Y(), coords.Z() );
#ifdef DEB_GRID
// debug
//cout << "----------------------------------------------------------------------"<<endl;
//for ( int id = SMESH_Block::ID_V000; id < SMESH_Block::ID_Shell; ++id)
//{
// gp_XYZ p = pointsOnShapes[ id ];
// SMESH_Block::DumpShapeID( id,cout)<<" ( "<<p.X()<<", "<<p.Y()<<", "<<p.Z()<<" )"<<endl;
//}
//cout << "Params: ( "<< params.X()<<", "<<params.Y()<<", "<<params.Z()<<" )"<<endl;
//cout << "coords: ( "<< coords.X()<<", "<<coords.Y()<<", "<<coords.Z()<<" )"<<endl;
#endif
}
}
}
// faces no more needed, free memory
boxFaces.clear();
// ----------------
// Add hexahedrons
// ----------------
for ( x = 0; x < xSize-1; ++x ) {
for ( y = 0; y < ySize-1; ++y ) {
vector< const SMDS_MeshNode* >& col00 = columns[ colIndex( x, y )];
vector< const SMDS_MeshNode* >& col10 = columns[ colIndex( x+1, y )];
vector< const SMDS_MeshNode* >& col01 = columns[ colIndex( x, y+1 )];
vector< const SMDS_MeshNode* >& col11 = columns[ colIndex( x+1, y+1 )];
for ( z = 0; z < zSize-1; ++z )
{
// bottom face normal of a hexa mush point outside the volume
helper.AddVolume(col00[z], col01[z], col11[z], col10[z],
col00[z+1], col01[z+1], col11[z+1], col10[z+1]);
}
}
}
return true;
}
| GeomAbs_Shape SMESH_Algo::Continuity | ( | TopoDS_Edge | E1, |
| TopoDS_Edge | E2 | ||
| ) | [static, inherited] |
Return continuity of two edges.
| E1 | - the 1st edge |
| E2 | - the 2nd edge |
| GeomAbs_Shape | - regularity at the junction between E1 and E2 |
Definition at line 494 of file SMESH_Algo.cxx.
References SMESH_AdvancedEditor.tol.
{
//E1.Orientation(TopAbs_FORWARD), E2.Orientation(TopAbs_FORWARD); // avoid pb with internal edges
if (E1.Orientation() > TopAbs_REVERSED) // INTERNAL
E1.Orientation( TopAbs_FORWARD );
if (E2.Orientation() > TopAbs_REVERSED) // INTERNAL
E2.Orientation( TopAbs_FORWARD );
TopoDS_Vertex V = TopExp::LastVertex (E1, true);
if ( !V.IsSame( TopExp::FirstVertex(E2, true )))
if ( !TopExp::CommonVertex( E1, E2, V ))
return GeomAbs_C0;
Standard_Real u1 = BRep_Tool::Parameter( V, E1 );
Standard_Real u2 = BRep_Tool::Parameter( V, E2 );
BRepAdaptor_Curve C1( E1 ), C2( E2 );
Standard_Real tol = BRep_Tool::Tolerance( V );
Standard_Real angTol = 2e-3;
try {
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
OCC_CATCH_SIGNALS;
#endif
return BRepLProp::Continuity(C1, C2, u1, u2, tol, angTol);
}
catch (Standard_Failure) {
}
return GeomAbs_C0;
}
| double SMESH_Algo::EdgeLength | ( | const TopoDS_Edge & | E | ) | [static, inherited] |
Compute length of an edge.
| E | - the edge |
| double | - the length |
Definition at line 167 of file SMESH_Algo.cxx.
References Handle().
Referenced by StdMeshers_PrismAsBlock.Init().
{
double UMin = 0, UMax = 0;
if (BRep_Tool::Degenerated(E))
return 0;
TopLoc_Location L;
Handle(Geom_Curve) C = BRep_Tool::Curve(E, L, UMin, UMax);
GeomAdaptor_Curve AdaptCurve(C, UMin, UMax); //range is important for periodic curves
double length = GCPnts_AbscissaPoint::Length(AdaptCurve, UMin, UMax);
return length;
}
| bool SMESH_Algo.error | ( | const SMESH_Comment & | comment = "" | ) | [protected, inherited] |
store COMPERR_ALGO_FAILED error and comment and then return false
Definition at line 340 of file SMESH_Algo.hxx.
References COMPERR_ALGO_FAILED, and SMESH_Algo.error().
Referenced by SMESH_Algo.error().
{ return error(COMPERR_ALGO_FAILED, comment); }
| bool SMESH_Algo::error | ( | SMESH_ComputeErrorPtr | error | ) | [protected, inherited] |
store error and return error->IsOK()
store error and return ( error == COMPERR_OK )
Definition at line 623 of file SMESH_Algo.cxx.
| bool SMESH_Algo.error | ( | int | error, |
| const SMESH_Comment & | comment = "" |
||
| ) | [protected, inherited] |
store error and comment and then return ( error == COMPERR_OK )
Referenced by StdMeshers_Projection_3D.Compute(), StdMeshers_HexaFromSkin_3D.Compute(), Compute(), StdMeshers_Projection_3D.Evaluate(), and StdMeshers_HexaFromSkin_3D.Evaluate().
| bool StdMeshers_CompositeHexa_3D::Evaluate | ( | SMESH_Mesh & | aMesh, |
| const TopoDS_Shape & | aShape, | ||
| MapShapeNbElems & | aResMap | ||
| ) | [virtual] |
Evaluate.
Implements SMESH_Algo.
Definition at line 540 of file StdMeshers_CompositeHexa_3D.cxx.
References SMESH_Algo._quadraticMesh, _QuadFaceGrid.FindAdjacentForSide(), _QuadFaceGrid.GetChildren(), _QuadFaceGrid.GetFace(), GetNb2d(), _QuadFaceGrid.GetSide(), SMESH_Mesh.GetSubMesh(), batchmode_smesh.Init(), _QuadFaceGrid.Init(), _QuadFaceGrid.IsComplex(), SMESH_MesherHelper.IsQuadraticSubMesh(), Max(), SMDS_SetIterator< VALUE, VALUE_SET_ITERATOR, ACCESOR >.more(), SMDS_SetIterator< VALUE, VALUE_SET_ITERATOR, ACCESOR >.next(), Q_BOTTOM, Q_LEFT, Q_RIGHT, Q_TOP, _QuadFaceGrid.SetBottomSide(), SMDSEntity_Edge, SMDSEntity_Hexa, SMDSEntity_Last, SMDSEntity_Node, SMDSEntity_Penta, SMDSEntity_Quad_Edge, SMDSEntity_Quad_Hexa, SMDSEntity_Quad_Penta, SMDSEntity_Quad_Quadrangle, SMDSEntity_Quad_Triangle, SMDSEntity_Quadrangle, and SMDSEntity_Triangle.
{
SMESH_MesherHelper aTool(theMesh);
bool _quadraticMesh = aTool.IsQuadraticSubMesh(theShape);
// -------------------------
// Try to find 6 side faces
// -------------------------
vector< _QuadFaceGrid > boxFaces; boxFaces.reserve( 6 );
TopExp_Explorer exp;
int iFace, nbFaces = 0;
for ( exp.Init(theShape, TopAbs_FACE); exp.More(); exp.Next(), ++nbFaces )
{
_QuadFaceGrid f;
if ( !f.Init( TopoDS::Face( exp.Current() )))
//return error (COMPERR_BAD_SHAPE);
return false;
bool isContinuous = false;
for ( int i=0; i < boxFaces.size() && !isContinuous; ++i )
isContinuous = boxFaces[ i ].AddContinuousFace( f );
if ( !isContinuous )
boxFaces.push_back( f );
}
// Check what we have
if ( boxFaces.size() != 6 && nbFaces != 6)
//return error
// (COMPERR_BAD_SHAPE,
// SMESH_Comment("Can't find 6 sides of a box. Number of found sides - ")<<boxFaces.size());
return false;
if ( boxFaces.size() != 6 && nbFaces == 6 ) { // strange ordinary box with continuous faces
boxFaces.resize( 6 );
iFace = 0;
for ( exp.Init(theShape, TopAbs_FACE); exp.More(); exp.Next(), ++iFace )
boxFaces[ iFace ].Init( TopoDS::Face( exp.Current() ) );
}
// ----------------------------------------
// Find out position of faces within a box
// ----------------------------------------
_QuadFaceGrid *fBottom, *fTop, *fFront, *fBack, *fLeft, *fRight;
// start from a bottom face
fBottom = &boxFaces[0];
// find vertical faces
fFront = fBottom->FindAdjacentForSide( Q_BOTTOM, boxFaces );
fLeft = fBottom->FindAdjacentForSide( Q_RIGHT, boxFaces );
fBack = fBottom->FindAdjacentForSide( Q_TOP, boxFaces );
fRight = fBottom->FindAdjacentForSide( Q_LEFT, boxFaces );
// check the found
if ( !fFront || !fBack || !fLeft || !fRight )
//return error(COMPERR_BAD_SHAPE);
return false;
// top face
fTop = 0;
int i = 1;
for(; i < boxFaces.size() && !fTop; ++i ) {
fTop = & boxFaces[ i ];
if ( fTop==fFront || fTop==fLeft || fTop==fBack || fTop==fRight )
fTop = 0;
}
// set bottom of the top side
if ( !fTop->SetBottomSide( fFront->GetSide( Q_TOP ) )) {
if ( !fFront->IsComplex() )
//return error( ERR_LI("Error in StdMeshers_CompositeHexa_3D::Compute()"));
return false;
else {
_QuadFaceGrid::TChildIterator chIt = fFront->GetChildren();
while ( chIt.more() ) {
const _QuadFaceGrid& frontChild = chIt.next();
if ( fTop->SetBottomSide( frontChild.GetSide( Q_TOP )))
break;
}
}
}
if ( !fTop )
//return error(COMPERR_BAD_SHAPE);
return false;
TopTools_SequenceOfShape BottomFaces;
_QuadFaceGrid::TChildIterator aCI = fBottom->GetChildren();
while( aCI.more() ) {
const _QuadFaceGrid& currChild = aCI.next();
BottomFaces.Append(currChild.GetFace());
}
// find boundary edges and internal nodes for bottom face
TopTools_SequenceOfShape BndEdges;
int nb0d_in = 0;
//TopTools_MapOfShape BndEdges;
for(i=1; i<=BottomFaces.Length(); i++) {
for (TopExp_Explorer exp(BottomFaces.Value(i), TopAbs_EDGE); exp.More(); exp.Next()) {
int nb0 = 0;
SMESH_subMesh *sm = theMesh.GetSubMesh(exp.Current());
if( sm ) {
MapShapeNbElemsItr anIt = aResMap.find(sm);
if( anIt == aResMap.end() ) continue;
std::vector<int> aVec = (*anIt).second;
nb0 = aVec[SMDSEntity_Node];
}
int j = 1;
for(; j<=BndEdges.Length(); j++) {
if( BndEdges.Value(j) == exp.Current() ) {
// internal edge => remove it
BndEdges.Remove(j);
nb0d_in += nb0;
break;
}
}
if( j > BndEdges.Length() ) {
BndEdges.Append(exp.Current());
}
//if( BndEdges.Contains(exp.Current()) ) {
//BndEdges.Remove( exp.Current() );
//}
//else {
//BndEdges.Add( exp.Current() );
//}
}
}
// find number of 1d elems for bottom face
int nb1d = 0;
for(i=1; i<=BndEdges.Length(); i++) {
SMESH_subMesh *sm = theMesh.GetSubMesh(BndEdges.Value(i));
if( sm ) {
MapShapeNbElemsItr anIt = aResMap.find(sm);
if( anIt == aResMap.end() ) continue;
std::vector<int> aVec = (*anIt).second;
nb1d += Max(aVec[SMDSEntity_Edge],aVec[SMDSEntity_Quad_Edge]);
}
}
// find number of 2d elems on side faces
int nb2d = 0;
nb2d += GetNb2d(fFront, theMesh, aResMap);
nb2d += GetNb2d(fRight, theMesh, aResMap);
nb2d += GetNb2d(fBack, theMesh, aResMap);
nb2d += GetNb2d(fLeft, theMesh, aResMap);
// find number of 2d elems and nodes on bottom faces
int nb0d=0, nb2d_3=0, nb2d_4=0;
for(i=1; i<=BottomFaces.Length(); i++) {
SMESH_subMesh *sm = theMesh.GetSubMesh(BottomFaces.Value(i));
if( sm ) {
MapShapeNbElemsItr anIt = aResMap.find(sm);
if( anIt == aResMap.end() ) continue;
std::vector<int> aVec = (*anIt).second;
nb0d += aVec[SMDSEntity_Node];
nb2d_3 += Max(aVec[SMDSEntity_Triangle], aVec[SMDSEntity_Quad_Triangle]);
nb2d_4 += Max(aVec[SMDSEntity_Quadrangle], aVec[SMDSEntity_Quad_Quadrangle]);
}
}
nb0d += nb0d_in;
std::vector<int> aResVec(SMDSEntity_Last);
for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aResVec[i] = 0;
if(_quadraticMesh) {
aResVec[SMDSEntity_Quad_Penta] = nb2d_3 * ( nb2d/nb1d );
aResVec[SMDSEntity_Quad_Hexa] = nb2d_4 * ( nb2d/nb1d );
aResVec[SMDSEntity_Node] = nb0d * ( 2*nb2d/nb1d - 1 );
}
else {
aResVec[SMDSEntity_Node] = nb0d * ( nb2d/nb1d - 1 );
aResVec[SMDSEntity_Penta] = nb2d_3 * ( nb2d/nb1d );
aResVec[SMDSEntity_Hexa] = nb2d_4 * ( nb2d/nb1d );
}
SMESH_subMesh * sm = theMesh.GetSubMesh(theShape);
aResMap.insert(std::make_pair(sm,aResVec));
return true;
}
| bool SMESH_Algo::FaceNormal | ( | const SMDS_MeshElement * | F, |
| gp_XYZ & | normal, | ||
| bool | normalized = true |
||
| ) | [static, inherited] |
Calculate normal of a mesh face.
Definition at line 185 of file SMESH_Algo.cxx.
References SMDS_MeshElement.GetNode(), SMDS_MeshElement.GetType(), SMDS_MeshElement.IsQuadratic(), SMDS_MeshElement.NbNodes(), ex29_refine.node(), SMDSAbs_Face, SMDS_MeshNode.X(), SMDS_MeshNode.Y(), and SMDS_MeshNode.Z().
Referenced by SMESH_ElementSearcherImpl.findOuterBoundary(), and SMESH_ElementSearcherImpl.GetPointState().
{
if ( !F || F->GetType() != SMDSAbs_Face )
return false;
normal.SetCoord(0,0,0);
int nbNodes = F->IsQuadratic() ? F->NbNodes()/2 : F->NbNodes();
for ( int i = 0; i < nbNodes-2; ++i )
{
gp_XYZ p[3];
for ( int n = 0; n < 3; ++n )
{
const SMDS_MeshNode* node = F->GetNode( i + n );
p[n].SetCoord( node->X(), node->Y(), node->Z() );
}
normal += ( p[2] - p[1] ) ^ ( p[0] - p[1] );
}
double size2 = normal.SquareModulus();
bool ok = ( size2 > numeric_limits<double>::min() * numeric_limits<double>::min());
if ( normalized && ok )
normal /= sqrt( size2 );
return ok;
}
| const list< const SMESHDS_Hypothesis * > & SMESH_Algo::GetAppliedHypothesis | ( | SMESH_Mesh & | aMesh, |
| const TopoDS_Shape & | aShape, | ||
| const bool | ignoreAuxiliary = true |
||
| ) | [inherited] |
Returns a list of compatible hypotheses assigned to a shape in a mesh.
List the relevant hypothesis associated to the shape.
| aMesh | - the mesh |
| aShape | - the shape |
| ignoreAuxiliary | - do not include auxiliary hypotheses in the list |
| const | std.list <const SMESHDS_Hypothesis*> - hypotheses list |
List the relevant hypothesis associated to the shape. Relevant hypothesis have a name (type) listed in the algorithm. Hypothesis associated to father shape -are not- taken into account (see GetUsedHypothesis)
Relevant hypothesis have a name (type) listed in the algorithm. Hypothesis associated to father shape -are not- taken into account (see GetUsedHypothesis)
Definition at line 149 of file SMESH_Algo.cxx.
{
_appliedHypList.clear();
SMESH_HypoFilter filter;
if ( InitCompatibleHypoFilter( filter, ignoreAuxiliary ))
aMesh.GetHypotheses( aShape, filter, _appliedHypList, false );
return _appliedHypList;
}
| vector< const SMDS_MeshNode * > SMESH_Algo::GetCommonNodes | ( | const SMDS_MeshElement * | e1, |
| const SMDS_MeshElement * | e2 | ||
| ) | [static, inherited] |
Return nodes common to two elements.
Definition at line 547 of file SMESH_Algo.cxx.
References SMDS_MeshElement.GetNode(), SMDS_MeshElement.GetNodeIndex(), and SMDS_MeshElement.NbNodes().
Referenced by StdMeshers_QuadToTriaAdaptor.Compute2ndPart(), SMESH_MeshEditor.ConvertFromQuadratic(), and SMESH_ElementSearcherImpl.GetPointState().
{
vector< const SMDS_MeshNode*> common;
for ( int i = 0 ; i < e1->NbNodes(); ++i )
if ( e2->GetNodeIndex( e1->GetNode( i )) >= 0 )
common.push_back( e1->GetNode( i ));
return common;
}
| const std::vector< std::string >& SMESH_Algo.GetCompatibleHypothesis | ( | ) | [inherited] |
Returns all types of compatible hypotheses.
| SMESH_ComputeErrorPtr SMESH_Algo.GetComputeError | ( | ) | const [inherited] |
return compute error
Referenced by StdMeshers_Hexa_3D.Compute().
| bool SMESH_Algo::GetNodeParamOnEdge | ( | const SMESHDS_Mesh * | theMesh, |
| const TopoDS_Edge & | theEdge, | ||
| std::vector< double > & | theParams | ||
| ) | [static, inherited] |
Fill vector of node parameters on geometrical edge, including vertex nodes.
| theMesh | - The mesh containing nodes |
| theEdge | - The geometrical edge of interest |
| theParams | - The resulting vector of sorted node parameters |
| bool | - false if not all parameters are OK |
Definition at line 343 of file SMESH_Algo.cxx.
References SMESHDS_SubMesh.GetElements(), SMESHDS_SubMesh.GetNodes(), SMDS_MeshNode.GetPosition(), SMDS_Position.GetTypeOfPosition(), SMDS_EdgePosition.GetUParameter(), SMESHDS_Mesh.MeshElements(), ex29_refine.node(), and SMDS_TOP_EDGE.
Referenced by StdMeshers_Arithmetic1D.SetParametersByMesh().
{
theParams.clear();
if ( !theMesh || theEdge.IsNull() )
return false;
SMESHDS_SubMesh * eSubMesh = theMesh->MeshElements( theEdge );
if ( !eSubMesh || !eSubMesh->GetElements()->more() )
return false; // edge is not meshed
//int nbEdgeNodes = 0;
set < double > paramSet;
if ( eSubMesh )
{
// loop on nodes of an edge: sort them by param on edge
SMDS_NodeIteratorPtr nIt = eSubMesh->GetNodes();
while ( nIt->more() )
{
const SMDS_MeshNode* node = nIt->next();
const SMDS_PositionPtr& pos = node->GetPosition();
if ( pos->GetTypeOfPosition() != SMDS_TOP_EDGE )
return false;
const SMDS_EdgePosition* epos =
static_cast<const SMDS_EdgePosition*>(node->GetPosition());
if ( !paramSet.insert( epos->GetUParameter() ).second )
return false; // equal parameters
}
}
// add vertex nodes params
TopoDS_Vertex V1,V2;
TopExp::Vertices( theEdge, V1, V2);
if ( VertexNode( V1, theMesh ) &&
!paramSet.insert( BRep_Tool::Parameter(V1,theEdge) ).second )
return false; // there are equal parameters
if ( VertexNode( V2, theMesh ) &&
!paramSet.insert( BRep_Tool::Parameter(V2,theEdge) ).second )
return false; // there are equal parameters
// fill the vector
theParams.resize( paramSet.size() );
set < double >::iterator par = paramSet.begin();
vector< double >::iterator vecPar = theParams.begin();
for ( ; par != paramSet.end(); ++par, ++vecPar )
*vecPar = *par;
return theParams.size() > 1;
}
| bool SMESH_Algo::GetSortedNodesOnEdge | ( | const SMESHDS_Mesh * | theMesh, |
| const TopoDS_Edge & | theEdge, | ||
| const bool | ignoreMediumNodes, | ||
| std::map< double, const SMDS_MeshNode * > & | theNodes | ||
| ) | [static, inherited] |
Fill map of node parameter on geometrical edge to node it-self.
Fill vector of node parameters on geometrical edge, including vertex nodes.
| theMesh | - The mesh containing nodes |
| theEdge | - The geometrical edge of interest |
| theNodes | - The resulting map |
| ignoreMediumNodes | - to store medium nodes of quadratic elements or not |
| bool | - false if not all parameters are OK |
| theMesh | - The mesh containing nodes |
| theEdge | - The geometrical edge of interest |
| theParams | - The resulting vector of sorted node parameters |
| bool | - false if not all parameters are OK |
Definition at line 404 of file SMESH_Algo.cxx.
References SMESHDS_SubMesh.GetElements(), SMDS_MeshNode.GetInverseElementIterator(), SMESHDS_SubMesh.GetNodes(), SMDS_MeshNode.GetPosition(), SMDS_Position.GetTypeOfPosition(), SMDS_EdgePosition.GetUParameter(), SMESHDS_Mesh.MeshElements(), SMESH_AdvancedEditor.n1, SMESH_AdvancedEditor.n2, ex29_refine.node(), and SMDS_TOP_EDGE.
Referenced by VISCOUS._ViscousBuilder.addBoundaryElements(), SMESH_MesherHelper.LoadNodeColumns(), and _FaceSide.StoreNodes().
{
theNodes.clear();
if ( !theMesh || theEdge.IsNull() )
return false;
SMESHDS_SubMesh * eSubMesh = theMesh->MeshElements( theEdge );
if ( !eSubMesh || !eSubMesh->GetElements()->more() )
return false; // edge is not meshed
int nbNodes = 0;
set < double > paramSet;
if ( eSubMesh )
{
// loop on nodes of an edge: sort them by param on edge
SMDS_NodeIteratorPtr nIt = eSubMesh->GetNodes();
while ( nIt->more() )
{
const SMDS_MeshNode* node = nIt->next();
if ( ignoreMediumNodes ) {
SMDS_ElemIteratorPtr elemIt = node->GetInverseElementIterator();
if ( elemIt->more() && elemIt->next()->IsMediumNode( node ))
continue;
}
const SMDS_PositionPtr& pos = node->GetPosition();
if ( pos->GetTypeOfPosition() != SMDS_TOP_EDGE )
return false;
const SMDS_EdgePosition* epos =
static_cast<const SMDS_EdgePosition*>(node->GetPosition());
theNodes.insert( make_pair( epos->GetUParameter(), node ));
//MESSAGE("U " << epos->GetUParameter() << " ID " << node->GetID());
++nbNodes;
}
}
// add vertex nodes
TopoDS_Vertex v1, v2;
TopExp::Vertices(theEdge, v1, v2);
const SMDS_MeshNode* n1 = VertexNode( v1, (SMESHDS_Mesh*) theMesh );
const SMDS_MeshNode* n2 = VertexNode( v2, (SMESHDS_Mesh*) theMesh );
//MESSAGE("Vertices ID " << n1->GetID() << " " << n2->GetID());
Standard_Real f, l;
BRep_Tool::Range(theEdge, f, l);
if ( v1.Orientation() != TopAbs_FORWARD )
std::swap( f, l );
if ( n1 && ++nbNodes )
theNodes.insert( make_pair( f, n1 ));
if ( n2 && ++nbNodes )
theNodes.insert( make_pair( l, n2 ));
return theNodes.size() == nbNodes;
}
| virtual const std::list<const SMESHDS_Hypothesis *>& SMESH_Algo.GetUsedHypothesis | ( | SMESH_Mesh & | aMesh, |
| const TopoDS_Shape & | aShape, | ||
| const bool | ignoreAuxiliary = true |
||
| ) | [virtual, inherited] |
Returns a list of compatible hypotheses used to mesh a shape.
| aMesh | - the mesh |
| aShape | - the shape |
| ignoreAuxiliary | - do not include auxiliary hypotheses in the list |
| const | std.list <const SMESHDS_Hypothesis*> - hypotheses list |
List the hypothesis used by the algorithm associated to the shape. Hypothesis associated to father shape -are- taken into account (see GetAppliedHypothesis). Relevant hypothesis have a name (type) listed in the algorithm. This method could be surcharged by specific algorithms, in case of several hypothesis simultaneously applicable.
Reimplemented in StdMeshers_Regular_1D.
Referenced by StdMeshers_SegmentAroundVertex_0D.CheckHypothesis(), and StdMeshers_Projection_3D.CheckHypothesis().
| bool SMESH_Algo::InitCompatibleHypoFilter | ( | SMESH_HypoFilter & | theFilter, |
| const bool | ignoreAuxiliary | ||
| ) | const [inherited] |
Make the filter recognize only compatible hypotheses.
Make filter recognize only compatible hypotheses.
| theFilter | - the filter to initialize |
| ignoreAuxiliary | - make filter ignore compatible auxiliary hypotheses |
| bool | - true if the algo has compatible hypotheses |
| theFilter | - the filter to initialize |
| ignoreAuxiliary | - make filter ignore compatible auxiliary hypotheses |
Definition at line 468 of file SMESH_Algo.cxx.
References SMESH_HypoFilter.AndNot(), SMESH_HypoFilter.HasName(), SMESH_HypoFilter.Init(), SMESH_HypoFilter.IsAuxiliary(), and SMESH_HypoFilter.Or().
{
if ( !_compatibleHypothesis.empty() )
{
theFilter.Init( theFilter.HasName( _compatibleHypothesis[0] ));
for ( int i = 1; i < _compatibleHypothesis.size(); ++i )
theFilter.Or( theFilter.HasName( _compatibleHypothesis[ i ] ));
if ( ignoreAuxiliary )
theFilter.AndNot( theFilter.IsAuxiliary() );
return true;
}
return false;
}
| void SMESH_Algo::InitComputeError | ( | ) | [inherited] |
initialize compute error
Definition at line 655 of file SMESH_Algo.cxx.
References COMPERR_OK.
Referenced by StdMeshers_Hexa_3D.Compute().
{
_error = COMPERR_OK;
_comment.clear();
list<const SMDS_MeshElement*>::iterator elem = _badInputElements.begin();
for ( ; elem != _badInputElements.end(); ++elem )
if ( (*elem)->GetID() < 1 )
delete *elem;
_badInputElements.clear();
}
| static bool SMESH_Algo.IsContinuous | ( | const TopoDS_Edge & | E1, |
| const TopoDS_Edge & | E2 | ||
| ) | [static, inherited] |
Return true if an edge can be considered as a continuation of another.
Definition at line 313 of file SMESH_Algo.hxx.
Referenced by StdMeshers_Quadrangle_2D.CheckNbEdges(), StdMeshers_Quadrangle_2D.CheckNbEdgesForEvaluate(), and _QuadFaceGrid.Init().
{
return ( Continuity( E1, E2 ) >= GeomAbs_G1 );
}
| bool SMESH_Algo::IsReversedSubMesh | ( | const TopoDS_Face & | theFace, |
| SMESHDS_Mesh * | theMeshDS | ||
| ) | [static, inherited] |
Find out elements orientation on a geometrical face.
| theFace | - The face correctly oriented in the shape being meshed |
| theMeshDS | - The mesh data structure |
| bool | - true if the face normal and the normal of first element in the correspoding submesh point in different directions |
Definition at line 220 of file SMESH_Algo.cxx.
References SMESHDS_SubMesh.GetElements(), SMDS_MeshNode.GetPosition(), SMDS_MeshElement.getshapeId(), SMDS_Position.GetTypeOfPosition(), SMDS_FacePosition.GetUParameter(), SMDS_FacePosition.GetVParameter(), Handle(), SMESHDS_Mesh.IndexToShape(), SMESHDS_Mesh.MeshElements(), SMDS_MeshElement.NbNodes(), ex29_refine.node(), SMDS_MeshElement.nodesIterator(), SMESHDS_Mesh.ShapeToIndex(), SMDS_TOP_FACE, SMDS_TOP_VERTEX, SMDS_MeshNode.X(), SMDS_MeshNode.Y(), and SMDS_MeshNode.Z().
Referenced by StdMeshers_QuadToTriaAdaptor.Compute(), and VISCOUS._ViscousBuilder.findFacesWithLayers().
{
if ( theFace.IsNull() || !theMeshDS )
return false;
// find out orientation of a meshed face
int faceID = theMeshDS->ShapeToIndex( theFace );
TopoDS_Shape aMeshedFace = theMeshDS->IndexToShape( faceID );
bool isReversed = ( theFace.Orientation() != aMeshedFace.Orientation() );
const SMESHDS_SubMesh * aSubMeshDSFace = theMeshDS->MeshElements( faceID );
if ( !aSubMeshDSFace )
return isReversed;
// find element with node located on face and get its normal
const SMDS_FacePosition* facePos = 0;
int vertexID = 0;
gp_Pnt nPnt[3];
gp_Vec Ne;
bool normalOK = false;
SMDS_ElemIteratorPtr iteratorElem = aSubMeshDSFace->GetElements();
while ( iteratorElem->more() ) // loop on elements on theFace
{
const SMDS_MeshElement* elem = iteratorElem->next();
if ( elem && elem->NbNodes() > 2 ) {
SMDS_ElemIteratorPtr nodesIt = elem->nodesIterator();
const SMDS_FacePosition* fPos = 0;
int i = 0, vID = 0;
while ( nodesIt->more() ) { // loop on nodes
const SMDS_MeshNode* node
= static_cast<const SMDS_MeshNode *>(nodesIt->next());
if ( i == 3 ) i = 2;
nPnt[ i++ ].SetCoord( node->X(), node->Y(), node->Z() );
// check position
const SMDS_PositionPtr& pos = node->GetPosition();
if ( !pos ) continue;
if ( pos->GetTypeOfPosition() == SMDS_TOP_FACE ) {
fPos = dynamic_cast< const SMDS_FacePosition* >( pos );
}
else if ( pos->GetTypeOfPosition() == SMDS_TOP_VERTEX ) {
vID = node->getshapeId();
}
}
if ( fPos || ( !normalOK && vID )) {
// compute normal
gp_Vec v01( nPnt[0], nPnt[1] ), v02( nPnt[0], nPnt[2] );
if ( v01.SquareMagnitude() > RealSmall() &&
v02.SquareMagnitude() > RealSmall() )
{
Ne = v01 ^ v02;
normalOK = ( Ne.SquareMagnitude() > RealSmall() );
}
// we need position on theFace or at least on vertex
if ( normalOK ) {
vertexID = vID;
if ((facePos = fPos))
break;
}
}
}
}
if ( !normalOK )
return isReversed;
// node position on face
double u,v;
if ( facePos ) {
u = facePos->GetUParameter();
v = facePos->GetVParameter();
}
else if ( vertexID ) {
TopoDS_Shape V = theMeshDS->IndexToShape( vertexID );
if ( V.IsNull() || V.ShapeType() != TopAbs_VERTEX )
return isReversed;
gp_Pnt2d uv = BRep_Tool::Parameters( TopoDS::Vertex( V ), theFace );
u = uv.X();
v = uv.Y();
}
else
{
return isReversed;
}
// face normal at node position
TopLoc_Location loc;
Handle(Geom_Surface) surf = BRep_Tool::Surface( theFace, loc );
if ( surf.IsNull() || surf->Continuity() < GeomAbs_C1 ) return isReversed;
gp_Vec d1u, d1v;
surf->D1( u, v, nPnt[0], d1u, d1v );
gp_Vec Nf = (d1u ^ d1v).Transformed( loc );
if ( theFace.Orientation() == TopAbs_REVERSED )
Nf.Reverse();
return Ne * Nf < 0.;
}
| virtual std::istream& SMESH_Algo.LoadFrom | ( | std::istream & | load | ) | [virtual, inherited] |
Loads nothing from a stream.
| load | - the stream |
| std.ostream | & - the stream |
| bool SMESH_Algo.NeedDescretBoundary | ( | ) | const [inherited] |
Definition at line 222 of file SMESH_Algo.hxx.
{ return _requireDescretBoundary; }
| bool SMESH_Algo.NeedShape | ( | ) | const [inherited] |
Definition at line 225 of file SMESH_Algo.hxx.
{ return _requireShape; }
| bool SMESH_Algo.OnlyUnaryInput | ( | ) | const [inherited] |
Definition at line 214 of file SMESH_Algo.hxx.
{ return _onlyUnaryInput; }
| virtual std::ostream& SMESH_Algo.SaveTo | ( | std::ostream & | save | ) | [virtual, inherited] |
Saves nothing in a stream.
| save | - the stream |
| std.ostream | & - the stream |
| virtual void SMESH_Algo.SetEventListener | ( | SMESH_subMesh * | subMesh | ) | [virtual, inherited] |
Sets event listener to submeshes if necessary.
| subMesh | - submesh where algo is set |
This method is called when a submesh gets HYP_OK algo_state. After being set, event listener is notified on each event of a submesh. By default none listener is set
Reimplemented in StdMeshers_CompositeSegment_1D, StdMeshers_Import_1D, StdMeshers_Import_1D2D, StdMeshers_Projection_1D, StdMeshers_Projection_2D, StdMeshers_Projection_3D, and StdMeshers_Regular_1D.
| virtual bool SMESH_Algo.SetParametersByDefaults | ( | const TDefaults & | dflts, |
| const SMESH_Mesh * | theMesh = 0 |
||
| ) | [virtual, inherited] |
| virtual bool SMESH_Algo.SetParametersByMesh | ( | const SMESH_Mesh * | theMesh, |
| const TopoDS_Shape & | theShape | ||
| ) | [virtual, inherited] |
Just return false as the algorithm does not hold parameters values.
| virtual void SMESH_Algo.SubmeshRestored | ( | SMESH_subMesh * | subMesh | ) | [virtual, inherited] |
Allow algo to do something after persistent restoration.
| subMesh | - restored submesh |
This method is called only if a submesh has HYP_OK algo_state.
Reimplemented in StdMeshers_Import_1D, StdMeshers_Import_1D2D, StdMeshers_RadialQuadrangle_1D2D, and StdMeshers_Regular_1D.
| bool SMESH_Algo.SupportSubmeshes | ( | ) | const [inherited] |
Definition at line 228 of file SMESH_Algo.hxx.
{ return _supportSubmeshes; }
| const SMDS_MeshNode * SMESH_Algo::VertexNode | ( | const TopoDS_Vertex & | V, |
| const SMESHDS_Mesh * | meshDS | ||
| ) | [static, inherited] |
Return the node built on a vertex.
| V | - the vertex |
| meshDS | - mesh |
| const | SMDS_MeshNode* - found node or NULL |
Definition at line 531 of file SMESH_Algo.cxx.
References SMESHDS_Mesh.MeshElements().
Referenced by SMESH.SMESH_Gen.Compute(), StdMeshers_ProjectionUtils.FindMatchingNodesOnFaces(), StdMeshers_FaceSide.GetFaceWires(), and StdMeshers_FaceSide.GetUVPtStruct().
{
if ( SMESHDS_SubMesh* sm = meshDS->MeshElements(V) ) {
SMDS_NodeIteratorPtr nIt= sm->GetNodes();
if (nIt->more())
return nIt->next();
}
return 0;
}
std::list<const SMESHDS_Hypothesis *> SMESH_Algo._appliedHypList [protected, inherited] |
Definition at line 356 of file SMESH_Algo.hxx.
std::list<const SMDS_MeshElement*> SMESH_Algo._badInputElements [protected, inherited] |
to explain COMPERR_BAD_INPUT_MESH
Definition at line 373 of file SMESH_Algo.hxx.
std::string SMESH_Algo._comment [protected, inherited] |
any text explaining what is wrong in Compute()
Definition at line 372 of file SMESH_Algo.hxx.
std::vector<std::string> SMESH_Algo._compatibleHypothesis [protected, inherited] |
Definition at line 355 of file SMESH_Algo.hxx.
Referenced by StdMeshers_Hexa_3D.StdMeshers_Hexa_3D(), StdMeshers_Import_1D.StdMeshers_Import_1D(), StdMeshers_Import_1D2D.StdMeshers_Import_1D2D(), StdMeshers_MEFISTO_2D.StdMeshers_MEFISTO_2D(), StdMeshers_Projection_1D.StdMeshers_Projection_1D(), StdMeshers_Projection_2D.StdMeshers_Projection_2D(), StdMeshers_Projection_3D.StdMeshers_Projection_3D(), StdMeshers_Quadrangle_2D.StdMeshers_Quadrangle_2D(), StdMeshers_RadialPrism_3D.StdMeshers_RadialPrism_3D(), StdMeshers_RadialQuadrangle_1D2D.StdMeshers_RadialQuadrangle_1D2D(), and StdMeshers_Regular_1D.StdMeshers_Regular_1D().
int SMESH_Algo._error [protected, inherited] |
SMESH_ComputeErrorName or anything algo specific.
Definition at line 371 of file SMESH_Algo.hxx.
Referenced by SMESH_Algo.SMESH_Algo().
bool SMESH_Algo._onlyUnaryInput [protected, inherited] |
Definition at line 362 of file SMESH_Algo.hxx.
Referenced by SMESH_Algo.SMESH_Algo().
bool SMESH_Algo._quadraticMesh [protected, inherited] |
Definition at line 369 of file SMESH_Algo.hxx.
Referenced by Compute(), Evaluate(), and SMESH_Algo.SMESH_Algo().
bool SMESH_Algo._requireDescretBoundary [protected, inherited] |
Definition at line 363 of file SMESH_Algo.hxx.
Referenced by SMESH_Algo.SMESH_Algo(), StdMeshers_Import_1D2D.StdMeshers_Import_1D2D(), and StdMeshers_RadialQuadrangle_1D2D.StdMeshers_RadialQuadrangle_1D2D().
bool SMESH_Algo._requireShape [protected, inherited] |
Definition at line 364 of file SMESH_Algo.hxx.
Referenced by SMESH_Algo.SMESH_Algo(), and StdMeshers_Hexa_3D.StdMeshers_Hexa_3D().
bool SMESH_Algo._supportSubmeshes [protected, inherited] |
Definition at line 365 of file SMESH_Algo.hxx.
Referenced by SMESH_Algo.SMESH_Algo(), and StdMeshers_RadialQuadrangle_1D2D.StdMeshers_RadialQuadrangle_1D2D().
std::list<const SMESHDS_Hypothesis *> SMESH_Algo._usedHypList [protected, inherited] |
Definition at line 357 of file SMESH_Algo.hxx.