NETGENPlugin_Mesher Class Reference

This class calls the NETGEN mesher of OCC geometry. More...

#include <NETGENPlugin_Mesher.hxx>

Public Member Functions

bool Compute ()
 
bool Evaluate (MapShapeNbElems &aResMap)
 
bool FillNgMesh (netgen::OCCGeometry &occgeom, netgen::Mesh &ngMesh, std::vector< const SMDS_MeshNode * > &nodeVec, const std::list< SMESH_subMesh * > &meshedSM, SMESH_MesherHelper *quadHelper=0, SMESH_ProxyMesh::Ptr proxyMesh=SMESH_ProxyMesh::Ptr())
 fill ngMesh with nodes and elements of computed submeshes More...
 
double GetProgress (const SMESH_Algo *holder, const int *algoProgressTic, const double *algoProgress) const
 
 NETGENPlugin_Mesher (SMESH_Mesh *mesh, const TopoDS_Shape &aShape, const bool isVolume)
 
void SetDefaultParameters ()
 Initialize global NETGEN parameters with default values. More...
 
void SetParameters (const NETGENPlugin_Hypothesis *hyp)
 
void SetParameters (const NETGENPlugin_SimpleHypothesis_2D *hyp)
 
void SetSelfPointer (NETGENPlugin_Mesher **ptr)
 
void SetViscousLayers2DAssigned (bool isAssigned)
 
 ~NETGENPlugin_Mesher ()
 

Static Public Member Functions

static void AddIntVerticesInFaces (const netgen::OCCGeometry &occgeom, netgen::Mesh &ngMesh, std::vector< const SMDS_MeshNode * > &nodeVec, NETGENPlugin_Internals &internalShapes)
 Make netgen take internal vertices in faces into account by adding segments including internal vertices. More...
 
static void AddIntVerticesInSolids (const netgen::OCCGeometry &occgeom, netgen::Mesh &ngMesh, std::vector< const SMDS_MeshNode * > &nodeVec, NETGENPlugin_Internals &internalShapes)
 Make netgen take internal vertices in solids into account by adding faces including internal vertices. More...
 
static SMESH_ComputeErrorPtr AddSegmentsToMesh (netgen::Mesh &ngMesh, netgen::OCCGeometry &geom, const TSideVector &wires, SMESH_MesherHelper &helper, std::vector< const SMDS_MeshNode * > &nodeVec, const bool overrideMinH=true)
 Fill netgen mesh with segments of a FACE. More...
 
static int FillSMesh (const netgen::OCCGeometry &occgeom, netgen::Mesh &ngMesh, const NETGENPlugin_ngMeshInfo &initState, SMESH_Mesh &sMesh, std::vector< const SMDS_MeshNode * > &nodeVec, SMESH_Comment &comment, SMESH_MesherHelper *quadHelper=0)
 Fill SMESH mesh according to contents of netgen mesh. More...
 
static bool FixFaceMesh (const netgen::OCCGeometry &occgeom, netgen::Mesh &ngMesh, const int faceID)
 Tries to heal the mesh on a FACE. The FACE is supposed to be partially meshed due to NETGEN failure. More...
 
static void FixIntFaces (const netgen::OCCGeometry &occgeom, netgen::Mesh &ngMesh, NETGENPlugin_Internals &internalShapes)
 Duplicate mesh faces on internal geom faces. More...
 
static double GetDefaultMinSize (const TopoDS_Shape &shape, const double maxSize)
 Return a default min size value suitable for the given geometry. More...
 
static void PrepareOCCgeometry (netgen::OCCGeometry &occgeom, const TopoDS_Shape &shape, SMESH_Mesh &mesh, std::list< SMESH_subMesh * > *meshedSM=0, NETGENPlugin_Internals *internalShapes=0)
 Initialize netgen::OCCGeometry with OCCT shape. More...
 
static SMESH_ComputeErrorPtr ReadErrors (const std::vector< const SMDS_MeshNode * > &nodeVec)
 Read mesh entities preventing successful computation from "test.out" file. More...
 
static void RemoveTmpFiles ()
 Remove "test.out" and "problemfaces" files in current directory. More...
 
static void RestrictLocalSize (netgen::Mesh &ngMesh, const gp_XYZ &p, double size, const bool overrideMinH=true)
 Restrict size of elements at a given point. More...
 
static void toPython (const netgen::Mesh *ngMesh, const std::string &pyFile)
 Write a python script creating an equivalent SALOME mesh. This is useful to see what mesh is passed as input for the next step of mesh generation (of mesh of higher dimension) More...
 

Detailed Description

This class calls the NETGEN mesher of OCC geometry.

Constructor & Destructor Documentation

◆ NETGENPlugin_Mesher()

NETGENPlugin_Mesher::NETGENPlugin_Mesher ( SMESH_Mesh mesh,
const TopoDS_Shape &  aShape,
const bool  isVolume 
)

◆ ~NETGENPlugin_Mesher()

NETGENPlugin_Mesher::~NETGENPlugin_Mesher ( )

Destuctor

Member Function Documentation

◆ AddIntVerticesInFaces()

void NETGENPlugin_Mesher::AddIntVerticesInFaces ( const netgen::OCCGeometry &  occgeom,
netgen::Mesh &  ngMesh,
std::vector< const SMDS_MeshNode * > &  nodeVec,
NETGENPlugin_Internals internalShapes 
)
static

◆ AddIntVerticesInSolids()

void NETGENPlugin_Mesher::AddIntVerticesInSolids ( const netgen::OCCGeometry &  occgeom,
netgen::Mesh &  ngMesh,
std::vector< const SMDS_MeshNode * > &  nodeVec,
NETGENPlugin_Internals internalShapes 
)
static

Make netgen take internal vertices in solids into account by adding faces including internal vertices.

This function works in supposition that 2D mesh is already computed in ngMesh

References NETGENPlugin_Internals::getMesh(), SMESH_Mesh::GetMeshDS(), and NETGENPlugin_Internals::getSolidsWithVertices().

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

◆ AddSegmentsToMesh()

SMESH_ComputeErrorPtr NETGENPlugin_Mesher::AddSegmentsToMesh ( netgen::Mesh &  ngMesh,
netgen::OCCGeometry &  geom,
const TSideVector &  wires,
SMESH_MesherHelper helper,
std::vector< const SMDS_MeshNode * > &  nodeVec,
const bool  overrideMinH = true 
)
static

Fill netgen mesh with segments of a FACE.

Parameters
ngMesh- netgen mesh
geom- container of OCCT geometry to mesh
wires- data of nodes on FACE boundary
helper- mesher helper holding the FACE
nodeVec- vector of nodes in which node index == netgen ID
Return values
SMESH_ComputeErrorPtr- error description

References AddIntVerticesInFaces(), SMESH_TNodeXYZ::Distance(), SMESH_MesherHelper::GetMesh(), SMESH_MesherHelper::GetMeshDS(), SMDS_MeshElement::getshapeId(), SMESH_MesherHelper::GetSubShape(), SMESH_MesherHelper::IsDegenShape(), SMESH_MesherHelper::IsRealSeam(), SMESH_ComputeError::New(), uvPtStruct::normParam, uvPtStruct::param, RestrictLocalSize(), SMESHDS_Mesh::ShapeToIndex(), uvPtStruct::u, uvPtStruct::v, SMESH_MesherHelper::WrapIndex(), SMDS_MeshNode::X(), SMDS_MeshNode::Y(), and SMDS_MeshNode::Z().

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

◆ Compute()

bool NETGENPlugin_Mesher::Compute ( )

Here we are going to use the NETGEN mesher

References AddIntVerticesInFaces(), AddIntVerticesInSolids(), AddSegmentsToMesh(), StdMeshers_QuadToTriaAdaptor::Compute(), StdMeshers_ViscousLayers2D::Compute(), SMESH_Algo::EdgeLength(), FillNgMesh(), FillSMesh(), FixIntFaces(), SMESH_subMesh::GetComputeError(), GetDefaultMinSize(), StdMeshers_FaceSide::GetFaceWires(), SMESH_subMesh::GetId(), NETGENPlugin_Internals::getInternalEdges(), SMESH_MesherHelper::GetIsQuadratic(), NETGENPlugin_SimpleHypothesis_3D::GetMaxElementVolume(), SMESH_Algo::GetMeshError(), SMESH_ProxyMesh::GetProxySubMesh(), NETGENPlugin_Internals::getSolidsWithVertices(), SMESH_subMesh::GetSubMeshDS(), NETGENPlugin_Internals::hasInternalEdges(), NETGENPlugin_Internals::hasInternalFaces(), NETGENPlugin_Internals::hasInternalVertexInFace(), NETGENPlugin_Internals::hasInternalVertexInSolid(), SMESH_subMesh::IsEmpty(), SMESH_subMesh::IsMeshComputed(), SMESH_Algo::MEr_OK, netgen::merge_solids, netgen::mparam, netgen::multithread, SMESHDS_SubMesh::NbElements(), SMESHDS_SubMesh::NbNodes(), SMESH_ComputeError::New(), netgen::OCCGenerateMesh(), PrepareOCCgeometry(), ReadErrors(), NETGENPlugin_ngMeshInfo::restoreLocalH(), RestrictLocalSize(), SMESH_subMesh::SetIsAlwaysComputed(), SMESH_MesherHelper::SetIsQuadratic(), NETGENPlugin_NetgenLibWrapper::setMesh(), SMESH_MesherHelper::SetSubShape(), NETGENPlugin_ngMeshInfo::transferLocalH(), and NETGENPlugin_Hypothesis::UserDefined.

Referenced by NETGENPlugin_NETGEN_2D::Compute(), NETGENPlugin_NETGEN_2D3D::Compute(), Fem::FemMeshShapeNetgenObject::execute(), and Fem::FemMeshShapeObject::execute().

◆ Evaluate()

◆ FillNgMesh()

◆ FillSMesh()

int NETGENPlugin_Mesher::FillSMesh ( const netgen::OCCGeometry &  occgeo,
netgen::Mesh &  ngMesh,
const NETGENPlugin_ngMeshInfo initState,
SMESH_Mesh sMesh,
std::vector< const SMDS_MeshNode * > &  nodeVec,
SMESH_Comment comment,
SMESH_MesherHelper quadHelper = 0 
)
static

Fill SMESH mesh according to contents of netgen mesh.

Parameters
occgeo- container of OCCT geometry to mesh
ngMesh- netgen mesh
initState- bn of entities in netgen mesh before computing
sMesh- SMESH mesh to fill in
nodeVec- vector of nodes in which node index == netgen ID
comment- returns problem description
quadHelper- holder of medium nodes of sub-meshes
Return values
int- error

References SMESHDS_Mesh::AddEdge(), SMESH_MesherHelper::AddEdge(), SMESHDS_Mesh::AddFace(), SMESH_MesherHelper::AddFace(), SMESHDS_Mesh::AddNode(), SMESHDS_Mesh::AddVolume(), SMDS_Mesh::FindEdge(), SMESH_MesherHelper::GetIsQuadratic(), SMESH_Mesh::GetMeshDS(), SMDS_MeshElement::getshapeId(), SMESH_MesherHelper::GetTLinkNodeMap(), draftguitools.gui_annotationstyleeditor::param, SMESHDS_Mesh::SetMeshElementOnShape(), SMESHDS_Mesh::SetNodeInVolume(), SMESHDS_Mesh::SetNodeOnEdge(), SMESHDS_Mesh::SetNodeOnFace(), SMESHDS_Mesh::SetNodeOnVertex(), and SMESH_Algo::VertexNode().

Referenced by Compute().

◆ FixFaceMesh()

bool NETGENPlugin_Mesher::FixFaceMesh ( const netgen::OCCGeometry &  occgeom,
netgen::Mesh &  ngMesh,
const int  faceID 
)
static

Tries to heal the mesh on a FACE. The FACE is supposed to be partially meshed due to NETGEN failure.

Parameters
[in]occgeom- geometry
[in,out]ngMesh- the mesh to fix
[in,out]faceID- ID of the FACE to fix the mesh on
Returns
bool - is mesh is or becomes OK

References Link::Contains(), Link::IsConnected(), Link::n1, and Link::n2.

Referenced by NETGENPlugin_NETGEN_2D_ONLY::Compute().

◆ FixIntFaces()

void NETGENPlugin_Mesher::FixIntFaces ( const netgen::OCCGeometry &  occgeom,
netgen::Mesh &  ngMesh,
NETGENPlugin_Internals internalShapes 
)
static

◆ GetDefaultMinSize()

double NETGENPlugin_Mesher::GetDefaultMinSize ( const TopoDS_Shape &  shape,
const double  maxSize 
)
static

Return a default min size value suitable for the given geometry.

Referenced by Compute(), NETGENPlugin_NETGEN_2D_ONLY::Compute(), NETGENPlugin_NETGEN_3D::compute(), Evaluate(), and NETGENPlugin_Hypothesis::SetParametersByDefaults().

◆ GetProgress()

double NETGENPlugin_Mesher::GetProgress ( const SMESH_Algo holder,
const int algoProgressTic,
const double *  algoProgress 
) const

References netgen::multithread.

◆ PrepareOCCgeometry()

void NETGENPlugin_Mesher::PrepareOCCgeometry ( netgen::OCCGeometry &  occgeom,
const TopoDS_Shape &  shape,
SMESH_Mesh mesh,
std::list< SMESH_subMesh * > *  meshedSM = 0,
NETGENPlugin_Internals internalShapes = 0 
)
static

◆ ReadErrors()

SMESH_ComputeErrorPtr NETGENPlugin_Mesher::ReadErrors ( const std::vector< const SMDS_MeshNode * > &  nodeVec)
static

Read mesh entities preventing successful computation from "test.out" file.

References SMESH_ComputeError::New().

Referenced by Compute(), and NETGENPlugin_NETGEN_3D::compute().

◆ RemoveTmpFiles()

void NETGENPlugin_Mesher::RemoveTmpFiles ( )
static

Remove "test.out" and "problemfaces" files in current directory.

References SMESH_File::remove().

Referenced by NETGENPlugin_NetgenLibWrapper::~NETGENPlugin_NetgenLibWrapper().

◆ RestrictLocalSize()

void NETGENPlugin_Mesher::RestrictLocalSize ( netgen::Mesh &  ngMesh,
const gp_XYZ &  p,
double  size,
const bool  overrideMinH = true 
)
static

Restrict size of elements at a given point.

References netgen::mparam.

Referenced by AddSegmentsToMesh(), Compute(), Evaluate(), and FillNgMesh().

◆ SetDefaultParameters()

◆ SetParameters() [1/2]

◆ SetParameters() [2/2]

void NETGENPlugin_Mesher::SetParameters ( const NETGENPlugin_SimpleHypothesis_2D hyp)

Pass simple parameters to NETGEN

References SetDefaultParameters().

◆ SetSelfPointer()

void NETGENPlugin_Mesher::SetSelfPointer ( NETGENPlugin_Mesher **  ptr)

Set pointer to NETGENPlugin_Mesher* field of the holder, that will be nullified at destruction of this

Referenced by NETGENPlugin_NETGEN_2D::Compute(), and NETGENPlugin_NETGEN_2D3D::Compute().

◆ SetViscousLayers2DAssigned()

void NETGENPlugin_Mesher::SetViscousLayers2DAssigned ( bool  isAssigned)

◆ toPython()

void NETGENPlugin_Mesher::toPython ( const netgen::Mesh *  ngMesh,
const std::string &  pyFile 
)
static

Write a python script creating an equivalent SALOME mesh. This is useful to see what mesh is passed as input for the next step of mesh generation (of mesh of higher dimension)


The documentation for this class was generated from the following files: