42template<
class PrimitiveType>
49 for (
const auto& item : items)
51 const std::string
s(item.str());
57 values.push_back(val);
76 if (mainIOranks.empty())
92 if (mainIOranks[i] <= myProci)
94 begProc = mainIOranks[i];
95 if (i+1 < mainIOranks.size())
97 endProc = mainIOranks[i+1];
103 return labelRange(begProc, (endProc-begProc));
120 digests[myProci] = myDigest;
125 digests.data_bytes(),
133 hostLeaders.push_back(0);
134 for (label previ = 0, proci = 1; proci < digests.size(); ++proci)
136 if (digests[previ] != digests[proci])
138 hostLeaders.push_back(proci);
156 bool byHostName =
false;
164 if (str.contains(
'('))
173 else if (str ==
"host")
192 <<
"Rank 0 (master) should be in the IO ranks. Currently:" <<
nl
200 std::sort(dynRanks.
begin(), dynRanks.
end());
202 if (dynRanks.
front() < 0)
205 <<
"Cannot have negative ranks! Currently:" <<
nl
212 auto last = std::unique(dynRanks.
begin(), dynRanks.
end());
214 if (last < dynRanks.
end())
216 ranks = dynRanks.
slice(0, (last - dynRanks.
begin()));
258 DynamicList<label> offsetMaster;
264 label nHostRanks = 0;
267 if (!hosts[ranki].empty())
272 offsetMaster.reserve(nHostRanks+1);
276 if (!hosts[ranki].empty())
278 offsetMaster.push_back(ranki);
283 offsetMaster.push_back(hosts.
size());
286 if (offsetMaster.size() > 2)
289 <<
"I/O on :" <<
nl <<
'(' <<
nl;
290 for (label group = 1;
group < offsetMaster.size(); ++
group)
292 const label beg = offsetMaster[
group-1];
293 const label
end = offsetMaster[
group];
296 <<
" (" << hosts[beg].c_str() <<
' '
297 << (
end-beg) <<
')' <<
nl;
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void push_back(const T &val)
Copy append an element to the end of this list.
void reserve(const label len)
Reserve allocation space for at least this size, allocating new space if required and retaining old c...
An input stream of tokens.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
static constexpr unsigned size_bytes() noexcept
The number of bytes in digest (20).
Functions to compute SHA1 message digest according to the NIST specification FIPS-180-1.
iterator begin() noexcept
Return an iterator to begin traversing the UList.
char * data_bytes() noexcept
Return pointer to the underlying array serving as data storage,.
bool empty() const noexcept
True if List is empty (ie, size() is zero).
bool contains(const T &val) const
True if the value is contained in the list.
iterator end() noexcept
Return an iterator to end traversing the UList.
SubList< T > slice(const label pos, label len=-1)
Return SubList slice (non-const access) - no range checking.
T & front()
Access first element of the list, position [0].
void size(const label n)
Older name for setAddressableSize.
static int myProcNo(const label communicator=worldComm)
Rank of this process in the communicator (starting from masterNo()). Negative if the process is not a...
static bool parRun(const bool on) noexcept
Set as parallel run on/off.
static int & msgType() noexcept
Message tag of standard messages.
static int numNodes() noexcept
The number of shared/host nodes in the (const) world communicator.
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
static label nProcs(const label communicator=worldComm)
Number of ranks in parallel run (for given communicator). It is 1 for serial run.
static label worldComm
Communicator for all ranks. May differ from commGlobal() if local worlds are in use.
static void mpiAllGather(Type *allData, int count, const int communicator=UPstream::worldComm)
Gather/scatter identically-sized data.
@ gatherList
gatherList [manual algorithm]
static bool & parRun() noexcept
Test if this a parallel run.
static labelRange subRanks(const labelUList &mainIOranks)
Get (contiguous) range/bounds of ranks addressed within the given main io-ranks.
const labelList ioRanks_
The list of IO ranks (global ranks).
bool isIOrank(const label proci) const
Is proci a master rank in the communicator (in parallel) or a master rank in the IO ranks (non-parall...
label comm_
Communicator to use.
static labelList getGlobalIORanks()
Get list of global IO ranks from FOAM_IORANKS env variable. If set, these correspond to the IO master...
void printRanks() const
Helper: output which ranks are IO.
static labelList getGlobalHostIORanks()
Get list of global IO master ranks based on the hostname. It is assumed that each host range is conti...
A range or interval of labels defined by a start and a size.
A class for handling character strings derived from std::string.
bool contains(char c) const noexcept
True if string contains given character (cf. C++23).
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
constexpr const char *const group
Group name for atomic constants.
Foam::SubStrings splitAny(const std::string &str, const std::string &delim, std::string::size_type pos=0)
Split string into sub-strings using any characters in delimiter.
string getEnv(const std::string &envName)
Get environment value for given envName.
bool read(const char *buf, int32_t &val)
Same as readInt32.
List< label > labelList
A List of labels.
List< string > stringList
List of string.
string hostName()
Return the system's host name, as per hostname(1).
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
static List< PrimitiveType > splitStringToList(const std::string &str)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
errorManipArg< error, int > exit(error &err, const int errNo=1)
UList< label > labelUList
A UList of labels.
constexpr char nl
The newline '\n' character (0x0a).
#define forAll(list, i)
Loop across all elements in list.
#define forAllReverse(list, i)
Reverse loop across all elements in list.