SALOME - SMESH
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
StdMeshers_NumberOfSegments.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   : StdMeshers_NumberOfSegments.hxx
00024 //           Moved here from SMESH_NumberOfSegments.hxx
00025 //  Author : Paul RASCLE, EDF
00026 //  Module : SMESH
00027 //
00028 #ifndef _SMESH_NUMBEROFSEGMENTS_HXX_
00029 #define _SMESH_NUMBEROFSEGMENTS_HXX_
00030 
00031 #include "SMESH_StdMeshers.hxx"
00032 
00033 #include "SMESH_Hypothesis.hxx"
00034 #include "Utils_SALOME_Exception.hxx"
00035 #include <vector>
00036 
00043 class STDMESHERS_EXPORT StdMeshers_NumberOfSegments:
00044   public SMESH_Hypothesis
00045 {
00046 public:
00047   StdMeshers_NumberOfSegments(int hypId, int studyId, SMESH_Gen* gen);
00048   virtual ~StdMeshers_NumberOfSegments();
00049 
00050   // Builds point distribution according to passed function
00051   const std::vector<double>& BuildDistributionExpr( const char*, int, int ) throw ( SALOME_Exception );
00052   const std::vector<double>& BuildDistributionTab( const std::vector<double>&, int, int ) throw ( SALOME_Exception );
00053 
00058   void SetNumberOfSegments(int segmentsNumber)
00059     throw (SALOME_Exception);
00060 
00064   int GetNumberOfSegments() const;
00065 
00069   enum DistrType
00070   {
00071     DT_Regular, 
00072     DT_Scale,   
00073     DT_TabFunc, 
00074     DT_ExprFunc 
00075   };
00076 
00080   void SetDistrType(DistrType typ)
00081     throw (SALOME_Exception);
00082 
00086   DistrType GetDistrType() const;
00087 
00095   virtual void SetScaleFactor(double scaleFactor)
00096     throw (SALOME_Exception);
00097 
00103   double GetScaleFactor() const
00104     throw (SALOME_Exception);
00105 
00115   void SetTableFunction(const std::vector<double>& table)
00116     throw (SALOME_Exception);
00117 
00123   const std::vector<double>& GetTableFunction() const
00124     throw (SALOME_Exception);
00125 
00133   void SetExpressionFunction( const char* expr)
00134     throw (SALOME_Exception);
00135 
00141   const char* GetExpressionFunction() const
00142     throw (SALOME_Exception);
00143 
00153   void SetConversionMode( int conv )
00154     throw (SALOME_Exception);
00155 
00161   int ConversionMode() const
00162     throw (SALOME_Exception);
00163 
00164   void SetReversedEdges( std::vector<int>& ids);
00165 
00166   void SetObjectEntry( const char* entry ) { _objEntry = entry; }
00167 
00168   const char* GetObjectEntry() { return _objEntry.c_str(); }
00169 
00170   const std::vector<int>& GetReversedEdges() const { return _edgeIDs; }
00171 
00178   virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
00179 
00184   virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
00185 
00186   virtual std::ostream & SaveTo(std::ostream & save);
00187   virtual std::istream & LoadFrom(std::istream & load);
00188   friend std::ostream& operator << (std::ostream & save, StdMeshers_NumberOfSegments & hyp);
00189   friend std::istream& operator >> (std::istream & load, StdMeshers_NumberOfSegments & hyp);
00190 
00191 protected:
00192   int                 _numberOfSegments; 
00193   DistrType           _distrType;        
00194   double              _scaleFactor;      
00195   std::vector<double> _table, _distr;    
00196   std::string         _func;             
00197   int                 _convMode;         
00198   std::vector<int>    _edgeIDs;          
00199   std::string         _objEntry;          
00200 };
00201 
00202 #endif