Back to index

salome-paravis  6.5.0
vtkMedDriver.h
Go to the documentation of this file.
00001 // Copyright (C) 2010-2012  CEA/DEN, EDF R&D
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 #ifndef __vtkMedDriver_h_
00021 #define __vtkMedDriver_h_
00022 
00023 #include "vtkObject.h"
00024 #include "vtkMed.h"
00025 
00026 class vtkMedFile;
00027 class vtkMedMesh;
00028 class vtkMedField;
00029 class vtkMedFamily;
00030 class vtkMedPolarGrid;
00031 class vtkMedRegularGrid;
00032 class vtkMedCurvilinearGrid;
00033 class vtkMedUnstructuredGrid;
00034 class vtkMedLocalization;
00035 class vtkMedProfile;
00036 class vtkMedFieldOverEntity;
00037 class vtkMedEntityArray;
00038 class vtkMedFieldStep;
00039 class vtkMedGrid;
00040 class vtkMedInterpolation;
00041 class vtkMedFieldOnProfile;
00042 class vtkMedStructElement;
00043 class vtkMedConstantAttribute;
00044 class vtkMedVariableAttribute;
00045 
00046 class VTK_EXPORT vtkMedDriver: public vtkObject
00047 {
00048 public:
00049   static vtkMedDriver* New();
00050   vtkTypeRevisionMacro(vtkMedDriver, vtkObject)
00051   void PrintSelf(ostream& os, vtkIndent indent);
00052 
00053   // Description:
00054   // Set/Get the med file that use this driver
00055   virtual void  SetMedFile(vtkMedFile*);
00056   vtkGetObjectMacro(MedFile, vtkMedFile);
00057 
00058   // Description :
00059   // This gives the File ID to read in parallel.
00060   vtkGetMacro(ParallelFileId, med_idt);
00061 
00062   // Description:
00063   // open the file for reading. Returns 0 on success, or error code.
00064   virtual int RestrictedOpen();
00065   virtual int Open();
00066   virtual void Close();
00067   virtual bool CanReadFile();
00068 
00069   // Description:
00070   // Get the Version numbers from the file
00071   virtual void ReadFileVersion(int* major, int* minor, int* release);
00072 
00073   // Description:
00074   // load all meta data associated with this file.
00075   virtual void ReadFileInformation(vtkMedFile*);
00076 
00077   // Description:
00078   // load all meta data associated with this mesh.
00079   virtual void ReadMeshInformation(vtkMedMesh*);
00080 
00081   // Description:
00082   // load all meta data associated with this field.
00083   virtual void ReadFieldInformation(vtkMedField*);
00084 
00085   // Description:
00086   // load all meta data associated with this regular (Cartesian or polar) grid.
00087   virtual void ReadRegularGridInformation(vtkMedRegularGrid*);
00088 
00089   // Description:
00090   // load all meta data associated with this standard grid.
00091   virtual void ReadCurvilinearGridInformation(vtkMedCurvilinearGrid*);
00092 
00093   // Description:
00094   // load all meta data associated with this unstructured grid.
00095   virtual void ReadUnstructuredGridInformation(vtkMedUnstructuredGrid*);
00096 
00097   // Description:
00098   // load all meta data associated with this grid.
00099   // (call one of the above method depending on the type of grid)
00100   virtual void ReadGridInformation(vtkMedGrid*);
00101 
00102   // Description:
00103   // load all meta data associated with this family.
00104   virtual void ReadFamilyInformation(vtkMedMesh*, vtkMedFamily*);
00105 
00106   // Description:
00107   // load all meta data associated with this family.
00108   virtual void ReadProfileInformation(vtkMedProfile*);
00109 
00110   // Description:
00111   // load information on a field and a given cell type at a given step
00112   virtual void ReadFieldOverEntityInformation(vtkMedFieldOverEntity*);
00113 
00114   // Description:
00115   // load information related to the given quadrature scheme definition
00116   virtual void ReadLocalizationInformation(vtkMedLocalization*);
00117 
00118   // Description:
00119   // load all information associated witht this field step
00120   virtual void ReadFieldStepInformation(vtkMedFieldStep*, bool readAllEntityInfo);
00121 
00122   // Description:
00123   // load all information related to this interpolation function
00124   virtual void ReadInterpolationInformation(vtkMedInterpolation*);
00125 
00126   // Description:
00127   // load all information related to this field on this profile
00128   virtual void ReadFieldOnProfileInformation(vtkMedFieldOnProfile*);
00129 
00130   // Description:
00131   // read all information related to the structural elements models
00132   // in this file
00133   virtual void ReadStructElementInformation(vtkMedStructElement*);
00134 
00135   // Description:
00136   // read all information related to the support mesh
00137   // in this file
00138   virtual void ReadSupportMeshInformation(vtkMedMesh*);
00139 
00140   // Description:
00141   // read all information related to the support mesh
00142   // in this file
00143   virtual void ReadConstantAttributeInformation(vtkMedConstantAttribute*);
00144 
00145   // Description:
00146   // read all information related to the support mesh
00147   // in this file
00148   virtual void ReadVariableAttributeInformation(vtkMedVariableAttribute*);
00149 
00150   // Description:
00151   // load the field on this profile
00152   virtual void LoadField(vtkMedFieldOnProfile* fop, med_storage_mode mode);
00153 
00154   // Description:
00155   // Load the indices of the profile
00156   virtual void LoadProfile(vtkMedProfile* profile);
00157 
00158   // Description:
00159   // Load the values of the given step
00160 //  void Load(vtkMedFieldOnProfile*);
00161 
00162   virtual void LoadFamilyIds(vtkMedEntityArray*);
00163 
00164   virtual void LoadCoordinates(vtkMedGrid*);
00165 
00166   virtual void LoadPointGlobalIds(vtkMedGrid*);
00167 
00168   //virtual void LoadPointFamilyIds(vtkMedGrid*);
00169 
00170   virtual void LoadConnectivity(vtkMedEntityArray*);
00171 
00172   virtual void LoadCellGlobalIds(vtkMedEntityArray*);
00173 
00174   virtual void  LoadVariableAttribute(vtkMedVariableAttribute*,
00175                                       vtkMedEntityArray*);
00176 
00177   //BTX
00178   class FileOpen
00179   {
00180   public:
00181     FileOpen(vtkMedDriver* driver)
00182     {
00183       this->Driver = driver;
00184       this->Driver->Open();
00185     }
00186     ~FileOpen()
00187     {
00188       this->Driver->Close();
00189     }
00190   protected:
00191     vtkMedDriver* Driver;
00192     vtkMedFile* File;
00193   };
00194   //ETX
00195 
00196   //BTX
00197   class FileRestrictedOpen
00198   {
00199   public:
00200     FileRestrictedOpen(vtkMedDriver* driver)
00201     {
00202       this->Driver = driver;
00203       this->Driver->RestrictedOpen();
00204     }
00205     ~FileRestrictedOpen()
00206     {
00207       this->Driver->Close();
00208     }
00209   protected:
00210     vtkMedDriver* Driver;
00211     vtkMedFile* File;
00212   };
00213   //ETX
00214 
00215 protected:
00216   vtkMedDriver();
00217   ~vtkMedDriver();
00218 
00219   // name of the file to read from
00220   vtkMedFile * MedFile;
00221 
00222   int OpenLevel;
00223 
00224   med_idt FileId;
00225   med_idt ParallelFileId;
00226 
00227 private:
00228   vtkMedDriver(const vtkMedDriver&); // Not implemented.
00229   void operator=(const vtkMedDriver&); // Not implemented.
00230 };
00231 
00232 #endif //__vtkMedDriver_h_