44 for (label i=0; i <
n; ++i)
46 for (
direction cmpt=0; cmpt < nCmpt; ++cmpt)
61 for (
const Type& val :
values)
68 template<
class Type,
unsigned N>
72 const FixedList<Type, N>&
values 75 for (
const Type& val :
values)
90 for (
const label idx : addressing)
101 const UList<Type>&
values,
102 const bitSet& selected
105 for (
const label idx : selected)
116 const UList<Type>&
values,
117 const UList<Type>& indirect,
134 if constexpr (!is_contiguous_v<Type>)
138 <<
"Contiguous data only" <<
endl 143 const List<label> counts(UPstream::listGatherValues(
count));
144 const List<Type>
values(UPstream::listGatherValues(val));
146 if (Pstream::master())
164 if constexpr (!is_contiguous_v<Type>)
168 <<
"Contiguous data only" <<
endl 174 const globalIndex
procAddr(globalIndex::gatherOnly{},
values.size());
177 if (Pstream::master())
183 DynamicList<Type> recvData(
procAddr.maxNonLocalSize());
185 for (
const label proci :
procAddr.subProcs())
187 const label procSize =
procAddr.localSize(proci);
191 recvData.resize_nocopy(procSize);
194 UPstream::commsTypes::scheduled,
208 UPstream::commsTypes::scheduled,
209 UPstream::masterNo(),
221 const UList<Type>&
values,
225 if constexpr (!is_contiguous_v<Type>)
229 <<
"Contiguous data only" <<
endl 235 if (!Pstream::master())
237 sendData = UIndirectList<Type>(
values, addressing);
241 const globalIndex
procAddr(globalIndex::gatherOnly{}, sendData.size());
244 if (Pstream::master())
250 DynamicList<Type> recvData(
procAddr.maxNonLocalSize());
252 for (
const label proci :
procAddr.subProcs())
254 const label procSize =
procAddr.localSize(proci);
258 recvData.resize_nocopy(procSize);
261 UPstream::commsTypes::scheduled,
275 UPstream::commsTypes::scheduled,
276 UPstream::masterNo(),
288 const UList<Type>&
values,
289 const bitSet& selected
292 if constexpr (!is_contiguous_v<Type>)
296 <<
"Contiguous data only" <<
endl 302 if (!Pstream::master())
308 const globalIndex
procAddr(globalIndex::gatherOnly{}, sendData.size());
311 if (Pstream::master())
317 DynamicList<Type> recvData(
procAddr.maxNonLocalSize());
319 for (
const label proci :
procAddr.subProcs())
321 const label procSize =
procAddr.localSize(proci);
325 recvData.resize_nocopy(procSize);
329 UPstream::commsTypes::scheduled,
343 UPstream::commsTypes::scheduled,
344 UPstream::masterNo(),
356 const UList<Type>& values1,
357 const UList<Type>& values2
360 if constexpr (!is_contiguous_v<Type>)
364 <<
"Contiguous data only" <<
endl 370 const globalIndex procAddr1(globalIndex::gatherOnly{}, values1.size());
371 const globalIndex procAddr2(globalIndex::gatherOnly{}, values2.size());
374 if (Pstream::master())
381 DynamicList<Type> recvData
383 max(procAddr1.maxNonLocalSize(), procAddr2.maxNonLocalSize())
386 for (
const label proci : procAddr1.subProcs())
389 label procSize = procAddr1.localSize(proci);
393 recvData.resize_nocopy(procSize);
396 UPstream::commsTypes::scheduled,
404 procSize = procAddr2.localSize(proci);
408 recvData.resize_nocopy(procSize);
411 UPstream::commsTypes::scheduled,
425 UPstream::commsTypes::scheduled,
426 UPstream::masterNo(),
435 UPstream::commsTypes::scheduled,
436 UPstream::masterNo(),
448 const UList<Type>& values1,
449 const UList<Type>& values2,
453 if constexpr (!is_contiguous_v<Type>)
457 <<
"Contiguous data only" <<
endl 462 List<Type> sendData2;
463 if (!Pstream::master())
465 sendData2 = UIndirectList<Type>(values2, addressing);
470 const globalIndex procAddr1(globalIndex::gatherOnly{}, values1.size());
471 const globalIndex procAddr2(globalIndex::gatherOnly{}, sendData2.size());
474 if (Pstream::master())
482 DynamicList<Type> recvData
484 max(procAddr1.maxNonLocalSize(), procAddr2.maxNonLocalSize())
487 for (
const label proci : procAddr1.subProcs())
490 label procSize = procAddr1.localSize(proci);
494 recvData.resize_nocopy(procSize);
497 UPstream::commsTypes::scheduled,
505 procSize = procAddr2.localSize(proci);
509 recvData.resize_nocopy(procSize);
512 UPstream::commsTypes::scheduled,
526 UPstream::commsTypes::scheduled,
527 UPstream::masterNo(),
532 if (sendData2.size())
536 UPstream::commsTypes::scheduled,
537 UPstream::masterNo(),
void writeLists(vtk::formatter &fmt, const UList< Type > &values1, const UList< Type > &values2, const labelUList &addressing)
Write a list of values and a list of values via indirect addressing.
errorManipArg< error, int > exit(error &err, const int errNo=1)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Ostream & endl(Ostream &os)
Add newline and flush stream.
A traits class, which is primarily used for primitives and vector-space.
void writeListsParallel(vtk::formatter &fmt, const UList< Type > &values1, const UList< Type > &values2)
Write a list of values and another list of values.
UList< label > labelUList
A UList of labels.
Various functions to operate on Lists.
#define forAll(list, i)
Loop across all elements in list.
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of 'true' entries.
void writeList(vtk::formatter &fmt, const UList< uint8_t > &values)
Write a list of uint8_t values.
List< T > subset(const BoolListType &select, const UList< T > &input, const bool invert=false)
Extract elements of the input list when select is true.
globalIndex procAddr(aMesh.nFaces())
void writeListParallel(vtk::formatter &fmt, const UList< Type > &values)
Write a list of values.
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
void writeValueParallel(vtk::formatter &fmt, const Type &val, const label count=1)
Component-wise write of a value (N times) in parallel.