Version: 9.12.0
StdMeshers_QuadToTriaAdaptor Class Reference

"Transforms" quadrilateral faces into triangular ones by creation of pyramids More...

#include <StdMeshers_QuadToTriaAdaptor.hxx>

Inheritance diagram for StdMeshers_QuadToTriaAdaptor:

Public Types

typedef boost::shared_ptr< SMESH_ProxyMeshPtr
 
typedef std::map< const SMDS_MeshNode *, const SMDS_MeshNode *, TIDCompareTN2NMap
 

Public Member Functions

 StdMeshers_QuadToTriaAdaptor ()
 Constructor. More...
 
 ~StdMeshers_QuadToTriaAdaptor ()
 Destructor. More...
 
bool Compute (SMESH_Mesh &aMesh, const TopoDS_Shape &aShape, SMESH_ProxyMesh *aProxyMesh=0)
 
bool Compute (SMESH_Mesh &aMesh)
 Computes pyramids in mesh with no shape. More...
 
const TopoDS_Shape & GetShape () const
 
const SMESHDS_SubMeshGetSubMesh (const TopoDS_Shape &shape) const
 Returns the submesh of a shape; it can be a proxy sub-mesh. More...
 
const SMESHDS_SubMeshGetSubMesh (const int shapeID) const
 Return a sub-mesh by a shape ID; it can be a proxy sub-mesh. More...
 
const SubMeshGetProxySubMesh (const TopoDS_Shape &shape) const
 Returns the proxy sub-mesh of a shape; it can be NULL. More...
 
const SMDS_MeshNodeGetProxyNode (const SMDS_MeshNode *node) const
 Returns the proxy node of a node; the input node is returned if no proxy exists. More...
 
int NbProxySubMeshes () const
 Returns number of proxy sub-meshes. More...
 
SMDS_ElemIteratorPtr GetFaces () const
 Returns iterator on all faces of the mesh taking into account substitutions To be used in case of mesh without shape. More...
 
SMDS_ElemIteratorPtr GetFaces (const TopoDS_Shape &face) const
 Returns iterator on all faces on the shape taking into account substitutions. More...
 
smIdType NbFaces () const
 Return total nb of faces taking into account substitutions. More...
 
bool IsTemporary (const SMDS_MeshElement *elem) const
 Return true if the element is a temporary one. More...
 
SMDS_ElemIteratorPtr GetInverseElementIterator (const SMDS_MeshNode *node, SMDSAbs_ElementType type) const
 Return iterator on inverse elements of a node that may be a proxy one. More...
 
SMESH_MeshGetMesh () const
 
SMESHDS_MeshGetMeshDS () const
 Returns mesh DS. More...
 

Static Public Member Functions

static bool HasPrismsOnTwoSides (SMESHDS_SubMesh *faceSM)
 Check if a FACE has prisms on its both sides. More...
 

Protected Member Functions

int Preparation (const SMDS_MeshElement *face, TColgp_Array1OfPnt &PN, TColgp_Array1OfVec &VN, std::vector< const SMDS_MeshNode * > &FNodes, gp_Pnt &PC, gp_Vec &VNorm, const SMDS_MeshElement **volumes=0)
 Retrieve data of the given face. More...
 
bool LimitHeight (gp_Pnt &Papex, const gp_Pnt &PC, const TColgp_Array1OfPnt &PN, const std::vector< const SMDS_MeshNode * > &FNodes, SMESH_Mesh &aMesh, const SMDS_MeshElement *NotCheckedFace, const bool UseApexRay, const TopoDS_Shape &Shape=TopoDS_Shape())
 Return allowed height of a pyramid. More...
 
bool Compute2ndPart (SMESH_Mesh &aMesh, const std::vector< const SMDS_MeshElement * > &pyramids)
 Update created pyramids and faces to avoid their intersection. More...
 
