30 template<
class KeyType,
class DataType>
38 template<
class KeyType,
class DataType>
46 template<
class KeyType,
class DataType>
49 const PrintTable<KeyType, DataType>& table
59 template<
class KeyType,
class DataType>
66 template<
class KeyType,
class DataType>
71 const bool printAverage
74 HashTable<HashTable<DataType, label>, KeyType> combinedTable;
84 label largestKeyLength = 6;
85 label largestDataLength = 0;
91 const HashTableData& procIData = procData[proci];
95 typename HashTableData::const_iterator iter = procIData.begin();
96 iter != procIData.end();
100 if (!combinedTable.found(iter.key()))
105 HashTable<DataType, label>()
109 HashTable<DataType, label>& key = combinedTable[iter.key()];
111 key.insert(proci, iter());
115 typename HashTable<DataType, label>
117 dataIter != key.end();
121 std::ostringstream buf;
124 largestDataLength =
max 127 label(buf.str().length())
131 std::ostringstream buf;
134 largestKeyLength =
max 137 label(buf.str().length())
142 os.width(largestKeyLength);
143 os <<
nl << indent << tab <<
"# " << title_.c_str() <<
endl;
145 os.
width(largestKeyLength);
146 os << indent <<
"# Proc";
151 os.width(largestDataLength);
158 os.width(largestDataLength);
165 os.width(largestDataLength);
171 const List<KeyType>& sortedTable = combinedTable.sortedToc();
175 const HashTable<DataType, label>& procDataList
176 = combinedTable[sortedTable[keyI]];
178 os.width(largestKeyLength);
179 os << indent << sortedTable[keyI];
181 forAll(procDataList, elemI)
184 os.width(largestDataLength);
185 os << procDataList[elemI];
191 forAll(procDataList, elemI)
193 sum += procDataList[elemI];
197 os.width(largestDataLength);
203 os.width(largestDataLength);
PrintTable()
Null constructor.
#define forAll(list, i)
Loop across all elements in list.
HashTable< nil, Key, Hash >::const_iterator const_iterator
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
Ostream & endl(Ostream &os)
Add newline and flush stream.
static bool master(const label communicator=0)
Am I the master process.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
iterator begin()
Iterator set to the beginning of the HashTable.
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.
static label nProcs(const label communicator=0)
Number of processes in parallel run.
static void gatherList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Gather data but keep individual values separate.