XMLIOSERVER 0.4
Serveur d'Entrées/Sorties parallèles
lscereader.hpp
Aller à la documentation de ce fichier.
00001 #ifndef __XMLIO_LSCE_READER__
00002 #define __XMLIO_LSCE_READER__
00003 
00005 #include "xmlioserver_spl.hpp"
00006 #include "inetcdf4.hpp"
00007 #include "inetcdf4_adv.hpp"
00008 
00010 #include <boost/shared_ptr.hpp>
00011 
00013 #include "vtkDataObjectAlgorithm.h"
00014 
00015 #include "vtkStdString.h"
00016 
00017 #include "vtkUnstructuredGrid.h"
00018 #include "vtkStructuredGrid.h"
00019 #include "vtkRectilinearGrid.h"
00020 
00021 #include "vtkSmartPointer.h"
00022 
00023 #include "vtkStringArray.h"
00024 #include "vtkFloatArray.h"
00025 #include "vtkIntArray.h"
00026 #include "vtkDoubleArray.h"
00027 #include "vtkCellArray.h"
00028 #include "vtkDataArraySelection.h"
00029 
00030 #include "vtkCellData.h"
00031 #include "vtkPointData.h"
00032 
00033 //BTX
00034 #ifndef LSCE_EXPORTS
00035 namespace xmlioserver
00036 {
00037    namespace vtk
00038    {
00039 #endif //LSCE_EXPORTS
00040 //ETX
00042 
00043       class VTK_EXPORT vtkLSCEReader : public vtkDataObjectAlgorithm
00044       {
00045          public :
00046              
00047             //BTX
00048             typedef enum _gridtype
00049             { RECTILINEAR = 0, CURVILINEAR, UNSTRUCTURED } GridType; 
00050             //ETX
00051 
00053             static vtkLSCEReader * New(void);
00054             vtkTypeMacro(vtkLSCEReader, vtkDataObjectAlgorithm);
00055             void PrintSelf(ostream& os, vtkIndent indent);
00056 
00057    
00059             void SetFileName(const vtkStdString & fileName);
00060             void SetVariable(const vtkStdString & variable);
00061       
00062             //BTX
00063             void AddVariableToSelection(const vtkStdString & varName);
00064             void RemoveSelectedVariable(const vtkStdString & varName);
00065             void RemoveAllSelectedVariables(void);
00066 
00067             void SetGridType (GridType type);
00068 
00069             void AcceptTemporalOnly(bool value);
00070             void Accept3DOnly(bool value);
00071             void AcceptCellOnly(bool value);  
00072 
00073             //ETX
00075             const char * GetFileName(void) const;
00076             
00077             vtkGetMacro(ReplaceFillValueWithNan, int);
00078             vtkSetMacro(ReplaceFillValueWithNan, int);
00079             vtkBooleanMacro(ReplaceFillValueWithNan, int);
00080              
00081             vtkGetMacro(SphericalCoordinates, int);
00082             vtkSetMacro(SphericalCoordinates, int);
00083             vtkBooleanMacro(SphericalCoordinates, int);
00084             //BTX
00085             
00086             const std::set<vtkStdString> & GetSelectedVariables(void) const;
00087 
00088    
00090             bool IsUnstructured(void) const;
00091             bool IsCurvilinear(void) const;
00092             bool IsRectilinear(void) const;
00093 
00094             bool HasSelectedVariable(void) const;
00095 
00097             static void ShowVariable(const vtkStdString & filename,
00098                                      const vtkStdString & varname);
00099   
00100 
00101          protected:
00102 
00104             vtkLSCEReader(void);
00105 
00107             virtual ~vtkLSCEReader(void);
00108  
00109             void GetSpacings(const vtkStdString & coordinate,
00110                              bool bounds, vtkFloatArray * spacing);
00111 
00112  
00113 
00114             void CreateRectilinearGrid(vtkRectilinearGrid *, vtkInformation *,
00115                                         vtkFloatArray *, vtkFloatArray *, vtkFloatArray *,
00116                                         vtkIntArray *);
00117 
00118             void CreateStructuredGrid(vtkStructuredGrid *, vtkInformation *,
00119                                       vtkPoints *, vtkIntArray *);
00120 
00121             void CreateUnstructuredGrid(vtkUnstructuredGrid *, vtkInformation *,
00122                                         vtkPoints *, vtkCellArray *, int);
00123 
00124  
00125 
00126             void CreateSimpleGrid (int xi, int xf, int yi, int yf, int zi, int zf,
00127                                    vtkFloatArray *, vtkFloatArray *, vtkFloatArray *,
00128                                    vtkIntArray *);
00129 
00130             void CreateSimpleGrid (int xi, int xf, int yi, int yf, int zi, int zf,
00131                                    vtkPoints *, vtkIntArray *);
00132 
00133             void CreateSimpleGrid (int xi, int xf, int yi, int yf, int zi, int zf,
00134                                    vtkPoints *, vtkCellArray *, vtkIntArray *);
00135 
00136  
00137 
00138             void GetRectilinearConnectivity(int, int, int, vtkCellArray *);
00139 
00140  
00141 
00142             void AddPoint(vtkPoints * points, float *  value, bool proj);
00143 
00144             void GetPoints(const vtkStdString & xcoordinate,
00145                            const vtkStdString & ycoordinate,
00146                            const vtkStdString & zcoordinate,
00147                            bool bounds, bool proj,
00148                            vtkPoints * points, vtkIntArray * dimensions);
00149 
00150  
00151 
00152             void GetCellsAndPoints(const vtkStdString & xcoordinate,
00153                                    const vtkStdString & ycoordinate,
00154                                    const vtkStdString & zcoordinate,
00155                                    bool bounds, bool proj, bool clean, std::size_t nbvertex,
00156                                    vtkCellArray * cells, vtkPoints * points,
00157                                    vtkIntArray * dimensions);
00158 
00159  
00160 
00161             void AddScalarData(vtkDataSet * output, const vtkStdString & varname,
00162                                std::size_t record, bool bounds);
00163             
00164             void GetDimensions(const vtkStdString & xcoordinate,
00165                                const vtkStdString & ycoordinate,
00166                                const vtkStdString & zcoordinate,
00167                               vtkIntArray * dimensions, bool bounds);
00168             
00169             void GetDimensions(const vtkStdString & xcoordinate,
00170                                const vtkStdString & zcoordinate,
00171                                vtkIntArray * dimensions, bool bounds);
00172             
00173             void GetTimeInformation
00174                (const vtkStdString & variable, vtkDoubleArray * values, double * timeRange);
00175             
00176             std::size_t GetRecord(const vtkStdString & variable, const double & value);
00177              
00178             //ETX
00179             
00181             virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
00182 
00183             virtual int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
00184 
00185             //virtual int RequestDataObject
00186             //   (vtkInformation *, vtkInformationVector **, vtkInformationVector *);
00187 
00188             virtual int ProcessRequest(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
00189             
00190 
00191             
00192          private:
00193 
00195             vtkLSCEReader(const vtkLSCEReader &);        // Not implemented 
00196             //vtkLSCEReader(const vtkLSCEReader * const);  // Not implemented  
00197             
00199             void operator=(const vtkLSCEReader &);       // Not implemented    
00200             
00201             //BTX
00203             vtkStdString FileName;
00204 
00205             GridType CurGridType;
00206             std::set<vtkStdString> VarNames;
00207             bool A3D, ATemporal, ACell, AGridDef;
00208             
00209             int ReplaceFillValueWithNan;
00210             int SphericalCoordinates;
00211 
00212             boost::shared_ptr<xmlioserver::io::CINetCDF4Adv> Reader;
00213             //ETX
00214 
00215       }; // class vtkLSCEReader
00216       
00217 //BTX
00218 #ifndef LSCE_EXPORTS
00219    } // namespace vtk
00220 } // namespace xmlioserver
00221 #endif //LSCE_EXPORTS
00222 //ETX
00223 
00224 #endif //__XMLIO_LSCE_READER__
 Tout Classes Espaces de nommage Fichiers Fonctions Variables Définition de type Énumérations Valeurs énumérées Amis Macros