VAPOR3 3.9.4
DerivedVarMgr.h
Go to the documentation of this file.
1#include <iostream>
2#include <vapor/MyBase.h>
3#include <vapor/DC.h>
4#include <vapor/DerivedVar.h>
5
6#ifndef _DERIVEDVARMGR_H_
7 #define _DERIVEDVARMGR_H_
8
9namespace VAPoR {
10
21public:
25
26 virtual ~DerivedVarMgr(){};
27
29
31
32 void RemoveVar(const DerivedVar *var);
33
34 DerivedVar *GetVar(string name) const;
35
36 bool HasVar(string name) const { return (GetVar(name) != NULL); }
37
38 void AddMesh(const Mesh &m);
39
40protected:
42 //
43 virtual int initialize(const std::vector<string> &paths, const std::vector<string> &options = std::vector<string>());
44
46 //
47 virtual bool getDimension(string dimname, DC::Dimension &dimension) const { return (false); }
48
50 //
51 virtual std::vector<string> getDimensionNames() const { return (std::vector<string>()); }
52
54 //
55 virtual std::vector<string> getMeshNames() const;
56
58 //
59 virtual bool getMesh(string mesh_name, DC::Mesh &mesh) const;
60
62 //
63 virtual bool getCoordVarInfo(string varname, DC::CoordVar &cvarInfo) const;
64
66 //
67 virtual bool getDataVarInfo(string varname, DC::DataVar &datavarInfo) const;
68
70 //
71 virtual bool getAuxVarInfo(string varname, DC::AuxVar &varInfo) const { return (false); }
72
74 //
75 virtual bool getBaseVarInfo(string varname, DC::BaseVar &varInfo) const;
76
78 //
79 virtual std::vector<string> getDataVarNames() const;
80
82 //
83 virtual std::vector<string> getCoordVarNames() const;
84
86 //
87 virtual std::vector<string> getAuxVarNames() const { return (std::vector<string>()); }
88
90 //
91 virtual size_t getNumRefLevels(string varname) const;
92
94 //
95 virtual bool getAtt(string varname, string attname, vector<double> &values) const;
96
98 //
99 virtual bool getAtt(string varname, string attname, vector<long> &values) const;
100
102 //
103 virtual bool getAtt(string varname, string attname, string &values) const;
104
106 //
107 virtual std::vector<string> getAttNames(string varname) const;
108
110 //
111 virtual XType getAttType(string varname, string attname) const;
112
114 //
115 virtual int getDimLensAtLevel(string varname, int level, std::vector<size_t> &dims_at_level, std::vector<size_t> &bs_at_level) const;
116
118 //
119 virtual string getMapProjection() const { return (string("")); }
120
122 //
123 virtual int openVariableRead(size_t ts, string varname, int level = 0, int lod = 0);
124
126 //
127 virtual int closeVariable(int fd);
128
130 //
131 virtual int readRegion(int fd, const vector<size_t> &min, const vector<size_t> &max, double *region);
132 virtual int readRegion(int fd, const vector<size_t> &min, const vector<size_t> &max, float *region);
133 virtual int readRegion(int fd, const vector<size_t> &min, const vector<size_t> &max, int *region) { return (-1); }
134
136 //
137 virtual bool variableExists(size_t ts, string varname, int reflevel = 0, int lod = 0) const;
138
139private:
140 std::map<string, DerivedVar *> _vars;
141 std::map<string, DerivedDataVar *> _dataVars;
142 std::map<string, DerivedCoordVar *> _coordVars;
143 std::map<string, Mesh> _meshes;
144
145 DerivedVar * _getVar(string name) const;
146 DerivedDataVar * _getDataVar(string name) const;
147 DerivedCoordVar *_getCoordVar(string name) const;
148
149private:
150 DC::FileTable _fileTable;
151};
152}; // namespace VAPoR
153
154#endif
Auxiliary variable metadata.
Definition: DC.h:1230
Base class for storing variable metadata.
Definition: DC.h:754
Coordinate variable metadata.
Definition: DC.h:881
Data variable metadata.
Definition: DC.h:987
Metadata describing a named dimension length.
Definition: DC.h:163
Metadata describing a computational mesh.
Definition: DC.h:310
A Template Method design pattern for reading a collection of data.
Definition: DC.h:150
XType
External storage types for primitive data.
Definition: DC.h:154
Derived coordinate variable abstract class.
Definition: DerivedVar.h:106
Derived data variable abstract class.
Definition: DerivedVar.h:234
Derived variables constructed from other variables.
Definition: DerivedVarMgr.h:20
virtual std::vector< string > getDimensionNames() const
Definition: DerivedVarMgr.h:51
virtual std::vector< string > getDataVarNames() const
virtual bool getBaseVarInfo(string varname, DC::BaseVar &varInfo) const
virtual int getDimLensAtLevel(string varname, int level, std::vector< size_t > &dims_at_level, std::vector< size_t > &bs_at_level) const
virtual std::vector< string > getMeshNames() const
DerivedVar * GetVar(string name) const
virtual int initialize(const std::vector< string > &paths, const std::vector< string > &options=std::vector< string >())
virtual bool getAtt(string varname, string attname, string &values) const
void AddMesh(const Mesh &m)
void AddCoordVar(DerivedCoordVar *cvar)
virtual std::vector< string > getCoordVarNames() const
virtual int readRegion(int fd, const vector< size_t > &min, const vector< size_t > &max, int *region)
void AddDataVar(DerivedDataVar *dvar)
virtual int openVariableRead(size_t ts, string varname, int level=0, int lod=0)
virtual bool getDataVarInfo(string varname, DC::DataVar &datavarInfo) const
void RemoveVar(const DerivedVar *var)
virtual size_t getNumRefLevels(string varname) const
virtual int closeVariable(int fd)
virtual std::vector< string > getAttNames(string varname) const
virtual bool getAtt(string varname, string attname, vector< long > &values) const
virtual int readRegion(int fd, const vector< size_t > &min, const vector< size_t > &max, double *region)
bool HasVar(string name) const
Definition: DerivedVarMgr.h:36
virtual int readRegion(int fd, const vector< size_t > &min, const vector< size_t > &max, float *region)
virtual bool getAuxVarInfo(string varname, DC::AuxVar &varInfo) const
Definition: DerivedVarMgr.h:71
virtual string getMapProjection() const
virtual XType getAttType(string varname, string attname) const
virtual ~DerivedVarMgr()
Definition: DerivedVarMgr.h:26
virtual bool variableExists(size_t ts, string varname, int reflevel=0, int lod=0) const
virtual bool getCoordVarInfo(string varname, DC::CoordVar &cvarInfo) const
virtual bool getAtt(string varname, string attname, vector< double > &values) const
virtual bool getDimension(string dimname, DC::Dimension &dimension) const
Definition: DerivedVarMgr.h:47
virtual bool getMesh(string mesh_name, DC::Mesh &mesh) const
virtual std::vector< string > getAuxVarNames() const
Definition: DerivedVarMgr.h:87
Derived variable abstract class.
Definition: DerivedVar.h:34
#define VDF_API
Definition: common.h:73