------------------------------------------------------------------------------
| 55 | |
| 56 | //------------------------------------------------------------------------------ |
| 57 | void vtkHyperTreeGridGhostCellsGenerator::ExchangeHTGMetadata(vtkHyperTreeGrid* inputHTG) |
| 58 | { |
| 59 | int metadataSourceProcess = 0; |
| 60 | double* bounds = inputHTG->GetBounds(); |
| 61 | int processInit = bounds[0] <= bounds[1] ? this->Controller->GetLocalProcessId() |
| 62 | : std::numeric_limits<int>::max(); |
| 63 | this->Controller->AllReduce(&processInit, &metadataSourceProcess, 1, vtkCommunicator::MIN_OP); |
| 64 | vtkDebugMacro("Metadata source process is " << metadataSourceProcess); |
| 65 | |
| 66 | // Exchange BranchFactor |
| 67 | int branchFactor = inputHTG->GetBranchFactor(); |
| 68 | this->Controller->Broadcast(&branchFactor, 1, metadataSourceProcess); |
| 69 | inputHTG->SetBranchFactor(branchFactor); |
| 70 | |
| 71 | // Exchange DepthLimiter |
| 72 | int depth = inputHTG->GetDepthLimiter(); |
| 73 | this->Controller->Broadcast(&depth, 1, metadataSourceProcess); |
| 74 | inputHTG->SetDepthLimiter(depth); |
| 75 | |
| 76 | // Exchange TransposedRootIndexing |
| 77 | int transposedRoot = inputHTG->GetTransposedRootIndexing(); |
| 78 | this->Controller->Broadcast(&transposedRoot, 1, metadataSourceProcess); |
| 79 | inputHTG->SetTransposedRootIndexing(transposedRoot); |
| 80 | |
| 81 | // Exchange Dimensions |
| 82 | int dims[3]; |
| 83 | inputHTG->GetDimensions(dims); |
| 84 | this->Controller->Broadcast(dims, 3, metadataSourceProcess); |
| 85 | inputHTG->SetDimensions(dims); |
| 86 | |
| 87 | // Exchange Interface |
| 88 | int hasInterface = inputHTG->GetHasInterface(); |
| 89 | this->Controller->Broadcast(&hasInterface, 1, metadataSourceProcess); |
| 90 | inputHTG->SetHasInterface(hasInterface); |
| 91 | if (hasInterface) |
| 92 | { |
| 93 | int interfaceNameSize; |
| 94 | std::string interfaceName; |
| 95 | |
| 96 | if (this->Controller->GetLocalProcessId() == metadataSourceProcess) |
| 97 | { |
| 98 | interfaceName = inputHTG->GetInterfaceNormalsName(); |
| 99 | interfaceNameSize = static_cast<int>(interfaceName.size()); |
| 100 | } |
| 101 | this->Controller->Broadcast(&interfaceNameSize, 1, metadataSourceProcess); |
| 102 | this->Controller->Broadcast( |
| 103 | const_cast<char*>(interfaceName.c_str()), interfaceNameSize + 1, metadataSourceProcess); |
| 104 | inputHTG->SetInterfaceNormalsName(interfaceName.c_str()); |
| 105 | |
| 106 | if (this->Controller->GetLocalProcessId() == metadataSourceProcess) |
| 107 | { |
| 108 | interfaceName = inputHTG->GetInterfaceInterceptsName(); |
| 109 | interfaceNameSize = static_cast<int>(interfaceName.size()); |
| 110 | } |
| 111 | this->Controller->Broadcast(&interfaceNameSize, 1, metadataSourceProcess); |
| 112 | this->Controller->Broadcast( |
| 113 | const_cast<char*>(interfaceName.c_str()), interfaceNameSize + 1, metadataSourceProcess); |
| 114 | inputHTG->SetInterfaceInterceptsName(interfaceName.c_str()); |
no test coverage detected