------------------------------------------------------------------------------ Need to add better error checking
| 142 | //------------------------------------------------------------------------------ |
| 143 | // Need to add better error checking |
| 144 | int vtkCommunicator::Send(vtkDataObject* data, int remoteHandle, int tag) |
| 145 | { |
| 146 | // If the receiving end is using with ANY_SOURCE, we have a problem because |
| 147 | // some versions of MPI might deliver the multiple data objects require out of |
| 148 | // order. To get around this, on the first message we send the actual source |
| 149 | // and a mangled tag. The remote process then receives the rest of the |
| 150 | // messages with the specific source and mangled tag, which are guaranteed to |
| 151 | // be received in the correct order. |
| 152 | static int tagMangler = 1000; |
| 153 | int mangledTag = tag + tagMangler++; |
| 154 | int header[2]; |
| 155 | header[0] = this->LocalProcessId; |
| 156 | header[1] = mangledTag; |
| 157 | this->Send(header, 2, remoteHandle, tag); |
| 158 | tag = mangledTag; |
| 159 | |
| 160 | int data_type = data ? data->GetDataObjectType() : -1; |
| 161 | this->Send(&data_type, 1, remoteHandle, tag); |
| 162 | |
| 163 | switch (data_type) |
| 164 | { |
| 165 | case -1: |
| 166 | // nullptr data. |
| 167 | return 1; |
| 168 | |
| 169 | // error on types we can't send |
| 170 | case VTK_DATA_OBJECT: |
| 171 | case VTK_DATA_SET: |
| 172 | case VTK_PIECEWISE_FUNCTION: |
| 173 | case VTK_POINT_SET: |
| 174 | case VTK_UNIFORM_GRID: |
| 175 | case VTK_GENERIC_DATA_SET: |
| 176 | case VTK_HYPER_OCTREE: |
| 177 | case VTK_COMPOSITE_DATA_SET: |
| 178 | case VTK_HIERARCHICAL_BOX_DATA_SET: // obsolete |
| 179 | case VTK_MULTIGROUP_DATA_SET: // obsolete |
| 180 | case VTK_HIERARCHICAL_DATA_SET: // obsolete |
| 181 | default: |
| 182 | vtkWarningMacro(<< "Cannot send " << data->GetClassName()); |
| 183 | return 0; |
| 184 | |
| 185 | // send elemental data objects |
| 186 | case VTK_DIRECTED_GRAPH: |
| 187 | case VTK_UNDIRECTED_GRAPH: |
| 188 | case VTK_IMAGE_DATA: |
| 189 | case VTK_POLY_DATA: |
| 190 | case VTK_RECTILINEAR_GRID: |
| 191 | case VTK_STRUCTURED_GRID: |
| 192 | case VTK_STRUCTURED_POINTS: |
| 193 | case VTK_TABLE: |
| 194 | case VTK_TREE: |
| 195 | case VTK_UNSTRUCTURED_GRID: |
| 196 | case VTK_MULTIBLOCK_DATA_SET: |
| 197 | case VTK_UNIFORM_GRID_AMR: |
| 198 | case VTK_OVERLAPPING_AMR: |
| 199 | case VTK_PARTITIONED_DATA_SET: |
| 200 | case VTK_PARTITIONED_DATA_SET_COLLECTION: |
| 201 | return this->SendElementalDataObject(data, remoteHandle, tag); |