source: XMLIO_V2/dev/dev_rv/src4/xmlio/vtk/lscereader.hpp @ 229

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