src/CONVERTOR/VISU_MedConvertor.hxx

Go to the documentation of this file.
00001 //  License as published by the Free Software Foundation; either 
00002 //  version 2.1 of the License. 
00003 // 
00004 //  This library is distributed in the hope that it will be useful, 
00005 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
00006 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
00007 //  Lesser General Public License for more details. 
00008 // 
00009 //  You should have received a copy of the GNU Lesser General Public 
00010 //  License along with this library; if not, write to the Free Software 
00011 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
00012 // 
00013 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00014 //
00015 //  File   : VISU_MedConvertor.hxx
00016 //  Author : Alexey PETROV
00017 //  Module : VISU
00018 
00019 #ifndef VISU_MedConvertor_HeaderFile
00020 #define VISU_MedConvertor_HeaderFile
00021 
00022 #include "VISU_Convertor_impl.hxx"
00023 
00024 #include "MED_Common.hxx"
00025 #include "MED_Structures.hxx"
00026 
00027 #include <boost/thread/mutex.hpp>
00028 #include <qfileinfo.h>
00029 
00030 namespace VISU
00031 {
00032   typedef TVector<TName> TNames;
00033 
00034   //---------------------------------------------------------------
00035   class TMEDNamedPointCoords: public virtual TNamedPointCoords
00036   {
00037     MED::PNodeInfo myNodeInfo;
00038     TNames myPointNames;
00039   public:
00040     void
00041     Init(vtkIdType theNbPoints,
00042       vtkIdType theDim,
00043       const MED::PNodeInfo& theNodeInfo);
00044 
00045     void
00046     Init(vtkIdType theNbPoints,
00047       vtkIdType theDim,
00048       const MED::PGrilleInfo& theGrilleInfo);
00049 
00050     virtual
00051     std::string 
00052     GetNodeName(vtkIdType theObjID) const;
00053   };
00054   typedef SharedPtr<TMEDNamedPointCoords> PMEDNamedPointCoords;
00055 
00056 
00057   //---------------------------------------------------------------
00058   struct TMEDMesh: virtual TMeshImpl
00059   {
00060     MED::PMeshInfo myMeshInfo;
00061     MED::TEntityInfo myEntityInfo;
00062   };
00063   typedef SharedPtr<TMEDMesh> PMEDMesh;
00064 
00065 
00066   //---------------------------------------------------------------
00067   struct TMEDSubProfile: virtual TSubProfileImpl
00068   {
00069     MED::EGeometrieElement myMGeom;
00070 
00071     TMEDSubProfile():
00072       myIsElemNum(MED::eFAUX)
00073     {}
00074 
00075     MED::EBooleen myIsElemNum;
00076     MED::TElemNum myElemNum;
00077 
00078     virtual 
00079     vtkIdType 
00080     GetElemObjID(vtkIdType theID) const;
00081   };
00082   typedef SharedPtr<TMEDSubProfile> PMEDSubProfile;
00083 
00084 
00085   //---------------------------------------------------------------
00086   struct TMEDProfile: virtual TProfileImpl
00087   {};
00088   typedef SharedPtr<TMEDProfile> PMEDProfile;
00089 
00090 
00091   //---------------------------------------------------------------
00092   struct TMEDGauss: virtual TGaussImpl
00093   {
00094     MED::PGaussInfo myGaussInfo;
00095 
00097     virtual
00098     void
00099     LessThan(const PGaussImpl& theGauss,
00100           bool& theResult) const;
00101   };
00102   typedef SharedPtr<TMEDGauss> PMEDGauss;
00103 
00104 
00105   //---------------------------------------------------------------
00106   struct TMEDGaussSubMesh: virtual TGaussSubMeshImpl
00107   {
00108     TMEDGaussSubMesh():
00109       myIsElemNum(MED::eFAUX)
00110     {}
00111 
00112     MED::EBooleen myIsElemNum;
00113     MED::TElemNum myElemNum;
00114 
00115     virtual
00116     TGaussPointID
00117     GetObjID(vtkIdType theID,
00118           vtkIdType theStartID) const;
00119   };
00120   typedef SharedPtr<TMEDGaussSubMesh> PMEDGaussSubMesh;
00121 
00122 
00123   //---------------------------------------------------------------
00124   struct TMEDGaussMesh: virtual TGaussMeshImpl
00125   {};
00126   typedef SharedPtr<TMEDGaussMesh> PMEDGaussMesh;
00127 
00128 
00129   //---------------------------------------------------------------
00130   struct TMEDSubMesh: virtual TSubMeshImpl
00131   {
00132     TMEDSubMesh():
00133       myIsElemNum(MED::eFAUX)
00134     {}
00135 
00136     MED::EBooleen myIsElemNum;
00137     MED::TElemNum myElemNum;
00138     MED::PElemInfo myElemInfo;
00139 
00140     void
00141     Init(const MED::PElemInfo& theElemInfo);
00142 
00143     void
00144     Init(const MED::PGrilleInfo& theGrilleInfo);
00145 
00146     virtual 
00147     vtkIdType 
00148     GetElemObjID(vtkIdType theID) const;
00149 
00150     virtual
00151     std::string 
00152     GetElemName(vtkIdType theObjID) const;
00153   };
00154   typedef SharedPtr<TMEDSubMesh> PMEDSubMesh;
00155 
00156 
00157   //---------------------------------------------------------------
00158   typedef std::map<vtkIdType,vtkIdType> TFamilyID2CellsSize;
00159 
00160   struct TMEDMeshOnEntity: virtual TMeshOnEntityImpl
00161   {
00162     TFamilyID2CellsSize myFamilyID2CellsSize;
00163     MED::TGeom2Size myGeom2Size;
00164   };
00165   typedef SharedPtr<TMEDMeshOnEntity> PMEDMeshOnEntity;
00166 
00167 
00168   //---------------------------------------------------------------
00169   struct TMEDFamily: virtual TFamilyImpl
00170   {};
00171   typedef SharedPtr<TMEDFamily> PMEDFamily;
00172   
00173 
00174   //---------------------------------------------------------------
00175   struct TMEDGroup: virtual TGroupImpl
00176   {};
00177   typedef SharedPtr<TMEDGroup> PMEDGroup;
00178 
00179 
00180   //---------------------------------------------------------------
00181   struct TMEDField: virtual TFieldImpl
00182   {};
00183   typedef SharedPtr<TMEDField> PMEDField;
00184 
00185 
00186   //---------------------------------------------------------------
00187   struct TMEDValForTime: virtual TValForTimeImpl
00188   {};
00189   typedef SharedPtr<TMEDValForTime> PMEDValForTime;
00190 
00191 }
00192 
00193 class VISU_MedConvertor: public VISU_Convertor_impl
00194 {  
00195   VISU_MedConvertor();
00196   VISU_MedConvertor(const VISU_MedConvertor&);
00197   
00198   bool myIsEntitiesDone;
00199   bool myIsFieldsDone;
00200   bool myIsGroupsDone;
00201   bool myIsMinMaxDone;
00202 
00203 public:
00204   VISU_MedConvertor(const std::string& theFileName);
00205 
00206   virtual
00207   VISU_Convertor* 
00208   BuildEntities();
00209 
00210   virtual
00211   VISU_Convertor* 
00212   BuildFields();
00213 
00214   virtual
00215   VISU_Convertor* 
00216   BuildMinMax();
00217 
00218   virtual
00219   VISU_Convertor* 
00220   BuildGroups();
00221 
00222 protected:
00223   QFileInfo myFileInfo;
00224 
00225   virtual
00226   int
00227   LoadMeshOnEntity(VISU::PMeshImpl theMesh,
00228              VISU::PMeshOnEntityImpl theMeshOnEntity);
00229   
00230   virtual
00231   int
00232   LoadFamilyOnEntity(VISU::PMeshImpl theMesh,
00233                VISU::PMeshOnEntityImpl theMeshOnEntity, 
00234                VISU::PFamilyImpl theFamily);
00235 
00236   virtual
00237   int
00238   LoadMeshOnGroup(VISU::PMeshImpl theMesh, 
00239             const VISU::TFamilySet& theFamilySet);
00240   
00241   virtual
00242   int
00243   LoadValForTimeOnMesh(VISU::PMeshImpl theMesh, 
00244                  VISU::PMeshOnEntityImpl theMeshOnEntity, 
00245                  VISU::PFieldImpl theField, 
00246                  VISU::PValForTimeImpl theValForTime);
00247   
00248   virtual 
00249   int
00250   LoadValForTimeOnGaussPts(VISU::PMeshImpl theMesh, 
00251                   VISU::PMeshOnEntityImpl theMeshOnEntity, 
00252                   VISU::PFieldImpl theField, 
00253                   VISU::PValForTimeImpl theValForTime);
00254 
00255   int
00256   LoadPoints(const MED::PWrapper& theMed,
00257           const VISU::PMEDMesh theMesh);
00258   
00259   int
00260   LoadPointsOnFamily(const MED::PWrapper& theMed,
00261                const VISU::PMEDMesh theMesh, 
00262                const VISU::PMEDFamily theFamily);
00263   
00264   int
00265   LoadCellsOnEntity(const MED::PWrapper& theMed,
00266               const VISU::PMEDMesh theMesh,
00267               const VISU::PMEDMeshOnEntity theMeshOnEntity);
00268   
00269   int
00270   LoadCellsOnFamily(const MED::PWrapper& theMed,
00271               const VISU::PMEDMesh theMesh,
00272               const VISU::PMEDMeshOnEntity theMeshOnEntity,
00273               const VISU::PMEDFamily theFamily);
00274   
00275   int
00276   LoadValForTimeOnMesh(const MED::PWrapper& theMed,
00277                  VISU::PMEDMesh theMesh,
00278                  VISU::PMEDMeshOnEntity theMeshOnEntity,
00279                  VISU::PMEDField theField, 
00280                  VISU::PMEDValForTime theValForTime);
00281   
00282   int
00283   LoadValForTimeOnGaussPts(const MED::PWrapper& theMed,
00284                   VISU::PMEDMesh theMesh,
00285                   VISU::PMEDMeshOnEntity theMeshOnEntity,
00286                   VISU::PMEDField theField, 
00287                   VISU::PMEDValForTime theValForTime);
00288 };
00289 
00290 #endif