1 | #ifndef __XMLIO_LSCE_READER__ |
---|
2 | #define __XMLIO_LSCE_READER__ |
---|
3 | |
---|
4 | /// xmlioserver headers /// |
---|
5 | #include "xmlioserver_spl.hpp" |
---|
6 | #include "inetcdf4.hpp" |
---|
7 | |
---|
8 | /// VTK headers /// |
---|
9 | #include "vtkDataObjectAlgorithm.h" |
---|
10 | |
---|
11 | #include "vtkStdString.h" |
---|
12 | |
---|
13 | #include "vtkUnstructuredGrid.h" |
---|
14 | #include "vtkStructuredGrid.h" |
---|
15 | #include "vtkRectilinearGrid.h" |
---|
16 | |
---|
17 | #include "vtkSmartPointer.h" |
---|
18 | |
---|
19 | #include "vtkStringArray.h" |
---|
20 | #include "vtkFloatArray.h" |
---|
21 | #include "vtkIntArray.h" |
---|
22 | #include "vtkDoubleArray.h" |
---|
23 | #include "vtkCellArray.h" |
---|
24 | |
---|
25 | #include "vtkCellData.h" |
---|
26 | #include "vtkPointData.h" |
---|
27 | |
---|
28 | namespace xmlioserver |
---|
29 | { |
---|
30 | namespace vtk |
---|
31 | { |
---|
32 | /// ////////////////////// Déclarations ////////////////////// /// |
---|
33 | |
---|
34 | class VTK_EXPORT vtkLSCEReader |
---|
35 | : public vtkDataObjectAlgorithm |
---|
36 | { |
---|
37 | public : |
---|
38 | |
---|
39 | //------------------------------------------------------------- |
---|
40 | typedef enum _gridtype |
---|
41 | { RECTILINEAR = 0, CURVILINEAR, UNSTRUCTURED } GridType; |
---|
42 | //------------------------------------------------------------- |
---|
43 | |
---|
44 | /// Spécifique VTK /// |
---|
45 | static vtkLSCEReader * New(void); |
---|
46 | vtkTypeMacro(vtkLSCEReader, vtkDataObjectAlgorithm); |
---|
47 | void PrintSelf(ostream& os, vtkIndent indent); |
---|
48 | |
---|
49 | //------------------------------------------------------------- |
---|
50 | |
---|
51 | /// Mutateurs /// |
---|
52 | void SetFileName(const StdString & fileName); |
---|
53 | |
---|
54 | void AddVariableToSelection(const StdString & varName); |
---|
55 | void RemoveSelectedVariable(const StdString & varName); |
---|
56 | void RemoveAllSelectedVariables(void); |
---|
57 | |
---|
58 | void SetGridType (GridType type); |
---|
59 | |
---|
60 | void AcceptTemporalOnly(bool value); |
---|
61 | void Accept3DOnly(bool value); |
---|
62 | void AcceptCellOnly(bool value); |
---|
63 | |
---|
64 | //------------------------------------------------------------- |
---|
65 | |
---|
66 | /// Accesseurs /// |
---|
67 | const StdString & GetFileName(void) const; |
---|
68 | |
---|
69 | const std::set<StdString> & GetSelectedVariables(void) const; |
---|
70 | |
---|
71 | //------------------------------------------------------------- |
---|
72 | |
---|
73 | /// Tests /// |
---|
74 | bool IsUnstructured(void) const; |
---|
75 | bool IsCurvilinear(void) const; |
---|
76 | bool IsRectilinear(void) const; |
---|
77 | |
---|
78 | bool HasSelectedVariable(void) const; |
---|
79 | |
---|
80 | /// Visualisation /// |
---|
81 | static void ShowVariable(const vtkStdString & filename, |
---|
82 | const vtkStdString & varname); |
---|
83 | |
---|
84 | protected: |
---|
85 | |
---|
86 | /// Constructeur /// |
---|
87 | vtkLSCEReader(void); |
---|
88 | |
---|
89 | /// Destructeur /// |
---|
90 | virtual ~vtkLSCEReader(void); |
---|
91 | |
---|
92 | //------------------------------------------------------------- |
---|
93 | void GetSpacings(const vtkStdString & coordinate, |
---|
94 | bool bounds, vtkFloatArray * spacing); |
---|
95 | |
---|
96 | //------------------------------------------------------------- |
---|
97 | |
---|
98 | void CreateRectilinearGrid(vtkRectilinearGrid *, vtkInformation *, |
---|
99 | vtkFloatArray *, vtkFloatArray *, vtkFloatArray *, |
---|
100 | vtkIntArray *); |
---|
101 | |
---|
102 | void CreateStructuredGrid(vtkStructuredGrid *, vtkInformation *, |
---|
103 | vtkPoints *, vtkIntArray *); |
---|
104 | |
---|
105 | void CreateUnstructuredGrid(vtkUnstructuredGrid *, vtkInformation *, |
---|
106 | vtkPoints *, vtkCellArray *, int); |
---|
107 | |
---|
108 | //------------------------------------------------------------- |
---|
109 | |
---|
110 | void CreateSimpleGrid (int xi, int xf, int yi, int yf, int zi, int zf, |
---|
111 | vtkFloatArray *, vtkFloatArray *, vtkFloatArray *, |
---|
112 | vtkIntArray *); |
---|
113 | |
---|
114 | void CreateSimpleGrid (int xi, int xf, int yi, int yf, int zi, int zf, |
---|
115 | vtkPoints *, vtkIntArray *); |
---|
116 | |
---|
117 | void CreateSimpleGrid (int xi, int xf, int yi, int yf, int zi, int zf, |
---|
118 | vtkPoints *, vtkCellArray *, vtkIntArray *); |
---|
119 | |
---|
120 | //------------------------------------------------------------- |
---|
121 | |
---|
122 | void GetRectilinearConnectivity(int, int, int, vtkCellArray *); |
---|
123 | |
---|
124 | //------------------------------------------------------------- |
---|
125 | |
---|
126 | void AddPoint(vtkPoints * points, float * value, bool proj); |
---|
127 | |
---|
128 | void GetPoints(const vtkStdString & xcoordinate, |
---|
129 | const vtkStdString & ycoordinate, |
---|
130 | const vtkStdString & zcoordinate, |
---|
131 | bool bounds, bool proj, |
---|
132 | vtkPoints * points, vtkIntArray * dimensions); |
---|
133 | |
---|
134 | //------------------------------------------------------------- |
---|
135 | |
---|
136 | void GetCellsAndPoints(const vtkStdString & xcoordinate, |
---|
137 | const vtkStdString & ycoordinate, |
---|
138 | const vtkStdString & zcoordinate, |
---|
139 | bool bounds, bool proj, StdSize nbvertex, |
---|
140 | vtkCellArray * cells, vtkPoints * points, |
---|
141 | vtkIntArray * dimensions); |
---|
142 | |
---|
143 | //------------------------------------------------------------- |
---|
144 | |
---|
145 | void AddScalarData(vtkDataSet * output, const StdString & varname, |
---|
146 | StdSize record, bool bounds); |
---|
147 | |
---|
148 | //------------------------------------------------------------- |
---|
149 | |
---|
150 | /// Traitements /// |
---|
151 | virtual int RequestData |
---|
152 | (vtkInformation *, vtkInformationVector **, vtkInformationVector *); |
---|
153 | |
---|
154 | //virtual int RequestInformation |
---|
155 | // (vtkInformation *, vtkInformationVector **, vtkInformationVector *); |
---|
156 | |
---|
157 | //virtual int RequestDataObject |
---|
158 | // (vtkInformation *, vtkInformationVector **, vtkInformationVector *); |
---|
159 | |
---|
160 | virtual int ProcessRequest |
---|
161 | (vtkInformation *, vtkInformationVector **, vtkInformationVector *); |
---|
162 | |
---|
163 | //------------------------------------------------------------- |
---|
164 | |
---|
165 | private: |
---|
166 | |
---|
167 | /// Constructeurs /// |
---|
168 | vtkLSCEReader(const vtkLSCEReader &); // Not implemented |
---|
169 | vtkLSCEReader(const vtkLSCEReader * const); // Not implemented |
---|
170 | |
---|
171 | /// Opérateur /// |
---|
172 | void operator=(const vtkLSCEReader &); // Not implemented |
---|
173 | |
---|
174 | //------------------------------------------------------------- |
---|
175 | |
---|
176 | /// Propriétés privées /// |
---|
177 | StdString FileName; |
---|
178 | |
---|
179 | GridType CurGridType; |
---|
180 | std::set<StdString> VarNames; |
---|
181 | bool A3D, ATemporal, ACell; |
---|
182 | |
---|
183 | boost::shared_ptr<io::CINetCDF4> Reader; |
---|
184 | |
---|
185 | }; // class vtkLSCEReader |
---|
186 | |
---|
187 | ///---------------------------------------------------------------- |
---|
188 | |
---|
189 | } // namespace vtk |
---|
190 | } // namespace xmlioserver |
---|
191 | |
---|
192 | #endif //__XMLIO_LSCE_READER__ |
---|