-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathPltAppState.cpp
177 lines (145 loc) · 5.22 KB
/
PltAppState.cpp
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
173
174
175
176
177
// ---------------------------------------------------------------
// PltAppState.cpp
// ---------------------------------------------------------------
#include <PltAppState.H>
#include <cctype>
#include <iostream>
#include <limits>
using std::cout;
using std::cerr;
using std::endl;
using namespace amrex;
// -------------------------------------------------------------------
CMinMax::CMinMax()
: rMin( std::numeric_limits<Real>::max()),
rMax(-std::numeric_limits<Real>::max()),
bMinMaxSet(false)
{
}
// -------------------------------------------------------------------
CMinMax::~CMinMax() {
}
// -------------------------------------------------------------------
void CMinMax::SetMinMax(const Real rmin, const Real rmax) {
BL_ASSERT(rmax >= rmin);
rMin = rmin;
rMax = rmax;
bMinMaxSet = true;
}
// -------------------------------------------------------------------
void CMinMax::GetMinMax(Real &rmin, Real &rmax) {
BL_ASSERT(bMinMaxSet);
rmin = rMin;
rmax = rMax;
}
// -------------------------------------------------------------------
// -------------------------------------------------------------------
PltAppState::PltAppState(int numFrames, int numDerived)
: currentScale(NOTSETYET),
maxScale(NOTSETYET),
currentFrame(0),
currentDerivedNumber(NOTSETYET),
currentContourType(Amrvis::INVALIDCONTOURTYPE),
nContours(NOTSETYET),
currentMinMaxType(Amrvis::INVALIDMINMAX),
minDrawnLevel(NOTSETYET),
maxDrawnLevel(NOTSETYET),
minAllowableLevel(NOTSETYET),
maxAllowableLevel(NOTSETYET),
finestLevel(NOTSETYET)
{
minMax.resize(numFrames);
for(int nf(0); nf < numFrames; ++nf) {
minMax[nf].resize(numDerived);
for(int nd(0); nd < numDerived; ++nd) {
minMax[nf][nd].resize(Amrvis::NUMBEROFMINMAX);
}
}
cgSmoothing = false;
}
// -------------------------------------------------------------------
PltAppState::~PltAppState() {
}
// -------------------------------------------------------------------
PltAppState &PltAppState::operator=(const PltAppState &rhs) {
if(this == &rhs) {
return *this;
}
currentScale = rhs.currentScale;
maxScale = rhs.maxScale;
currentFrame = rhs.currentFrame;
currentDerived = rhs.currentDerived;
currentDerivedNumber = rhs.currentDerivedNumber;
showBoxes = rhs.showBoxes;
cgSmoothing = rhs.cgSmoothing;
currentContourType = rhs.currentContourType;
nContours = rhs.nContours;
currentMinMaxType = rhs.currentMinMaxType;
// mins and maxes
//Array<Vector<Array<CMinMax> > > minMax; // minMax [frame] [derived] [RangeType]
minMax = rhs.minMax; // minMax [frame] [derived] [RangeType]
//Array<Box> subDomains;
subDomains = rhs.subDomains;
minDrawnLevel = rhs.minDrawnLevel;
maxDrawnLevel = rhs.maxDrawnLevel;
minAllowableLevel = rhs.minAllowableLevel;
maxAllowableLevel = rhs.maxAllowableLevel;
finestLevel = rhs.finestLevel;
contourNumString = rhs.contourNumString;
formatString = rhs.formatString;
fileName = rhs.fileName;
palFilename = rhs.palFilename;
return *this;
}
// -------------------------------------------------------------------
void PltAppState::SetMinMax(const Amrvis::MinMaxRangeType mmrangetype,
const int framenumber, const int derivednumber,
const Real rmin, const Real rmax)
{
minMax[framenumber][derivednumber][mmrangetype].SetMinMax(rmin, rmax);
}
// -------------------------------------------------------------------
void PltAppState::GetMinMax(const Amrvis::MinMaxRangeType mmrangetype,
const int framenumber, const int derivednumber,
Real &rmin, Real &rmax)
{
minMax[framenumber][derivednumber][mmrangetype].GetMinMax(rmin, rmax);
}
// -------------------------------------------------------------------
void PltAppState::GetMinMax(Real &rmin, Real &rmax) {
minMax[currentFrame][currentDerivedNumber][currentMinMaxType].
GetMinMax(rmin, rmax);
}
// -------------------------------------------------------------------
bool PltAppState::IsSet(const Amrvis::MinMaxRangeType mmrangetype,
const int framenumber, const int derivednumber)
{
return (minMax[framenumber][derivednumber][mmrangetype].IsSet());
}
// -------------------------------------------------------------------
void PltAppState::PrintSetMap() {
cout << "PltAppState::PrintSetMap(): minMax[frame] [derived] [rangetype]" << endl;
for(int iframe(0); iframe < minMax.size(); ++iframe) {
for(int ider(0); ider < minMax[iframe].size(); ++ider) {
for(int immrt(0); immrt < minMax[iframe][ider].size(); ++immrt) {
cout << "minMax[" << iframe << "][" << ider << "][" << immrt << "] = ";
if(minMax[iframe][ider][immrt].IsSet()) {
cout << " set = ";
} else {
cout << " not set = ";
}
cout << minMax[iframe][ider][immrt].Min() << " "
<< minMax[iframe][ider][immrt].Max() << endl;
}
cout << endl;
}
cout << endl;
}
}
// -------------------------------------------------------------------
void PltAppState::SetCurrentDerived(const string &newDerived, int cdnumber) {
currentDerived = newDerived;
currentDerivedNumber = cdnumber;
}
// -------------------------------------------------------------------
// -------------------------------------------------------------------