Commit 5f0be174 authored by George Zagaris's avatar George Zagaris
Browse files

ENH: Compute global AMR box w/prescribe spacing

Added functionality to compute the global AMR box,
i.e., an AMR box that covers the entire domain, with
the prescribed spacing.
parent 980ff5c4
......@@ -483,6 +483,40 @@ void vtkHierarchicalBoxDataSet::GetRootAMRBox( vtkAMRBox &root )
root.SetProcessId( -1 ); /* not owned, can be computed by any process */
}
//----------------------------------------------------------------------------
void vtkHierarchicalBoxDataSet::GetGlobalAMRBoxWithSpacing(
vtkAMRBox &box, double h[3] )
{
vtkAMRBox root;
this->GetRootAMRBox( root );
double min[3]; double max[3];
root.GetMinBounds( min );
root.GetMaxBounds( max );
int ndim[3];
ndim[0]=ndim[1]=ndim[2]=0;
for(int i=0; i < root.GetDimensionality(); ++i )
{
// Note -1 is subtracted here because the data
// is cell-centered and we downshift to number
// from 0.
ndim[ i ] = round( (max[i]-min[i])/h[i] )-1;
}
int lo[3];
lo[0]=lo[1]=lo[2]=0;
box.SetDimensionality( root.GetDimensionality() );
box.SetDataSetOrigin( min );
box.SetGridSpacing( h );
box.SetDimensions( lo, ndim );
box.SetLevel( 0 );
box.SetBlockId( 0 );
box.SetProcessId( -1 ); /* any process can compute this block */
}
//----------------------------------------------------------------------------
int vtkHierarchicalBoxDataSet::GetMetaData(
unsigned int level, unsigned int index, vtkAMRBox &box)
......
......@@ -95,6 +95,11 @@ public:
// The root AMR box covers the entire domain.
void GetRootAMRBox( vtkAMRBox &root );
// Description:
// This method returns the global AMR box, covering the entire
// domain, with the prescribed spacing.
void GetGlobalAMRBoxWithSpacing( vtkAMRBox &box, double h[3] );
// Description:
// Set the dataset pointer for a given node. This will resize the number of
// levels and the number of datasets in the level to fit level, id requested.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment