VAPOR3 3.9.4
DataStatus.h
Go to the documentation of this file.
1//************************************************************************
2// *
3// Copyright (C) 2004 *
4// University Corporation for Atmospheric Research *
5// All Rights Reserved *
6// *
7//************************************************************************/
8//
9// File: DataStatus.h
10//
11// Author: Alan Norton
12// National Center for Atmospheric Research
13// PO 3000, Boulder, Colorado
14//
15// Date: February 2006
16//
17// Description: Defines the DataStatus class.
18// This class maintains information about the data that is currently
19// loaded. Maintained and accessed mostly through the Session
20#ifndef DATASTATUS_H
21#define DATASTATUS_H
22
23#include <vector>
24#include <string>
25#include <map>
26#include <vapor/common.h>
27#include <vapor/DataMgr.h>
28#include <vapor/ParamsMgr.h>
29
30namespace VAPoR {
31
49
51public:
52 DataStatus(size_t cacheSize, int nThreads = 0);
54 virtual ~DataStatus();
55
56 int Open(const std::vector<string> &files, const std::vector<string> &options, string name, string format);
57
58 void Close(string name);
59
60 // const DataMrgV3_0 *GetDataMgr(string name) const;
61 DataMgr *GetDataMgr(string name) const;
62
63 vector<string> GetDataMgrNames() const;
64
86 //
87 void GetActiveExtents(const ParamsMgr *paramsMgr, string winName, string datasetName, size_t ts, CoordType &minExts, CoordType &maxExts) const;
88
89 void GetActiveExtents(const ParamsMgr *paramsMgr, string winName, size_t ts, CoordType &minExts, CoordType &maxExts) const;
90
91 void GetActiveExtents(const ParamsMgr *paramsMgr, size_t ts, CoordType &minExts, CoordType &maxExts) const;
92
101 //
102 const vector<double> &GetTimeCoordinates() const { return (_timeCoords); }
103
110 //
111 const vector<string> &GetTimeCoordsFormatted() const { return (_timeCoordsFormatted); }
112
124 //
125 size_t MapGlobalToLocalTimeStep(string dataSetName, size_t ts) const;
126
134 //
135 void MapLocalToGlobalTimeRange(string dataSetName, size_t local_ts, size_t &min_ts, size_t &max_ts) const;
136
144 //
145 void SetNumThreads(size_t nthreads) { _nThreads = nthreads; }
146
147 size_t GetNumThreads() const { return _nThreads; }
148
156 //
157 void SetCacheSize(size_t sizeMB) { _cacheSize = sizeMB; }
158
159 string GetMapProjection() const;
160 string GetMapProjectionDefault(string dataSetName) const;
161
164 size_t getMinTimestep() { return 0; }
165
168 size_t getMaxTimestep() { return _timeCoords.size() ? _timeCoords.size() - 1 : 0; }
169
171
172private:
173 typedef struct {
174 std::vector<string> varnames;
175 int refLevel;
176 int compLevel;
177 } var_info_t;
178
179 void _getExtents(size_t ts, const map<string, std::vector<var_info_t>> &variables, CoordType &minExt, CoordType &maxExt) const;
180
181 map<string, vector<var_info_t>> _getFirstVar(string dataSetName, size_t &ts) const;
182
183 void reset_time();
184 void reset_time_helper();
185
186#ifndef DOXYGEN_SKIP_THIS
187
188 size_t _cacheSize;
189 int _nThreads;
190 map<string, DataMgr *> _dataMgrs;
191 map<string, vector<size_t>> _timeMap;
192 vector<double> _timeCoords;
193 vector<string> _timeCoordsFormatted;
194
195#endif // DOXYGEN_SKIP_THIS
196};
197
198}; // namespace VAPoR
199#endif // DATASTATUS_H
A cache based data reader.
Definition: DataMgr.h:110
A class for describing the currently loaded dataset.
Definition: DataStatus.h:50
void SetNumThreads(size_t nthreads)
Definition: DataStatus.h:145
DataStatus(size_t cacheSize, int nThreads=0)
void GetActiveExtents(const ParamsMgr *paramsMgr, string winName, string datasetName, size_t ts, CoordType &minExts, CoordType &maxExts) const
void SetCacheSize(size_t sizeMB)
Definition: DataStatus.h:157
void MapLocalToGlobalTimeRange(string dataSetName, size_t local_ts, size_t &min_ts, size_t &max_ts) const
const vector< double > & GetTimeCoordinates() const
Definition: DataStatus.h:102
void Close(string name)
string GetMapProjectionDefault(string dataSetName) const
size_t getMaxTimestep()
Definition: DataStatus.h:168
const vector< string > & GetTimeCoordsFormatted() const
Definition: DataStatus.h:111
DataMgr * GetDataMgr(string name) const
size_t GetNumThreads() const
Definition: DataStatus.h:147
void GetActiveExtents(const ParamsMgr *paramsMgr, string winName, size_t ts, CoordType &minExts, CoordType &maxExts) const
virtual ~DataStatus()
int Open(const std::vector< string > &files, const std::vector< string > &options, string name, string format)
string GetMapProjection() const
vector< string > GetDataMgrNames() const
void GetActiveExtents(const ParamsMgr *paramsMgr, size_t ts, CoordType &minExts, CoordType &maxExts) const
size_t getMinTimestep()
Definition: DataStatus.h:164
size_t MapGlobalToLocalTimeStep(string dataSetName, size_t ts) const
A singleton class for managing Params instances.
Definition: ParamsMgr.h:53
#define PARAMS_API
Definition: common.h:77
std::array< double, 3 > CoordType
Type for specifying floating point coordinates.
Definition: Grid.h:23