Salome HOME
Minor: removing annoying print message
[modules/paravis.git] / src / Plugins / MedReader / IO / vtkMedMesh.h
1 // Copyright (C) 2010-2013  CEA/DEN, EDF R&D
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #ifndef __vtkMedMesh_h_
21 #define __vtkMedMesh_h_
22
23 #include "vtkObject.h"
24 #include "vtkMedSetGet.h"
25 #include "vtkMed.h"
26 #include "vtkMedUtilities.h"
27
28 class vtkMedGrid;
29 class vtkMedFamily;
30 class vtkMedGroup;
31 class vtkMedString;
32 class vtkMedIntArray;
33 class vtkMedComputeStep;
34 class vtkMedFile;
35 class vtkStringArray;
36
37 #include <set>
38
39 class VTK_EXPORT vtkMedMesh: public vtkObject
40 {
41 public:
42   static vtkMedMesh* New();
43   vtkTypeMacro(vtkMedMesh, vtkObject);
44   void PrintSelf(ostream& os, vtkIndent indent);
45
46   // Description:
47   // The name of the mesh in the med file.
48   vtkGetStringMacro(Name);
49   vtkSetStringMacro(Name);
50
51   // Description:
52   // The universal name of the mesh.
53   vtkGetStringMacro(UniversalName);
54   vtkSetStringMacro(UniversalName);
55
56   // Description:
57   // The name of the mesh in the med file.
58   vtkGetStringMacro(Description);
59   vtkSetStringMacro(Description);
60
61   // Description:
62   // The unit of the time steps.
63   vtkGetStringMacro(TimeUnit);
64   vtkSetStringMacro(TimeUnit);
65
66   // Description:
67   // The dimension of the space this mesh lives in
68   vtkSetMacro(SpaceDimension, med_int);
69   vtkGetMacro(SpaceDimension, med_int);
70
71   // Description:
72   // The dimension of this mesh
73   vtkSetMacro(MeshDimension, med_int);
74   vtkGetMacro(MeshDimension, med_int);
75
76   // Description:
77   // The type of grid used by this mesh
78   vtkSetMacro(MeshType, med_mesh_type);
79   vtkGetMacro(MeshType, med_mesh_type);
80
81   // Description:
82   // This stores how the compute steps should be iterated over
83   // either first by time or first by iteration
84   vtkSetMacro(SortingType, med_sorting_type);
85   vtkGetMacro(SortingType, med_sorting_type);
86
87   // Description:
88   // This is the type of the axis
89   // MED_CARTESIAN, MED_CYLINDRICAL, MED_SPHERICAL or MED_UNDEF_AXIS_TYPE
90   vtkSetMacro(AxisType, med_axis_type);
91   vtkGetMacro(AxisType, med_axis_type);
92
93   // Description:
94   // This is the type of the axis
95   // MED_CARTESIAN, MED_CYLINDRICAL, MED_SPHERICAL or MED_UNDEF_AXIS_TYPE
96   vtkSetMacro(StructuredGridType, med_grid_type);
97   vtkGetMacro(StructuredGridType, med_grid_type);
98
99   // Description:
100   // a mesh can be modified over time, so this stores the
101   // different compute steps of a given mesh
102   void  AddGridStep(vtkMedGrid*);
103   void  ClearGridStep();
104   vtkMedGrid* GetGridStep(const vtkMedComputeStep&);
105   vtkMedGrid* FindGridStep(const vtkMedComputeStep&, int);
106   med_int GetNumberOfGridStep();
107   vtkMedGrid* GetGridStep(med_int);
108   void  GatherGridTimes(std::set<med_float>&);
109   void  GatherGridIterations(med_float,std::set<med_int>&);
110
111   // Description:
112   // Container of the cell families in this mesh
113   vtkGetObjectVectorMacro(CellFamily, vtkMedFamily);
114   vtkSetObjectVectorMacro(CellFamily, vtkMedFamily);
115   virtual vtkMedFamily* GetOrCreateCellFamilyById(med_int);
116
117   // Description:
118   // Get the Point Families
119   vtkGetObjectVectorMacro(PointFamily, vtkMedFamily);
120   vtkSetObjectVectorMacro(PointFamily, vtkMedFamily);
121   virtual vtkMedFamily* GetOrCreatePointFamilyById(med_int);
122
123   int GetNumberOfFamily();
124   vtkMedFamily* GetFamily(int);
125
126   // Description:
127   // Container of the groups in this mesh
128   vtkGetObjectVectorMacro(PointGroup, vtkMedGroup);
129   vtkSetObjectVectorMacro(PointGroup, vtkMedGroup);
130   vtkGetObjectVectorMacro(CellGroup, vtkMedGroup);
131   vtkSetObjectVectorMacro(CellGroup, vtkMedGroup);
132   virtual vtkMedGroup*  GetOrCreateGroup(int pointOrCell, const char*);
133
134   // Description:
135   // this id is the id to use when reading the med file
136   vtkSetMacro(MedIterator, med_int);
137   vtkGetMacro(MedIterator, med_int);
138
139   // Description:
140   // This stores the name of each axis
141   vtkGetObjectMacro(AxisName, vtkStringArray);
142
143   // Description:
144   // This stores the unit of each axis
145   vtkGetObjectMacro(AxisUnit, vtkStringArray);
146
147   // Description:
148   // This sets the number of axis of this mesh, and also allocates
149   // the arrays to store the name and unit of each axis.
150   void  SetNumberOfAxis(int);
151   int GetNumberOfAxis();
152
153   // Description:
154   // free the memory used by this mesh (coordinates, connectivity)
155   virtual void  ClearMedSupports();
156
157   // Description:
158   // The name of the mesh in the med file.
159   virtual void  SetParentFile(vtkMedFile*);
160   vtkGetObjectMacro(ParentFile, vtkMedFile);
161
162   // Description:
163   // This helper method fills the std::set with all vtkMedEntity types used in the first grid step
164   // MED specifies that all types must be present in the first step for a varying mesh to be valid
165   virtual void  GatherMedEntities(std::set<vtkMedEntity>& entities);
166
167 protected:
168   vtkMedMesh();
169   virtual ~vtkMedMesh();
170
171   char* Name;
172   char* UniversalName;
173   char* Description;
174   char* TimeUnit;
175   med_int MedIterator;
176   med_int SpaceDimension;
177   med_int MeshDimension;
178   med_mesh_type MeshType;
179   med_sorting_type SortingType;
180   med_axis_type AxisType;
181   med_grid_type StructuredGridType;
182
183   vtkMedFile* ParentFile;
184
185   vtkObjectVector<vtkMedFamily>* CellFamily;
186   vtkObjectVector<vtkMedFamily>* PointFamily;
187
188   vtkObjectVector<vtkMedGroup>* PointGroup;
189   vtkObjectVector<vtkMedGroup>* CellGroup;
190
191   vtkStringArray* AxisName;
192   vtkStringArray* AxisUnit;
193
194   vtkMedComputeStepMap<vtkMedGrid>* GridStep;
195
196   bool IsSupportMesh;
197
198 private:
199   vtkMedMesh(const vtkMedMesh&); // Not implemented.
200   void operator=(const vtkMedMesh&); // Not implemented.
201
202 };
203
204 #endif //__vtkMedMesh_h_