1 // Copyright (C) 2010-2011 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef __vtkMedDriver_h_
21 #define __vtkMedDriver_h_
23 #include "vtkObject.h"
30 class vtkMedPolarGrid;
31 class vtkMedRegularGrid;
32 class vtkMedCurvilinearGrid;
33 class vtkMedUnstructuredGrid;
34 class vtkMedLocalization;
36 class vtkMedFieldOverEntity;
37 class vtkMedEntityArray;
38 class vtkMedFieldStep;
40 class vtkMedInterpolation;
41 class vtkMedFieldOnProfile;
42 class vtkMedStructElement;
43 class vtkMedConstantAttribute;
44 class vtkMedVariableAttribute;
46 class VTK_EXPORT vtkMedDriver: public vtkObject
49 static vtkMedDriver* New();
50 vtkTypeMacro(vtkMedDriver, vtkObject)
51 void PrintSelf(ostream& os, vtkIndent indent);
54 // Set/Get the med file that use this driver
55 virtual void SetMedFile(vtkMedFile*);
56 vtkGetObjectMacro(MedFile, vtkMedFile);
59 // This gives the File ID to read in parallel.
60 vtkGetMacro(ParallelFileId, med_idt);
63 // open the file for reading. Returns 0 on success, or error code.
64 virtual int RestrictedOpen();
67 virtual bool CanReadFile();
70 // Get the Version numbers from the file
71 virtual void ReadFileVersion(int* major, int* minor, int* release);
74 // load all meta data associated with this file.
75 virtual void ReadFileInformation(vtkMedFile*);
78 // load all meta data associated with this mesh.
79 virtual void ReadMeshInformation(vtkMedMesh*);
82 // load all meta data associated with this field.
83 virtual void ReadFieldInformation(vtkMedField*);
86 // load all meta data associated with this regular (Cartesian or polar) grid.
87 virtual void ReadRegularGridInformation(vtkMedRegularGrid*);
90 // load all meta data associated with this standard grid.
91 virtual void ReadCurvilinearGridInformation(vtkMedCurvilinearGrid*);
94 // load all meta data associated with this unstructured grid.
95 virtual void ReadUnstructuredGridInformation(vtkMedUnstructuredGrid*);
98 // load all meta data associated with this grid.
99 // (call one of the above method depending on the type of grid)
100 virtual void ReadGridInformation(vtkMedGrid*);
103 // load all meta data associated with this family.
104 virtual void ReadFamilyInformation(vtkMedMesh*, vtkMedFamily*);
107 // load all meta data associated with this family.
108 virtual void ReadProfileInformation(vtkMedProfile*);
111 // load information on a field and a given cell type at a given step
112 virtual void ReadFieldOverEntityInformation(vtkMedFieldOverEntity*);
115 // load information related to the given quadrature scheme definition
116 virtual void ReadLocalizationInformation(vtkMedLocalization*);
119 // load all information associated witht this field step
120 virtual void ReadFieldStepInformation(vtkMedFieldStep*, bool readAllEntityInfo);
123 // load all information related to this interpolation function
124 virtual void ReadInterpolationInformation(vtkMedInterpolation*);
127 // load all information related to this field on this profile
128 virtual void ReadFieldOnProfileInformation(vtkMedFieldOnProfile*);
131 // read all information related to the structural elements models
133 virtual void ReadStructElementInformation(vtkMedStructElement*);
136 // read all information related to the support mesh
138 virtual void ReadSupportMeshInformation(vtkMedMesh*);
141 // read all information related to the support mesh
143 virtual void ReadConstantAttributeInformation(vtkMedConstantAttribute*);
146 // read all information related to the support mesh
148 virtual void ReadVariableAttributeInformation(vtkMedVariableAttribute*);
151 // load the field on this profile
152 virtual void LoadField(vtkMedFieldOnProfile* fop, med_storage_mode mode);
155 // Load the indices of the profile
156 virtual void LoadProfile(vtkMedProfile* profile);
159 // Load the values of the given step
160 // void Load(vtkMedFieldOnProfile*);
162 virtual void LoadFamilyIds(vtkMedEntityArray*);
164 virtual void LoadCoordinates(vtkMedGrid*);
166 virtual void LoadPointGlobalIds(vtkMedGrid*);
168 //virtual void LoadPointFamilyIds(vtkMedGrid*);
170 virtual void LoadConnectivity(vtkMedEntityArray*);
172 virtual void LoadCellGlobalIds(vtkMedEntityArray*);
174 virtual void LoadVariableAttribute(vtkMedVariableAttribute*,
181 FileOpen(vtkMedDriver* driver)
183 this->Driver = driver;
184 this->Driver->Open();
188 this->Driver->Close();
191 vtkMedDriver* Driver;
197 class FileRestrictedOpen
200 FileRestrictedOpen(vtkMedDriver* driver)
202 this->Driver = driver;
203 this->Driver->RestrictedOpen();
205 ~FileRestrictedOpen()
207 this->Driver->Close();
210 vtkMedDriver* Driver;
219 // name of the file to read from
220 vtkMedFile * MedFile;
225 med_idt ParallelFileId;
228 vtkMedDriver(const vtkMedDriver&); // Not implemented.
229 void operator=(const vtkMedDriver&); // Not implemented.
232 #endif //__vtkMedDriver_h_