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

Method TestFixTooFewInputFiles

Filters/ParallelGeometry/vtkPDistributedDataFilter.cxx:834–1117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

832}
833
834VTK_ABI_NAMESPACE_BEGIN
835
836//------------------------------------------------------------------------------
837vtkDataSet* vtkPDistributedDataFilter::TestFixTooFewInputFiles(
838 vtkDataSet* input, int& duplicateCells)
839{
840 TimeLog timer("TestFixTooFewInputFiles", this->Timing);
841 (void)timer;
842
843 vtkIdType i;
844 int proc;
845 int me = this->MyId;
846 int nprocs = this->NumProcesses;
847
848 vtkIdType numMyCells = input->GetNumberOfCells();
849
850 // Find out how many input cells each process has.
851
852 vtkIdTypeArray* inputSize = this->ExchangeCounts(numMyCells, 0x0001);
853 vtkIdType* sizes = inputSize->GetPointer(0);
854
855 int* nodeType = new int[nprocs];
856 const int Producer = 1;
857 const int Consumer = 2;
858 int numConsumers = 0;
859 vtkIdType numTotalCells = 0;
860
861 for (proc = 0; proc < nprocs; proc++)
862 {
863 numTotalCells += sizes[proc];
864 if (sizes[proc] == 0)
865 {
866 numConsumers++;
867 nodeType[proc] = Consumer;
868 }
869 else
870 {
871 nodeType[proc] = Producer;
872 }
873 }
874
875 if (numTotalCells == 0)
876 {
877 // Nothing to do.
878 // Based on the comments in RequestData() where this method is called, if
879 // this method returns nullptr, it indicates that there's no distribution to be
880 // done. That's indeed the case for empty datasets. Hence we'll return nullptr.
881 delete[] nodeType;
882 inputSize->Delete();
883 return nullptr;
884 }
885
886 if (numConsumers == 0)
887 {
888 // Nothing to do. Every process has input data.
889
890 delete[] nodeType;
891 inputSize->Delete();

Callers 1

RequestDataInternalMethod · 0.95

Calls 14

ExchangeCountsMethod · 0.95
ExchangeMergeSubGridsMethod · 0.95
fill_nFunction · 0.85
SetNumberOfIdsMethod · 0.80
DeleteMethod · 0.65
NewInstanceFunction · 0.50
NewFunction · 0.50
GetNumberOfCellsMethod · 0.45
GetPointerMethod · 0.45
ShallowCopyMethod · 0.45

Tested by

no test coverage detected