Version: 9.12.0
SMESH_Gen Class Reference

#include <SMESH_Gen.hxx>

Data Structures

struct  TAlgoStateError
 

Public Types

enum  ComputeFlags { SHAPE_ONLY = 1 , UPWARD = 2 , COMPACT_MESH = 4 , SHAPE_ONLY_UPWARD = 3 }
 

Public Member Functions

 SMESH_Gen ()
 Constructor. More...
 
 ~SMESH_Gen ()
 Destructor. More...
 
SMESH_MeshCreateMesh (bool theIsEmbeddedMode)
 Creates a mesh in a study. More...
 
SMESH_ParallelMeshCreateParallelMesh (bool theIsEmbeddedMode)
 Creates a parallel mesh in a study. More...
 
bool Compute (::SMESH_Mesh &aMesh, const TopoDS_Shape &aShape, const int aFlags=COMPACT_MESH, const ::MeshDimension aDim=::MeshDim_3D, TSetOfInt *aShapesId=0, TopTools_IndexedMapOfShape *anAllowedSubShapes=0)
 Computes aMesh on aShape. More...
 
void PrepareCompute (::SMESH_Mesh &aMesh, const TopoDS_Shape &aShape)
 Prepare Compute a mesh. More...
 
void CancelCompute (::SMESH_Mesh &aMesh, const TopoDS_Shape &aShape)
 
const SMESH_subMeshGetCurrentSubMesh () const
 Returns a sub-mesh being currently computed. More...
 
bool Evaluate (::SMESH_Mesh &aMesh, const TopoDS_Shape &aShape, MapShapeNbElems &aResMap, const bool anUpward=false, TSetOfInt *aShapesId=0)
 evaluates size of prospective mesh on a shape More...
 
bool CheckAlgoState (SMESH_Mesh &aMesh, const TopoDS_Shape &aShape)
 
void SetBoundaryBoxSegmentation (int theNbSegments)
 Sets number of segments per diagonal of boundary box of geometry by which default segment length of appropriate 1D hypotheses is defined. More...
 
int GetBoundaryBoxSegmentation () const
 
void SetDefaultNbSegments (int nb)
 Sets default number of segments per edge. More...
 
int GetDefaultNbSegments () const
 
bool GetAlgoState (SMESH_Mesh &aMesh, const TopoDS_Shape &aShape, std::list< SMESH_Gen::TAlgoStateError > &theErrors)
 
StudyContextStructGetStudyContext ()
 Returns StudyContextStruct for a study. More...
 
SMESH_AlgoGetAlgo (SMESH_Mesh &aMesh, const TopoDS_Shape &aShape, TopoDS_Shape *assignedTo=0)
 Finds algo to mesh a shape. More...
 
SMESH_AlgoGetAlgo (SMESH_subMesh *aSubMesh, TopoDS_Shape *assignedTo=0)
 Finds algo to mesh a sub-mesh. More...
 
int GetANewId ()
 Generate a new id unique within this Gen. More...
 
void send_mesh (SMESH_Mesh &aMesh, std::string filename)
 
bool parallelComputeSubMeshes (SMESH_Mesh &aMesh, const TopoDS_Shape &aShape, const ::MeshDimension aDim, TSetOfInt *aShapesId, TopTools_IndexedMapOfShape *allowedSubShapes, SMESH_subMesh::compute_event &computeEvent, const bool includeSelf, const bool complexShapeFirst, const bool aShapeOnly)
 Algo to run the computation of all the submeshes of a mesh in parallel. More...
 
bool sequentialComputeSubMeshes (SMESH_Mesh &aMesh, const TopoDS_Shape &aShape, const ::MeshDimension aDim, TSetOfInt *aShapesId, TopTools_IndexedMapOfShape *allowedSubShapes, SMESH_subMesh::compute_event &computeEvent, const bool includeSelf, const bool complexShapeFirst, const bool aShapeOnly)
 Algo to run the computation of all the submeshes of a mesh in sequentila. More...
 

Static Public Member Functions

static int GetShapeDim (const TopAbs_ShapeEnum &aShapeType)
 Return shape dimension by TopAbs_ShapeEnum. More...
 
static int GetShapeDim (const TopoDS_Shape &aShape)
 
static int GetFlatShapeDim (const TopoDS_Shape &aShape)
 Return shape dimension by exploding compounds. More...
 
static bool IsGlobalHypothesis (const SMESH_Hypothesis *theHyp, SMESH_Mesh &aMesh)
 
static std::vector< std::string > GetPluginXMLPaths ()
 Return paths to xml files of plugins. More...
 

