Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef _SMESH_GEN_HXX_
00029 #define _SMESH_GEN_HXX_
00030
00031 #include "SMESH_SMESH.hxx"
00032
00033 #include "Utils_SALOME_Exception.hxx"
00034
00035 #include "SMESH_Hypothesis.hxx"
00036 #include "SMESH_ComputeError.hxx"
00037 #include "SMESH_Algo.hxx"
00038 #include "SMESH_0D_Algo.hxx"
00039 #include "SMESH_1D_Algo.hxx"
00040 #include "SMESH_2D_Algo.hxx"
00041 #include "SMESH_3D_Algo.hxx"
00042 #include "SMESH_Mesh.hxx"
00043
00044 #include "chrono.hxx"
00045
00046 #include <TopoDS_Shape.hxx>
00047
00048 #include <map>
00049 #include <list>
00050
00051 class SMESHDS_Document;
00052
00053 typedef SMESH_Hypothesis::Hypothesis_Status TAlgoStateErrorName;
00054
00055 typedef struct studyContextStruct
00056 {
00057 std::map < int, SMESH_Hypothesis * >mapHypothesis;
00058 std::map < int, SMESH_Mesh * >mapMesh;
00059 SMESHDS_Document * myDocument;
00060 } StudyContextStruct;
00061
00062 typedef std::set<int> TSetOfInt;
00063
00064 class SMESH_EXPORT SMESH_Gen
00065 {
00066 public:
00067 SMESH_Gen();
00068 ~SMESH_Gen();
00069
00070 SMESH_Mesh* CreateMesh(int theStudyId, bool theIsEmbeddedMode)
00071 throw(SALOME_Exception);
00072
00080 bool Compute(::SMESH_Mesh & aMesh,
00081 const TopoDS_Shape & aShape,
00082 const bool anUpward=false,
00083 const ::MeshDimension aDim=::MeshDim_3D,
00084 TSetOfInt* aShapesId=0);
00085
00086 #ifdef WITH_SMESH_CANCEL_COMPUTE
00087 void PrepareCompute(::SMESH_Mesh & aMesh,
00088 const TopoDS_Shape & aShape);
00089 void CancelCompute(::SMESH_Mesh & aMesh,
00090 const TopoDS_Shape & aShape);
00091 #endif
00092
00100 bool Evaluate(::SMESH_Mesh & aMesh,
00101 const TopoDS_Shape & aShape,
00102 MapShapeNbElems& aResMap,
00103 const bool anUpward=false,
00104 TSetOfInt* aShapesId=0);
00105
00106 bool CheckAlgoState(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape);
00107
00108
00109
00114 void SetBoundaryBoxSegmentation( int theNbSegments ) { _segmentation = theNbSegments; }
00115 int GetBoundaryBoxSegmentation() const { return _segmentation; }
00119 void SetDefaultNbSegments(int nb) { _nbSegments = nb; }
00120 int GetDefaultNbSegments() const { return _nbSegments; }
00121
00122 struct TAlgoStateError
00123 {
00124 TAlgoStateErrorName _name;
00125 const SMESH_Algo* _algo;
00126 int _algoDim;
00127 bool _isGlobalAlgo;
00128
00129 TAlgoStateError(): _algoDim(0),_algo(0),_name(SMESH_Hypothesis::HYP_OK) {}
00130 void Set(TAlgoStateErrorName name, const SMESH_Algo* algo, bool isGlobal)
00131 { _name = name; _algo = algo; _algoDim = algo->GetDim(); _isGlobalAlgo = isGlobal; }
00132 void Set(TAlgoStateErrorName name, const int algoDim, bool isGlobal)
00133 { _name = name; _algo = 0; _algoDim = algoDim; _isGlobalAlgo = isGlobal; }
00134 };
00135
00136 bool GetAlgoState(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape,
00137 std::list< SMESH_Gen::TAlgoStateError > & theErrors);
00138
00139
00140
00141
00142 StudyContextStruct *GetStudyContext(int studyId);
00143
00144 static int GetShapeDim(const TopAbs_ShapeEnum & aShapeType);
00145 static int GetShapeDim(const TopoDS_Shape & aShape)
00146 { return GetShapeDim( aShape.ShapeType() ); }
00147 SMESH_Algo* GetAlgo(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, TopoDS_Shape* assignedTo=0);
00148 static bool IsGlobalHypothesis(const SMESH_Hypothesis* theHyp, SMESH_Mesh& aMesh);
00149
00150 int GetANewId();
00151
00152 std::map < int, SMESH_Algo * >_mapAlgo;
00153 std::map < int, SMESH_0D_Algo * >_map0D_Algo;
00154 std::map < int, SMESH_1D_Algo * >_map1D_Algo;
00155 std::map < int, SMESH_2D_Algo * >_map2D_Algo;
00156 std::map < int, SMESH_3D_Algo * >_map3D_Algo;
00157
00158 private:
00159
00160 int _localId;
00161 std::map < int, StudyContextStruct * >_mapStudyContext;
00162
00163
00164 int _hypId;
00165
00166
00167
00168 int _segmentation;
00169
00170 int _nbSegments;
00171 counters *_counters;
00172
00173 #ifdef WITH_SMESH_CANCEL_COMPUTE
00174 volatile bool _compute_canceled;
00175 SMESH_subMesh* _sm_current;
00176 #endif
00177 };
00178
00179 #endif