Version: 6.3.1
Data Structures | Public Member Functions | Static Public Member Functions | Data Fields | Private Attributes

SMESH_Gen Class Reference

#include <SMESH_Gen.hxx>

Data Structures

struct  TAlgoStateError

Public Member Functions

 SMESH_Gen ()
 Constructor.
 ~SMESH_Gen ()
 Destructor.
SMESH_MeshCreateMesh (int theStudyId, bool theIsEmbeddedMode) throw (SALOME_Exception)
 Creates a mesh in a study.
bool Compute (::SMESH_Mesh &aMesh, const TopoDS_Shape &aShape, const bool anUpward=false, const ::MeshDimension aDim=::MeshDim_3D, TSetOfInt *aShapesId=0)
 Computes aMesh on aShape.
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
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.
int GetBoundaryBoxSegmentation () const
void SetDefaultNbSegments (int nb)
 Sets default number of segments per edge.
int GetDefaultNbSegments () const
bool GetAlgoState (SMESH_Mesh &aMesh, const TopoDS_Shape &aShape, std::list< SMESH_Gen::TAlgoStateError > &theErrors)
StudyContextStructGetStudyContext (int studyId)
 Returns StudyContextStruct for a study.
SMESH_AlgoGetAlgo (SMESH_Mesh &aMesh, const TopoDS_Shape &aShape, TopoDS_Shape *assignedTo=0)
 Finds algo to mesh a shape.
int GetANewId ()
 Genarate a new id unique withing this Gen.

Static Public Member Functions

static int GetShapeDim (const TopAbs_ShapeEnum &aShapeType)
 Return shape dimension by TopAbs_ShapeEnum.
static int GetShapeDim (const TopoDS_Shape &aShape)
static bool IsGlobalHypothesis (const SMESH_Hypothesis *theHyp, SMESH_Mesh &aMesh)

Data Fields

std::map< int, SMESH_Algo * > _mapAlgo
std::map< int, SMESH_0D_Algo * > _map0D_Algo
std::map< int, SMESH_1D_Algo * > _map1D_Algo
std::map< int, SMESH_2D_Algo * > _map2D_Algo
std::map< int, SMESH_3D_Algo * > _map3D_Algo

Private Attributes

int _localId
std::map< int,
StudyContextStruct * > 
_mapStudyContext
int _hypId
int _segmentation
int _nbSegments
counters_counters

Detailed Description

Definition at line 64 of file SMESH_Gen.hxx.


Constructor & Destructor Documentation

SMESH_Gen::SMESH_Gen ( )

Constructor.

Definition at line 57 of file SMESH_Gen.cxx.

References SMDS_Mesh._meshList, MESSAGE, and ex21_lamp.size.

{
        MESSAGE("SMESH_Gen::SMESH_Gen");
        _localId = 0;
        _hypId = 0;
        _segmentation = _nbSegments = 10;
        SMDS_Mesh::_meshList.clear();
        MESSAGE(SMDS_Mesh::_meshList.size());
        _counters = new counters(100);
#ifdef WITH_SMESH_CANCEL_COMPUTE
        _compute_canceled = false;
        _sm_current = NULL;
#endif
}
SMESH_Gen::~SMESH_Gen ( )

Destructor.

Definition at line 78 of file SMESH_Gen.cxx.

References MESSAGE.

{
  MESSAGE("SMESH_Gen::~SMESH_Gen");
}

Member Function Documentation

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

Definition at line 734 of file SMESH_Gen.cxx.

{
  list< TAlgoStateError > errors;
  return GetAlgoState( aMesh, aShape, errors );
}
bool SMESH_Gen.Compute ( ::SMESH_Mesh aMesh,
const TopoDS_Shape &  aShape,
const bool  anUpward = false,
const ::MeshDimension  aDim = ::MeshDim_3D,
TSetOfInt aShapesId = 0 
)

Computes aMesh on aShape.

Parameters:
anUpward- compute from vertices up to more complex shape (internal usage)
aDim- upper level dimension of the mesh computation
aShapesId- list of shapes with computed mesh entities (elements or nodes)
Return values:
bool- true if none submesh failed to compute
SMESH_Mesh * SMESH_Gen::CreateMesh ( int  theStudyId,
bool  theIsEmbeddedMode 
) throw (SALOME_Exception)

Creates a mesh in a study.

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

Definition at line 90 of file SMESH_Gen.cxx.

References studyContextStruct.mapMesh, MESSAGE, and studyContextStruct.myDocument.

{
  Unexpect aCatch(SalomeException);
  MESSAGE("SMESH_Gen::CreateMesh");

  // Get studyContext, create it if it does'nt exist, with a SMESHDS_Document
  StudyContextStruct *aStudyContext = GetStudyContext(theStudyId);

  // create a new SMESH_mesh object
  SMESH_Mesh *aMesh = new SMESH_Mesh(_localId++,
                                     theStudyId,
                                     this,
                                     theIsEmbeddedMode,
                                     aStudyContext->myDocument);
  aStudyContext->mapMesh[_localId] = aMesh;

  return aMesh;
}
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
SMESH_Algo * SMESH_Gen::GetAlgo ( SMESH_Mesh aMesh,
const TopoDS_Shape &  aShape,
TopoDS_Shape *  assignedTo = 0 
)

Finds algo to mesh a shape.

