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

Method CheckValidity

Common/DataModel/vtkOverlappingAMRMetaData.cxx:204–314  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

202
203//------------------------------------------------------------------------------
204bool vtkOverlappingAMRMetaData::CheckValidity()
205{
206 int emptyDimension = -1;
207 switch (this->GetGridDescription())
208 {
209 case vtkStructuredData::VTK_STRUCTURED_YZ_PLANE:
210 emptyDimension = 0;
211 break;
212 case vtkStructuredData::VTK_STRUCTURED_XZ_PLANE:
213 emptyDimension = 1;
214 break;
215 case vtkStructuredData::VTK_STRUCTURED_XY_PLANE:
216 emptyDimension = 2;
217 break;
218 }
219
220 // Check origin
221 for (int dim = 0; dim < 3; dim++)
222 {
223 if (dim != emptyDimension)
224 {
225 if (this->Origin[dim] != this->Bounds[2 * dim])
226 {
227 vtkErrorMacro("Bound min does not match origin at dimension "
228 << dim << ": " << this->Origin[dim] << " != " << this->Bounds[2 * dim]);
229 return false;
230 }
231 }
232 }
233
234 // check refinement levels
235 if (this->HasRefinementRatio() &&
236 static_cast<unsigned int>(this->Refinement->GetNumberOfTuples()) != this->GetNumberOfLevels())
237 {
238 vtkErrorMacro("Refinement levels wrong " << this->Refinement->GetNumberOfTuples());
239 return false;
240 }
241
242 for (unsigned int level = 0; level < this->GetNumberOfLevels(); level++)
243 {
244 // check spacing
245
246 double spacing[3];
247 if (this->HasSpacing())
248 {
249 this->GetSpacing(level, spacing);
250 for (int dim = 0; dim < 3; dim++)
251 {
252 if (spacing[dim] < 0)
253 {
254 vtkErrorMacro("Invalid spacing at level " << level << ": " << spacing[dim] << endl);
255 return false;
256 }
257 }
258 }
259
260 // check refinement ratio
261 if (this->HasRefinementRatio())

Callers

nothing calls this directly

Calls 10

HasRefinementRatioMethod · 0.95
HasSpacingMethod · 0.95
GetSpacingMethod · 0.95
NearlyEqualFunction · 0.85
GetGridDescriptionMethod · 0.80
GetTuple1Method · 0.80
SafeDivisionFunction · 0.50
GetNumberOfTuplesMethod · 0.45
GetNumberOfLevelsMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected