VAPoR  3.0.0
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 
24 #include <vector>
25 #include <string>
26 #include <map>
27 #include <vapor/common.h>
28 #include <vapor/DataMgrV3_0.h>
29 #include <vapor/MetadataVDC.h>
30 #include "regionparams.h"
31 #include "vizfeatureparams.h"
32 
33 namespace VAPoR {
52 public:
53 
56  static DataStatus* getInstance() {
57  if (!_dataStatus) _dataStatus = new DataStatus;
58  return _dataStatus;
59  }
60 
65  static const double* getLocalExtents() { return _extents; }
66 
70  static const double* getFullSizes() {return _fullSizes;}
71 
75  static const double* getFullStretchedSizes() {return _fullStretchedSizes;}
76 
80  static const double* getStretchedLocalExtents() {return _stretchedExtents;}
81 
84  static size_t getMinTimestep() {return _minTimeStep;}
85 
88  static size_t getMaxTimestep() {return _maxTimeStep;}
89 
92  static int getNumTimesteps() {return _numTimesteps;}
93 
98  static int getActiveVarNum(int dim, string varname);
99 
106  static double getVoxelSize(size_t timestep, string varname, int refLevel, int dir);
107 
110  static int getNumActiveVariables3D() {return _dataMgr->GetDataVarNames(3,true).size();}
113  static int getNumActiveVariables2D() {return _dataMgr->GetDataVarNames(2,true).size();}
116  static int getNumActiveVariables() {return getNumActiveVariables3D()+getNumActiveVariables2D();}
117 
122  float getDefaultDataMax(string vname);
123 
128  float getDefaultDataMin(string vname);
129 
137  static float getDefaultLODFidelity2D(){return _defaultLODFidelity2D;}
138 
146  static float getDefaultRefinementFidelity2D(){return _defaultRefFidelity2D;}
147 
152  static float getDefaultLODFidelity3D(){return _defaultLODFidelity3D;}
153 
158  static float getDefaultRefinementFidelity3D(){return _defaultRefFidelity3D;}
159 
164  static void setDefaultLODFidelity2D(float q) {_defaultLODFidelity2D = q;}
165 
170  static void setDefaultLODFidelity3D(float q) {_defaultLODFidelity3D = q;}
171 
176  static void setDefaultRefinementFidelity2D(float q){_defaultRefFidelity2D = q;}
177 
182  static void setDefaultRefinementFidelity3D(float q){_defaultRefFidelity3D = q;}
183 
191  static int getDefaultFidelitySettings(int dim, vector<int>&lods, vector<int>&refs){
192  if (dim == 2) {lods = _fidelity2DLODs; refs = _fidelity2DRefs;}
193  else {lods = _fidelity3DLODs; refs = _fidelity3DRefs;}
194  return _defaultFidelity[dim-2];
195  }
196 
199  static void setFidelityDefault(RenderParams* rp);
200 
205  static bool convertToLonLat(double coords[], int npoints = 1);
210  static bool convertFromLonLat(double coords[], int npoints = 1);
217  static bool convertLocalToLonLat(int timestep, double coords[], int npoints = 1);
224  static bool convertLocalFromLonLat(int timestep,double coords[], int npoints = 1);
225 
233  void mapBoxToVox(Box* box, int refLevel, int lod, int timestep, size_t voxExts[6]);
234 
237  static int GetExtents(size_t timestep, vector<double>& minExts, vector<double>& maxExts);
238 
241  static const vector<double> getStretchFactors() {
242  return ((VizFeatureParams*)Params::GetDefaultParams(Params::_visualizerFeaturesParamsTag))->GetStretchFactors();
243  }
244 
247  static void stretchCoords(vector<double>& coords){
248  vector<double>stretchFactors = getStretchFactors();
249  for (int i = 0; i<3; i++) coords[i] = coords[i]*stretchFactors[i];
250  }
253  static void stretchCoords(double coords[3]){
254  vector<double>stretchFactors = getStretchFactors();
255  for (int i = 0; i<3; i++) coords[i] = coords[i]*stretchFactors[i];
256  }
259  static double getMaxStretchedSize(){
260  return (Max(_fullStretchedSizes[0],Max(_fullStretchedSizes[1],_fullStretchedSizes[2])));
261  }
265  static void localToStretched(const double fromCoords[3], double toCoords[3]);
270  static int maxXFormPresent(string varname, size_t timestep);
275  static int maxLODPresent(string varname, size_t timestep);
278  static bool useLowerAccuracy() {return _useLowerAccuracy;}
281  static void setUseLowerAccuracy(bool val){_useLowerAccuracy = val;}
285  static bool dataIsPresent(int timestep);
293  static int mapVoxToUser(size_t timestep, string varname, const size_t vcoords[3], double uCoords[3], int reflevel);
301  static void mapUserToVox(size_t timestep, string varname, const double uCoords[3], size_t vCoords[3], int reflevel);
302 
303 
304  DataStatus();
305  ~DataStatus();
306 
311  bool reset(DataMgrV3_0* dm, size_t cachesize);
312 
316  static void stretchExtents(vector<double> factor){
317  vector<double> stretchFactors;
318  for (int i = 0; i< 3; i++) {
319  _stretchedExtents[i] = _extents[i]*factor[i];
320  _stretchedExtents[i+3] = _extents[i+3]*factor[i];
321  _fullStretchedSizes[i] = _fullSizes[i]*factor[i];
322  }
323 
324  }
325  static size_t getCacheMB() {return _cacheMB;}
326 
327 
328 private:
333  static void makeFidelitySettings();
334 
335 #ifndef DOXYGEN_SKIP_THIS
336  static DataStatus* _dataStatus;
337  static DataMgrV3_0* _dataMgr;
338 
339  //specify the minimum and max time step that actually have data:
340  static size_t _minTimeStep;
341  static size_t _maxTimeStep;
342 
343  //numTimeSteps may include lots of times that are not used.
344  static int _numTimesteps;
345 
346  static float _defaultRefFidelity2D;
347  static float _defaultRefFidelity3D;
348  static float _defaultLODFidelity2D;
349  static float _defaultLODFidelity3D;
350  static int _defaultFidelity[2];
351  static vector<int> _fidelity2DRefs;
352  static vector<int> _fidelity3DRefs;
353  static vector<int> _fidelity2DLODs;
354  static vector<int> _fidelity3DLODs;
355  static double _extents[6];
356  static double _stretchedExtents[6];
357  static double _fullSizes[3];
358  static double _fullStretchedSizes[3];
359  //Cache size in megabytes
360  static size_t _cacheMB;
361  static bool _useLowerAccuracy;
362 
363 #endif //DOXYGEN_SKIP_THIS
364 };
365 
366 }; //end VAPoR namespace
367 #endif //DATASTATUS_H
368 
static void stretchExtents(vector< double > factor)
Definition: datastatus.h:316
A class for describing the currently loaded dataset.
Definition: datastatus.h:51
3D or 2D box with options for orientation angles and extents changing in time. Intended to be used in...
Definition: Box.h:43
static const double * getLocalExtents()
Definition: datastatus.h:65
static size_t getMinTimestep()
Definition: datastatus.h:84
A Params subclass for managing parameters used by Renderers.
Definition: renderparams.h:57
static void stretchCoords(double coords[3])
Definition: datastatus.h:253
static int getNumActiveVariables2D()
Definition: datastatus.h:113
static int getNumActiveVariables3D()
Definition: datastatus.h:110
static void stretchCoords(vector< double > &coords)
Definition: datastatus.h:247
static const double * getFullSizes()
Definition: datastatus.h:70
static bool useLowerAccuracy()
Definition: datastatus.h:278
static float getDefaultRefinementFidelity2D()
Definition: datastatus.h:146
static void setDefaultLODFidelity2D(float q)
Definition: datastatus.h:164
static void setDefaultLODFidelity3D(float q)
Definition: datastatus.h:170
static float getDefaultRefinementFidelity3D()
Definition: datastatus.h:158
static Params * GetDefaultParams(ParamsBase::ParamsBaseType pType)
Definition: params.h:224
static size_t getMaxTimestep()
Definition: datastatus.h:88
static void setDefaultRefinementFidelity2D(float q)
Definition: datastatus.h:176
static void setDefaultRefinementFidelity3D(float q)
Definition: datastatus.h:182
static const double * getFullStretchedSizes()
Definition: datastatus.h:75
COMMON_API int Max(int a, int b)
Definition: MyBase.h:280
static DataStatus * getInstance()
Definition: datastatus.h:56
static int getNumActiveVariables()
Definition: datastatus.h:116
#define PARAMS_API
static void setUseLowerAccuracy(bool val)
Definition: datastatus.h:281
Definition: DC.h:10
static double getMaxStretchedSize()
Definition: datastatus.h:259
static const double * getStretchedLocalExtents()
Definition: datastatus.h:80
static size_t getCacheMB()
Definition: datastatus.h:325
static int getNumTimesteps()
Definition: datastatus.h:92
static float getDefaultLODFidelity3D()
Definition: datastatus.h:152
A cache based data reader.
Definition: DataMgrV3_0.h:100
static const vector< double > getStretchFactors()
Definition: datastatus.h:241
static int getDefaultFidelitySettings(int dim, vector< int > &lods, vector< int > &refs)
Definition: datastatus.h:191
static float getDefaultLODFidelity2D()
Definition: datastatus.h:137