----------------------------------------------------------------------------
| 244 | |
| 245 | //---------------------------------------------------------------------------- |
| 246 | int vtkConduitSource::RequestData( |
| 247 | vtkInformation*, vtkInformationVector**, vtkInformationVector* outputVector) |
| 248 | { |
| 249 | auto& internals = (*this->Internals); |
| 250 | vtkDataObject* real_output = vtkDataObject::GetData(outputVector, 0); |
| 251 | |
| 252 | bool dataGenerated = false; |
| 253 | if (this->UseAMRMeshProtocol) |
| 254 | { |
| 255 | dataGenerated = this->GenerateAMR(real_output); |
| 256 | } |
| 257 | else if (this->UseMultiMeshProtocol) |
| 258 | { |
| 259 | dataGenerated = this->GeneratePartitionedDataSetCollection(real_output); |
| 260 | } |
| 261 | else |
| 262 | { |
| 263 | dataGenerated = this->GeneratePartitionedDataSet(real_output); |
| 264 | } |
| 265 | |
| 266 | // Check wether all ranks successfully generated the data. If at least one rank failed, we need to |
| 267 | // return 0 on every nodes to prevent code hanging in the pipeline. |
| 268 | vtkMultiProcessController* controller = vtkMultiProcessController::GetGlobalController(); |
| 269 | std::vector<int> allDataGenerationResults(controller->GetNumberOfProcesses()); |
| 270 | int dataGenerationLocalResult = dataGenerated; |
| 271 | controller->AllGather(&dataGenerationLocalResult, allDataGenerationResults.data(), 1); |
| 272 | |
| 273 | for (size_t nodeIdx = 0; nodeIdx < allDataGenerationResults.size(); nodeIdx++) |
| 274 | { |
| 275 | if (!allDataGenerationResults[nodeIdx]) |
| 276 | { |
| 277 | vtkLogF(ERROR, "Data generation failure on process %lu", nodeIdx); |
| 278 | return 0; |
| 279 | } |
| 280 | } |
| 281 | |
| 282 | if (this->OutputMultiBlock) |
| 283 | { |
| 284 | vtkNew<vtkConvertToMultiBlockDataSet> converter; |
| 285 | converter->SetInputData(real_output); |
| 286 | converter->Update(); |
| 287 | real_output->ShallowCopy(converter->GetOutput()); |
| 288 | } |
| 289 | |
| 290 | if (internals.GlobalFieldsNodeValid) |
| 291 | { |
| 292 | vtkConduitToDataObject::AddFieldData( |
| 293 | real_output, internals.GlobalFieldsNode, /*isAMReX=*/false); |
| 294 | } |
| 295 | |
| 296 | if (internals.Node.has_path("state/fields")) |
| 297 | { |
| 298 | vtkConduitToDataObject::AddFieldData(real_output, internals.Node["state/fields"]); |
| 299 | } |
| 300 | |
| 301 | return 1; |
| 302 | } |
| 303 |
nothing calls this directly
no test coverage detected