Commit a8e18643 authored by Utkarsh Ayachit's avatar Utkarsh Ayachit Committed by Kitware Robot
Browse files

Merge topic '15445_fix_d3_issues'

1be51c35 BUG #15445: Handle empty input datasets in vtkDistributedDataFilter.
e449dfef

 Use AllGather instead of custom implementation of the same.
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Reviewed-by: Berk Geveci's avatarBerk Geveci <berk.geveci@kitware.com>
Merge-request: !400
parents 083f263c 1be51c35
......@@ -1089,6 +1089,17 @@ vtkDataSet *vtkDistributedDataFilter::TestFixTooFewInputFiles(vtkDataSet *input)
}
}
if (numTotalCells == 0)
{
// Nothing to do.
// Based on the comments in RequestData() where this method is called, if
// this method returns NULL, it indicates that there's no distribution to be
// done. That's indeed the case for empty datasets. Hence we'll return NULL.
delete[] nodeType;
inputSize->Delete();
return NULL;
}
if (numConsumers == 0)
{
// Nothing to do. Every process has input data.
......@@ -1954,55 +1965,19 @@ vtkUnstructuredGrid *
}
// ----------------------- Fast versions ----------------------------//
vtkIdTypeArray *vtkDistributedDataFilter::ExchangeCountsFast(vtkIdType myCount, int tag)
vtkIdTypeArray *vtkDistributedDataFilter::ExchangeCountsFast(
vtkIdType myCount, int vtkNotUsed(tag))
{
vtkIdTypeArray *countArray = NULL;
vtkIdType i;
int nprocs = this->NumProcesses;
int me = this->MyId;
vtkMPICommunicator::Request *req = new vtkMPICommunicator::Request [nprocs];
vtkMPIController *mpiContr = vtkMPIController::SafeDownCast(this->Controller);
vtkIdType *counts = new vtkIdType [nprocs];
counts[me] = myCount;
for (i = 0; i < nprocs; i++)
{
if (i == me)
{
continue;
}
mpiContr->NoBlockReceive(counts + i, 1, i, tag, req[i]);
}
mpiContr->Barrier();
for (i = 0; i < nprocs; i++)
{
if (i == me)
{
continue;
}
mpiContr->Send(&myCount, 1, i, tag);
}
this->Controller->AllGather(&myCount, counts, 1);
countArray = vtkIdTypeArray::New();
countArray->SetArray(counts, nprocs, 0,
vtkIdTypeArray::VTK_DATA_ARRAY_DELETE);
for (i = 0; i < nprocs; i++)
{
if (i == me)
{
continue;
}
req[i].Wait();
}
delete [] req;
return countArray;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment