1 // Copyright (C) 2010-2013 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 __vtkMedMesh_h_
21 #define __vtkMedMesh_h_
23 #include "vtkObject.h"
24 #include "vtkMedSetGet.h"
26 #include "vtkMedUtilities.h"
33 class vtkMedComputeStep;
39 class VTK_EXPORT vtkMedMesh: public vtkObject
42 static vtkMedMesh* New();
43 vtkTypeMacro(vtkMedMesh, vtkObject);
44 void PrintSelf(ostream& os, vtkIndent indent);
47 // The name of the mesh in the med file.
48 vtkGetStringMacro(Name);
49 vtkSetStringMacro(Name);
52 // The universal name of the mesh.
53 vtkGetStringMacro(UniversalName);
54 vtkSetStringMacro(UniversalName);
57 // The name of the mesh in the med file.
58 vtkGetStringMacro(Description);
59 vtkSetStringMacro(Description);
62 // The unit of the time steps.
63 vtkGetStringMacro(TimeUnit);
64 vtkSetStringMacro(TimeUnit);
67 // The dimension of the space this mesh lives in
68 vtkSetMacro(SpaceDimension, med_int);
69 vtkGetMacro(SpaceDimension, med_int);
72 // The dimension of this mesh
73 vtkSetMacro(MeshDimension, med_int);
74 vtkGetMacro(MeshDimension, med_int);
77 // The type of grid used by this mesh
78 vtkSetMacro(MeshType, med_mesh_type);
79 vtkGetMacro(MeshType, med_mesh_type);
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);
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);
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);
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>&);
112 // Container of the cell families in this mesh
113 vtkGetObjectVectorMacro(CellFamily, vtkMedFamily);
114 vtkSetObjectVectorMacro(CellFamily, vtkMedFamily);
115 virtual vtkMedFamily* GetOrCreateCellFamilyById(med_int);
118 // Get the Point Families
119 vtkGetObjectVectorMacro(PointFamily, vtkMedFamily);
120 vtkSetObjectVectorMacro(PointFamily, vtkMedFamily);
121 virtual vtkMedFamily* GetOrCreatePointFamilyById(med_int);
123 int GetNumberOfFamily();
124 vtkMedFamily* GetFamily(int);
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*);
135 // this id is the id to use when reading the med file
136 vtkSetMacro(MedIterator, med_int);
137 vtkGetMacro(MedIterator, med_int);
140 // This stores the name of each axis
141 vtkGetObjectMacro(AxisName, vtkStringArray);
144 // This stores the unit of each axis
145 vtkGetObjectMacro(AxisUnit, vtkStringArray);
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();
154 // free the memory used by this mesh (coordinates, connectivity)
155 virtual void ClearMedSupports();
158 // The name of the mesh in the med file.
159 virtual void SetParentFile(vtkMedFile*);
160 vtkGetObjectMacro(ParentFile, vtkMedFile);
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);
169 virtual ~vtkMedMesh();
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;
183 vtkMedFile* ParentFile;
185 vtkObjectVector<vtkMedFamily>* CellFamily;
186 vtkObjectVector<vtkMedFamily>* PointFamily;
188 vtkObjectVector<vtkMedGroup>* PointGroup;
189 vtkObjectVector<vtkMedGroup>* CellGroup;
191 vtkStringArray* AxisName;
192 vtkStringArray* AxisUnit;
194 vtkMedComputeStepMap<vtkMedGrid>* GridStep;
199 vtkMedMesh(const vtkMedMesh&); // Not implemented.
200 void operator=(const vtkMedMesh&); // Not implemented.
204 #endif //__vtkMedMesh_h_