3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
29 #ifndef MED_Common_HeaderFile
30 #define MED_Common_HeaderFile
43 #include <boost/shared_ptr.hpp>
45 #include "SALOMEconfig.h"
49 enum EVersion {eVUnknown = -1, eV2_1, eV2_2};
52 template<class T> class SharedPtr: public boost::shared_ptr<T>
58 explicit SharedPtr(Y * p):
59 boost::shared_ptr<T>(p)
63 SharedPtr(SharedPtr<Y> const & r):
64 boost::shared_ptr<T>(r,boost::detail::polymorphic_cast_tag())
68 SharedPtr& operator=(SharedPtr<Y> const & r)
70 boost::shared_ptr<T>(r,boost::detail::polymorphic_cast_tag()).swap(*this);
74 template<class Y> SharedPtr& operator()(Y * p) // Y must be complete
76 return operator=<Y>(SharedPtr<Y>(p));
79 operator const T& () const
81 return *(this->get());
86 return *(this->get());
91 template<class TContainer>
94 const TContainer& myConstContainer;
97 size_t GetID(size_t theId) const
99 if(theId < mySlice.size()){
100 size_t anId = mySlice.start() + theId*mySlice.stride();
101 if(anId < myConstContainer.size())
104 throw std::out_of_range();
109 typedef typename TContainer::value_type TValue;
111 ConstSliceArray(const TContainer& theContainer,
112 const std::slice& theSlice):
113 myConstContainer(theContainer),
118 const TValue& operator[](size_t theId) const
120 return myConstContainer[GetID(theId)];
125 return mySlice.size();
130 template<class TContainer>
131 class SliceArray: public ConstSliceArray<TContainer>
133 TContainer& myContainer;
136 typedef ConstSliceArray<TContainer> TSupperClass;
137 SliceArray(TContainer& theContainer,
138 const std::slice& theSlice):
139 TSupperClass(theContainer,theSlice),
140 myContainer(theContainer)
144 typename TSupperClass::TValue& operator[](size_t theId)
146 return myContainer[this->GetID(theId)];
151 typedef enum {eFAUX, eVRAI} EBooleen ;
152 typedef double TFloat;
153 #if defined(SUN4SOL2) || defined(PCLINUX) || defined(OSF1_32) || defined(IRIX64_32) || defined(RS6000) || defined(HP9000)
156 #if defined(IRIX64) || defined(OSF1)
162 typedef enum {eFLOAT64=6, eINT=26} ETypeChamp;
164 typedef enum {eNON_STRUCTURE, eSTRUCTURE} EMaillage;
166 typedef enum {eCART, eCYL, eSPHER} ERepere;
168 typedef enum {eNOD, eDESC} EConnectivite ;
170 typedef enum {ePOINT1=1, eSEG2=102, eSEG3=103, eTRIA3=203,
171 eQUAD4=204, eTRIA6=206,eQUAD8=208, eTETRA4=304,
172 ePYRA5=305, ePENTA6=306, eHEXA8=308, eTETRA10=310,
173 ePYRA13=313, ePENTA15=315, eHEXA20=320,
174 ePOLYGONE=400, ePOLYEDRE=500, eNONE=0} EGeometrieElement;
176 typedef enum {eMAILLE, eFACE, eARETE, eNOEUD} EEntiteMaillage;
178 typedef enum {eNO_PFLMOD, eGLOBAL, eCOMPACT} EModeProfil;
180 typedef std::vector<TFloat> TFloatVector;
181 typedef std::vector<std::string> TStringVector;
182 typedef std::vector<TInt> TIntVector;
183 typedef std::set<std::string> TStringSet;
185 typedef std::map<EGeometrieElement,TInt> TGeom;
186 typedef std::map<EEntiteMaillage,TGeom> TEntityInfo;
188 typedef std::set<EGeometrieElement> TGeomSet;
189 typedef std::map<EEntiteMaillage,TGeomSet> TEntity2GeomSet;
191 const TEntity2GeomSet& GetEntity2GeomSet();
195 TInt GetNbConn(EGeometrieElement typmai,
196 EEntiteMaillage typent,
200 TInt GetNbConn<eV2_1>(EGeometrieElement typmai,
201 EEntiteMaillage typent,
205 TInt GetNbConn<eV2_2>(EGeometrieElement typmai,
206 EEntiteMaillage typent,
209 TInt GetNbNodes(EGeometrieElement typmai);
212 typedef SharedPtr<TNameInfo> PNameInfo;
215 typedef SharedPtr<TMeshInfo> PMeshInfo;
218 typedef SharedPtr<TFamilyInfo> PFamilyInfo;
221 typedef SharedPtr<TElemInfo> PElemInfo;
224 typedef SharedPtr<TNodeInfo> PNodeInfo;
226 struct TPolygoneInfo;
227 typedef SharedPtr<TPolygoneInfo> PPolygoneInfo;
229 struct TPolyedreInfo;
230 typedef SharedPtr<TPolyedreInfo> PPolyedreInfo;
233 typedef SharedPtr<TCellInfo> PCellInfo;
236 typedef SharedPtr<TFieldInfo> PFieldInfo;
238 struct TTimeStampInfo;
239 typedef SharedPtr<TTimeStampInfo> PTimeStampInfo;
241 struct TTimeStampVal;
242 typedef SharedPtr<TTimeStampVal> PTimeStampVal;
245 typedef SharedPtr<TWrapper> PWrapper;