32template<
class KeyType,
class DataType>
40template<
class KeyType,
class DataType>
48template<
class KeyType,
class DataType>
51 const PrintTable<KeyType, DataType>& table
61template<
class KeyType,
class DataType>
66 const bool printAverage
69 HashTable<Map<DataType>, KeyType> combinedTable;
71 List<HashTableData> procData(Pstream::nProcs(), HashTableData());
73 procData[Pstream::myProcNo()] = table_;
75 Pstream::gatherList(procData);
77 if (Pstream::master())
79 label largestKeyLength = 6;
80 label largestDataLength = 0;
82 labelList largestProcSize(Pstream::nProcs(), Zero);
86 const HashTableData& procIData = procData[proci];
90 if (!combinedTable.found(iter.key()))
99 Map<DataType>&
key = combinedTable[iter.key()];
101 key.insert(proci, iter.val());
105 std::ostringstream buf;
106 buf << dataIter.val();
108 largestDataLength =
max
111 label(buf.str().length())
115 std::ostringstream buf;
118 largestKeyLength =
max
121 label(buf.str().length())
126 os.width(largestKeyLength);
129 os.width(largestKeyLength);
135 os.width(largestDataLength);
142 os.width(largestDataLength);
149 os.width(largestDataLength);
155 const List<KeyType>& sortedTable = combinedTable.sortedToc();
159 const Map<DataType>& procDataList
160 = combinedTable[sortedTable[keyI]];
162 os.width(largestKeyLength);
165 forAll(procDataList, elemI)
168 os.width(largestDataLength);
169 os << procDataList[elemI];
175 forAll(procDataList, elemI)
177 sum += procDataList[elemI];
181 os.width(largestDataLength);
187 os.width(largestDataLength);
188 os <<
sum/Pstream::nProcs();
PrintTable()
Null constructor.
scalar print()
Print to screen.
OBJstream os(runTime.globalPath()/outputName)
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
List< label > labelList
A List of labels.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Ostream & indent(Ostream &os)
Indent stream.
constexpr char nl
The newline '\n' character (0x0a)
constexpr char tab
The tab '\t' character(0x09)
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIters(container, iter)
Iterate across all elements of the container object with const access.