| 832 | } |
| 833 | |
| 834 | VTK_ABI_NAMESPACE_BEGIN |
| 835 | |
| 836 | //------------------------------------------------------------------------------ |
| 837 | vtkDataSet* 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(); |
no test coverage detected