SALOME - SMESH
SMESH_MesherHelper Class Reference

#include <SMESH_MesherHelper.hxx>

Collaboration diagram for SMESH_MesherHelper:
Collaboration graph

Public Types

enum  MType { LINEAR, QUADRATIC, COMP }
 Check mesh without geometry for: if all elements on this shape are quadratic, quadratic elements will be created. More...
 

Public Member Functions

 SMESH_MesherHelper (SMESH_Mesh &theMesh)
 
SMESH_MeshGetMesh () const
 
SMESHDS_MeshGetMeshDS () const
 
bool IsQuadraticSubMesh (const TopoDS_Shape &theShape)
 
void SetIsQuadratic (const bool theBuildQuadratic)
 Set order of elements to create without calling IsQuadraticSubMesh() More...
 
bool GetIsQuadratic () const
 Return myCreateQuadratic flag. More...
 
void FixQuadraticElements (bool volumeOnly=true)
 Move medium nodes of faces and volumes to fix distorted elements. More...
 
void SetElementsOnShape (bool toSet)
 To set created elements on the shape set by IsQuadraticSubMesh() or the next methods. By defaul elements are set on the shape if a mesh has no shape to be meshed. More...
 
void SetSubShape (const int subShapeID)
 Set shape to make elements on without calling IsQuadraticSubMesh() More...
 
void SetSubShape (const TopoDS_Shape &subShape)
 ==SMESHDS_Mesh::ShapeToIndex(shape) More...
 
int GetSubShapeID () const
 Return ID of the shape set by IsQuadraticSubMesh() or SetSubShape() More...
 
TopoDS_Shape GetSubShape () const
 Return the shape set by IsQuadraticSubMesh() or SetSubShape() More...
 
SMDS_MeshNodeAddNode (double x, double y, double z, int ID=0)
 
SMDS_MeshEdgeAddEdge (const SMDS_MeshNode *n1, const SMDS_MeshNode *n2, const int id=0, const bool force3d=true)
 
SMDS_MeshFaceAddFace (const SMDS_MeshNode *n1, const SMDS_MeshNode *n2, const SMDS_MeshNode *n3, const int id=0, const bool force3d=false)
 
SMDS_MeshFaceAddFace (const SMDS_MeshNode *n1, const SMDS_MeshNode *n2, const SMDS_MeshNode *n3, const SMDS_MeshNode *n4, const int id=0, const bool force3d=false)
 
SMDS_MeshVolumeAddVolume (const SMDS_MeshNode *n1, const SMDS_MeshNode *n2, const SMDS_MeshNode *n3, const SMDS_MeshNode *n4, const int id=0, const bool force3d=true)
 
SMDS_MeshVolumeAddVolume (const SMDS_MeshNode *n1, const SMDS_MeshNode *n2, const SMDS_MeshNode *n3, const SMDS_MeshNode *n4, const SMDS_MeshNode *n5, const int id=0, const bool force3d=true)
 
SMDS_MeshVolumeAddVolume (const SMDS_MeshNode *n1, const SMDS_MeshNode *n2, const SMDS_MeshNode *n3, const SMDS_MeshNode *n4, const SMDS_MeshNode *n5, const SMDS_MeshNode *n6, const int id=0, const bool force3d=true)
 
SMDS_MeshVolumeAddVolume (const SMDS_MeshNode *n1, const SMDS_MeshNode *n2, const SMDS_MeshNode *n3, const SMDS_MeshNode *n4, const SMDS_MeshNode *n5, const SMDS_MeshNode *n6, const SMDS_MeshNode *n7, const SMDS_MeshNode *n8, const int id=0, bool force3d=true)
 
double GetNodeU (const TopoDS_Edge &theEdge, const SMDS_MeshNode *theNode, bool *check=0)
 Return U of the given node on the edge. More...
 
gp_XY GetNodeUV (const TopoDS_Face &F, const SMDS_MeshNode *n, const SMDS_MeshNode *inFaceNode=0, bool *check=0) const
 Return node UV on face. More...
 
bool CheckNodeUV (const TopoDS_Face &F, const SMDS_MeshNode *n, gp_XY &uv, const double tol) const
 Check and fix node UV on a face. More...
 
bool GetNodeUVneedInFaceNode (const TopoDS_Face &F=TopoDS_Face()) const
 Check if inFaceNode argument is necessary for call GetNodeUV(F,..) More...
 
bool IsDegenShape (const int subShape) const
 Check if shape is a degenerated edge or it's vertex. More...
 
bool IsSeamShape (const int subShape) const
 Check if shape is a seam edge or it's vertex. More...
 
bool IsSeamShape (const TopoDS_Shape &subShape) const
 Check if shape is a seam edge or it's vertex. More...
 
bool IsRealSeam (const int subShape) const
 Return true if an edge or a vertex encounters twice in face wire. More...
 
bool IsRealSeam (const TopoDS_Shape &subShape) const
 Return true if an edge or a vertex encounters twice in face wire. More...
 
bool HasSeam () const
 Check if the shape set through IsQuadraticSubMesh() or SetSubShape() has a seam edge. More...
 
int GetPeriodicIndex () const
 Return index of periodic parametric direction of a closed face. More...
 
double GetOtherParam (const double param) const
 Return an alternative parameter for a node on seam. More...
 
const SMDS_MeshNodeGetMediumNode (const SMDS_MeshNode *n1, const SMDS_MeshNode *n2, const bool force3d)
 Special function for search or creation medium node. More...
 
void AddTLinkNode (const SMDS_MeshNode *n1, const SMDS_MeshNode *n2, const SMDS_MeshNode *n12)
 
void AddTLinkNodeMap (const TLinkNodeMap &aMap)
 Auxilary function for filling myTLinkNodeMap. More...
 
const TLinkNodeMapGetTLinkNodeMap () const
 Returns myTLinkNodeMap. More...
 
MType IsQuadraticMesh ()
 

Static Public Member Functions

static bool IsMedium (const SMDS_MeshNode *node, const SMDSAbs_ElementType typeToCheck=SMDSAbs_All)
 Returns true if given node is medium. More...
 
static bool LoadNodeColumns (TParam2ColumnMap &theParam2ColumnMap, const TopoDS_Face &theFace, const TopoDS_Edge &theBaseEdge, SMESHDS_Mesh *theMesh)
 Load nodes bound to face into a map of node columns. More...
 
static TopoDS_Shape GetSubShapeByNode (const SMDS_MeshNode *node, SMESHDS_Mesh *meshDS)
 Return support shape of a node. More...
 
static int WrapIndex (const int ind, const int nbNodes)
 Return a valid node index, fixing the given one if necessary. More...
 
static int NbAncestors (const TopoDS_Shape &shape, const SMESH_Mesh &mesh, TopAbs_ShapeEnum ancestorType=TopAbs_SHAPE)
 Return number of unique ancestors of the shape. More...
 
static gp_XY GetMiddleUV (const Handle(Geom_Surface)&surface, const gp_XY &uv1, const gp_XY &uv2)
 Return middle UV taking in account surface period. More...
 

Protected Member Functions

gp_Pnt2d GetUVOnSeam (const gp_Pnt2d &uv1, const gp_Pnt2d &uv2) const
 Select UV on either of 2 pcurves of a seam edge, closest to the given UV. More...
 

Private Member Functions

 SMESH_MesherHelper (const SMESH_MesherHelper &theOther)
 

Private Attributes

TLinkNodeMap myTLinkNodeMap
 
std::set< intmyDegenShapeIds
 
std::set< intmySeamShapeIds
 
double myPar1
 
double myPar2
 
int myParIndex
 
TopoDS_Shape myShape
 
SMESH_MeshmyMesh
 
int myShapeID
 
bool myCreateQuadratic
 
bool mySetElemOnShape
 
std::set< intmyOkNodePosShapes
 

Detailed Description

Definition at line 57 of file SMESH_MesherHelper.hxx.

Member Enumeration Documentation

