Salome HOME
Fix test case hang-up
[modules/paravis.git] / src / Plugins / MedReader / IO / vtkMedField.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 __vtkMedField_h_
21 #define __vtkMedField_h_
22
23 #include "vtkObject.h"
24 #include "vtkMedSetGet.h"
25 #include "vtkMed.h"
26
27 #include "vtkSmartPointer.h"
28
29 #include <set>
30
31 class vtkStringArray;
32
33 class vtkMedInterpolation;
34 class vtkMedFieldOverEntity;
35 class vtkMedString;
36 class vtkMedFieldStep;
37 class vtkMedComputeStep;
38 template <class T>
39 class vtkMedComputeStepMap;
40 class vtkMedFile;
41
42 class VTK_EXPORT vtkMedField: public vtkObject
43 {
44 public:
45   static vtkMedField* New();
46   vtkTypeMacro(vtkMedField, vtkObject);
47   void PrintSelf(ostream& os, vtkIndent indent);
48
49   // Description:
50   // The number of component of this field
51   virtual void  SetNumberOfComponent(int);
52   vtkGetMacro(NumberOfComponent, int);
53
54   // Description:
55   // The type of data stored in this field
56   vtkSetMacro(DataType, med_field_type);
57   vtkGetMacro(DataType, med_field_type);
58
59   // Description:
60   // The name of this field
61   vtkGetStringMacro(Name);
62   vtkSetStringMacro(Name);
63
64   // Description:
65   // The name of this mesh this field is on
66   vtkGetStringMacro(MeshName);
67   vtkSetStringMacro(MeshName);
68
69   // Description:
70   // The name of this mesh this field is on
71   vtkGetStringMacro(TimeUnit);
72   vtkSetStringMacro(TimeUnit);
73
74   // Description:
75   // The units of each component of this field
76   vtkGetObjectMacro(Unit, vtkStringArray);
77
78   // Description:
79   // The name of each component of this field
80   vtkGetObjectMacro(ComponentName, vtkStringArray);
81
82   // Description:
83   // add a cell type as support to this field
84   void  AddFieldStep(vtkMedFieldStep*);
85   void  ClearFieldStep();
86   vtkMedFieldStep* GetFieldStep(const vtkMedComputeStep&);
87   vtkMedFieldStep* FindFieldStep(const vtkMedComputeStep&, int);
88   med_int GetNumberOfFieldStep();
89   vtkMedFieldStep* GetFieldStep(med_int);
90   void  GatherFieldTimes(std::set<med_float>&);
91   void  GatherFieldIterations(med_float,std::set<med_int>&);
92
93   // Description:
94   // returns if the field is on point, cell, quadrature point or elno
95   //BTX
96   enum {
97     UnknownFieldType = 0x00,
98     PointField = 0x01,
99     CellField = 0x02,
100     QuadratureField = 0x04,
101     ElnoField = 0x08};
102   //ETX
103   //Description:
104   // returns the type of field this is. The returned code is and OR between
105   // the different possible types.
106   vtkGetMacro(FieldType, int);
107
108   // This computes the FieldType
109   // (currently, it does it by looking only at the first compute step)
110   virtual void  ComputeFieldType();
111
112   // Description:
113   // This returns true if the FieldType is composed of several types
114   virtual int HasManyFieldTypes();
115
116   // Description:
117   // returns the first support type this field is on.
118   virtual int GetFirstType();
119
120   // Description:
121   // This methods extracts from the other field all the fields that are
122   // on the given support type and add them to the current field.
123   // It also updates the other FieldType ivar.
124   virtual void  ExtractFieldType(vtkMedField* otherfield, int type);
125
126   // Description:
127   // The index of this field in the med file
128   vtkSetMacro(MedIterator, med_int);
129   vtkGetMacro(MedIterator, med_int);
130
131   // Description:
132   // if the mesh is local or not.
133   vtkSetMacro(Local, med_int);
134   vtkGetMacro(Local, med_int);
135
136   // Description:
137   // The interpolation functions associated with this field
138   vtkGetObjectVectorMacro(Interpolation, vtkMedInterpolation);
139   vtkSetObjectVectorMacro(Interpolation, vtkMedInterpolation);
140
141   // Description:
142   // This stores the file this field is stored on.
143   virtual void  SetParentFile(vtkMedFile*);
144   vtkGetObjectMacro(ParentFile, vtkMedFile);
145
146 protected:
147   vtkMedField();
148   virtual ~vtkMedField();
149
150   vtkSetMacro(FieldType, int);
151
152   int NumberOfComponent;
153   med_field_type DataType;
154   med_int MedIterator;
155   med_int Local;
156   char* Name;
157   char* MeshName;
158   char* TimeUnit;
159   int FieldType;
160   vtkMedFile* ParentFile;
161
162   //BTX
163   vtkMedComputeStepMap<vtkMedFieldStep>* FieldStep;
164   vtkObjectVector<vtkMedInterpolation>* Interpolation;
165   //ETX
166
167   vtkStringArray* Unit;
168   vtkStringArray* ComponentName;
169
170 private:
171   vtkMedField(const vtkMedField&); // Not implemented.
172   void operator=(const vtkMedField&); // Not implemented.
173
174 };
175
176 #endif //__vtkMedField_h_