Generate a processor dirname from number or tuple. For 1 component: procNum -> 'processor ' For 3 component tuple (nprocs, first, size) - processors , when first == size == 0 - processors _ - , where last is inclusive
| 119 | // - processors<nprocs>, when first == size == 0 |
| 120 | // - processors<nprocs>_<first>-<last>, where last is inclusive |
| 121 | std::string ProcessorDirName(const vtkIntArray* dirs, int index) |
| 122 | { |
| 123 | if (index < 0 || index >= dirs->GetNumberOfTuples()) |
| 124 | { |
| 125 | return std::string(); |
| 126 | } |
| 127 | else if (3 == dirs->GetNumberOfComponents()) |
| 128 | { |
| 129 | // Collated name |
| 130 | const auto nprocs = dirs->GetTypedComponent(index, 0); |
| 131 | const auto first = dirs->GetTypedComponent(index, 1); |
| 132 | const auto size = dirs->GetTypedComponent(index, 2); |
| 133 | |
| 134 | std::string stem("processors" + vtk::to_string(nprocs)); |
| 135 | if (size) |
| 136 | { |
| 137 | const auto last = (first + size - 1); // inclusive range |
| 138 | return (stem + "_" + vtk::to_string(first) + "-" + vtk::to_string(last)); |
| 139 | } |
| 140 | return stem; |
| 141 | } |
| 142 | |
| 143 | // Uncollated name |
| 144 | return std::string("processor" + vtk::to_string(dirs->GetValue(index))); |
| 145 | } |
| 146 | |
| 147 | #if VTK_FOAMFILE_COLLATED_FORMAT |
| 148 | // Number of processor pieces represented by the tuple |
no test coverage detected