MCPcopy Create free account
hub / github.com/Kitware/VTK / TestAMRBoxShiftOperator

Function TestAMRBoxShiftOperator

Common/DataModel/Testing/Cxx/TestAMRBox.cxx:132–178  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

130
131//------------------------------------------------------------------------------
132int TestAMRBoxShiftOperator()
133{
134 int rc = 0;
135
136 double h[3];
137 int lo[3];
138 int hi[3];
139
140 vtkAMRBox A, A0, Ashifted;
141
142 // Here is the initial AMR box
143 h[0] = h[1] = h[2] = 1.0;
144 lo[0] = lo[1] = lo[2] = 8;
145 hi[0] = hi[1] = hi[2] = 16;
146 Construct3DAMRBox(A, lo, hi);
147
148 A0 = A;
149
150 int shift[3];
151 shift[0] = shift[1] = shift[2] = 3;
152
153 // Here is the shifted AMR box
154 h[0] = h[1] = h[2] = 1.0;
155 lo[0] = lo[1] = lo[2] = 11;
156 hi[0] = hi[1] = hi[2] = 19;
157 Construct3DAMRBox(Ashifted, lo, hi);
158
159 A.Shift(shift);
160 if (A != Ashifted)
161 {
162 std::cerr << "ERROR: shifting AMR box failed!\n";
163 rc++;
164 }
165
166 // Reverse shift orientation
167 for (int i = 0; i < 3; i++)
168 {
169 shift[i] = shift[i] * (-1);
170 }
171 A.Shift(shift);
172 if (A != A0)
173 {
174 std::cerr << "ERROR: shifting AMR box failed!\n";
175 rc++;
176 }
177 return (rc);
178}
179
180//------------------------------------------------------------------------------
181int TestAMRBoxGrowShrinkOperators()

Callers 1

TestAMRBoxFunction · 0.85

Calls 2

Construct3DAMRBoxFunction · 0.85
ShiftMethod · 0.45

Tested by

no test coverage detected