1 /*=========================================================================
3 Program: Visualization Toolkit
4 Module: vtkPVUnstructuredGridGhostCellsGenerator.cxx
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
14 =========================================================================*/
16 #include "vtkPVUnstructuredGridGhostCellsGenerator.h"
17 #include "vtkPVConfig.h" // need ParaView defines before MPI stuff
19 #include "vtkInformation.h"
20 #include "vtkInformationVector.h"
21 #include "vtkMultiProcessController.h"
23 #include "vtkObjectFactory.h"
24 #include "vtkStreamingDemandDrivenPipeline.h"
25 #include "vtkUnstructuredGrid.h"
27 #ifdef PARAVIEW_USE_MPI
28 # include "vtkPUnstructuredGridGhostCellsGenerator.h"
31 static const char* PVUGGCG_GLOBAL_POINT_IDS = "GlobalNodeIds";
33 //----------------------------------------------------------------------------
35 vtkStandardNewMacro(vtkPVUnstructuredGridGhostCellsGenerator)
36 vtkSetObjectImplementationMacro(
37 vtkPVUnstructuredGridGhostCellsGenerator, Controller, vtkMultiProcessController);
39 //----------------------------------------------------------------------------
40 vtkPVUnstructuredGridGhostCellsGenerator::vtkPVUnstructuredGridGhostCellsGenerator()
42 this->Controller = NULL;
43 this->SetController(vtkMultiProcessController::GetGlobalController());
45 this->GlobalPointIdsArrayName = NULL;
46 this->UseGlobalPointIds = true;
47 this->SetGlobalPointIdsArrayName(PVUGGCG_GLOBAL_POINT_IDS);
50 //----------------------------------------------------------------------------
51 vtkPVUnstructuredGridGhostCellsGenerator::~vtkPVUnstructuredGridGhostCellsGenerator()
53 this->SetController(NULL);
54 this->SetGlobalPointIdsArrayName(NULL);
57 //-----------------------------------------------------------------------------
58 void vtkPVUnstructuredGridGhostCellsGenerator::PrintSelf(ostream& os, vtkIndent indent)
60 Superclass::PrintSelf(os, indent);
63 //-----------------------------------------------------------------------------
64 int vtkPVUnstructuredGridGhostCellsGenerator::RequestData(
65 vtkInformation *vtkNotUsed(request),
66 vtkInformationVector **inputVector,
67 vtkInformationVector *outputVector)
69 // get the info objects
70 vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
71 vtkInformation *outInfo = outputVector->GetInformationObject(0);
73 // get the input and output. Input may just have the UnstructuredGridBase
74 // interface, but output should be an unstructured grid.
75 vtkUnstructuredGridBase *input = vtkUnstructuredGridBase::SafeDownCast(
76 inInfo->Get(vtkDataObject::DATA_OBJECT()));
77 vtkUnstructuredGrid *output = vtkUnstructuredGrid::SafeDownCast(
78 outInfo->Get(vtkDataObject::DATA_OBJECT()));
79 #ifdef PARAVIEW_USE_MPI
80 vtkNew<vtkPUnstructuredGridGhostCellsGenerator> ghostGenerator;
81 ghostGenerator->SetInputData(input);
82 ghostGenerator->SetController(this->Controller);
83 ghostGenerator->SetUseGlobalPointIds(this->UseGlobalPointIds);
84 ghostGenerator->SetGlobalPointIdsArrayName(this->GlobalPointIdsArrayName);
85 ghostGenerator->Update();
86 output->ShallowCopy(ghostGenerator->GetOutput());
88 output->ShallowCopy(input);