SALOME - SMESH
SMESH_Hypothesis.hxx
Go to the documentation of this file.
00001 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 //  This library is free software; you can redistribute it and/or
00007 //  modify it under the terms of the GNU Lesser General Public
00008 //  License as published by the Free Software Foundation; either
00009 //  version 2.1 of the License.
00010 //
00011 //  This library is distributed in the hope that it will be useful,
00012 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 //  Lesser General Public License for more details.
00015 //
00016 //  You should have received a copy of the GNU Lesser General Public
00017 //  License along with this library; if not, write to the Free Software
00018 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 //  SMESH SMESH : implementaion of SMESH idl descriptions
00023 //  File   : SMESH_Hypothesis.hxx
00024 //  Author : Paul RASCLE, EDF
00025 //  Module : SMESH
00026 //
00027 
00028 #ifndef _SMESH_HYPOTHESIS_HXX_
00029 #define _SMESH_HYPOTHESIS_HXX_
00030 
00031 #include "SMESH_SMESH.hxx"
00032 
00033 #include "SMESHDS_Hypothesis.hxx"
00034 
00035 class SMESH_Gen;
00036 class TopoDS_Shape;
00037 class SMESH_Mesh;
00038 
00039 enum MeshDimension // dimension of mesh
00040 {
00041   MeshDim_0D = 0,
00042   MeshDim_1D,
00043   MeshDim_2D,
00044   MeshDim_3D
00045 };
00046 
00047 class SMESH_EXPORT SMESH_Hypothesis: public SMESHDS_Hypothesis
00048 {
00049 public:
00050   enum Hypothesis_Status // in the order of severity
00051   {
00052     HYP_OK = 0,
00053     HYP_MISSING,      // algo misses a hypothesis
00054     HYP_CONCURENT,    // several applicable hypotheses
00055     HYP_BAD_PARAMETER,// hypothesis has a bad parameter value
00056     HYP_HIDDEN_ALGO,  // an algo is hidden by an upper dim algo generating all-dim elements
00057     HYP_HIDING_ALGO,  // an algo hides lower dim algos by generating all-dim elements
00058     HYP_UNKNOWN_FATAL,//  --- all statuses below should be considered as fatal
00059                       //      for Add/RemoveHypothesis operations
00060     HYP_INCOMPATIBLE, // hypothesis does not fit algo
00061     HYP_NOTCONFORM,   // not conform mesh is produced appling a hypothesis
00062     HYP_ALREADY_EXIST,// such hypothesis already exist
00063     HYP_BAD_DIM,      // bad dimension
00064     HYP_BAD_SUBSHAPE, // shape is neither the main one, nor its subshape, nor a group
00065     HYP_BAD_GEOMETRY, // shape geometry mismatches algorithm's expectation
00066     HYP_NEED_SHAPE    // algorithm can work on shape only
00067   };
00068   static bool IsStatusFatal(Hypothesis_Status theStatus)
00069   { return theStatus >= HYP_UNKNOWN_FATAL; }
00070 
00071   SMESH_Hypothesis(int hypId, int studyId, SMESH_Gen* gen);
00072   virtual ~SMESH_Hypothesis();
00073   virtual int GetDim() const;
00074   int GetStudyId() const;
00075   virtual void NotifySubMeshesHypothesisModification();
00076   virtual int GetShapeType() const;
00077   virtual const char* GetLibName() const;
00078   void  SetLibName(const char* theLibName);
00079 
00080   void  SetParameters(const char *theParameters);
00081   char* GetParameters() const;
00082 
00083   void SetLastParameters(const char* theParameters);
00084   char* GetLastParameters() const;
00085   void ClearParameters();
00086   
00093   virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape)=0;
00094 
00095   struct TDefaults
00096   {
00097     double _elemLength;
00098     int    _nbSegments;
00099   };
00104   virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0)=0;
00105 
00114   virtual bool IsAuxiliary() const
00115   { return GetType() == PARAM_ALGO && _param_algo_dim < 0; }
00116 
00117 protected:
00118   SMESH_Gen* _gen;
00119   int _studyId;
00120   int _shapeType;
00121   int _param_algo_dim;
00122 
00123 private:
00124   std::string _libName;
00125   std::string _parameters;
00126   std::string _lastParameters;
00127 };
00128 
00129 #endif
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines