| 4012 | // We omit cells the remote process already has. |
| 4013 | |
| 4014 | vtkIdList** vtkPDistributedDataFilter::BuildRequestedGrids(vtkIdTypeArray** globalPtIds, |
| 4015 | vtkUnstructuredGrid* grid, vtkPDistributedDataFilterSTLCloak* ptIdMap) |
| 4016 | { |
| 4017 | TimeLog timer("BuildRequestedGrids", this->Timing); |
| 4018 | (void)timer; |
| 4019 | |
| 4020 | vtkIdType id; |
| 4021 | int proc; |
| 4022 | int nprocs = this->NumProcesses; |
| 4023 | vtkIdType cellId; |
| 4024 | vtkIdType nelts; |
| 4025 | |
| 4026 | // for each process, create a list of the ids of cells I need |
| 4027 | // to send to it |
| 4028 | |
| 4029 | std::map<int, int>::iterator imap; |
| 4030 | |
| 4031 | vtkIdList* cellList = vtkIdList::New(); |
| 4032 | |
| 4033 | vtkIdList** sendCells = new vtkIdList*[nprocs]; |
| 4034 | |
| 4035 | for (proc = 0; proc < nprocs; proc++) |
| 4036 | { |
| 4037 | sendCells[proc] = vtkIdList::New(); |
| 4038 | |
| 4039 | if (globalPtIds[proc] == nullptr) |
| 4040 | { |
| 4041 | continue; |
| 4042 | } |
| 4043 | |
| 4044 | if ((nelts = globalPtIds[proc]->GetNumberOfTuples()) == 0) |
| 4045 | { |
| 4046 | globalPtIds[proc]->Delete(); |
| 4047 | continue; |
| 4048 | } |
| 4049 | |
| 4050 | vtkIdType* ptarray = globalPtIds[proc]->GetPointer(0); |
| 4051 | |
| 4052 | std::set<vtkIdType> subGridCellIds; |
| 4053 | |
| 4054 | vtkIdType nYourCells = 0; |
| 4055 | |
| 4056 | for (id = 0; id < nelts; id += (nYourCells + 2)) |
| 4057 | { |
| 4058 | vtkIdType ptId = ptarray[id]; |
| 4059 | nYourCells = ptarray[id + 1]; |
| 4060 | |
| 4061 | imap = ptIdMap->IntMap.find(ptId); |
| 4062 | |
| 4063 | if (imap == ptIdMap->IntMap.end()) |
| 4064 | { |
| 4065 | continue; // I don't have this point |
| 4066 | } |
| 4067 | |
| 4068 | vtkIdType myPtId = (vtkIdType)imap->second; // convert to my local point Id |
| 4069 | |
| 4070 | grid->GetPointCells(myPtId, cellList); |
| 4071 |
no test coverage detected