MCPcopy Create free account
hub / github.com/Kitware/VTK / RequestData

Method RequestData

Filters/ParallelDIY2/vtkProbeLineFilter.cxx:863–959  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

861
862//------------------------------------------------------------------------------
863int vtkProbeLineFilter::RequestData(
864 vtkInformation*, vtkInformationVector** inputVector, vtkInformationVector* outputVector)
865{
866 // Check inputs / outputs
867 vtkInformation* inputInfo = inputVector[0]->GetInformationObject(0);
868 vtkInformation* samplerInfo = inputVector[1]->GetInformationObject(0);
869 vtkInformation* outInfo = outputVector->GetInformationObject(0);
870 if (!outInfo || !inputInfo || !samplerInfo)
871 {
872 vtkErrorMacro("Missing input or output information");
873 return 0;
874 }
875
876 vtkDataObject* input = inputInfo->Get(vtkDataObject::DATA_OBJECT());
877 auto* samplerLocal = vtkPointSet::SafeDownCast(samplerInfo->Get(vtkDataObject::DATA_OBJECT()));
878 auto* output = outInfo->Get(vtkDataObject::DATA_OBJECT());
879 bool outputIsValid = this->AggregateAsPolyData
880 ? vtkPolyData::SafeDownCast(output) != nullptr
881 : vtkMultiBlockDataSet::SafeDownCast(output) != nullptr;
882 if (!output || !input || !samplerLocal || !outputIsValid)
883 {
884 vtkErrorMacro("Missing input or output");
885 return 0;
886 }
887
888 // The probe locations source need to be the same on all ranks : always take rank 0 source
889 auto sampler = vtkSmartPointer<vtkPointSet>::Take(samplerLocal->NewInstance());
890 if (this->Controller->GetLocalProcessId() == 0)
891 {
892 this->Controller->Broadcast(samplerLocal, 0);
893 sampler->ShallowCopy(samplerLocal);
894 }
895 else
896 {
897 this->Controller->Broadcast(sampler, 0);
898 }
899
900 // Compute tolerance if needed
901 double tolerance = this->Tolerance;
902 if (this->ComputeTolerance)
903 {
904 double bounds[6] = { 0, 0, 0, 0, 0, 0 };
905 if (auto cds = vtkCompositeDataSet::SafeDownCast(input))
906 {
907 cds->GetBounds(bounds);
908 }
909 else if (auto ds = vtkDataSet::SafeDownCast(input))
910 {
911 ds->GetBounds(bounds);
912 }
913 else if (auto htg = vtkHyperTreeGrid::SafeDownCast(input))
914 {
915 htg->GetBounds(bounds);
916 }
917 vtkBoundingBox bb(bounds);
918 if (bb.IsValid())
919 {
920 tolerance = std::numeric_limits<float>::epsilon() * bb.GetDiagonalLength();

Callers

nothing calls this directly

Calls 15

TakeFunction · 0.85
GetInformationObjectMethod · 0.80
UpdateLocatorsMethod · 0.80
GoToNextCellMethod · 0.80
SetNumberOfBlocksMethod · 0.80
SetBlockMethod · 0.80
GetBlockMethod · 0.80
GetMethod · 0.45
NewInstanceMethod · 0.45
GetLocalProcessIdMethod · 0.45
BroadcastMethod · 0.45

Tested by

no test coverage detected