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

ENH: Changed to use vtkAMRLink instead

Changed the vtkAMRInterBlockConnnectivity data-structure
to use vtkAMRLink as primary storage of each AMR link.
parent 385fdcee
......@@ -15,7 +15,7 @@
#include "vtkAMRInterBlockConnectivity.h"
#include "vtkAMRGridIndexEncoder.h"
#include "vtkObjectFactory.h"
#include "vtkVector.h"
#include "vtkAMRLink.h"
#include "vtkAssertUtils.hpp"
//
......@@ -32,7 +32,7 @@ vtkAMRInterBlockConnectivity::vtkAMRInterBlockConnectivity()
//------------------------------------------------------------------------------
vtkAMRInterBlockConnectivity::~vtkAMRInterBlockConnectivity()
{
vtkstd::map<unsigned int,vtkstd::vector< vtkVector<int,3> > >::iterator iter;
vtkstd::map<unsigned int,vtkstd::vector< vtkAMRLink > >::iterator iter;
for(iter=this->connectivity.begin();iter != this->connectivity.end(); ++iter)
iter->second.clear( );
this->connectivity.clear( );
......@@ -42,7 +42,7 @@ vtkAMRInterBlockConnectivity::~vtkAMRInterBlockConnectivity()
void vtkAMRInterBlockConnectivity::PrintSelf(
std::ostream &oss, vtkIndent indent )
{
vtkstd::map<unsigned int,vtkstd::vector< vtkVector<int,3> > >::iterator iter;
vtkstd::map<unsigned int,vtkstd::vector< vtkAMRLink > >::iterator iter;
for(iter=this->connectivity.begin();iter != this->connectivity.end(); ++iter)
{
unsigned int idx = iter->first;
......@@ -57,8 +57,10 @@ void vtkAMRInterBlockConnectivity::PrintSelf(
for( int i=0; i < this->GetNumberOfConnections( idx ); ++i )
{
vtkVector<int,3> tuple = this->GetConnection( idx, i );
oss << "(" << tuple[0] << ", " << tuple[1] << ", " << tuple[2];
vtkAMRLink tuple = this->GetConnection( idx, i );
oss << "(" << tuple.GetBlockID() << ", ";
oss << tuple.GetLevel( ) << ", ";
oss << tuple.GetProcessRank( );
oss << ")\n";
} // END for all connections of the block corresponding to (block,level)
......@@ -82,7 +84,7 @@ void vtkAMRInterBlockConnectivity::InsertConnection(
}
else
{
vtkstd::vector< vtkVector<int,3> > myVector;
vtkstd::vector< vtkAMRLink > myVector;
myVector.push_back(
this->GetTuple( connectingBlockIdx, connectingBlockLevel,
connectingBlockProcess )
......@@ -127,7 +129,7 @@ bool vtkAMRInterBlockConnectivity::HasBlockConnections( const unsigned int idx )
}
//------------------------------------------------------------------------------
vtkVector<int,3> vtkAMRInterBlockConnectivity::GetConnection(
vtkAMRLink vtkAMRInterBlockConnectivity::GetConnection(
const int myBlockId, const int myLevelId, const int idx )
{
unsigned int blockidx=vtkAMRGridIndexEncoder::encode( myLevelId, myBlockId );
......@@ -135,7 +137,7 @@ vtkVector<int,3> vtkAMRInterBlockConnectivity::GetConnection(
}
//------------------------------------------------------------------------------
vtkVector<int,3> vtkAMRInterBlockConnectivity::GetConnection(
vtkAMRLink vtkAMRInterBlockConnectivity::GetConnection(
const unsigned int blockidx, const int idx )
{
if( !this->HasBlockConnections( blockidx ) )
......@@ -154,15 +156,12 @@ vtkVector<int,3> vtkAMRInterBlockConnectivity::GetConnection(
}
//------------------------------------------------------------------------------
vtkVector<int,3> vtkAMRInterBlockConnectivity::GetTuple(
vtkAMRLink vtkAMRInterBlockConnectivity::GetTuple(
const int block, const int level, const int rank)
{
vtkVector<int,3> tuple;
tuple[0] = block;
tuple[1] = level;
tuple[2] = rank;
return( tuple );
vtkAMRLink link;
link.SetProcessRank( rank );
link.SetBlockID( block );
link.SetLevel( level );
return( link );
}
......@@ -25,7 +25,7 @@
#ifndef VTKAMRINTERBLOCKCONNECTIVITY_H_
#define VTKAMRINTERBLOCKCONNECTIVITY_H_
class vtkVector;
class vtkAMRLink;
class VTK_AMR_EXPORT vtkAMRInterBlockConnectivity : public vtkObject
{
......@@ -56,7 +56,7 @@ class VTK_AMR_EXPORT vtkAMRInterBlockConnectivity : public vtkObject
// blockId = tuple[0]
// level = tuple[1]
// rank = tuple[2]
vtkVector<int,3> GetConnection(
vtkAMRLink GetConnection(
const int myBlockId, const int myLevelId, const int connectionIndex );
protected:
......@@ -67,7 +67,7 @@ class VTK_AMR_EXPORT vtkAMRInterBlockConnectivity : public vtkObject
// Returns the connection information for the given block
// boxk -- the encoded (blockId,levelId) of the block in query.
// NOTE: See vtkAMRGridIndexEncoder for the encoding
vtkVector<int,3> GetConnection( const unsigned int block, int idx );
vtkAMRLink GetConnection( const unsigned int block, int idx );
// Description:
// Returns true if connections for the given block exist, o/w false.
......@@ -83,7 +83,7 @@ class VTK_AMR_EXPORT vtkAMRInterBlockConnectivity : public vtkObject
// Description:
// Constructs a tuple to hold the (block,level,rank) information
vtkVector<int,3> GetTuple(const int block, const int level, const int rank);
vtkAMRLink GetTuple(const int block, const int level, const int rank);
private:
......@@ -91,7 +91,7 @@ class VTK_AMR_EXPORT vtkAMRInterBlockConnectivity : public vtkObject
const vtkAMRInterBlockConnectivity&);// Not Implemented
void operator=(const vtkAMRInterBlockConnectivity&);// Not Implemented
vtkstd::map<unsigned int,vtkstd::vector< vtkVector<int,3> > > connectivity;
vtkstd::map<unsigned int,vtkstd::vector< vtkAMRLink > > connectivity;
};
#endif /* VTKAMRINTERBLOCKCONNECTIVITY_H_ */
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