32 template<
class KeyType,
class DataType>
40 template<
class KeyType,
class DataType>
48 template<
class KeyType,
class DataType>
51 const PrintTable<KeyType, DataType>& table
61 template<
class KeyType,
class DataType>
66 const bool printAverage
69 HashTable<Map<DataType>, KeyType> combinedTable;
79 label largestKeyLength = 6;
80 label largestDataLength = 0;
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);
163 os <<
indent << sortedTable[keyI];
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);
PrintTable()
Null constructor.
Ostream & indent(Ostream &os)
Indent stream.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
static int myProcNo(label communicator=worldComm)
Rank of this process in the communicator (starting from masterNo()). Negative if the process is not a...
constexpr char tab
The tab '\t' character(0x09)
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &f1, const label comm)
static void gatherList(UList< T > &values, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Gather data, but keep individual values separate.
#define forAll(list, i)
Loop across all elements in list.
virtual int width() const =0
Get width of output field.
void print(Ostream &os, const bool printSum=false, const bool printAverage=false) const
Print the table.
constexpr auto key(const Type &t) noexcept
Helper function to return the enum value.
static label nProcs(label communicator=worldComm)
Number of ranks in parallel run (for given communicator). It is 1 for serial run. ...
static bool master(label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
List< label > labelList
A List of labels.
forAllConstIters(mixture.phases(), phase)
static constexpr const zero Zero
Global zero (0)