Commit 4e141ca0 authored by George Zagaris's avatar George Zagaris
Browse files

Merge branch 'AMR-Refactoring' of...

Merge branch 'AMR-Refactoring' of kwsource.kitwarein.com:~gzagaris/vtk/gzagaris-vtk into AMR-Refactoring
parents 6ed4087f 6e81cfce
......@@ -63,7 +63,7 @@ void vtkAMRBaseReader::Initialize()
this->FileName = NULL;
this->MaxLevel = 0;
this->LoadParticles = 1;
this->Controller = NULL;
this->Controller = vtkMultiProcessController::GetGlobalController();
this->InitialRequest = true;
this->CellDataArraySelection = vtkDataArraySelection::New();
......@@ -155,7 +155,7 @@ int vtkAMRBaseReader::GetBlockProcessId( const int blockIdx )
{
// If this is reader instance is serial, return Process 0
// as the Process ID for the corresponding block.
if( this->Controller == NULL )
if( !this->IsParallel() )
return 0;
int N = this->Controller->GetNumberOfProcesses();
......@@ -167,7 +167,7 @@ bool vtkAMRBaseReader::IsBlockMine( const int blockIdx )
{
// If this reader instance does not run in parallel, then,
// all blocks are owned by this reader.
if( this->Controller == NULL )
if( !this->IsParallel() )
return true;
int myRank = this->Controller->GetLocalProcessId();
......@@ -187,6 +187,18 @@ void vtkAMRBaseReader::InitializeArraySelections()
}
}
//------------------------------------------------------------------------------
bool vtkAMRBaseReader::IsParallel( )
{
if( this->Controller == NULL )
return false;
if( this->Controller->GetNumberOfProcesses() > 1 )
return true;
return false;
}
//------------------------------------------------------------------------------
int vtkAMRBaseReader::RequestData(
vtkInformation* vtkNotUsed(request),
......@@ -231,7 +243,7 @@ int vtkAMRBaseReader::RequestData(
// If this instance of the reader is not parallel, block until all processes
// read their blocks.
if( this->Controller != NULL )
if( this->IsParallel() )
this->Controller->Barrier();
outInf = NULL;
......
......@@ -93,6 +93,11 @@ class VTK_AMR_EXPORT vtkAMRBaseReader :
vtkAMRBaseReader();
~vtkAMRBaseReader();
// Desscription:
// Checks if this reader instance is attached to a communicator
// with more than one MPI processes.
bool IsParallel();
// Description:
// Determines if the block is owned by this process based on the
// the block index and total number of processes.
......
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