diff --git a/Filters/ParallelMPI/vtkPExtractGrid.cxx b/Filters/ParallelMPI/vtkPExtractGrid.cxx index 0d778d09d018ea5a02570f00ce212d38befdd3ad..9d0bac2b410f89ca477ae28c763905863292fcbd 100644 --- a/Filters/ParallelMPI/vtkPExtractGrid.cxx +++ b/Filters/ParallelMPI/vtkPExtractGrid.cxx @@ -37,8 +37,8 @@ vtkStandardNewMacro(vtkPExtractGrid); //------------------------------------------------------------------------------ vtkPExtractGrid::vtkPExtractGrid() { - this->Controller = vtkMPIController::SafeDownCast( - vtkMultiProcessController::GetGlobalController()); + this->Controller = vtkMPIController::SafeDownCast( + vtkMultiProcessController::GetGlobalController()); } //------------------------------------------------------------------------------ @@ -50,7 +50,7 @@ vtkPExtractGrid::~vtkPExtractGrid() //------------------------------------------------------------------------------ void vtkPExtractGrid::PrintSelf(ostream& os, vtkIndent indent) { - this->Superclass::PrintSelf(os,indent); + this->Superclass::PrintSelf(os,indent); } //------------------------------------------------------------------------------ @@ -59,78 +59,78 @@ int vtkPExtractGrid::RequestData( vtkInformationVector** inputVector, vtkInformationVector* outputVector) { - // STEP 0: Execute superclass - int rc = this->Superclass::RequestData(request,inputVector,outputVector); - if( rc < 0 ) - { - return( rc ); - } + // STEP 0: Execute superclass + int rc = this->Superclass::RequestData(request,inputVector,outputVector); + if( rc < 0 ) + { + return( rc ); + } - // STEP 1: Get output information - vtkInformation* outInfo = outputVector->GetInformationObject(0); - assert("pre: output invformation is NULL!" && (outInfo != NULL) ); + // STEP 1: Get output information + vtkInformation* outInfo = outputVector->GetInformationObject(0); + assert("pre: output invformation is NULL!" && (outInfo != NULL) ); - // STEP 2: Get the whole extent - int wholeExtent[6]; - outInfo->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(),wholeExtent); + // STEP 2: Get the whole extent + int wholeExtent[6]; + outInfo->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(),wholeExtent); #ifdef DEBUG - vtkMPIUtilities::SynchronizedPrintf( - this->Controller,"wholeExtent=[%d,%d,%d,%d,%d,%d]\n", - wholeExtent[0],wholeExtent[1],wholeExtent[2], - wholeExtent[3],wholeExtent[4],wholeExtent[5]); + vtkMPIUtilities::SynchronizedPrintf( + this->Controller,"wholeExtent=[%d,%d,%d,%d,%d,%d]\n", + wholeExtent[0],wholeExtent[1],wholeExtent[2], + wholeExtent[3],wholeExtent[4],wholeExtent[5]); #endif - // STEP 3: Get the structured grid instance in this process - vtkStructuredGrid* grid = vtkStructuredGrid::SafeDownCast( - outInfo->Get(vtkDataObject::DATA_OBJECT())); + // STEP 3: Get the structured grid instance in this process + vtkStructuredGrid* grid = vtkStructuredGrid::SafeDownCast( + outInfo->Get(vtkDataObject::DATA_OBJECT())); #ifdef DEBUG - int myExt[6]; - grid->GetExtent(myExt); + int myExt[6]; + grid->GetExtent(myExt); - vtkMPIUtilities::SynchronizedPrintf( - this->Controller,"ext=[%d,%d,%d,%d,%d,%d]\n", - myExt[0],myExt[1],myExt[2],myExt[3],myExt[4],myExt[5]); + vtkMPIUtilities::SynchronizedPrintf( + this->Controller,"ext=[%d,%d,%d,%d,%d,%d]\n", + myExt[0],myExt[1],myExt[2],myExt[3],myExt[4],myExt[5]); #endif - // STEP 4: Detect & resolve gaps if any - vtkStructuredImplicitConnectivity* gridConnectivity = - vtkStructuredImplicitConnectivity::New(); - gridConnectivity->SetWholeExtent(wholeExtent); - - // Register the grid, grid ID is the same as the process ID - gridConnectivity->RegisterGrid( - this->Controller->GetLocalProcessId(), - grid->GetExtent(), - grid->GetPoints(), - grid->GetPointData() - ); - - // Establish neighbor connectivity & detect any gaps - gridConnectivity->EstablishConnectivity(); - - // Check if there are any gaps, if any close them now - if( gridConnectivity->HasImplicitConnectivity() ) - { + // STEP 4: Detect & resolve gaps if any + vtkStructuredImplicitConnectivity* gridConnectivity = + vtkStructuredImplicitConnectivity::New(); + gridConnectivity->SetWholeExtent(wholeExtent); + + // Register the grid, grid ID is the same as the process ID + gridConnectivity->RegisterGrid( + this->Controller->GetLocalProcessId(), + grid->GetExtent(), + grid->GetPoints(), + grid->GetPointData() + ); + + // Establish neighbor connectivity & detect any gaps + gridConnectivity->EstablishConnectivity(); + + // Check if there are any gaps, if any close them now + if( gridConnectivity->HasImplicitConnectivity() ) + { #ifdef DEBUG - vtkMPIUtilities::Printf(this->Controller, "Closing Gap...\n"); + vtkMPIUtilities::Printf(this->Controller, "Closing Gap...\n"); #endif - // there are gaps, grow the grid to the right - gridConnectivity->ExchangeData(); - gridConnectivity->GetOutputStructuredGrid( - this->Controller->GetLocalProcessId(),grid); - } + // there are gaps, grow the grid to the right + gridConnectivity->ExchangeData(); + gridConnectivity->GetOutputStructuredGrid( + this->Controller->GetLocalProcessId(),grid); + } #ifdef DEBUG - grid->GetExtent(myExt); - vtkMPIUtilities::SynchronizedPrintf( - this->Controller,"ext=[%d,%d,%d,%d,%d,%d]\n", - myExt[0],myExt[1],myExt[2],myExt[3],myExt[4],myExt[5]); + grid->GetExtent(myExt); + vtkMPIUtilities::SynchronizedPrintf( + this->Controller,"ext=[%d,%d,%d,%d,%d,%d]\n", + myExt[0],myExt[1],myExt[2],myExt[3],myExt[4],myExt[5]); #endif - gridConnectivity->Delete(); - return( rc ); + gridConnectivity->Delete(); + return( rc ); } //------------------------------------------------------------------------------ @@ -139,9 +139,14 @@ int vtkPExtractGrid::RequestInformation( vtkInformationVector** inputVector, vtkInformationVector* outputVector) { - int rc = this->Superclass::RequestInformation( - request,inputVector,outputVector); - return( rc ); + if (!this->Controller) + { + vtkErrorMacro("This filter needs a controller to work."); + return 0; + } + int rc = this->Superclass::RequestInformation( + request,inputVector,outputVector); + return( rc ); } //------------------------------------------------------------------------------ @@ -150,7 +155,7 @@ int vtkPExtractGrid::RequestUpdateExtent( vtkInformationVector** inputVector, vtkInformationVector* outputVector) { - int rc = this->Superclass::RequestUpdateExtent( - request,inputVector,outputVector); - return( rc ); + int rc = this->Superclass::RequestUpdateExtent( + request,inputVector,outputVector); + return( rc ); } diff --git a/Filters/ParallelMPI/vtkPExtractRectilinearGrid.cxx b/Filters/ParallelMPI/vtkPExtractRectilinearGrid.cxx index cb53d3fb5ad2742b13ed48536550af2c1eaf39ac..de2ba0d4f3cac9c42fbfa449dc17455fe74b7ac6 100644 --- a/Filters/ParallelMPI/vtkPExtractRectilinearGrid.cxx +++ b/Filters/ParallelMPI/vtkPExtractRectilinearGrid.cxx @@ -57,81 +57,81 @@ int vtkPExtractRectilinearGrid::RequestData( vtkInformationVector** inputVector, vtkInformationVector* outputVector) { - // STEP 0: Execute superclass - int rc = this->Superclass::RequestData(request,inputVector,outputVector); - if( rc < 0 ) - { - return( rc ); - } + // STEP 0: Execute superclass + int rc = this->Superclass::RequestData(request,inputVector,outputVector); + if( rc < 0 ) + { + return( rc ); + } - // STEP 1: Get output information - vtkInformation* outInfo = outputVector->GetInformationObject(0); - assert("pre: output invformation is NULL!" && (outInfo != NULL) ); + // STEP 1: Get output information + vtkInformation* outInfo = outputVector->GetInformationObject(0); + assert("pre: output invformation is NULL!" && (outInfo != NULL) ); - // STEP 2: Get the whole extent - int wholeExtent[6]; - outInfo->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(),wholeExtent); + // STEP 2: Get the whole extent + int wholeExtent[6]; + outInfo->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(),wholeExtent); #ifdef DEBUG - vtkMPIUtilities::SynchronizedPrintf( - this->Controller,"wholeExtent=[%d,%d,%d,%d,%d,%d]\n", - wholeExtent[0],wholeExtent[1],wholeExtent[2], - wholeExtent[3],wholeExtent[4],wholeExtent[5]); + vtkMPIUtilities::SynchronizedPrintf( + this->Controller,"wholeExtent=[%d,%d,%d,%d,%d,%d]\n", + wholeExtent[0],wholeExtent[1],wholeExtent[2], + wholeExtent[3],wholeExtent[4],wholeExtent[5]); #endif - // STEP 3: Get the structured grid instance in this process - vtkRectilinearGrid* grid = vtkRectilinearGrid::SafeDownCast( - outInfo->Get(vtkDataObject::DATA_OBJECT())); + // STEP 3: Get the structured grid instance in this process + vtkRectilinearGrid* grid = vtkRectilinearGrid::SafeDownCast( + outInfo->Get(vtkDataObject::DATA_OBJECT())); #ifdef DEBUG - int myExt[6]; - grid->GetExtent(myExt); + int myExt[6]; + grid->GetExtent(myExt); - vtkMPIUtilities::SynchronizedPrintf( - this->Controller,"ext=[%d,%d,%d,%d,%d,%d]\n", - myExt[0],myExt[1],myExt[2],myExt[3],myExt[4],myExt[5]); + vtkMPIUtilities::SynchronizedPrintf( + this->Controller,"ext=[%d,%d,%d,%d,%d,%d]\n", + myExt[0],myExt[1],myExt[2],myExt[3],myExt[4],myExt[5]); #endif - // STEP 4: Detect & resolve gaps if any - vtkStructuredImplicitConnectivity* gridConnectivity = - vtkStructuredImplicitConnectivity::New(); - gridConnectivity->SetWholeExtent(wholeExtent); - - // Register the grid, grid ID is the same as the process ID - gridConnectivity->RegisterRectilinearGrid( - this->Controller->GetLocalProcessId(), - grid->GetExtent(), - grid->GetXCoordinates(), - grid->GetYCoordinates(), - grid->GetZCoordinates(), - grid->GetPointData() - ); - - // Establish neighbor connectivity & detect any gaps - gridConnectivity->EstablishConnectivity(); - - // Check if there are any gaps, if any close them now - if( gridConnectivity->HasImplicitConnectivity() ) - { + // STEP 4: Detect & resolve gaps if any + vtkStructuredImplicitConnectivity* gridConnectivity = + vtkStructuredImplicitConnectivity::New(); + gridConnectivity->SetWholeExtent(wholeExtent); + + // Register the grid, grid ID is the same as the process ID + gridConnectivity->RegisterRectilinearGrid( + this->Controller->GetLocalProcessId(), + grid->GetExtent(), + grid->GetXCoordinates(), + grid->GetYCoordinates(), + grid->GetZCoordinates(), + grid->GetPointData() + ); + + // Establish neighbor connectivity & detect any gaps + gridConnectivity->EstablishConnectivity(); + + // Check if there are any gaps, if any close them now + if( gridConnectivity->HasImplicitConnectivity() ) + { #ifdef DEBUG - vtkMPIUtilities::Printf(this->Controller, "Closing Gap...\n"); + vtkMPIUtilities::Printf(this->Controller, "Closing Gap...\n"); #endif - // there are gaps, grow the grid to the right - gridConnectivity->ExchangeData(); + // there are gaps, grow the grid to the right + gridConnectivity->ExchangeData(); - gridConnectivity->GetOutputRectilinearGrid( - this->Controller->GetLocalProcessId(),grid); - } + gridConnectivity->GetOutputRectilinearGrid( + this->Controller->GetLocalProcessId(),grid); + } #ifdef DEBUG - grid->GetExtent(myExt); - vtkMPIUtilities::SynchronizedPrintf( - this->Controller,"ext=[%d,%d,%d,%d,%d,%d]\n", - myExt[0],myExt[1],myExt[2],myExt[3],myExt[4],myExt[5]); + grid->GetExtent(myExt); + vtkMPIUtilities::SynchronizedPrintf( + this->Controller,"ext=[%d,%d,%d,%d,%d,%d]\n", + myExt[0],myExt[1],myExt[2],myExt[3],myExt[4],myExt[5]); #endif - gridConnectivity->Delete(); - return( rc ); + gridConnectivity->Delete(); + return( rc ); } //------------------------------------------------------------------------------ @@ -140,9 +140,15 @@ int vtkPExtractRectilinearGrid::RequestInformation( vtkInformationVector** inputVector, vtkInformationVector* outputVector) { - int rc = this->Superclass::RequestInformation( - request,inputVector,outputVector); - return( rc ); + if (!this->Controller) + { + vtkErrorMacro("This filter needs a controller to work."); + return 0; + } + + int rc = this->Superclass::RequestInformation( + request,inputVector,outputVector); + return( rc ); } //------------------------------------------------------------------------------ @@ -151,7 +157,7 @@ int vtkPExtractRectilinearGrid::RequestUpdateExtent( vtkInformationVector** inputVector, vtkInformationVector* outputVector) { - int rc = this->Superclass::RequestUpdateExtent( - request,inputVector,outputVector); - return( rc ); + int rc = this->Superclass::RequestUpdateExtent( + request,inputVector,outputVector); + return( rc ); } diff --git a/Filters/ParallelMPI/vtkPExtractVOI.cxx b/Filters/ParallelMPI/vtkPExtractVOI.cxx index e21f9dfccb8898add246dd214ed6ef69a8286c41..cd1cfb7bc5196c39271616b405713fb45b94c151 100644 --- a/Filters/ParallelMPI/vtkPExtractVOI.cxx +++ b/Filters/ParallelMPI/vtkPExtractVOI.cxx @@ -57,79 +57,79 @@ int vtkPExtractVOI::RequestData( vtkInformationVector** inputVector, vtkInformationVector* outputVector) { - // STEP 0: Execute superclass - int rc = this->Superclass::RequestData(request,inputVector,outputVector); - if( rc < 0 ) - { - return( rc ); - } + // STEP 0: Execute superclass + int rc = this->Superclass::RequestData(request,inputVector,outputVector); + if( rc < 0 ) + { + return( rc ); + } - // STEP 1: Get output information - vtkInformation* outInfo = outputVector->GetInformationObject(0); - assert("pre: output invformation is NULL!" && (outInfo != NULL) ); + // STEP 1: Get output information + vtkInformation* outInfo = outputVector->GetInformationObject(0); + assert("pre: output invformation is NULL!" && (outInfo != NULL) ); - // STEP 2: Get the whole extent - int wholeExtent[6]; - outInfo->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(),wholeExtent); + // STEP 2: Get the whole extent + int wholeExtent[6]; + outInfo->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(),wholeExtent); #ifdef DEBUG - vtkMPIUtilities::SynchronizedPrintf( - this->Controller,"wholeExtent=[%d,%d,%d,%d,%d,%d]\n", - wholeExtent[0],wholeExtent[1],wholeExtent[2], - wholeExtent[3],wholeExtent[4],wholeExtent[5]); + vtkMPIUtilities::SynchronizedPrintf( + this->Controller,"wholeExtent=[%d,%d,%d,%d,%d,%d]\n", + wholeExtent[0],wholeExtent[1],wholeExtent[2], + wholeExtent[3],wholeExtent[4],wholeExtent[5]); #endif - // STEP 3: Get the structured grid instance in this process - vtkImageData* grid = vtkImageData::SafeDownCast( - outInfo->Get(vtkDataObject::DATA_OBJECT())); + // STEP 3: Get the structured grid instance in this process + vtkImageData* grid = vtkImageData::SafeDownCast( + outInfo->Get(vtkDataObject::DATA_OBJECT())); #ifdef DEBUG - int myExt[6]; - grid->GetExtent(myExt); + int myExt[6]; + grid->GetExtent(myExt); - vtkMPIUtilities::SynchronizedPrintf( - this->Controller,"ext=[%d,%d,%d,%d,%d,%d]\n", - myExt[0],myExt[1],myExt[2],myExt[3],myExt[4],myExt[5]); + vtkMPIUtilities::SynchronizedPrintf( + this->Controller,"ext=[%d,%d,%d,%d,%d,%d]\n", + myExt[0],myExt[1],myExt[2],myExt[3],myExt[4],myExt[5]); #endif - // STEP 4: Detect & resolve gaps if any - vtkStructuredImplicitConnectivity* gridConnectivity = - vtkStructuredImplicitConnectivity::New(); - gridConnectivity->SetWholeExtent(wholeExtent); - - // Register the grid, grid ID is the same as the process ID - gridConnectivity->RegisterGrid( - this->Controller->GetLocalProcessId(), - grid->GetExtent(), - NULL, - grid->GetPointData() - ); - - // Establish neighbor connectivity & detect any gaps - gridConnectivity->EstablishConnectivity(); - - // Check if there are any gaps, if any close them now - if( gridConnectivity->HasImplicitConnectivity() ) - { + // STEP 4: Detect & resolve gaps if any + vtkStructuredImplicitConnectivity* gridConnectivity = + vtkStructuredImplicitConnectivity::New(); + gridConnectivity->SetWholeExtent(wholeExtent); + + // Register the grid, grid ID is the same as the process ID + gridConnectivity->RegisterGrid( + this->Controller->GetLocalProcessId(), + grid->GetExtent(), + NULL, + grid->GetPointData() + ); + + // Establish neighbor connectivity & detect any gaps + gridConnectivity->EstablishConnectivity(); + + // Check if there are any gaps, if any close them now + if( gridConnectivity->HasImplicitConnectivity() ) + { #ifdef DEBUG - vtkMPIUtilities::Printf(this->Controller, "Closing Gap...\n"); + vtkMPIUtilities::Printf(this->Controller, "Closing Gap...\n"); #endif - // there are gaps, grow the grid to the right - gridConnectivity->ExchangeData(); + // there are gaps, grow the grid to the right + gridConnectivity->ExchangeData(); - gridConnectivity->GetOutputImageData( - this->Controller->GetLocalProcessId(),grid); - } + gridConnectivity->GetOutputImageData( + this->Controller->GetLocalProcessId(),grid); + } #ifdef DEBUG - grid->GetExtent(myExt); - vtkMPIUtilities::SynchronizedPrintf( - this->Controller,"ext=[%d,%d,%d,%d,%d,%d]\n", - myExt[0],myExt[1],myExt[2],myExt[3],myExt[4],myExt[5]); + grid->GetExtent(myExt); + vtkMPIUtilities::SynchronizedPrintf( + this->Controller,"ext=[%d,%d,%d,%d,%d,%d]\n", + myExt[0],myExt[1],myExt[2],myExt[3],myExt[4],myExt[5]); #endif - gridConnectivity->Delete(); - return( rc ); + gridConnectivity->Delete(); + return( rc ); } //------------------------------------------------------------------------------ @@ -138,9 +138,15 @@ int vtkPExtractVOI::RequestInformation( vtkInformationVector** inputVector, vtkInformationVector* outputVector) { - int rc = this->Superclass::RequestInformation( - request,inputVector,outputVector); - return( rc ); + if (!this->Controller) + { + vtkErrorMacro("This filter needs a controller to work."); + return 0; + } + + int rc = this->Superclass::RequestInformation( + request,inputVector,outputVector); + return( rc ); } //------------------------------------------------------------------------------ @@ -149,7 +155,7 @@ int vtkPExtractVOI::RequestUpdateExtent( vtkInformationVector** inputVector, vtkInformationVector* outputVector) { - int rc = this->Superclass::RequestUpdateExtent( - request,inputVector,outputVector); - return( rc ); + int rc = this->Superclass::RequestUpdateExtent( + request,inputVector,outputVector); + return( rc ); } diff --git a/Filters/ParallelMPI/vtkStructuredImplicitConnectivity.cxx b/Filters/ParallelMPI/vtkStructuredImplicitConnectivity.cxx index c36a5ae7afc71344b95e53b9d1743ae23a84557e..ce4989e8105720b67736bea33c540e584b1da870 100644 --- a/Filters/ParallelMPI/vtkStructuredImplicitConnectivity.cxx +++ b/Filters/ParallelMPI/vtkStructuredImplicitConnectivity.cxx @@ -350,6 +350,11 @@ struct DomainMetaData this->DataDescription = vtkStructuredData::GetDataDescriptionFromExtent(wholeExt); + if (this->DataDescription == VTK_EMPTY) + { + return; + } + // Sanity checks! assert( "pre: data description is VTK_EMPTY!" && (this->DataDescription != VTK_EMPTY) ); diff --git a/IO/Geometry/vtkParticleReader.cxx b/IO/Geometry/vtkParticleReader.cxx index 45c1a8521517ef6449d7016970f91c01c5ec344a..5ca80467bbd27519f07b98bbec4786c509d2847d 100644 --- a/IO/Geometry/vtkParticleReader.cxx +++ b/IO/Geometry/vtkParticleReader.cxx @@ -181,6 +181,12 @@ int vtkParticleReader::RequestInformation( vtkInformationVector **vtkNotUsed(inputVector), vtkInformationVector *outputVector) { + if (!this->FileName) + { + vtkErrorMacro(<<"FileName must be specified."); + return 0; + } + this->OpenFile(); int ft = this->FileType; if ( ft == FILE_TYPE_IS_UNKNOWN )