-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathPltAppState.H
172 lines (134 loc) · 5.44 KB
/
PltAppState.H
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
// ---------------------------------------------------------------
// PltAppState.H
// ---------------------------------------------------------------
// state observers:
// pltapp
// amrpicture
// projectionpicture
// dataset
// palette
// lightingwindow
// xyplots
// ---------------------------------------------------------------
#ifndef _PLTAPPSTATE_H_
#define _PLTAPPSTATE_H_
#include <AMReX_AmrvisConstants.H>
#include <AMReX_Vector.H>
#include <AMReX_Box.H>
#include <string>
using std::string;
using amrex::Real;
const int NOTSETYET(-42);
static void Cnsy(int val) { BL_ASSERT(val != NOTSETYET); }
class CMinMax {
public:
CMinMax();
~CMinMax();
void SetMinMax(const Real rmin, const Real rmax);
void GetMinMax(Real &rmin, Real &rmax);
bool IsSet() const { return bMinMaxSet; }
// no is_set checking on these
Real Min() const { return rMin; }
Real Max() const { return rMax; }
private:
Real rMin, rMax;
bool bMinMaxSet;
};
class AmrPicture;
class PltAppState {
private:
PltAppState(); // disallow
public:
// created when opening a new file
PltAppState(int numFrames, int numDerived);
~PltAppState();
PltAppState &operator=(const PltAppState &rhs);
// ------------------------ scale
int CurrentScale() const { Cnsy(currentScale); return currentScale; }
void SetCurrentScale(int newScale) { currentScale = newScale; }
int MaxScale() const { Cnsy(maxScale); return maxScale; }
void SetMaxScale(int newMaxScale) { maxScale = newMaxScale; }
// ------------------------ frame
void SetCurrentFrame(int newFrame) { currentFrame = newFrame; }
// ------------------------ derived
void SetCurrentDerived(const string &newDerived, int cdnumber);
const string &CurrentDerived() const { return currentDerived; }
int CurrentDerivedNumber() const { Cnsy(currentDerivedNumber);
return currentDerivedNumber; }
// ------------------------ boxes
bool GetShowingBoxes() const { return showBoxes; }
void SetShowingBoxes(bool showing) { showBoxes = showing; }
// ------------------------ cg smoothing
bool GetCGSmoothing() const { return cgSmoothing; }
void SetCGSmoothing(bool smoothing) { cgSmoothing = smoothing; }
// ------------------------ number format
string GetFormatString() const { return formatString; }
void SetFormatString(const string &newformat) { formatString = newformat; }
// ------------------------ contours
void SetContourType(amrex::Amrvis::ContourType newContourType)
{ currentContourType = newContourType; }
amrex::Amrvis::ContourType GetContourType() const { return currentContourType; }
void SetNumContours(int ncontours) { nContours = ncontours; }
int GetNumContours() const { Cnsy(nContours); return nContours; }
// ------------------------ mins and maxes
amrex::Amrvis::MinMaxRangeType GetMinMaxRangeType() const { return currentMinMaxType; }
void SetMinMaxRangeType(amrex::Amrvis::MinMaxRangeType newmmrtype)
{ currentMinMaxType = newmmrtype; }
void SetMinMax(const amrex::Amrvis::MinMaxRangeType mmrangetype,
const int framenumber,
const int derivednumber,
const Real rmin, const Real rmax);
void GetMinMax(const amrex::Amrvis::MinMaxRangeType mmrangetype,
const int framenumber,
const int derivednumber,
Real &rmin, Real &rmax);
// this one uses the current frame, derived, and range type
void GetMinMax(Real &rmin, Real &rmax);
bool IsSet(const amrex::Amrvis::MinMaxRangeType mmrangetype, const int framenumber,
const int derivednumber);
void PrintSetMap();
// ------------------------ levels
void SetMinAllowableLevel(int newval) { minAllowableLevel = newval; }
void SetMaxAllowableLevel(int newval) { maxAllowableLevel = newval; }
void SetMinDrawnLevel(int newval) { minDrawnLevel = newval; }
void SetMaxDrawnLevel(int newval) { maxDrawnLevel = newval; }
void SetFinestLevel(int newval) { finestLevel = newval; }
int MinAllowableLevel() const { Cnsy(minAllowableLevel);
return minAllowableLevel; }
int MaxAllowableLevel() const { Cnsy(maxAllowableLevel);
return maxAllowableLevel; }
int MinDrawnLevel() const { Cnsy(minDrawnLevel); return minDrawnLevel; }
int MaxDrawnLevel() const { Cnsy(maxDrawnLevel); return maxDrawnLevel; }
int FinestLevel() const { Cnsy(finestLevel); return finestLevel; }
//GraphicsAttributes *GetGAptr() const { return gaPtr; }
private:
// state variables
int currentScale;
int maxScale;
int currentFrame;
string currentDerived;
int currentDerivedNumber;
bool showBoxes;
bool cgSmoothing;
amrex::Amrvis::ContourType currentContourType;
int nContours;
amrex::Amrvis::MinMaxRangeType currentMinMaxType;
string formatString;
// mins and maxes
amrex::Vector<amrex::Vector<amrex::Vector<CMinMax> > > minMax; // minMax [frame] [derived] [RangeType]
amrex::Vector<amrex::Box> subDomains;
int minDrawnLevel, maxDrawnLevel, minAllowableLevel, maxAllowableLevel;
int finestLevel;
//bool datasetShowing, paletteDrawn, writingRGB, interfaceReady;
//int minDrawnLevel, maxDrawnLevel, minDataLevel, maxDataLevel;
//int activeView;
string contourNumString, fileName, palFilename;
//Array<string> fileNames, derivedStrings;
//GraphicsAttributes *gaPtr;
// observers
//AmrPicture *amrPicturePtrArray[NPLANES];
//Palette *pltPaletteptr;
//Dataset *datasetPtr;
//Array<DataServices *> dataServicesPtr;
};
#endif