1 // Copyright (C) 2010-2012 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 __vtkMedGrid_h_
21 #define __vtkMedGrid_h_
23 #include "vtkObject.h"
24 #include "vtkMedSetGet.h"
25 #include "vtkMedUtilities.h"
27 #include "vtkMedIntArray.h"
30 class vtkMedFamilyOnEntity;
33 class VTK_EXPORT vtkMedGrid : public vtkObject
36 vtkTypeRevisionMacro(vtkMedGrid, vtkObject)
37 void PrintSelf(ostream& os, vtkIndent indent);
40 // This identifies the time and iteration of this grid
41 void SetComputeStep(vtkMedComputeStep cs)
43 this->ComputeStep = cs;
45 vtkMedComputeStep GetComputeStep()
47 return this->ComputeStep;
51 // returns the number of points. Each sub class has to implement this method.
52 virtual med_int GetNumberOfPoints() = 0;
55 // Initialize the global Ids of the first element of each MedEntityArray
56 virtual void InitializeCellGlobalIds(){;}
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);
65 // Gather the families that are present on this mesh nodes
66 //virtual void ComputePointFamilies();
69 // this array contains the global ids of the points used by the grid.
70 virtual void SetPointGlobalIds(vtkMedIntArray*);
71 vtkGetObjectMacro(PointGlobalIds, vtkMedIntArray);
74 // this array contains the family ids of the points used by the grid.
75 //virtual void SetPointFamilyIds(vtkMedIntArray*);
76 //vtkGetObjectMacro(PointFamilyIds, vtkMedIntArray);
79 // The mesh that use this grid
80 virtual void SetParentMesh(vtkMedMesh*);
81 vtkGetObjectMacro(ParentMesh, vtkMedMesh);
84 // The mesh that use this grid
85 virtual void SetPreviousGrid(vtkMedGrid*);
86 vtkGetObjectMacro(PreviousGrid, vtkMedGrid);
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();
94 // clear the entity arrays storing the connectivity
95 virtual void ClearMedSupports();
98 // This is the coordinate system the grid live in.
99 vtkSetMacro(CoordinateSystem, med_axis_type);
100 vtkGetMacro(CoordinateSystem, med_axis_type);
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);
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);
117 // load the family ids using the driver
118 //void LoadPointFamilyIds();
120 virtual void LoadCoordinates() = 0;
121 virtual int IsCoordinatesLoaded() = 0;
124 // return the vtkMedEntityArray that match the Entity type, if any.
125 virtual vtkMedEntityArray* GetEntityArray(const vtkMedEntity&);
127 virtual double* GetCoordTuple(med_int index) = 0;
130 // This will instanciate a new vtkDataSet object.
131 // The caller is responsible for deleting it.
132 virtual vtkDataSet* CreateVTKDataSet(vtkMedFamilyOnEntityOnProfile*) = 0;
135 // This utility method returns all vtkMedEntity types present in this grid
136 virtual void GatherMedEntities(std::set<vtkMedEntity>& entities);
140 virtual ~vtkMedGrid();
142 vtkMedComputeStep ComputeStep;
143 vtkMedIntArray* PointGlobalIds;
144 //vtkMedIntArray* PointFamilyIds;
146 vtkMedMesh* ParentMesh;
148 vtkMedGrid* PreviousGrid;
151 //vtkObjectVector<vtkMedFamilyOnEntity>* PointFamilyData;
154 bool UsePreviousCoordinates;
155 med_axis_type CoordinateSystem;
157 vtkObjectVector<vtkMedEntityArray>* EntityArray;
161 vtkMedGrid(const vtkMedGrid&); // Not implemented.
162 void operator=(const vtkMedGrid&); // Not implemented.
166 #endif //__vtkMedGrid_h_