Skip to content
Snippets Groups Projects
Commit 2a1e821a authored by Nicolas Vuaille's avatar Nicolas Vuaille
Browse files

Add spacing/refinement consistency check

vtkOverlappingAMR offers an `Audit` (debug) method.
Update it to also catch spacing vs refinement consistency.
parent e2457871
No related merge requests found
......@@ -6,6 +6,7 @@
#include "vtkDoubleArray.h"
#include "vtkIntArray.h"
#include "vtkMath.h"
#include "vtkMathUtilities.h"
#include "vtkObjectFactory.h"
#include "vtkStructuredGrid.h"
#include "vtkUnsignedIntArray.h"
......@@ -231,6 +232,26 @@ bool vtkAMRInformation::Audit()
vtkErrorMacro("Invalid spacing at level " << i << endl);
}
}
if (this->HasRefinementRatio())
{
double ratio = this->Refinement->GetTuple1(0);
unsigned int nextLevel = i + 1;
if (nextLevel < this->GetNumberOfLevels())
{
double nextSpacing[3];
this->GetSpacing(nextLevel, nextSpacing);
for (int axis = 0; axis < 3; axis++)
{
if (axis != emptyDimension &&
!vtkMathUtilities::NearlyEqual(
ratio, vtkMathUtilities::SafeDivision(h[axis], nextSpacing[axis]), 10e-6))
{
vtkErrorMacro("Spacing and refinement ratio are inconsistent for level " << i << endl);
}
}
}
}
}
// check amr boxes
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment