Commit c7687a46 authored by George Zagaris's avatar George Zagaris
Browse files

ENH: Move common metadata locic upstream

Moved common metadata logic such as GetMetaData, HasLevelMetadata
and metadata accessors that return a generic vtkInformation object
to the base class. The overlapping AMR additionally extends these
methods by adding the concept of the vtkAMRBox.

Change-Id: Id467d25c246c7baa244aaac2c36c37249a9072fa
parent 8a93e2ad
......@@ -425,33 +425,6 @@ int vtkOverlappingAMR::GetMetaData(
return 0;
}
//----------------------------------------------------------------------------
vtkInformation* vtkOverlappingAMR::GetMetaData(unsigned int level,
unsigned int index)
{
vtkMultiPieceDataSet* levelMDS = vtkMultiPieceDataSet::SafeDownCast(
this->GetChild(level));
if (levelMDS)
{
return levelMDS->GetMetaData(index);
}
return 0;
}
//----------------------------------------------------------------------------
int vtkOverlappingAMR::HasMetaData(unsigned int level,
unsigned int index)
{
vtkMultiPieceDataSet* levelMDS =
vtkMultiPieceDataSet::SafeDownCast(this->GetChild(level));
if (levelMDS)
{
return levelMDS->HasMetaData(index);
}
return 0;
}
//----------------------------------------------------------------------------
int vtkOverlappingAMRIsInBoxes(vtkAMRBoxList& boxes,
int i, int j, int k)
......
......@@ -134,18 +134,6 @@ public:
// Returns the AMR box for the location pointer by the iterator.
vtkAMRBox GetAMRBox(vtkCompositeDataIterator* iter);
// Description:
// Get meta-data associated with a level. This may allocate a new
// vtkInformation object if none is already present. Use HasLevelMetaData to
// avoid unnecessary allocations.
vtkInformation* GetLevelMetaData(unsigned int level)
{ return this->GetChildMetaData(level); }
// Description:
// Returns if meta-data exists for a given level.
int HasLevelMetaData(unsigned int level)
{ return this->HasChildMetaData(level); }
// Description:
// Sets the composite index of the data at the given (level,index) pair.
void SetCompositeIndex(
......@@ -156,20 +144,11 @@ public:
// (level,index) pair.
int GetCompositeIndex( const unsigned int level, const unsigned int index );
// Description:
// Get meta-data associated with a dataset. This may allocate a new
// vtkInformation object if none is already present. Use HasMetaData to
// avoid unnecessary allocations.
vtkInformation* GetMetaData(unsigned int level, unsigned int index);
// Description:
// Get the AMR box meta-data associated with a given dataset.
// Returns 1 iff GetMetaData() was successful, else 0.
int GetMetaData(unsigned int level, unsigned int index, vtkAMRBox &box);
// Description:
// Returns if meta-data exists for a given dataset under a given level.
int HasMetaData(unsigned int level, unsigned int index);
virtual int GetMetaData(
unsigned int level, unsigned int index, vtkAMRBox &box);
// Description:
// Sets the refinement of a given level. The spacing at level
......@@ -230,14 +209,24 @@ public:
// Description:
// Unhiding superclass method.
virtual vtkInformation* GetMetaData(vtkCompositeDataIterator* iter)
{ return this->Superclass::GetMetaData(iter); }
{return this->Superclass::GetMetaData(iter); }
// Description:
// Unhiding superclass method.
virtual int HasMetaData(vtkCompositeDataIterator* iter)
{ return this->Superclass::HasMetaData(iter); }
{return this->Superclass::HasMetaData(iter); }
// Description:
// Unhiding superclass method.
virtual int HasMetaData(unsigned int level, unsigned int index)
{return this->Superclass::HasMetaData(level,index); }
// Desription:
// Unhiding superclass method.
virtual vtkInformation* GetMetaData(unsigned int level, unsigned int index)
{return this->Superclass::GetMetaData(level,index); }
// Description:
// Given the level and dataset index, returns the flat index in pre-order
// traversal.
......
......@@ -137,6 +137,31 @@ void vtkUniformGridAMR::SetDataSet(
}
}
//------------------------------------------------------------------------------
vtkInformation* vtkUniformGridAMR::GetMetaData(unsigned level, unsigned int idx)
{
vtkMultiPieceDataSet *levelMDS =
vtkMultiPieceDataSet::SafeDownCast(this->GetChild(level));
if( levelMDS != NULL )
{
return( levelMDS->GetMetaData(idx) );
}
return NULL;
}
//------------------------------------------------------------------------------
int vtkUniformGridAMR::HasMetaData(unsigned int level, unsigned int idx )
{
vtkMultiPieceDataSet* levelMDS =
vtkMultiPieceDataSet::SafeDownCast(this->GetChild(level));
if(levelMDS != NULL)
{
return( levelMDS->HasMetaData(idx) );
}
return 0;
}
//------------------------------------------------------------------------------
void vtkUniformGridAMR::AppendDataSet(
unsigned int level, vtkUniformGrid* grid)
......
......@@ -84,12 +84,33 @@ class VTK_FILTERING_EXPORT vtkUniformGridAMR : public vtkCompositeDataSet
virtual vtkInformation* GetMetaData(vtkCompositeDataIterator* iter)
{ return this->Superclass::GetMetaData(iter); }
// Description:
// Unhiding superclass method.
virtual int HasMetaData(vtkCompositeDataIterator* iter)
{ return this->Superclass::HasMetaData(iter); }
// Description:
// Get meta-data associated with a level. This may allocate a new
// vtkInformation object if none is already present. Use HasLevelMetaData to
// avoid unnecessary allocations.
virtual vtkInformation* GetLevelMetaData(unsigned int level)
{ return this->GetChildMetaData(level); }
// Description:
// Returns if meta-data exists for a given level.
virtual int HasLevelMetaData(unsigned int level)
{ return this->HasChildMetaData(level); }
// Description:
// Get meta-data associated with a dataset. This may allocate a new
// vtkInformation object if none is already present. Use HasMetaData to
// avoid unnecessary allocations.
virtual vtkInformation* GetMetaData(unsigned int level, unsigned int index);
// Description:
// Returns if meta-data exists for a given dataset under a given level.
virtual int HasMetaData(unsigned int level, unsigned int index);
// Description:
// Sets the dataset at the given level and index. If insufficient number
// of levels or data slots within the level, this method will grow the
......
Markdown is supported
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