Private Member Functions

void setCurrentSubMesh (SMESH_subMesh *sm)
 Sets a sub-mesh being currently computed. More...
 
void resetCurrentSubMesh ()
 

Private Attributes

int _localId
 
StudyContextStruct_studyContext
 
int _hypId
 
int _segmentation
 
int _nbSegments
 
volatile bool _compute_canceled
 
std::list< SMESH_subMesh * > _sm_current
 

Member Enumeration Documentation

◆ ComputeFlags

Enumerator
SHAPE_ONLY 
UPWARD 
COMPACT_MESH 
SHAPE_ONLY_UPWARD 

Constructor & Destructor Documentation

◆ SMESH_Gen()

SMESH_Gen::SMESH_Gen ( )

Constructor.

References studyContextStruct::myDocument.

◆ ~SMESH_Gen()

SMESH_Gen::~SMESH_Gen ( )

Destructor.

Member Function Documentation

◆ CancelCompute()

void SMESH_Gen::CancelCompute ( ::SMESH_Mesh aMesh,
const TopoDS_Shape &  aShape 
)

◆ CheckAlgoState()

bool SMESH_Gen::CheckAlgoState ( SMESH_Mesh aMesh,
const TopoDS_Shape &  aShape 
)

◆ Compute()

bool SMESH_Gen::Compute ( ::SMESH_Mesh aMesh,
const TopoDS_Shape &  aShape,
const int  aFlags = COMPACT_MESH,
const ::MeshDimension  aDim = ::MeshDim_3D,
TSetOfInt aShapesId = 0,
TopTools_IndexedMapOfShape *  anAllowedSubShapes = 0 
)

Computes aMesh on aShape.

Parameters
aMesh- the mesh.
aShape- the shape.
aFlags- ComputeFlags. By default compute the whole mesh and compact at the end.
aDim- upper level dimension of the mesh computation (for preview)
aShapesId- list of shapes with computed mesh entities (elements or nodes)
anAllowedSubShapes- shapes to mesh only. Mesh all if empty or nullptr
Return values
bool- true if none sub-mesh failed to compute

Referenced by StdMeshers_Prism_3D::assocOrProjBottom2Top(), SMESH_Gen_i::Compute(), StdMeshers_Import_1D::Compute(), StdMeshers_Import_1D2D::Compute(), StdMeshers_Prism_3D::computeBase(), StdMeshers_ProjectionUtils::MakeComputed(), and SMESH_Gen_i::Precompute().

◆ CreateMesh()

SMESH_Mesh * SMESH_Gen::CreateMesh ( bool  theIsEmbeddedMode)

Creates a mesh in a study.

if (theIsEmbeddedMode) { mesh modification commands are not logged }

Referenced by SMESH_Gen_i::createMesh().

◆ CreateParallelMesh()

SMESH_ParallelMesh * SMESH_Gen::CreateParallelMesh ( bool  theIsEmbeddedMode)

Creates a parallel mesh in a study.

if (theIsEmbeddedMode) { mesh modification commands are not logged }

Referenced by SMESH_Gen_i::createParallelMesh().

◆ Evaluate()

bool SMESH_Gen::Evaluate ( ::SMESH_Mesh aMesh,
const TopoDS_Shape &  aShape,
MapShapeNbElems aResMap,
const bool  anUpward = false,
TSetOfInt aShapesId = 0 
)

evaluates size of prospective mesh on a shape

Parameters
aMesh- the mesh
aShape- the shape
aResMap- map for prospective numbers of elements
Return values
bool- is a success

Referenced by SMESH_Gen_i::Evaluate(), StdMeshers_Projection_1D2D::Evaluate(), and StdMeshers_Projection_2D::Evaluate().

◆ GetAlgo() [1/2]

SMESH_Algo * SMESH_Gen::GetAlgo ( SMESH_Mesh aMesh,
const TopoDS_Shape &  aShape,
TopoDS_Shape *  assignedTo = 0 
)

◆ GetAlgo() [2/2]

◆ GetAlgoState()

◆ GetANewId()

int SMESH_Gen::GetANewId ( )

Generate a new id unique within this Gen.

Referenced by StdMeshers_Hexa_3D::Compute(), ComputePentahedralMesh(), EvaluatePentahedralMesh(), StdMeshers_Adaptive1D::GetAlgo(), StdMeshers_Adaptive1D_i::StdMeshers_Adaptive1D_i(), StdMeshers_Arithmetic1D_i::StdMeshers_Arithmetic1D_i(), StdMeshers_AutomaticLength_i::StdMeshers_AutomaticLength_i(), StdMeshers_BlockRenumber_i::StdMeshers_BlockRenumber_i(), StdMeshers_Cartesian_3D_i::StdMeshers_Cartesian_3D_i(), StdMeshers_CartesianParameters3D_i::StdMeshers_CartesianParameters3D_i(), StdMeshers_CompositeSegment_1D_i::StdMeshers_CompositeSegment_1D_i(), StdMeshers_Deflection1D_i::StdMeshers_Deflection1D_i(), StdMeshers_FixedPoints1D_i::StdMeshers_FixedPoints1D_i(), StdMeshers_Geometric1D_i::StdMeshers_Geometric1D_i(), StdMeshers_Hexa_3D::StdMeshers_Hexa_3D(), StdMeshers_Hexa_3D_i::StdMeshers_Hexa_3D_i(), StdMeshers_Import_1D2D_i::StdMeshers_Import_1D2D_i(), StdMeshers_Import_1D_i::StdMeshers_Import_1D_i(), StdMeshers_ImportSource1D_i::StdMeshers_ImportSource1D_i(), StdMeshers_ImportSource2D_i::StdMeshers_ImportSource2D_i(), StdMeshers_LayerDistribution2D_i::StdMeshers_LayerDistribution2D_i(), StdMeshers_LayerDistribution_i::StdMeshers_LayerDistribution_i(), StdMeshers_LengthFromEdges_i::StdMeshers_LengthFromEdges_i(), StdMeshers_LocalLength_i::StdMeshers_LocalLength_i(), StdMeshers_MaxElementArea_i::StdMeshers_MaxElementArea_i(), StdMeshers_MaxElementVolume_i::StdMeshers_MaxElementVolume_i(), StdMeshers_MaxLength_i::StdMeshers_MaxLength_i(), StdMeshers_NotConformAllowed_i::StdMeshers_NotConformAllowed_i(), StdMeshers_NumberOfLayers2D_i::StdMeshers_NumberOfLayers2D_i(), StdMeshers_NumberOfLayers_i::StdMeshers_NumberOfLayers_i(), StdMeshers_NumberOfSegments_i::StdMeshers_NumberOfSegments_i(), StdMeshers_PolygonPerFace_2D_i::StdMeshers_PolygonPerFace_2D_i(), StdMeshers_PolyhedronPerSolid_3D_i::StdMeshers_PolyhedronPerSolid_3D_i(), StdMeshers_Prism_3D_i::StdMeshers_Prism_3D_i(), StdMeshers_Projection_1D2D_i::StdMeshers_Projection_1D2D_i(), StdMeshers_Projection_1D_i::StdMeshers_Projection_1D_i(), StdMeshers_Projection_2D_i::StdMeshers_Projection_2D_i(), StdMeshers_Projection_3D_i::StdMeshers_Projection_3D_i(), StdMeshers_ProjectionSource1D_i::StdMeshers_ProjectionSource1D_i(), StdMeshers_ProjectionSource2D_i::StdMeshers_ProjectionSource2D_i(), StdMeshers_ProjectionSource3D_i::StdMeshers_ProjectionSource3D_i(), StdMeshers_Propagation_i::StdMeshers_Propagation_i(), StdMeshers_PropagOfDistribution_i::StdMeshers_PropagOfDistribution_i(), StdMeshers_QuadFromMedialAxis_1D2D_i::StdMeshers_QuadFromMedialAxis_1D2D_i(), StdMeshers_Quadrangle_2D_i::StdMeshers_Quadrangle_2D_i(), StdMeshers_QuadrangleParams_i::StdMeshers_QuadrangleParams_i(), StdMeshers_QuadranglePreference_i::StdMeshers_QuadranglePreference_i(), StdMeshers_QuadraticMesh_i::StdMeshers_QuadraticMesh_i(), StdMeshers_RadialPrism_3D_i::StdMeshers_RadialPrism_3D_i(), StdMeshers_RadialQuadrangle_1D2D_i::StdMeshers_RadialQuadrangle_1D2D_i(), StdMeshers_Regular_1D_i::StdMeshers_Regular_1D_i(), StdMeshers_SegmentAroundVertex_0D_i::StdMeshers_SegmentAroundVertex_0D_i(), StdMeshers_SegmentLengthAroundVertex_i::StdMeshers_SegmentLengthAroundVertex_i(), StdMeshers_StartEndLength_i::StdMeshers_StartEndLength_i(), StdMeshers_UseExisting_1D_i::StdMeshers_UseExisting_1D_i(), StdMeshers_UseExisting_2D_i::StdMeshers_UseExisting_2D_i(), StdMeshers_ViscousLayerBuilder_i::StdMeshers_ViscousLayerBuilder_i(), StdMeshers_ViscousLayers2D_i::StdMeshers_ViscousLayers2D_i(), and StdMeshers_ViscousLayers_i::StdMeshers_ViscousLayers_i().

◆ GetBoundaryBoxSegmentation()

int SMESH_Gen::GetBoundaryBoxSegmentation ( ) const

◆ GetCurrentSubMesh()

const SMESH_subMesh * SMESH_Gen::GetCurrentSubMesh ( ) const

Returns a sub-mesh being currently computed.

Referenced by SMESH_Mesh::GetComputeProgress().

◆ GetDefaultNbSegments()

int SMESH_Gen::GetDefaultNbSegments ( ) const

◆ GetFlatShapeDim()

int SMESH_Gen::GetFlatShapeDim ( const TopoDS_Shape &  aShape)
static

Return shape dimension by exploding compounds.

◆ GetPluginXMLPaths()

std::vector< std::string > SMESH_Gen::GetPluginXMLPaths ( )
static

Return paths to xml files of plugins.

References env_sep.

Referenced by _pyHypothesisReader::_pyHypothesisReader(), and SMESH_Algo::GetFeatures().

◆ GetShapeDim() [1/2]

◆ GetShapeDim() [2/2]

static int SMESH_Gen::GetShapeDim ( const TopoDS_Shape &  aShape)
static

◆ GetStudyContext()

◆ IsGlobalHypothesis()

bool SMESH_Gen::IsGlobalHypothesis ( const SMESH_Hypothesis theHyp,
SMESH_Mesh aMesh 
)
static

◆ parallelComputeSubMeshes()

bool SMESH_Gen::parallelComputeSubMeshes ( SMESH_Mesh aMesh,
const TopoDS_Shape &  aShape,
const ::MeshDimension  aDim,
TSetOfInt aShapesId,
TopTools_IndexedMapOfShape *  allowedSubShapes,
SMESH_subMesh::compute_event computeEvent,
const bool  includeSelf,
const bool  complexShapeFirst,
const bool  aShapeOnly 
)

◆ PrepareCompute()

void SMESH_Gen::PrepareCompute ( ::SMESH_Mesh aMesh,
const TopoDS_Shape &  aShape 
)

Prepare Compute a mesh.

Referenced by SMESH_Gen_i::Compute().

◆ resetCurrentSubMesh()

void SMESH_Gen::resetCurrentSubMesh ( )
private

◆ send_mesh()

void SMESH_Gen::send_mesh ( SMESH_Mesh aMesh,
std::string  filename 
)

◆ sequentialComputeSubMeshes()

bool SMESH_Gen::sequentialComputeSubMeshes ( SMESH_Mesh aMesh,
const TopoDS_Shape &  aShape,
const ::MeshDimension  aDim,
TSetOfInt aShapesId,
TopTools_IndexedMapOfShape *  allowedSubShapes,
SMESH_subMesh::compute_event computeEvent,
const bool  includeSelf,
const bool  complexShapeFirst,
const bool  aShapeOnly 
)

◆ SetBoundaryBoxSegmentation()

void SMESH_Gen::SetBoundaryBoxSegmentation ( int  theNbSegments)

Sets number of segments per diagonal of boundary box of geometry by which default segment length of appropriate 1D hypotheses is defined.

Referenced by SMESH_Gen_i::SetBoundaryBoxSegmentation().

◆ setCurrentSubMesh()

void SMESH_Gen::setCurrentSubMesh ( SMESH_subMesh sm)
private

Sets a sub-mesh being currently computed.

An algorithm can call Compute() for a sub-shape, hence we keep a stack of sub-meshes

◆ SetDefaultNbSegments()

void SMESH_Gen::SetDefaultNbSegments ( int  nb)

Sets default number of segments per edge.

Referenced by SMESH_Gen_i::SetDefaultNbSegments().

Field Documentation

◆ _compute_canceled

volatile bool SMESH_Gen::_compute_canceled
private

◆ _hypId

int SMESH_Gen::_hypId
private

◆ _localId

int SMESH_Gen::_localId
private

◆ _nbSegments

int SMESH_Gen::_nbSegments
private

◆ _segmentation

int SMESH_Gen::_segmentation
private

◆ _sm_current

std::list< SMESH_subMesh* > SMESH_Gen::_sm_current
private

◆ _studyContext

StudyContextStruct* SMESH_Gen::_studyContext
private