Salome HOME
Merge from BR_PORTING_VTK6 01/03/2013
[modules/paravis.git] / src / Plugins / MedReader / IO / vtkMedGrid.h
1 // Copyright (C) 2010-2011  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 __vtkMedGrid_h_
21 #define __vtkMedGrid_h_
22
23 #include "vtkObject.h"
24 #include "vtkMedSetGet.h"
25 #include "vtkMedUtilities.h"
26 #include "vtkMed.h"
27 #include "vtkMedIntArray.h"
28
29 class vtkMedString;
30 class vtkMedFamilyOnEntity;
31 class vtkMedIntArray;
32
33 class VTK_EXPORT vtkMedGrid : public vtkObject
34 {
35 public :
36   vtkTypeMacro(vtkMedGrid, vtkObject)
37   void PrintSelf(ostream& os, vtkIndent indent);
38
39   // Description:
40   // This identifies the time and iteration of this grid
41   void  SetComputeStep(vtkMedComputeStep cs)
42     {
43     this->ComputeStep = cs;
44     }
45   vtkMedComputeStep  GetComputeStep()
46     {
47     return this->ComputeStep;
48     }
49
50   // Description:
51   // returns the number of points. Each sub class has to implement this method.
52   virtual med_int GetNumberOfPoints() = 0;
53
54   // Description:
55   // Initialize the global Ids of the first element of each MedEntityArray
56   virtual void  InitializeCellGlobalIds(){;}
57
58   // Description:
59   // this stores the array giving the family id for each point of this mesh.
60   //vtkGetObjectVectorMacro(PointFamilyData, vtkMedFamilyOnEntity);
61   //vtkSetObjectVectorMacro(PointFamilyData, vtkMedFamilyOnEntity);
62   //virtual vtkMedFamilyOnEntity* GetPointFamilyDataById(med_int id);
63
64   // Description:
65   // Gather the families that are present on this mesh nodes
66   //virtual void ComputePointFamilies();
67
68   // Description:
69   // this array contains the global ids of the points used by the grid.
70   virtual void  SetPointGlobalIds(vtkMedIntArray*);
71   vtkGetObjectMacro(PointGlobalIds, vtkMedIntArray);
72
73   // Description:
74   // this array contains the family ids of the points used by the grid.
75   //virtual void  SetPointFamilyIds(vtkMedIntArray*);
76   //vtkGetObjectMacro(PointFamilyIds, vtkMedIntArray);
77
78   // Description:
79   // The mesh that use this grid
80   virtual void  SetParentMesh(vtkMedMesh*);
81   vtkGetObjectMacro(ParentMesh, vtkMedMesh);
82
83   // Description:
84   // The mesh that use this grid
85   virtual void  SetPreviousGrid(vtkMedGrid*);
86   vtkGetObjectMacro(PreviousGrid, vtkMedGrid);
87
88   // Description:
89   // returns 1 if the global Ids array is set, and the
90   //  number of tuples matches the number of points
91   virtual int IsPointGlobalIdsLoaded();
92
93   // Description:
94   // clear the entity arrays storing the connectivity
95   virtual void  ClearMedSupports();
96
97   // Description:
98   // This is the coordinate system the grid live in.
99   vtkSetMacro(CoordinateSystem, med_axis_type);
100   vtkGetMacro(CoordinateSystem, med_axis_type);
101
102   // Description:
103   // This flag is set during the information loading, and tells if the
104   // coordinates of this grid at this step has changed from the previous step.
105   // if not, you should request the coordinates array from the previous grid
106   // instead of this one.
107   vtkSetMacro(UsePreviousCoordinates, bool);
108   vtkGetMacro(UsePreviousCoordinates, bool);
109
110   // Description:
111   // Add a cell array to this unstructured grid.
112   // each cell array represents a different cell type.
113   vtkGetObjectVectorMacro(EntityArray, vtkMedEntityArray);
114   vtkSetObjectVectorMacro(EntityArray, vtkMedEntityArray);
115
116   // Description:
117   // load the family ids using the driver
118   //void  LoadPointFamilyIds();
119
120   virtual void  LoadCoordinates() = 0;
121   virtual int  IsCoordinatesLoaded() = 0;
122
123   // Description:
124   // return the vtkMedEntityArray that match the Entity type, if any.
125   virtual vtkMedEntityArray* GetEntityArray(const vtkMedEntity&);
126
127   virtual double* GetCoordTuple(med_int index) = 0;
128
129   // Description:
130   // This will instanciate a new vtkDataSet object.
131   // The caller is responsible for deleting it.
132   virtual vtkDataSet* CreateVTKDataSet(vtkMedFamilyOnEntityOnProfile*) = 0;
133   
134   //  Description:
135   // This utility method returns all vtkMedEntity types present in this grid
136   virtual void  GatherMedEntities(std::set<vtkMedEntity>& entities);
137
138 protected:
139   vtkMedGrid();
140   virtual ~vtkMedGrid();
141
142   vtkMedComputeStep ComputeStep;
143   vtkMedIntArray* PointGlobalIds;
144   //vtkMedIntArray* PointFamilyIds;
145
146   vtkMedMesh* ParentMesh;
147
148   vtkMedGrid* PreviousGrid;
149
150   //BTX
151   //vtkObjectVector<vtkMedFamilyOnEntity>* PointFamilyData;
152   //ETX
153
154   bool UsePreviousCoordinates;
155   med_axis_type CoordinateSystem;
156   //BTX
157   vtkObjectVector<vtkMedEntityArray>* EntityArray;
158   //ETX
159
160 private:
161   vtkMedGrid(const vtkMedGrid&); // Not implemented.
162   void operator=(const vtkMedGrid&); // Not implemented.
163
164 };
165
166 #endif //__vtkMedGrid_h_