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,
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 (!is_contiguous<Type>::value)
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,
196 recvData.data_bytes(),
197 recvData.size_bytes()
209 UPstream::commsTypes::scheduled,
210 UPstream::masterNo(),
223 const UList<Type>&
values,
227 if (!is_contiguous<Type>::value)
231 <<
"Contiguous data only" <<
endl 237 if (!Pstream::master())
239 sendData = UIndirectList<Type>(
values, addressing);
243 const globalIndex
procAddr(globalIndex::gatherOnly{}, sendData.size());
246 if (Pstream::master())
252 DynamicList<Type> recvData(
procAddr.maxNonLocalSize());
254 for (
const label proci :
procAddr.subProcs())
256 const label procSize =
procAddr.localSize(proci);
260 recvData.resize_nocopy(procSize);
263 UPstream::commsTypes::scheduled,
265 recvData.data_bytes(),
266 recvData.size_bytes()
278 UPstream::commsTypes::scheduled,
279 UPstream::masterNo(),
280 sendData.cdata_bytes(),
281 sendData.size_bytes()
292 const UList<Type>&
values,
293 const bitSet& selected
296 if (!is_contiguous<Type>::value)
300 <<
"Contiguous data only" <<
endl 306 if (!Pstream::master())
312 const globalIndex
procAddr(globalIndex::gatherOnly{}, sendData.size());
315 if (Pstream::master())
321 DynamicList<Type> recvData(
procAddr.maxNonLocalSize());
323 for (
const label proci :
procAddr.subProcs())
325 const label procSize =
procAddr.localSize(proci);
329 recvData.resize_nocopy(procSize);
333 UPstream::commsTypes::scheduled,
335 recvData.data_bytes(),
336 recvData.size_bytes()
348 UPstream::commsTypes::scheduled,
349 UPstream::masterNo(),
350 sendData.cdata_bytes(),
351 sendData.size_bytes()
362 const UList<Type>& values1,
363 const UList<Type>& values2
366 if (!is_contiguous<Type>::value)
370 <<
"Contiguous data only" <<
endl 376 const globalIndex procAddr1(globalIndex::gatherOnly{}, values1.size());
377 const globalIndex procAddr2(globalIndex::gatherOnly{}, values2.size());
380 if (Pstream::master())
387 DynamicList<Type> recvData
389 max(procAddr1.maxNonLocalSize(), procAddr2.maxNonLocalSize())
392 for (
const label proci : procAddr1.subProcs())
395 label procSize = procAddr1.localSize(proci);
399 recvData.resize_nocopy(procSize);
402 UPstream::commsTypes::scheduled,
404 recvData.data_bytes(),
405 recvData.size_bytes()
411 procSize = procAddr2.localSize(proci);
415 recvData.resize_nocopy(procSize);
418 UPstream::commsTypes::scheduled,
420 recvData.data_bytes(),
421 recvData.size_bytes()
433 UPstream::commsTypes::scheduled,
434 UPstream::masterNo(),
435 values1.cdata_bytes(),
444 UPstream::commsTypes::scheduled,
445 UPstream::masterNo(),
446 values2.cdata_bytes(),
458 const UList<Type>& values1,
459 const UList<Type>& values2,
463 if (!is_contiguous<Type>::value)
467 <<
"Contiguous data only" <<
endl 472 List<Type> sendData2;
473 if (!Pstream::master())
475 sendData2 = UIndirectList<Type>(values2, addressing);
480 const globalIndex procAddr1(globalIndex::gatherOnly{}, values1.size());
481 const globalIndex procAddr2(globalIndex::gatherOnly{}, sendData2.size());
484 if (Pstream::master())
492 DynamicList<Type> recvData
494 max(procAddr1.maxNonLocalSize(), procAddr2.maxNonLocalSize())
497 for (
const label proci : procAddr1.subProcs())
500 label procSize = procAddr1.localSize(proci);
504 recvData.resize_nocopy(procSize);
507 UPstream::commsTypes::scheduled,
509 recvData.data_bytes(),
510 recvData.size_bytes()
516 procSize = procAddr2.localSize(proci);
520 recvData.resize_nocopy(procSize);
523 UPstream::commsTypes::scheduled,
525 recvData.data_bytes(),
526 recvData.size_bytes()
538 UPstream::commsTypes::scheduled,
539 UPstream::masterNo(),
540 values1.cdata_bytes(),
545 if (sendData2.size())
549 UPstream::commsTypes::scheduled,
550 UPstream::masterNo(),
551 sendData2.cdata_bytes(),
552 sendData2.size_bytes()
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())
A template class to specify that a data type can be considered as being contiguous in memory...
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.