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

Method UnstructuredGridExecute

IO/Parallel/vtkPDataSetReader.cxx:818–875  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

816
817//------------------------------------------------------------------------------
818int vtkPDataSetReader::UnstructuredGridExecute(
819 vtkInformation*, vtkInformationVector**, vtkInformationVector* outputVector)
820{
821 vtkInformation* info = outputVector->GetInformationObject(0);
822 vtkUnstructuredGrid* output =
823 vtkUnstructuredGrid::SafeDownCast(info->Get(vtkDataObject::DATA_OBJECT()));
824
825 int updatePiece, updateNumberOfPieces;
826 int startPiece, endPiece;
827 int idx;
828
829 updatePiece = info->Get(vtkStreamingDemandDrivenPipeline::UPDATE_PIECE_NUMBER());
830 updateNumberOfPieces = info->Get(vtkStreamingDemandDrivenPipeline::UPDATE_NUMBER_OF_PIECES());
831
832 // Only the first N pieces have anything in them.
833 updateNumberOfPieces = std::min(updateNumberOfPieces, this->NumberOfPieces);
834 if (updatePiece >= updateNumberOfPieces)
835 { // This duplicates functionality of the pipeline super classes ...
836 return 1;
837 }
838 startPiece = updatePiece * this->NumberOfPieces / updateNumberOfPieces;
839 endPiece = ((updatePiece + 1) * this->NumberOfPieces / updateNumberOfPieces) - 1;
840
841 vtkDataSetReader* reader;
842 vtkAppendFilter* append = vtkAppendFilter::New();
843 for (idx = startPiece; idx <= endPiece; ++idx)
844 {
845 reader = vtkDataSetReader::New();
846 reader->ReadAllScalarsOn();
847 reader->ReadAllVectorsOn();
848 reader->ReadAllNormalsOn();
849 reader->ReadAllTensorsOn();
850 reader->ReadAllColorScalarsOn();
851 reader->ReadAllTCoordsOn();
852 reader->ReadAllFieldsOn();
853 reader->SetFileName(this->PieceFileNames[idx]);
854 reader->Update();
855 if (reader->GetOutput()->GetDataObjectType() != VTK_UNSTRUCTURED_GRID)
856 {
857 vtkErrorMacro("Expecting unstructured grid.");
858 }
859 else
860 {
861 append->AddInputConnection(reader->GetOutputPort());
862 }
863 reader->Delete();
864 }
865
866 append->Update();
867 output->CopyStructure(append->GetOutput());
868 output->GetFieldData()->PassData(append->GetOutput()->GetFieldData());
869 output->GetCellData()->PassData(append->GetOutput()->GetCellData());
870 output->GetPointData()->PassData(append->GetOutput()->GetPointData());
871
872 append->Delete();
873
874 return 1;
875}

Callers 1

RequestDataMethod · 0.95

Calls 15

GetInformationObjectMethod · 0.80
GetDataObjectTypeMethod · 0.80
DeleteMethod · 0.65
minFunction · 0.50
NewFunction · 0.50
GetMethod · 0.45
SetFileNameMethod · 0.45
UpdateMethod · 0.45
GetOutputMethod · 0.45
AddInputConnectionMethod · 0.45
GetOutputPortMethod · 0.45
CopyStructureMethod · 0.45

Tested by

no test coverage detected