Commit 8a7efa68 authored by Berk Geveci's avatar Berk Geveci
Browse files

Adding AMR support

parent 5a806db2
......@@ -35,6 +35,10 @@ vtkCharArray.cxx
vtkCollection.cxx
vtkCollectionIterator.cxx
vtkCommand.cxx
vtkCompositeDataIterator.cxx
vtkCompositeDataSet.cxx
vtkCompositeDataVisitor.cxx
vtkCompositeDataVisitorCommand.cxx
vtkContourValues.cxx
vtkConvexPointSet.cxx
vtkCoordinate.cxx
......@@ -69,6 +73,10 @@ vtkGeneralTransform.cxx
vtkGenericCell.cxx
vtkHeap.cxx
vtkHexahedron.cxx
vtkHierarchicalBoxDataSet.cxx
vtkHierarchicalBoxVisitor.cxx
vtkHierarchicalDataSet.cxx
vtkHierarchicalDataIterator.cxx
vtkHomogeneousTransform.cxx
vtkIdList.cxx
vtkIdListCollection.cxx
......@@ -97,6 +105,9 @@ vtkMath.cxx
vtkMatrix4x4.cxx
vtkMatrixToHomogeneousTransform.cxx
vtkMatrixToLinearTransform.cxx
vtkMultiBlockDataIterator.cxx
vtkMultiBlockDataSet.cxx
vtkMultiBlockDataVisitor.cxx
vtkMultiPartExtentTranslator.cxx
vtkMultiThreader.cxx
vtkMutexLock.cxx
......@@ -162,6 +173,7 @@ vtkTransform.cxx
vtkTransformCollection.cxx
vtkTriangle.cxx
vtkTriangleStrip.cxx
vtkUniformGrid.cxx
vtkUnsignedCharArray.cxx
vtkUnsignedIntArray.cxx
vtkUnsignedLongArray.cxx
......@@ -193,10 +205,15 @@ vtkCallbackCommand
vtkCell
vtkCell3D
vtkCommand
vtkCompositeDataIterator
vtkCompositeDataSet
vtkCompositeDataVisitor
vtkCompositeDataVisitorCommand
vtkDataArray
vtkDataSet
vtkExplicitCell
vtkFunctionSet
vtkHierarchicalDataSet
vtkHomogeneousTransform
vtkImplicitFunction
vtkInitialValueProblemSolver
......
......@@ -15,6 +15,7 @@ IF(PYTHON_EXECUTABLE)
vtkAbstractIterator.h
vtkAbstractList.h
vtkAbstractMap.h
vtkAMRBox.h
vtkArrayMap.h
vtkArrayMapIterator.h
vtkCallbackCommand.h
......@@ -26,6 +27,8 @@ IF(PYTHON_EXECUTABLE)
vtkErrorCode.h
vtkHashMap.h
vtkHashMapIterator.h
vtkHierarchicalDataSetInternal.h
vtkHierarchicalBoxDataSetInternal.h
vtkIOStream.h
vtkIOStreamFwd.h
vtkIdType.h
......@@ -39,6 +42,7 @@ IF(PYTHON_EXECUTABLE)
vtkLinkedListIterator.h
vtkMarchingCubesCases.h
vtkMarchingSquaresCases.h
vtkMultiBlockDataSetInternal.h
vtkOStrStreamWrapper.h
vtkOStreamWrapper.h
vtkObject.h
......
/*=========================================================================
Program: Visualization Toolkit
Module: vtkAMRBox.h
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) 1993-2002 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 vtkAMRBox - represents a 3D uniform region in space
// .SECTION Description
// vtkAMRBox is similar to Chombo's Box. It represents a 3D
// region by storing indices for two corners (LoCorner, HiCorner).
// A few utility methods are provided.
#ifndef __vtkAMRBox_h
#define __vtkAMRBox_h
#include "vtkObject.h"
class VTK_COMMON_EXPORT vtkAMRBox
{
public:
// public for quick access
int LoCorner[3];
int HiCorner[3];
vtkAMRBox()
{
for(int i=0; i<3; i++)
{
this->LoCorner[i] = this->HiCorner[i] = 0;
}
}
vtkAMRBox(int dimensionality, int* loCorner, int* hiCorner)
{
this->LoCorner[2] = this->HiCorner[2] = 0;
memcpy(this->LoCorner, loCorner, dimensionality*sizeof(int));
memcpy(this->HiCorner, hiCorner, dimensionality*sizeof(int));
}
// Description:
// Returns the number of cells (aka elements, zones etc.) in
// the given region (for the specified refinement, see Coarsen()
// and Refine() ).
vtkIdType GetNumberOfCells()
{
vtkIdType numCells=1;
for(int i=0; i<3; i++)
{
numCells *= HiCorner[i] - LoCorner[i] + 1;
}
return numCells;
}
// Description:
// Modify LoCorner and HiCorner by coarsening with the given
// refinement ratio.
void Coarsen(int refinement)
{
for (int i=0; i<3; i++)
{
this->LoCorner[i] =
( this->LoCorner[i] < 0 ?
-abs(this->LoCorner[i]+1)/refinement - 1 :
this->LoCorner[i]/refinement );
this->HiCorner[i] =
( this->HiCorner[i] < 0 ?
-abs(this->HiCorner[i]+1)/refinement - 1 :
this->HiCorner[i]/refinement );
}
}
// Description:
// Modify LoCorner and HiCorner by refining with the given
// refinement ratio.
void Refine(int refinement)
{
for (int i=0; i<3; i++)
{
this->LoCorner[i] = this->LoCorner[i]*refinement;
this->HiCorner[i] = this->HiCorner[i]*refinement;
}
}
// Description:
// Returns non-zero if the box contains the cell with
// given indices.
int DoesContainCell(int i, int j, int k)
{
return
i >= this->LoCorner[0] && i <= this->HiCorner[0] &&
j >= this->LoCorner[1] && j <= this->HiCorner[1] &&
k >= this->LoCorner[2] && k <= this->HiCorner[2];
}
};
struct vtkAMRLevelInformation
{
unsigned int Level;
unsigned int DataSetId;
vtkAMRBox Box;
};
#endif
/*=========================================================================
Program: Visualization Toolkit
Module: vtkCompositeDataIterator.cxx
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) 1993-2002 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 "vtkCompositeDataIterator.h"
vtkCxxRevisionMacro(vtkCompositeDataIterator, "1.1");
//----------------------------------------------------------------------------
vtkCompositeDataIterator::vtkCompositeDataIterator()
{
}
//----------------------------------------------------------------------------
vtkCompositeDataIterator::~vtkCompositeDataIterator()
{
}
//----------------------------------------------------------------------------
void vtkCompositeDataIterator::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os,indent);
}
/*=========================================================================
Program: Visualization Toolkit
Module: vtkCompositeDataIterator.h
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) 1993-2002 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 vtkCompositeDataIterator - abstract superclass for composite data iterators
// .SECTION Description
// vtkCompositeDataIterator provides an interface for accessing datasets
// in a collection (vtkCompositeDataIterator). Sub-classes provide the
// actual implementation.
#ifndef __vtkCompositeDataIterator_h
#define __vtkCompositeDataIterator_h
#include "vtkObject.h"
class vtkDataObject;
class VTK_COMMON_EXPORT vtkCompositeDataIterator : public vtkObject
{
public:
vtkTypeRevisionMacro(vtkCompositeDataIterator,vtkObject);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Move the iterator to the beginning of the collection.
void InitTraversal() { this->GoToFirstItem(); }
// Description:
// Move the iterator to the beginning of the collection.
virtual void GoToFirstItem() = 0;
// Description:
// Move the iterator to the next item in the collection.
virtual void GoToNextItem() = 0;
// Description:
// Test whether the iterator is currently pointing to a valid
// item. Returns 1 for yes, 0 for no.
virtual int IsDoneWithTraversal() = 0;
// Description:
// Get the current item. Valid only when IsDoneWithTraversal()
// returns 1.
virtual vtkDataObject* GetCurrentDataObject() = 0;
protected:
vtkCompositeDataIterator();
virtual ~vtkCompositeDataIterator();
private:
vtkCompositeDataIterator(const vtkCompositeDataIterator&); // Not implemented.
void operator=(const vtkCompositeDataIterator&); // Not implemented.
};
#endif
/*=========================================================================
Program: Visualization Toolkit
Module: vtkCompositeDataSet.cxx
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) 1993-2002 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 "vtkCompositeDataSet.h"
#include "vtkCompositeDataIterator.h"
#include "vtkCompositeDataVisitor.h"
#include "vtkDataSet.h"
vtkCxxRevisionMacro(vtkCompositeDataSet, "1.1");
//----------------------------------------------------------------------------
vtkCompositeDataSet::vtkCompositeDataSet()
{
}
//----------------------------------------------------------------------------
vtkCompositeDataSet::~vtkCompositeDataSet()
{
}
//----------------------------------------------------------------------------
void vtkCompositeDataSet::Initialize()
{
this->Superclass::Initialize();
}
//----------------------------------------------------------------------------
void vtkCompositeDataSet::SetUpdateExtent(int piece, int numPieces, int ghostLevel)
{
this->UpdatePiece = piece;
this->UpdateNumberOfPieces = numPieces;
this->UpdateGhostLevel = ghostLevel;
this->UpdateExtentInitialized = 1;
}
//----------------------------------------------------------------------------
void vtkCompositeDataSet::GetUpdateExtent(int &piece, int &numPieces, int &ghostLevel)
{
piece = this->UpdatePiece;
numPieces = this->UpdateNumberOfPieces;
ghostLevel = this->UpdateGhostLevel;
}
//----------------------------------------------------------------------------
void vtkCompositeDataSet::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os,indent);
}
/*=========================================================================
Program: Visualization Toolkit
Module: vtkCompositeDataSet.h
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) 1993-2002 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 vtkCompositeDataSet - abstact superclass for composite (multi-block or AMR) datasets
// .SECTION Description
// vtkCompositeDataSet is an abstract class that represents a collection
// of datasets (including other composite datasets). This superclass
// does not implement an actual method for storing datasets. It
// only provides an interface to access the datasets through iterators.
// .SECTION See Also
// vtkCompositeDataIterator vtkCompositeDataVisitor
#ifndef __vtkCompositeDataSet_h
#define __vtkCompositeDataSet_h
#include "vtkDataObject.h"
class vtkCompositeDataIterator;
class vtkCompositeDataVisitor;
class VTK_COMMON_EXPORT vtkCompositeDataSet : public vtkDataObject
{
public:
vtkTypeRevisionMacro(vtkCompositeDataSet,vtkDataObject);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Return a new (forward) iterator
// (the iterator has to be deleted by user)
virtual vtkCompositeDataIterator* NewIterator() = 0;
// Description:
// Return a new visitor. Sub-classes should overload
// this method to return the appropriate visitor.
virtual vtkCompositeDataVisitor* NewVisitor() = 0;
// Description:
// Return class name of data type (see vtkSystemIncludes.h for
// definitions).
virtual int GetDataObjectType() {return VTK_COMPOSITE_DATA_SET;}
// Description:
// Restore data object to initial state,
virtual void Initialize();
// Description:
// For streaming. User/next filter specifies which piece the want updated.
// The source of this data has to return exactly this piece.
void SetUpdateExtent(int piece, int numPieces, int ghostLevel);
void SetUpdateExtent(int piece, int numPieces)
{this->SetUpdateExtent(piece, numPieces, 0);}
void GetUpdateExtent(int &piece, int &numPieces, int &ghostLevel);
// Description:
// Call superclass method to avoid hiding
// Since this data type does not use 3D extents, this set method
// is useless but necessary since vtkDataSetToDataSetFilter does not
// know what type of data it is working on.
void SetUpdateExtent( int x1, int x2, int y1, int y2, int z1, int z2 )
{ this->Superclass::SetUpdateExtent( x1, x2, y1, y2, z1, z2 ); };
void SetUpdateExtent( int ext[6] )
{ this->Superclass::SetUpdateExtent( ext ); };
protected:
vtkCompositeDataSet();
~vtkCompositeDataSet();
private:
vtkCompositeDataSet(const vtkCompositeDataSet&); // Not implemented.
void operator=(const vtkCompositeDataSet&); // Not implemented.
};
#endif
/*=========================================================================
Program: Visualization Toolkit
Module: vtkCompositeDataVisitor.cxx
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) 1993-2002 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 "vtkCompositeDataVisitor.h"
#include "vtkCompositeDataVisitorCommand.h"
vtkCxxRevisionMacro(vtkCompositeDataVisitor, "1.1");
vtkCxxSetObjectMacro(vtkCompositeDataVisitor,
Command,
vtkCompositeDataVisitorCommand);
//----------------------------------------------------------------------------
vtkCompositeDataVisitor::vtkCompositeDataVisitor()
{
this->Command = 0;
this->CreateTransitionElements = 0;
}
//----------------------------------------------------------------------------
vtkCompositeDataVisitor::~vtkCompositeDataVisitor()
{
this->SetCommand(0);
}
//----------------------------------------------------------------------------
void vtkCompositeDataVisitor::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os,indent);
os << indent << "Command: ";
if (this->Command)
{
os << endl;
this->Command->PrintSelf(os, indent.GetNextIndent());
}
else
{
os << "(none)" << endl;
}
os << indent << "CreateTransitionElements: " << this->CreateTransitionElements
<< endl;
}
/*=========================================================================
Program: Visualization Toolkit
Module: vtkCompositeDataVisitor.h
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) 1993-2002 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 vtkCompositeDataVisitor - abstract superclass for composite data visitors
// .SECTION Description
// vtkCompositeDataVisitor is a superclass for composite data visitors.
// Composite data visitors iterate through dataset collections and
// apply an operation to each item.
#ifndef __vtkCompositeDataVisitor_h
#define __vtkCompositeDataVisitor_h
#include "vtkObject.h"
class vtkCompositeDataVisitorCommand;
class VTK_COMMON_EXPORT vtkCompositeDataVisitor : public vtkObject
{
public:
vtkTypeRevisionMacro(vtkCompositeDataVisitor,vtkObject);
void PrintSelf(ostream& os, vtkIndent indent);
//BTX
// Description:
// Set/get the command object applied to each item. The visitor
// will call Execute() on the command with the current item
// as an argument.
void SetCommand(vtkCompositeDataVisitorCommand* comm);
vtkGetObjectMacro(Command, vtkCompositeDataVisitorCommand);
//ETX
// Description:
// Apply the command on each object in the collection.
virtual void Execute() = 0;
// Description:
// When CreateTransitionElements is enabled, the visitor will
// try to create extra datasets to remove boundary artifacts.
// This is used by sub-classes that have such capability.
vtkSetMacro(CreateTransitionElements, int);
vtkGetMacro(CreateTransitionElements, int);
vtkBooleanMacro(CreateTransitionElements, int);
protected:
vtkCompositeDataVisitor();
virtual ~vtkCompositeDataVisitor();
vtkCompositeDataVisitorCommand* Command;
int CreateTransitionElements;
private:
vtkCompositeDataVisitor(const vtkCompositeDataVisitor&); // Not implemented.
void operator=(const vtkCompositeDataVisitor&); // Not implemented.
};
#endif
/*=========================================================================
Program: Visualization Toolkit
Module: vtkCompositeDataVisitorCommand.cxx
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) 1993-2002 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 "vtkCompositeDataVisitorCommand.h"
vtkCxxRevisionMacro(vtkCompositeDataVisitorCommand, "1.1");
//----------------------------------------------------------------------------
vtkCompositeDataVisitorCommand::vtkCompositeDataVisitorCommand()
{
}
//----------------------------------------------------------------------------
vtkCompositeDataVisitorCommand::~vtkCompositeDataVisitorCommand()
{
}