Optionally returns a shape the found algo is bound to

Definition at line 890 of file SMESH_Gen.cxx.

References SMESH_HypoFilter.And(), SMESH_HypoFilter.IsAlgo(), and SMESH_HypoFilter.IsApplicableTo().

{
  SMESH_HypoFilter filter( SMESH_HypoFilter::IsAlgo() );
  filter.And( filter.IsApplicableTo( aShape ));

  return (SMESH_Algo*) aMesh.GetHypothesis( aShape, filter, true, assignedTo );
}
bool SMESH_Gen.GetAlgoState ( SMESH_Mesh aMesh,
const TopoDS_Shape &  aShape,
std::list< SMESH_Gen::TAlgoStateError > &  theErrors 
)
int SMESH_Gen::GetANewId ( )
int SMESH_Gen.GetBoundaryBoxSegmentation ( ) const

Definition at line 115 of file SMESH_Gen.hxx.

{ return _segmentation; }
int SMESH_Gen.GetDefaultNbSegments ( ) const

Definition at line 120 of file SMESH_Gen.hxx.

{ return _nbSegments; }
int SMESH_Gen::GetShapeDim ( const TopAbs_ShapeEnum &  aShapeType) [static]

Return shape dimension by TopAbs_ShapeEnum.

Definition at line 925 of file SMESH_Gen.cxx.

References MeshDim_0D, MeshDim_1D, MeshDim_2D, and MeshDim_3D.

Referenced by SMESH_Mesh.AddHypothesis(), SMESH_subMesh.CanAddHypothesis(), checkMissing(), SMESH_subMesh.CleanDependants(), SMESH_subMesh.DumpAlgoState(), SMESH.SMESH_Gen.Evaluate(), SMESH_subMesh.IsApplicableHypotesis(), SMESH_subMesh.IsMeshComputed(), SMESH_HypoFilter.IsMoreLocalThanPredicate.IsOk(), SMESH_Mesh.RemoveHypothesis(), SMESH_subMesh.RemoveSubMeshElementsAndNodes(), SMESH_DimHyp.SetShape(), and SMESH_subMesh.SubMeshesComputed().

{
  static vector<int> dim;
  if ( dim.empty() )
  {
    dim.resize( TopAbs_SHAPE, -1 );
    dim[ TopAbs_COMPOUND ]  = MeshDim_3D;
    dim[ TopAbs_COMPSOLID ] = MeshDim_3D;
    dim[ TopAbs_SOLID ]     = MeshDim_3D;
    dim[ TopAbs_SHELL ]     = MeshDim_3D;
    dim[ TopAbs_FACE  ]     = MeshDim_2D;
    dim[ TopAbs_WIRE ]      = MeshDim_1D;
    dim[ TopAbs_EDGE ]      = MeshDim_1D;
    dim[ TopAbs_VERTEX ]    = MeshDim_0D;
  }
  return dim[ aShapeType ];
}
static int SMESH_Gen.GetShapeDim ( const TopoDS_Shape &  aShape) [static]

Definition at line 145 of file SMESH_Gen.hxx.

References GetShapeDim().

Referenced by GetShapeDim().

  { return GetShapeDim( aShape.ShapeType() ); }
StudyContextStruct * SMESH_Gen::GetStudyContext ( int  studyId)

Returns StudyContextStruct for a study.

Definition at line 906 of file SMESH_Gen.cxx.

References studyContextStruct.myDocument.

{
  // Get studyContext, create it if it does'nt exist, with a SMESHDS_Document

  if (_mapStudyContext.find(studyId) == _mapStudyContext.end())
  {
    _mapStudyContext[studyId] = new StudyContextStruct;
    _mapStudyContext[studyId]->myDocument = new SMESHDS_Document(studyId);
  }
  StudyContextStruct *myStudyContext = _mapStudyContext[studyId];
  return myStudyContext;
}
bool SMESH_Gen::IsGlobalHypothesis ( const SMESH_Hypothesis theHyp,
SMESH_Mesh aMesh 
) [static]

Definition at line 878 of file SMESH_Gen.cxx.

References SMESH_HypoFilter.Is().

{
  SMESH_HypoFilter filter( SMESH_HypoFilter::Is( theHyp ));
  return aMesh.GetHypothesis( aMesh.GetMeshDS()->ShapeToMesh(), filter, false );
}
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.

Definition at line 114 of file SMESH_Gen.hxx.

{ _segmentation = theNbSegments; }
void SMESH_Gen.SetDefaultNbSegments ( int  nb)

Sets default number of segments per edge.

Definition at line 119 of file SMESH_Gen.hxx.

{ _nbSegments = nb; }

Field Documentation

Definition at line 171 of file SMESH_Gen.hxx.

int SMESH_Gen._hypId [private]

Definition at line 164 of file SMESH_Gen.hxx.

Definition at line 160 of file SMESH_Gen.hxx.

Definition at line 153 of file SMESH_Gen.hxx.

Definition at line 154 of file SMESH_Gen.hxx.

Definition at line 155 of file SMESH_Gen.hxx.

Definition at line 156 of file SMESH_Gen.hxx.

Definition at line 152 of file SMESH_Gen.hxx.

Definition at line 161 of file SMESH_Gen.hxx.

Definition at line 170 of file SMESH_Gen.hxx.

Definition at line 168 of file SMESH_Gen.hxx.

Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS