MCPcopy Create free account
hub / github.com/Kitware/VTK / ProcessorDirName

Function ProcessorDirName

IO/Parallel/vtkPOpenFOAMReader.cxx:121–145  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

119// - processors<nprocs>, when first == size == 0
120// - processors<nprocs>_<first>-<last>, where last is inclusive
121std::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

Callers 1

RequestInformationMethod · 0.85

Calls 6

stringClass · 0.50
to_stringFunction · 0.50
GetNumberOfTuplesMethod · 0.45
GetNumberOfComponentsMethod · 0.45
GetTypedComponentMethod · 0.45
GetValueMethod · 0.45

Tested by

no test coverage detected