33 template<
class T,
class CombineOp,
class negateOp>
40 const negateOp& negOp,
50 label index = map[i]-1;
51 cop(lhs[index], rhs[i]);
55 label index = -map[i]-1;
56 cop(lhs[index], negOp(rhs[i]));
61 <<
"At index " << i <<
" out of " << map.
size()
62 <<
" have illegal index " << map[i]
63 <<
" for field " << rhs.
size() <<
" with flipMap"
72 cop(lhs[map[i]], rhs[i]);
78 template<
class T,
class negateOp>
96 t = negOp(
fld[-index-1]);
101 <<
"Illegal index " << index
102 <<
" into field of size " <<
fld.size()
103 <<
" with face-flipping"
117 template<
class T,
class negateOp>
122 const label constructSize,
124 const bool subHasFlip,
126 const bool constructHasFlip,
128 const negateOp& negOp,
141 subField[i] = accessAndFlip(field, mySubMap[i], subHasFlip, negOp);
179 subField[i] = accessAndFlip
197 subField[i] = accessAndFlip(field, mySubMap[i], subHasFlip, negOp);
218 const labelList& map = constructMap[domain];
225 checkReceivedSize(domain, map.
size(), subField.
size());
244 List<T> newField(constructSize);
253 subField[i] = accessAndFlip
281 label sendProc = twoProcs[0];
282 label recvProc = twoProcs[1];
300 subField[i] = accessAndFlip
320 const labelList& map = constructMap[recvProc];
322 checkReceivedSize(recvProc, map.
size(), subField.
size());
348 const labelList& map = constructMap[sendProc];
350 checkReceivedSize(sendProc, map.
size(), subField.
size());
375 subField[i] = accessAndFlip
393 if (!contiguous<T>())
410 subField[i] = accessAndFlip
418 toDomain << subField;
431 mySubField[i] = accessAndFlip
463 const labelList& map = constructMap[domain];
470 checkReceivedSize(domain, map.
size(), recvField.
size());
496 List<T>& subField = sendFields[domain];
500 subField[i] = accessAndFlip
513 reinterpret_cast<const char*
>(subField.
begin()),
526 const labelList& map = constructMap[domain];
535 reinterpret_cast<char*
>(recvFields[domain].begin()),
536 recvFields[domain].byteSize(),
552 subField[i] = accessAndFlip
594 const labelList& map = constructMap[domain];
598 const List<T>& subField = recvFields[domain];
600 checkReceivedSize(domain, map.
size(), subField.
size());
618 <<
"Unknown communication schedule " << int(commsType)
625 template<
class T,
class CombineOp,
class negateOp>
630 const label constructSize,
632 const bool subHasFlip,
634 const bool constructHasFlip,
636 const CombineOp& cop,
637 const negateOp& negOp,
651 subField[i] = accessAndFlip(field, mySubMap[i], subHasFlip, negOp);
660 flipAndCombine(map, constructHasFlip, subField, cop, negOp, field);
681 subField[i] = accessAndFlip
699 subField[i] = accessAndFlip(field, mySubMap[i], subHasFlip, negOp);
708 flipAndCombine(map, constructHasFlip, subField, cop, negOp, field);
713 const labelList& map = constructMap[domain];
720 checkReceivedSize(domain, map.
size(), subField.
size());
739 List<T> newField(constructSize, nullValue);
748 subField[i] = accessAndFlip
779 label sendProc = twoProcs[0];
780 label recvProc = twoProcs[1];
799 subField[i] = accessAndFlip
818 const labelList& map = constructMap[recvProc];
820 checkReceivedSize(recvProc, map.
size(), subField.
size());
845 const labelList& map = constructMap[sendProc];
847 checkReceivedSize(sendProc, map.
size(), subField.
size());
873 subField[i] = accessAndFlip
891 if (!contiguous<T>())
908 subField[i] = accessAndFlip
916 toDomain << subField;
930 mySubField[i] = accessAndFlip
964 const labelList& map = constructMap[domain];
971 checkReceivedSize(domain, map.
size(), recvField.
size());
997 List<T>& subField = sendFields[domain];
1001 subField[i] = accessAndFlip
1014 reinterpret_cast<const char*
>(subField.
begin()),
1015 subField.
size()*
sizeof(
T),
1027 const labelList& map = constructMap[domain];
1036 reinterpret_cast<char*
>(recvFields[domain].begin()),
1037 recvFields[domain].size()*
sizeof(
T),
1052 subField[i] = accessAndFlip
1094 const labelList& map = constructMap[domain];
1098 const List<T>& subField = recvFields[domain];
1100 checkReceivedSize(domain, map.
size(), subField.
size());
1118 <<
"Unknown communication schedule " << int(commsType)
1145 subField[i] = accessAndFlip
1153 toDomain << subField;
1167 field.
setSize(constructSize_);
1171 const labelList& map = constructMap_[domain];
1178 if (recvField.
size() != map.
size())
1181 <<
"Expected from processor " << domain
1182 <<
" " << map.
size() <<
" but received "
1183 << recvField.
size() <<
" elements."
1202 template<
class T,
class negateOp>
1206 const negateOp& negOp,
1285 distribute(fldList, tag);
1287 fld.setCapacity(fldList.
size());
1295 const label constructSize,
1357 const label constructSize,
Combination-Reduction operation for a parallel run. The information from all nodes is collected on th...
#define forAll(list, i)
Loop across all elements in list.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Input inter-processor communications stream.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void transfer(List< T > &)
Transfer the contents of the argument List into this list.
void size(const label)
Override size to be inconsistent with allocated storage.
void setSize(const label)
Reset size of List.
Output inter-processor communications stream.
Buffers for inter-processor communications streams (UOPstream, UIPstream).
void finishedSends(const bool block=true)
Mark all sends as having been done. This will start receives.
Input inter-processor communications stream operating on external buffer.
static label read(const commsTypes commsType, const int fromProcNo, char *buf, const std::streamsize bufSize, const int tag=UPstream::msgType(), const label communicator=0)
Read into given buffer from given processor and return the.
label size() const
Return the number of elements in the UList.
iterator begin()
Return an iterator to begin traversing the UList.
std::streamsize byteSize() const
Return the binary size in number of characters of the UList.
Output inter-processor communications stream operating on external buffer.
static bool write(const commsTypes commsType, const int toProcNo, const char *buf, const std::streamsize bufSize, const int tag=UPstream::msgType(), const label communicator=0)
Write given buffer to given processor.
commsTypes
Types of communications.
static label nRequests()
Get number of outstanding requests.
static label nProcs(const label communicator=0)
Number of processes in parallel run.
static void waitRequests(const label start=0)
Wait until all requests (from start onwards) have finished.
static bool & parRun()
Is this a parallel run?
static commsTypes defaultCommsType
Default commsType.
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
void reverseDistribute(const label constructSize, List< T > &, const int tag=UPstream::msgType()) const
Reverse distribute data using default commsType.
static void distribute(const Pstream::commsTypes commsType, const List< labelPair > &schedule, const label constructSize, const labelListList &subMap, const bool subHasFlip, const labelListList &constructMap, const bool constructHasFlip, List< T > &, const negateOp &negOp, const int tag=UPstream::msgType())
Distribute data. Note:schedule only used for.
static T accessAndFlip(const UList< T > &fld, const label index, const bool hasFlip, const negateOp &negOp)
void send(PstreamBuffers &, const List< T > &) const
Do all sends using PstreamBuffers.
static void flipAndCombine(const UList< label > &map, const bool hasFlip, const UList< T > &rhs, const CombineOp &cop, const negateOp &negOp, List< T > &lhs)
void receive(PstreamBuffers &, List< T > &) const
Do all receives using PstreamBuffers.
Class containing functor to negate primitives. Dummy for all other types.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
gmvFile<< "tracers "<< particles.size()<< nl;{ pointField positions(particles.size());label particlei=0;forAllConstIter(Cloud< passiveParticle >, particles, iter) { positions[particlei++]=iter().position(mesh);} for(i=0;i< pTraits< point >::nComponents;i++) { forAll(positions, particlei) { gmvFile<< component(positions[particlei], i)<< ' ';} gmvFile<< nl;}}forAll(lagrangianScalarNames, i){ const word &name=lagrangianScalarNames[i];IOField< scalar > fld(IOobject(name, runTime.name(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
errorManipArg< error, int > exit(error &err, const int errNo=1)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
errorManip< error > abort(error &err)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)