◆ MType

Check mesh without geometry for: if all elements on this shape are quadratic, quadratic elements will be created.

Used then generated 3D mesh without geometry.

Enumerator
LINEAR 
QUADRATIC 
COMP 

Definition at line 362 of file SMESH_MesherHelper.hxx.

Constructor & Destructor Documentation

◆ SMESH_MesherHelper() [1/2]

SMESH_MesherHelper::SMESH_MesherHelper ( SMESH_Mesh theMesh)

◆ SMESH_MesherHelper() [2/2]

SMESH_MesherHelper::SMESH_MesherHelper ( const SMESH_MesherHelper theOther)
private

Definition at line 378 of file SMESH_MesherHelper.hxx.

Member Function Documentation

◆ IsMedium()

static bool SMESH_MesherHelper::IsMedium ( const SMDS_MeshNode node,
const SMDSAbs_ElementType  typeToCheck = SMDSAbs_All 
)
static

Returns true if given node is medium.

Parameters
n- node to check
typeToCheck- type of elements containing the node to ask about node status
Return values
bool- check result

◆ LoadNodeColumns()

static bool SMESH_MesherHelper::LoadNodeColumns ( TParam2ColumnMap theParam2ColumnMap,
const TopoDS_Face &  theFace,
const TopoDS_Edge &  theBaseEdge,
SMESHDS_Mesh theMesh 
)
static

Load nodes bound to face into a map of node columns.

Parameters
theParam2ColumnMap- map of node columns to fill
theFace- the face on which nodes are searched for
theBaseEdge- the edge nodes of which are columns' bases
theMesh- the mesh containing nodes
Return values
bool- false if something is wrong

The key of the map is a normalized parameter of each base node on theBaseEdge. This method works in supposition that nodes on the face forms a rectangular grid and elements can be quardrangles or triangles

◆ GetSubShapeByNode()

static TopoDS_Shape SMESH_MesherHelper::GetSubShapeByNode ( const SMDS_MeshNode node,
SMESHDS_Mesh meshDS 
)
static

Return support shape of a node.

Parameters
node- the node
meshDS- mesh DS
Return values
TopoDS_Shape- found support shape

◆ WrapIndex()

static int SMESH_MesherHelper::WrapIndex ( const int  ind,
const int  nbNodes 
)
static

Return a valid node index, fixing the given one if necessary.

Parameters
ind- node index
nbNodes- total nb of nodes
Return values
int- valid node index

Definition at line 103 of file SMESH_MesherHelper.hxx.

◆ NbAncestors()

static int SMESH_MesherHelper::NbAncestors ( const TopoDS_Shape &  shape,
const SMESH_Mesh mesh,
TopAbs_ShapeEnum  ancestorType = TopAbs_SHAPE 
)
static

Return number of unique ancestors of the shape.

◆ GetMesh()

SMESH_Mesh* SMESH_MesherHelper::GetMesh ( ) const

Definition at line 122 of file SMESH_MesherHelper.hxx.

◆ GetMeshDS()

SMESHDS_Mesh* SMESH_MesherHelper::GetMeshDS ( ) const

Definition at line 124 of file SMESH_MesherHelper.hxx.

◆ IsQuadraticSubMesh()

bool SMESH_MesherHelper::IsQuadraticSubMesh ( const TopoDS_Shape &  theShape)

Check submesh for given shape: if all elements on this shape are quadratic, quadratic elements will be created. Also fill myTLinkNodeMap

◆ SetIsQuadratic()

void SMESH_MesherHelper::SetIsQuadratic ( const bool  theBuildQuadratic)

Set order of elements to create without calling IsQuadraticSubMesh()

Definition at line 134 of file SMESH_MesherHelper.hxx.

◆ GetIsQuadratic()

bool SMESH_MesherHelper::GetIsQuadratic ( ) const

Return myCreateQuadratic flag.

Definition at line 139 of file SMESH_MesherHelper.hxx.

◆ FixQuadraticElements()

void SMESH_MesherHelper::FixQuadraticElements ( bool  volumeOnly = true)

Move medium nodes of faces and volumes to fix distorted elements.

Parameters
volumeOnly- fix nodes on geom faces or not if the shape is solid

◆ SetElementsOnShape()

void SMESH_MesherHelper::SetElementsOnShape ( bool  toSet)

To set created elements on the shape set by IsQuadraticSubMesh() or the next methods. By defaul elements are set on the shape if a mesh has no shape to be meshed.

Definition at line 152 of file SMESH_MesherHelper.hxx.

◆ SetSubShape() [1/2]

void SMESH_MesherHelper::SetSubShape ( const int  subShapeID)

Set shape to make elements on without calling IsQuadraticSubMesh()

◆ SetSubShape() [2/2]

void SMESH_MesherHelper::SetSubShape ( const TopoDS_Shape &  subShape)

==SMESHDS_Mesh::ShapeToIndex(shape)

◆ GetSubShapeID()

int SMESH_MesherHelper::GetSubShapeID ( ) const

Return ID of the shape set by IsQuadraticSubMesh() or SetSubShape()

Return values
int- shape index in SMESHDS

Definition at line 163 of file SMESH_MesherHelper.hxx.

◆ GetSubShape()

TopoDS_Shape SMESH_MesherHelper::GetSubShape ( ) const

Return the shape set by IsQuadraticSubMesh() or SetSubShape()

Definition at line 167 of file SMESH_MesherHelper.hxx.

◆ AddNode()

SMDS_MeshNode* SMESH_MesherHelper::AddNode ( double  x,
double  y,
double  z,
int  ID = 0 
)

Creates a node

◆ AddEdge()

SMDS_MeshEdge* SMESH_MesherHelper::AddEdge ( const SMDS_MeshNode n1,
const SMDS_MeshNode n2,
const int  id = 0,
const bool  force3d = true 
)

Creates quadratic or linear edge

◆ AddFace() [1/2]

SMDS_MeshFace* SMESH_MesherHelper::AddFace ( const SMDS_MeshNode n1,
const SMDS_MeshNode n2,
const SMDS_MeshNode n3,
const int  id = 0,
const bool  force3d = false 
)

Creates quadratic or linear triangle

◆ AddFace() [2/2]

SMDS_MeshFace* SMESH_MesherHelper::AddFace ( const SMDS_MeshNode n1,
const SMDS_MeshNode n2,
const SMDS_MeshNode n3,
const SMDS_MeshNode n4,
const int  id = 0,
const bool  force3d = false 
)

Creates quadratic or linear quadrangle

◆ AddVolume() [1/4]

SMDS_MeshVolume* SMESH_MesherHelper::AddVolume ( const SMDS_MeshNode n1,
const SMDS_MeshNode n2,
const SMDS_MeshNode n3,
const SMDS_MeshNode n4,
const int  id = 0,
const bool  force3d = true 
)

Creates quadratic or linear tetraahedron

◆ AddVolume() [2/4]

SMDS_MeshVolume* SMESH_MesherHelper::AddVolume ( const SMDS_MeshNode n1,
const SMDS_MeshNode n2,
const SMDS_MeshNode n3,
const SMDS_MeshNode n4,
const SMDS_MeshNode n5,
const int  id = 0,
const bool  force3d = true 
)

Creates quadratic or linear pyramid

◆ AddVolume() [3/4]

SMDS_MeshVolume* SMESH_MesherHelper::AddVolume ( const SMDS_MeshNode n1,
const SMDS_MeshNode n2,
const SMDS_MeshNode n3,
const SMDS_MeshNode n4,
const SMDS_MeshNode n5,
const SMDS_MeshNode n6,
const int  id = 0,
const bool  force3d = true 
)

Creates quadratic or linear pentahedron

◆ AddVolume() [4/4]

SMDS_MeshVolume* SMESH_MesherHelper::AddVolume ( const SMDS_MeshNode n1,
const SMDS_MeshNode n2,
const SMDS_MeshNode n3,
const SMDS_MeshNode n4,
const SMDS_MeshNode n5,
const SMDS_MeshNode n6,
const SMDS_MeshNode n7,
const SMDS_MeshNode n8,
const int  id = 0,
bool  force3d = true 
)

Creates quadratic or linear hexahedron

◆ GetNodeU()

double SMESH_MesherHelper::GetNodeU ( const TopoDS_Edge &  theEdge,
const SMDS_MeshNode theNode,
bool *  check = 0 
)

Return U of the given node on the edge.

◆ GetNodeUV()

gp_XY SMESH_MesherHelper::GetNodeUV ( const TopoDS_Face &  F,
const SMDS_MeshNode n,
const SMDS_MeshNode inFaceNode = 0,
bool *  check = 0 
) const

Return node UV on face.

Parameters
inFaceNode- a node of element being created located inside a face

Referenced by StdMeshers_PrismAsBlock::TSideFace::GetNodeUV().

Here is the caller graph for this function:

◆ CheckNodeUV()

bool SMESH_MesherHelper::CheckNodeUV ( const TopoDS_Face &  F,
const SMDS_MeshNode n,
gp_XY &  uv,
const double  tol 
) const

Check and fix node UV on a face.

Return values
bool- false if UV is bad and could not be fixed

◆ GetMiddleUV()

static gp_XY SMESH_MesherHelper::GetMiddleUV ( const Handle(Geom_Surface)&  surface,
const gp_XY &  uv1,
const gp_XY &  uv2 
)
static

Return middle UV taking in account surface period.

◆ GetNodeUVneedInFaceNode()

bool SMESH_MesherHelper::GetNodeUVneedInFaceNode ( const TopoDS_Face &  F = TopoDS_Face()) const

Check if inFaceNode argument is necessary for call GetNodeUV(F,..)

Return values
bool- return true if the face is periodic

if F is Null, answer about subshape set through IsQuadraticSubMesh() or SetSubShape()

◆ IsDegenShape()

bool SMESH_MesherHelper::IsDegenShape ( const int  subShape) const

Check if shape is a degenerated edge or it's vertex.

Parameters
subShape- edge or vertex index in SMESHDS
Return values
bool- true if subShape is a degenerated shape

It works only if IsQuadraticSubMesh() or SetSubShape() has been called

Definition at line 284 of file SMESH_MesherHelper.hxx.

◆ IsSeamShape() [1/2]

bool SMESH_MesherHelper::IsSeamShape ( const int  subShape) const

Check if shape is a seam edge or it's vertex.

Parameters
subShape- edge or vertex index in SMESHDS
Return values
bool- true if subShape is a seam shape

It works only if IsQuadraticSubMesh() or SetSubShape() has been called. Seam shape has two 2D alternative represenations on the face

Definition at line 294 of file SMESH_MesherHelper.hxx.

◆ IsSeamShape() [2/2]

bool SMESH_MesherHelper::IsSeamShape ( const TopoDS_Shape &  subShape) const

Check if shape is a seam edge or it's vertex.

Parameters
subShape- edge or vertex
Return values
bool- true if subShape is a seam shape

It works only if IsQuadraticSubMesh() or SetSubShape() has been called. Seam shape has two 2D alternative represenations on the face

Definition at line 304 of file SMESH_MesherHelper.hxx.

◆ IsRealSeam() [1/2]

bool SMESH_MesherHelper::IsRealSeam ( const int  subShape) const

Return true if an edge or a vertex encounters twice in face wire.

Parameters
subShape- Id of edge or vertex

Definition at line 310 of file SMESH_MesherHelper.hxx.

◆ IsRealSeam() [2/2]

bool SMESH_MesherHelper::IsRealSeam ( const TopoDS_Shape &  subShape) const

Return true if an edge or a vertex encounters twice in face wire.

Parameters
subShape- edge or vertex

Definition at line 316 of file SMESH_MesherHelper.hxx.

◆ HasSeam()

bool SMESH_MesherHelper::HasSeam ( ) const

Check if the shape set through IsQuadraticSubMesh() or SetSubShape() has a seam edge.

Return values
bool- true if it has

Definition at line 323 of file SMESH_MesherHelper.hxx.

◆ GetPeriodicIndex()

int SMESH_MesherHelper::GetPeriodicIndex ( ) const

Return index of periodic parametric direction of a closed face.

Return values
int- 1 for U, 2 for V direction

Definition at line 328 of file SMESH_MesherHelper.hxx.

◆ GetOtherParam()

double SMESH_MesherHelper::GetOtherParam ( const double  param) const

Return an alternative parameter for a node on seam.

◆ GetMediumNode()

const SMDS_MeshNode* SMESH_MesherHelper::GetMediumNode ( const SMDS_MeshNode n1,
const SMDS_MeshNode n2,
const bool  force3d 
)

Special function for search or creation medium node.

◆ AddTLinkNode()

void SMESH_MesherHelper::AddTLinkNode ( const SMDS_MeshNode n1,
const SMDS_MeshNode n2,
const SMDS_MeshNode n12 
)

Auxilary function for filling myTLinkNodeMap

◆ AddTLinkNodeMap()

void SMESH_MesherHelper::AddTLinkNodeMap ( const TLinkNodeMap aMap)

Auxilary function for filling myTLinkNodeMap.

Definition at line 349 of file SMESH_MesherHelper.hxx.

◆ GetTLinkNodeMap()

const TLinkNodeMap& SMESH_MesherHelper::GetTLinkNodeMap ( ) const

Returns myTLinkNodeMap.

Definition at line 355 of file SMESH_MesherHelper.hxx.

◆ IsQuadraticMesh()

MType SMESH_MesherHelper::IsQuadraticMesh ( )

◆ GetUVOnSeam()

gp_Pnt2d SMESH_MesherHelper::GetUVOnSeam ( const gp_Pnt2d &  uv1,
const gp_Pnt2d &  uv2 
) const
protected

Select UV on either of 2 pcurves of a seam edge, closest to the given UV.

Parameters
uv1- UV on the seam
uv2- UV within a face
Return values
gp_Pnt2d- selected UV

Field Documentation

◆ myTLinkNodeMap

TLinkNodeMap SMESH_MesherHelper::myTLinkNodeMap
private

Definition at line 378 of file SMESH_MesherHelper.hxx.

◆ myDegenShapeIds

std::set< int > SMESH_MesherHelper::myDegenShapeIds
private

Definition at line 383 of file SMESH_MesherHelper.hxx.

◆ mySeamShapeIds

std::set< int > SMESH_MesherHelper::mySeamShapeIds
private

Definition at line 384 of file SMESH_MesherHelper.hxx.

◆ myPar1

double SMESH_MesherHelper::myPar1
private

Definition at line 385 of file SMESH_MesherHelper.hxx.

◆ myPar2

double SMESH_MesherHelper::myPar2
private

Definition at line 385 of file SMESH_MesherHelper.hxx.

◆ myParIndex

int SMESH_MesherHelper::myParIndex
private

Definition at line 386 of file SMESH_MesherHelper.hxx.

◆ myShape

TopoDS_Shape SMESH_MesherHelper::myShape
private

Definition at line 388 of file SMESH_MesherHelper.hxx.

◆ myMesh

SMESH_Mesh* SMESH_MesherHelper::myMesh
private

Definition at line 389 of file SMESH_MesherHelper.hxx.

◆ myShapeID

int SMESH_MesherHelper::myShapeID
private

Definition at line 390 of file SMESH_MesherHelper.hxx.

◆ myCreateQuadratic

bool SMESH_MesherHelper::myCreateQuadratic
private

Definition at line 393 of file SMESH_MesherHelper.hxx.

◆ mySetElemOnShape

bool SMESH_MesherHelper::mySetElemOnShape
private

Definition at line 394 of file SMESH_MesherHelper.hxx.

◆ myOkNodePosShapes

std::set< int > SMESH_MesherHelper::myOkNodePosShapes
private

Definition at line 395 of file SMESH_MesherHelper.hxx.