Commit 520fc2f2 authored by George Zagaris's avatar George Zagaris
Browse files

ENH: Updated AMR reader infrastructure

Updated AMR reader infrastructure, currently
consisting of the Enzo and Flash readers.
Still some ironing of the API is required...
parent 05e8cf90
......@@ -20,11 +20,13 @@
#include "vtkHierarchicalBoxDataSet.h"
#include "vtkDataArraySelection.h"
#include "vtkCallbackCommand.h"
#include "vtkIndent.h"
#include "vtkAMRUtilities.h"
#include <cassert>
vtkAMRBaseReader::vtkAMRBaseReader()
{
......@@ -61,12 +63,13 @@ void vtkAMRBaseReader::Initialize()
this->FileName = NULL;
this->MaxLevel = 0;
this->LoadParticles = 1;
this->Controller = NULL;
this->CellDataArraySelection = vtkDataArraySelection::New();
this->PointDataArraySelection = vtkDataArraySelection::New();
this->SelectionObserver = vtkCallbackCommand::New();
// this->SelectionObserver->SetCallback(
// &vtkAMRBaseReader::SelectionModifiedCallback);
this->SelectionObserver->SetCallback(
&vtkAMRBaseReader::SelectionModifiedCallback);
this->SelectionObserver->SetClientData( this );
this->CellDataArraySelection->AddObserver(
vtkCommand::ModifiedEvent,this->SelectionObserver );
......@@ -76,11 +79,11 @@ void vtkAMRBaseReader::Initialize()
}
//----------------------------------------------------------------------------
//void vtkAMRBaseReader::SelectionModifiedCallback(
// vtkObject*, unsigned long, void* clientdata, void*)
//{
// static_cast<vtkAMRBaseReader*>(clientdata)->Modified();
//}
void vtkAMRBaseReader::SelectionModifiedCallback(
vtkObject*, unsigned long, void* clientdata, void*)
{
static_cast<vtkAMRBaseReader*>(clientdata)->Modified();
}
//------------------------------------------------------------------------------
int vtkAMRBaseReader::GetNumberOfPointArrays()
......@@ -188,7 +191,7 @@ int vtkAMRBaseReader::RequestData(
this->GenerateBlockMap();
vtkstd::vector< int > idxcounter;
idxcounter.resize(this->GetNumberOfLevels(), 0);
idxcounter.resize(this->GetNumberOfLevels()+1, 0);
for( int block=0; block < this->GetNumberOfBlocks(); ++block )
{
......
......@@ -28,13 +28,14 @@ class vtkHierarchicalBoxDataSet;
class vtkMultiProcessController;
class vtkDataArraySelection;
class vtkCallbackCommand;
class vtkIndent;
class VTK_AMR_EXPORT vtkAMRBaseReader :
public vtkHierarchicalBoxDataSetAlgorithm
{
public:
vtkTypeMacro( vtkAMRBaseReader, vtkHierarchicalBoxDataSetAlgorithm );
virtual void PrintSelf(std::ostream &os, vtkIndent indent);
void PrintSelf(std::ostream &os, vtkIndent indent);
// Description:
// Initializes the AMR reader.
......@@ -90,7 +91,7 @@ class VTK_AMR_EXPORT vtkAMRBaseReader :
protected:
vtkAMRBaseReader();
virtual ~vtkAMRBaseReader();
~vtkAMRBaseReader();
// Description:
// Determines if the block is owned by this process based on the
......@@ -142,8 +143,9 @@ class VTK_AMR_EXPORT vtkAMRBaseReader :
// Description:
// Loads the block according to the index w.r.t. the generated BlockMap.
virtual void GetBlock( int index, vtkHierarchicalBoxDataSet *hbds,
vtkstd::vector< int > &idxcounter ) = 0;
virtual void GetBlock(
int index, vtkHierarchicalBoxDataSet *hbds,
vtkstd::vector< int > &idxcounter ) = 0;
// Description:
// Standard Pipeline methods, subclasses may override this method if needed.
......@@ -164,8 +166,8 @@ class VTK_AMR_EXPORT vtkAMRBaseReader :
// Descriptions
// Call-back registered with the SelectionObserver.
// static void SelectionModifiedCallback(
// vtkObject *caller,unsigned long eid,void *clientdata,void *calldata );
static void SelectionModifiedCallback(
vtkObject *caller,unsigned long eid,void *clientdata,void *calldata );
int LoadParticles;
int MaxLevel;
......
This diff is collapsed.
......@@ -22,35 +22,24 @@
#define VTKAMRENZOREADER_H_
#include "vtkAMRBaseReader.h"
#include <vtkstd/vector> // STL vector Header
//class vtkEnzoReaderInternal;
class vtkHierarchicalBoxDataSet;
class vtkCallbackCommand;
class vtkEnzoReaderInternal;
class VTK_AMR_EXPORT vtkAMREnzoReader : public vtkAMRBaseReader
{
public:
static vtkAMREnzoReader *New();
vtkTypeMacro( vtkAMREnzoReader, vtkAMRBaseReader );
void PrintSelf( std::ostream &s, vtkIndent indent );
static vtkAMREnzoReader* New();
vtkTypeMacro(vtkAMREnzoReader,vtkAMRBaseReader);
void PrintSelf(std::ostream &os, vtkIndent indent );
// Description:
// Set the input filename.
// See vtkAMRBaseReader::SetFileName
void SetFileName( const char* fileName );
protected:
vtkAMREnzoReader();
virtual ~vtkAMREnzoReader();
// Description:
// See vtkAMRBaseReader::SetUpDataArraySelections
void SetUpDataArraySelections();
// Description:
// See vtkAMRBaseReader::GetBlock
void GetBlock( int index, vtkHierarchicalBoxDataSet *hbds,
vtkstd::vector< int > &idxcounter );
~vtkAMREnzoReader();
// Description:
// See vtkAMRBaseReader::ReadMetaData
......@@ -69,19 +58,24 @@ class VTK_AMR_EXPORT vtkAMREnzoReader : public vtkAMRBaseReader
int GetNumberOfBlocks();
// Description:
// See vtkAMRBaseReader::GetNumberOfBlocks
// See vtkAMRBaseReader::GetNumberOfLevels
int GetNumberOfLevels();
// Description:
// TODO:
static void SelectionModifiedCallback(
vtkObject *caller,unsigned long eid,void *clientdata,void *calldata );
// See vtkAMRBaseReader::GetBlock
void GetBlock(
int index, vtkHierarchicalBoxDataSet *hbds,
vtkstd::vector< int > &idxcounter);
// vtkEnzoReaderInternal *Internal;
// Description:
// See vtkAMRBaseReader::SetUpDataArraySelections
void SetUpDataArraySelections();
private:
private:
vtkAMREnzoReader( const vtkAMREnzoReader& ); // Not Implemented
void operator=(const vtkAMREnzoReader& ); // Not Implemented
vtkEnzoReaderInternal *Internal;
};
#endif /* VTKAMRENZOREADER_H_ */
/*=========================================================================
Program: Visualization Toolkit
Module: vtkAMRFlashReader.cxx
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#include "vtkAMRFlashReader.h"
#include "vtkObjectFactory.h"
#include "vtkHierarchicalBoxDataSet.h"
#include "vtkAMRUtilities.h"
vtkStandardNewMacro(vtkAMRFlashReader);
//------------------------------------------------------------------------------
vtkAMRFlashReader::vtkAMRFlashReader()
{
this->Initialize();
}
//------------------------------------------------------------------------------
vtkAMRFlashReader::~vtkAMRFlashReader()
{
}
//-----------------------------------------------------------------------------
void vtkAMRFlashReader::PrintSelf( std::ostream &os, vtkIndent indent )
{
this->Superclass::PrintSelf( os, indent );
}
//-----------------------------------------------------------------------------
void vtkAMRFlashReader::SetFileName( const char* fileName )
{
// TODO: implement this
}
//-----------------------------------------------------------------------------
void vtkAMRFlashReader::ReadMetaData()
{
// TODO: implement this
}
//-----------------------------------------------------------------------------
void vtkAMRFlashReader::GenerateBlockMap()
{
// TODO: implement this
}
//-----------------------------------------------------------------------------
int vtkAMRFlashReader::GetBlockLevel( const int blockIdx )
{
// TODO: implement this
return 0;
}
//-----------------------------------------------------------------------------
int vtkAMRFlashReader::GetNumberOfBlocks()
{
// TODO: implement this
return 0;
}
//-----------------------------------------------------------------------------
int vtkAMRFlashReader::GetNumberOfLevels()
{
// TODO: implement this
return 0;
}
//-----------------------------------------------------------------------------
void vtkAMRFlashReader::GetBlock(
int index, vtkHierarchicalBoxDataSet *hbds,
vtkstd::vector< int > &idxcounter)
{
// TODO: implement this
}
//-----------------------------------------------------------------------------
void vtkAMRFlashReader::SetUpDataArraySelections()
{
// TODO: implement this
}
/*=========================================================================
Program: Visualization Toolkit
Module: vtkAMRFlashReader.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkAMREnzoReader.h -- Reader for Flash AMR datasets.
//
// .SECTION Description
// A concrete instance of vtkAMRBaseReader that implements functionality
// for reading Flash AMR datasets.
#ifndef VTKAMRFLASHREADER_H_
#define VTKAMRFLASHREADER_H_
#include "vtkAMRBaseReader.h"
class vtkHierarchicalBoxDataSet;
class VTK_AMR_EXPORT vtkAMRFlashReader : public vtkAMRBaseReader
{
public:
static vtkAMRFlashReader* New();
vtkTypeMacro( vtkAMRFlashReader, vtkAMRBaseReader );
void PrintSelf( std::ostream &os, vtkIndent indent );
// Description:
// See vtkAMRBaseReader::SetFileName
void SetFileName( const char* fileName );
protected:
vtkAMRFlashReader();
~vtkAMRFlashReader();
// Description:
// See vtkAMRBaseReader::ReadMetaData
void ReadMetaData();
// Description:
// See vtkAMRBaseReader::GenerateBlockMap
void GenerateBlockMap();
// Description:
// See vtkAMRBaseReader::GetBlockLevel
int GetBlockLevel( const int blockIdx );
// Description:
// See vtkAMRBaseReader::GetNumberOfBlocks
int GetNumberOfBlocks();
// Description:
// See vtkAMRBaseReader::GetNumberOfLevels
int GetNumberOfLevels();
// Description:
// See vtkAMRBaseReader::GetBlock
void GetBlock(
int index, vtkHierarchicalBoxDataSet *hbds,
vtkstd::vector< int > &idxcounter);
// Description:
// See vtkAMRBaseReader::SetUpDataArraySelections
void SetUpDataArraySelections();
private:
vtkAMRFlashReader( const vtkAMRFlashReader& ); // Not implemented
void operator=(const vtkAMRFlashReader& ); // Not implemented
};
#endif /* VTKAMRFLASHREADER_H_ */
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