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 <TopoDS_Shape.hxx>
00045
00046 #include <map>
00047 #include <list>
00048
00049 class SMESHDS_Document;
00050
00051 typedef SMESH_Hypothesis::Hypothesis_Status TAlgoStateErrorName;
00052
00053 typedef struct studyContextStruct
00054 {
00055 std::map < int, SMESH_Hypothesis * >mapHypothesis;
00056 std::map < int, SMESH_Mesh * >mapMesh;
00057 SMESHDS_Document * myDocument;
00058 } StudyContextStruct;
00059
00060 typedef std::set<int> TSetOfInt;
00061
00062 class SMESH_EXPORT SMESH_Gen
00063 {
00064 public:
00065 SMESH_Gen();
00066 ~SMESH_Gen();
00067
00068 SMESH_Mesh* CreateMesh(int theStudyId, bool theIsEmbeddedMode)
00069 throw(SALOME_Exception);
00070
00078 bool Compute(::SMESH_Mesh & aMesh,
00079 const TopoDS_Shape & aShape,
00080 const bool anUpward=false,
00081 const ::MeshDimension aDim=::MeshDim_3D,
00082 TSetOfInt* aShapesId=0);
00083
00091 bool Evaluate(::SMESH_Mesh & aMesh,
00092 const TopoDS_Shape & aShape,
00093 MapShapeNbElems& aResMap,
00094 const bool anUpward=false,
00095 TSetOfInt* aShapesId=0);
00096
00097 bool CheckAlgoState(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape);
00098
00099
00100
00105 void SetBoundaryBoxSegmentation( int theNbSegments ) { _segmentation = theNbSegments; }
00106 int GetBoundaryBoxSegmentation() const { return _segmentation; }
00110 void SetDefaultNbSegments(int nb) { _nbSegments = nb; }
00111 int GetDefaultNbSegments() const { return _nbSegments; }
00112
00113 struct TAlgoStateError
00114 {
00115 TAlgoStateErrorName _name;
00116 const SMESH_Algo* _algo;
00117 int _algoDim;
00118 bool _isGlobalAlgo;
00119
00120 TAlgoStateError(): _algoDim(0),_algo(0),_name(SMESH_Hypothesis::HYP_OK) {}
00121 void Set(TAlgoStateErrorName name, const SMESH_Algo* algo, bool isGlobal)
00122 { _name = name; _algo = algo; _algoDim = algo->GetDim(); _isGlobalAlgo = isGlobal; }
00123 void Set(TAlgoStateErrorName name, const int algoDim, bool isGlobal)
00124 { _name = name; _algo = 0; _algoDim = algoDim; _isGlobalAlgo = isGlobal; }
00125 };
00126
00127 bool GetAlgoState(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape,
00128 std::list< SMESH_Gen::TAlgoStateError > & theErrors);
00129
00130
00131
00132
00133 StudyContextStruct *GetStudyContext(int studyId);
00134
00135 static int GetShapeDim(const TopAbs_ShapeEnum & aShapeType);
00136 static int GetShapeDim(const TopoDS_Shape & aShape)
00137 { return GetShapeDim( aShape.ShapeType() ); }
00138 SMESH_Algo* GetAlgo(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, TopoDS_Shape* assignedTo=0);
00139 static bool IsGlobalHypothesis(const SMESH_Hypothesis* theHyp, SMESH_Mesh& aMesh);
00140
00141 int GetANewId();
00142
00143 std::map < int, SMESH_Algo * >_mapAlgo;
00144 std::map < int, SMESH_0D_Algo * >_map0D_Algo;
00145 std::map < int, SMESH_1D_Algo * >_map1D_Algo;
00146 std::map < int, SMESH_2D_Algo * >_map2D_Algo;
00147 std::map < int, SMESH_3D_Algo * >_map3D_Algo;
00148
00149 private:
00150
00151 int _localId;
00152 std::map < int, StudyContextStruct * >_mapStudyContext;
00153
00154
00155 int _hypId;
00156
00157
00158
00159 int _segmentation;
00160
00161 int _nbSegments;
00162 };
00163
00164 #endif