void MergePiramids (const SMDS_MeshElement *PrmI, const SMDS_MeshElement *PrmJ, std::set< const SMDS_MeshNode * > &nodesToMove)
 Merge the two pyramids (i.e. More...
 
void MergeAdjacent (const SMDS_MeshElement *PrmI, std::set< const SMDS_MeshNode * > &nodesToMove, const bool isRecursion=false)
 Merges adjacent pyramids. More...
 
bool DecreaseHeightDifference (const SMDS_MeshElement *pyram, const double h2)
 Decrease height of a given or adjacent pyramids if height difference is too large. More...
 
void setMesh (const SMESH_Mesh &mesh)
 Set mesh. More...
 
int shapeIndex (const TopoDS_Shape &shape) const
 Returns index of a shape. More...
 
virtual SubMeshnewSubmesh (int index=0) const
 Create a SubMesh. More...
 
SubMeshfindProxySubMesh (int shapeIndex=0) const
 Returns a proxy sub-mesh. More...
 
SubMeshgetProxySubMesh (int shapeIndex)
 Returns a proxy sub-mesh; it is created if not yet exists. More...
 
SubMeshgetProxySubMesh (const TopoDS_Shape &shape=TopoDS_Shape())
 Returns a proxy sub-mesh; it is created if not yet exists. More...
 
bool takeProxySubMesh (const TopoDS_Shape &shape, SMESH_ProxyMesh *proxyMesh)
 Move proxy sub-mesh from other proxy mesh to this, returns true if sub-mesh found. More...
 
void takeTmpElemsInMesh (SMESH_ProxyMesh *proxyMesh)
 Move tmp elements residing the _mesh from other proxy mesh to this. More...
 
void removeTmpElement (const SMDS_MeshElement *elem)
 Removes tmp elements from the _mesh. More...
 
void storeTmpElement (const SMDS_MeshElement *elem)
 Stores tmp element residing the _mesh. More...
 
void setNode2Node (const SMDS_MeshNode *srcNode, const SMDS_MeshNode *proxyNode, const SubMesh *subMesh)
 Set node-node correspondence. More...
 

Protected Attributes

TopoDS_Shape myShape
 
std::set< const SMDS_MeshElement * > myRemovedTrias
 
std::list< const SMDS_MeshNode * > myDegNodes
 
const SMESH_ElementSearchermyElemSearcher
 
NCollection_DataMap< const SMDS_MeshElement *, double > myPyramHeight2
 
std::vector< const SMDS_MeshElement * > myAdjPyrams
 
std::vector< const SMDS_MeshNode * > myNodes
 
std::vector< SMDSAbs_EntityType_allowedTypes
 

Private Types

typedef NCollection_DataMap< const SMDS_MeshNode *, std::vector< const SMDS_MeshElement * >, SMESH_HasherTNodeElemVecMap
 

Private Attributes

const SMESH_Mesh_mesh
 
std::vector< SubMesh * > _subMeshes
 
std::set< const SMDS_MeshElement * > _elemsInMesh
 
TNodeElemVecMap _inverseElements
 
SubMesh_subContainer
 

Detailed Description

"Transforms" quadrilateral faces into triangular ones by creation of pyramids

Member Typedef Documentation

◆ Ptr

typedef boost::shared_ptr<SMESH_ProxyMesh> SMESH_ProxyMesh::Ptr
inherited

◆ TN2NMap

typedef std::map<const SMDS_MeshNode*, const SMDS_MeshNode*, TIDCompare > SMESH_ProxyMesh::TN2NMap
inherited

◆ TNodeElemVecMap

typedef NCollection_DataMap< const SMDS_MeshNode*, std::vector< const SMDS_MeshElement* >, SMESH_Hasher > SMESH_ProxyMesh::TNodeElemVecMap
privateinherited

Constructor & Destructor Documentation

◆ StdMeshers_QuadToTriaAdaptor()

StdMeshers_QuadToTriaAdaptor::StdMeshers_QuadToTriaAdaptor ( )

Constructor.

◆ ~StdMeshers_QuadToTriaAdaptor()

StdMeshers_QuadToTriaAdaptor::~StdMeshers_QuadToTriaAdaptor ( )

Destructor.

References myElemSearcher.

Member Function Documentation

◆ Compute() [1/2]

◆ Compute() [2/2]

◆ Compute2ndPart()

◆ DecreaseHeightDifference()

bool StdMeshers_QuadToTriaAdaptor::DecreaseHeightDifference ( const SMDS_MeshElement thePyram,
const double  theH2 
)
protected

Decrease height of a given or adjacent pyramids if height difference is too large.

Parameters
[in]pyram- a pyramid to treat
[in,out]h2- pyramid's square height
Returns
bool - true if the height changes

References SMDS_Mesh::GetElementsByNodes(), SMDS_MeshElement::GetNode(), and SMDSAbs_Volume.

Referenced by Compute2ndPart().

◆ findProxySubMesh()

SMESH_ProxyMesh::SubMesh * SMESH_ProxyMesh::findProxySubMesh ( int  shapeIndex = 0) const
protectedinherited

◆ GetFaces() [1/2]

◆ GetFaces() [2/2]

SMDS_ElemIteratorPtr SMESH_ProxyMesh::GetFaces ( const TopoDS_Shape &  face) const
inherited

◆ GetInverseElementIterator()

SMDS_ElemIteratorPtr SMESH_ProxyMesh::GetInverseElementIterator ( const SMDS_MeshNode node,
SMDSAbs_ElementType  type 
) const
inherited

◆ GetMesh()

◆ GetMeshDS()

◆ GetProxyNode()

◆ GetProxySubMesh()

const SMESH_ProxyMesh::SubMesh * SMESH_ProxyMesh::GetProxySubMesh ( const TopoDS_Shape &  shape) const
inherited

Returns the proxy sub-mesh of a shape; it can be NULL.

References SMESH_ProxyMesh::_subMeshes, and SMESH_ProxyMesh::shapeIndex().

Referenced by VISCOUS_3D::_ViscousBuilder::makeGroupOfLE(), and VISCOUS_3D::_ViscousBuilder::MakeN2NMap().

◆ getProxySubMesh() [1/2]

SMESH_ProxyMesh::SubMesh * SMESH_ProxyMesh::getProxySubMesh ( const TopoDS_Shape &  shape = TopoDS_Shape())
protectedinherited

Returns a proxy sub-mesh; it is created if not yet exists.

References SMESH_ProxyMesh::getProxySubMesh(), and SMESH_ProxyMesh::shapeIndex().

◆ getProxySubMesh() [2/2]

SMESH_ProxyMesh::SubMesh * SMESH_ProxyMesh::getProxySubMesh ( int  shapeIndex)
protectedinherited

Returns a proxy sub-mesh; it is created if not yet exists.

References SMESH_ProxyMesh::_subMeshes, and SMESH_ProxyMesh::newSubmesh().

Referenced by Compute(), VISCOUS_3D::_MeshOfSolid::getFaceSubM(), and SMESH_ProxyMesh::getProxySubMesh().

◆ GetShape()

const TopoDS_Shape& StdMeshers_QuadToTriaAdaptor::GetShape ( ) const

◆ GetSubMesh() [1/2]

const SMESHDS_SubMesh * SMESH_ProxyMesh::GetSubMesh ( const int  shapeID) const
inherited

Return a sub-mesh by a shape ID; it can be a proxy sub-mesh.

References SMESH_ProxyMesh::_subMeshes, SMESH_ProxyMesh::GetMeshDS(), and SMESHDS_Mesh::MeshElements().

◆ GetSubMesh() [2/2]

const SMESHDS_SubMesh * SMESH_ProxyMesh::GetSubMesh ( const TopoDS_Shape &  shape) const
inherited

◆ HasPrismsOnTwoSides()

bool SMESH_ProxyMesh::HasPrismsOnTwoSides ( SMESHDS_SubMesh smFace)
staticinherited

Check if a FACE has prisms on its both sides.

Parameters
[in]smFace- sub-mesh of the FACE. NOT a proxy sub-mesh!
Returns
bool - true if there are prisms on the two sides

References SMDS_MeshElement::begin_nodes(), SMDS_MeshElement::end_nodes(), SMESHDS_SubMesh::GetElements(), SMDS_Mesh::GetElementsByNodes(), SMDS_MeshElement::NbCornerNodes(), SMESHDS_SubMesh::NbElements(), and SMDSAbs_Volume.

Referenced by Compute().

◆ IsTemporary()

bool SMESH_ProxyMesh::IsTemporary ( const SMDS_MeshElement elem) const
inherited

Return true if the element is a temporary one.

References SMESH_ProxyMesh::_elemsInMesh, and SMDS_MeshElement::GetID().

Referenced by _QuadFaceGrid::LoadGrid(), and SMESH_MesherHelper::LoadNodeColumns().

◆ LimitHeight()

bool StdMeshers_QuadToTriaAdaptor::LimitHeight ( gp_Pnt &  Papex,
const gp_Pnt &  PC,
const TColgp_Array1OfPnt &  PN,
const std::vector< const SMDS_MeshNode * > &  FNodes,
SMESH_Mesh aMesh,
const SMDS_MeshElement NotCheckedFace,
const bool  UseApexRay,
const TopoDS_Shape &  Shape = TopoDS_Shape() 
)
protected

Return allowed height of a pyramid.

Parameters
Papex- optimal pyramid apex
PC- gravity center of a quadrangle
PN- four nodes of the quadrangle
aMesh- mesh
NotCheckedFace- the quadrangle face
Shape- the shape being meshed
Return values
falseif mesh invalidity detected

References SMESH_MeshAlgos::GetElementSearcher(), SMESH_ElementSearcher::GetElementsInSphere(), SMESH_ElementSearcher::GetElementsNearLine(), SMESH_Mesh::GetMeshDS(), SMDS_MeshElement::GetNode(), SMDS_MeshElement::GetNodeIndex(), HasIntersection(), HasIntersection3(), myElemSearcher, SMDS_MeshElement::NbCornerNodes(), and SMDSAbs_Face.

Referenced by Compute().

◆ MergeAdjacent()

void StdMeshers_QuadToTriaAdaptor::MergeAdjacent ( const SMDS_MeshElement PrmI,
std::set< const SMDS_MeshNode * > &  nodesToMove,
const bool  isRecursion = false 
)
protected

◆ MergePiramids()

◆ NbFaces()

◆ NbProxySubMeshes()

int SMESH_ProxyMesh::NbProxySubMeshes ( ) const
inherited

Returns number of proxy sub-meshes.

References SMESH_ProxyMesh::_subMeshes.

Referenced by SMESH_ProxyMesh::GetInverseElementIterator().

◆ newSubmesh()

SMESH_ProxyMesh::SubMesh * SMESH_ProxyMesh::newSubmesh ( int  index = 0) const
protectedvirtualinherited

Create a SubMesh.

Parameters
[ino]index - shape index
Returns
SubMesh* - new SubMesh

Reimplemented in VISCOUS_2D::_ProxyMeshOfFace.

References SMESH_ProxyMesh::GetMeshDS().

Referenced by SMESH_ProxyMesh::getProxySubMesh().

◆ Preparation()

int StdMeshers_QuadToTriaAdaptor::Preparation ( const SMDS_MeshElement face,
TColgp_Array1OfPnt &  PN,
TColgp_Array1OfVec &  VN,
std::vector< const SMDS_MeshNode * > &  FNodes,
gp_Pnt &  PC,
gp_Vec &  VNorm,
const SMDS_MeshElement **  volumes = 0 
)
protected

Retrieve data of the given face.

Parameters
PN- coordinates of face nodes
VN- cross products of vectors (PC-PN(i)) ^ (PC-PN(i+1))
FNodes- face nodes
PC- gravity center of nodes
VNorm- face normal (sum of VN)
volumes- two volumes sharing the given face, the first is in VNorm direction
Return values
int- 0 if given face is not quad, 1 if given face is quad, 2 if given face is degenerate quad (two nodes are coincided)

References DEGEN_QUAD, SMDS_MeshElement::GetNode(), SMDS_MeshElement::GetNodeIndex(), myDegNodes, SMDS_MeshElement::NbCornerNodes(), SMDS_MeshElement::NbNodes(), SMDS_MeshElement::nodesIterator(), NOT_QUAD, QUAD, SMDSAbs_Volume, SMDS_MeshNode::X(), SMDS_MeshNode::Y(), and SMDS_MeshNode::Z().

Referenced by Compute().

◆ removeTmpElement()

void SMESH_ProxyMesh::removeTmpElement ( const SMDS_MeshElement elem)
protectedinherited

◆ setMesh()

void SMESH_ProxyMesh::setMesh ( const SMESH_Mesh mesh)
protectedinherited

◆ setNode2Node()

void SMESH_ProxyMesh::setNode2Node ( const SMDS_MeshNode srcNode,
const SMDS_MeshNode proxyNode,
const SubMesh subMesh 
)
protectedinherited

Set node-node correspondence.

References SMESH_ProxyMesh::SubMesh::_n2n.

Referenced by VISCOUS_3D::_MeshOfSolid::setNode2Node().

◆ shapeIndex()

◆ storeTmpElement()

void SMESH_ProxyMesh::storeTmpElement ( const SMDS_MeshElement elem)
protectedinherited

Stores tmp element residing the _mesh.

References SMESH_ProxyMesh::_elemsInMesh.

Referenced by Compute().

◆ takeProxySubMesh()

bool SMESH_ProxyMesh::takeProxySubMesh ( const TopoDS_Shape &  shape,
SMESH_ProxyMesh proxyMesh 
)
protectedinherited

Move proxy sub-mesh from other proxy mesh to this, returns true if sub-mesh found.

References SMESH_ProxyMesh::_mesh, SMESH_ProxyMesh::_subMeshes, SMESH_ProxyMesh::findProxySubMesh(), and SMESH_ProxyMesh::shapeIndex().

Referenced by Compute().

◆ takeTmpElemsInMesh()

void SMESH_ProxyMesh::takeTmpElemsInMesh ( SMESH_ProxyMesh proxyMesh)
protectedinherited

Move tmp elements residing the _mesh from other proxy mesh to this.

References SMESH_ProxyMesh::_elemsInMesh.

Referenced by Compute(), and SMESH_ProxyMesh::SMESH_ProxyMesh().

Field Documentation

◆ _allowedTypes

std::vector< SMDSAbs_EntityType> SMESH_ProxyMesh::_allowedTypes
protectedinherited

◆ _elemsInMesh

◆ _inverseElements

TNodeElemVecMap SMESH_ProxyMesh::_inverseElements
privateinherited

◆ _mesh

◆ _subContainer

SubMesh* SMESH_ProxyMesh::_subContainer
mutableprivateinherited

◆ _subMeshes

◆ myAdjPyrams

std::vector< const SMDS_MeshElement* > StdMeshers_QuadToTriaAdaptor::myAdjPyrams
protected

◆ myDegNodes

std::list< const SMDS_MeshNode* > StdMeshers_QuadToTriaAdaptor::myDegNodes
protected

Referenced by Compute2ndPart(), and Preparation().

◆ myElemSearcher

const SMESH_ElementSearcher* StdMeshers_QuadToTriaAdaptor::myElemSearcher
protected

◆ myNodes

std::vector<const SMDS_MeshNode *> StdMeshers_QuadToTriaAdaptor::myNodes
protected

Referenced by Compute2ndPart().

◆ myPyramHeight2

NCollection_DataMap< const SMDS_MeshElement*, double > StdMeshers_QuadToTriaAdaptor::myPyramHeight2
protected

Referenced by Compute(), and Compute2ndPart().

◆ myRemovedTrias

std::set<const SMDS_MeshElement*> StdMeshers_QuadToTriaAdaptor::myRemovedTrias
protected

Referenced by Compute2ndPart().

◆ myShape

TopoDS_Shape StdMeshers_QuadToTriaAdaptor::myShape
protected

Referenced by Compute().