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 __vtkMedEntityArray_h_
21 #define __vtkMedEntityArray_h_
23 #include "vtkObject.h"
24 #include "vtkMedSetGet.h"
25 #include "vtkMedUtilities.h"
27 #include "vtkMedFilter.h"
32 class vtkMedFamilyOnEntity;
36 class vtkMedStructElement;
37 class vtkMedVariableAttribute;
39 class VTK_EXPORT vtkMedEntityArray: public vtkObject
42 static vtkMedEntityArray* New();
43 vtkTypeMacro(vtkMedEntityArray, vtkObject)
44 void PrintSelf(ostream& os, vtkIndent indent);
47 // This is the number of cells of this entity type.
48 vtkSetMacro(NumberOfEntity, vtkIdType);
49 vtkGetMacro(NumberOfEntity, vtkIdType);
52 // the support of the cells : one of
53 void SetEntity(const vtkMedEntity& entity){this->Entity = entity;}
54 const vtkMedEntity& GetEntity(){return this->Entity;}
57 // This connectivity type of this entity : one of
58 // MED_NODAL, MED_DESCENDING, MED_NO_CMODE
59 vtkSetMacro(Connectivity, med_connectivity_mode);
60 vtkGetMacro(Connectivity, med_connectivity_mode);
63 // This array stores the family ids of each entity.
64 virtual void SetConnectivityArray(vtkMedIntArray*);
65 vtkGetObjectMacro(ConnectivityArray, vtkMedIntArray);
68 // This array stores the connectivity array for this entity.
69 virtual void SetFamilyIds(vtkMedIntArray*);
70 virtual med_int GetFamilyId(med_int id);
73 // This array stores the global Ids of the entities.
74 virtual void SetGlobalIds(vtkMedIntArray*);
75 vtkGetObjectMacro(GlobalIds, vtkMedIntArray);
78 // For polygons, this array stores the index of each edge described in
79 // the connectivity array
80 // For polyhedrons, this arrays stores the index of each face described
81 // in the NodeIndex array
82 virtual void SetFaceIndex(vtkMedIntArray*);
83 vtkGetObjectMacro(FaceIndex, vtkMedIntArray);
86 // For polyhedrons, this arrays can store either
87 // the index of each node of each face described in the Index1 array
88 // (node connectivity) or the type each face described in the Index1
89 // array (hierarchical connectivity)
90 virtual void SetNodeIndex(vtkMedIntArray*);
91 vtkGetObjectMacro(NodeIndex, vtkMedIntArray);
94 // Arrays of entities are partitionned over families.
95 vtkSetObjectVectorMacro(FamilyOnEntity, vtkMedFamilyOnEntity);
96 vtkGetObjectVectorMacro(FamilyOnEntity, vtkMedFamilyOnEntity);
99 // For polyhedrons, this arrays can store either
100 // the index of each node of each face described in the Index1 array
101 // (node connectivity) or the type each face described in the Index1
102 // array (hierarchical connectivity)
103 virtual void SetParentGrid(vtkMedGrid*);
104 vtkGetObjectMacro(ParentGrid, vtkMedGrid);
107 // Compute the list of families that are on this array
108 virtual void ComputeFamilies();
111 // returns true if there are cells of the given family on this entity.
112 virtual int HasFamily(vtkMedFamily*);
115 // returns 1 if the connectivity array is set and matches the number of
116 // connectivity elements.
117 virtual int IsConnectivityLoaded();
120 // returns 1 if the family ids is set and matches the number of entities.
121 virtual int IsFamilyIdsLoaded();
124 // returns 1 if the global ids is set and matches the number of entities.
125 virtual int IsGlobalIdsLoaded();
128 // This gives the global id of the first element of this array.
129 vtkSetMacro(InitialGlobalId, vtkIdType);
130 vtkGetMacro(InitialGlobalId, vtkIdType);
133 // resets all to default status, release memory
134 virtual void Initialize();
137 // Get the indices of the vertices used by a given cell.
138 void GetCellVertices(vtkIdType, vtkIdList*);
140 virtual void LoadConnectivity();
143 // This is a pointer to the StructElement object if any
144 // This pointer is set during the LinkMedInfo pass
145 virtual void SetStructElement(vtkMedStructElement*);
146 vtkGetObjectMacro(StructElement, vtkMedStructElement);
148 void SetVariableAttributeValues(vtkMedVariableAttribute*,
150 vtkAbstractArray* GetVariableAttributeValue(vtkMedVariableAttribute*);
153 // Get/Set of the MED Filter for parallel reading.
154 void SetFilter(vtkMedFilter* filter){this->Filter = filter;}
155 vtkMedFilter* GetFilter(){return this->Filter;}
159 virtual ~vtkMedEntityArray();
161 vtkIdType NumberOfEntity;
164 vtkMedFilter* Filter;
166 med_connectivity_mode Connectivity;
167 vtkIdType InitialGlobalId;
169 vtkMedGrid* ParentGrid;
171 vtkMedIntArray* FamilyIds;
172 vtkMedIntArray* GlobalIds;
173 vtkMedIntArray* ConnectivityArray;
174 vtkMedIntArray* FaceIndex;
175 vtkMedIntArray* NodeIndex;
177 vtkMedStructElement* StructElement;
181 FAMILY_ID_NOT_LOADED,
187 vtkObjectVector<vtkMedFamilyOnEntity>* FamilyOnEntity;
189 std::map<vtkMedVariableAttribute*, vtkSmartPointer<vtkAbstractArray> >
190 VariableAttributeValue;
196 vtkMedEntityArray(const vtkMedEntityArray&); // Not implemented.
197 void operator=(const vtkMedEntityArray&); // Not implemented.
200 #endif //__vtkMedEntityArray_h_