86#ifndef Foam_decomposedBlockData_H
87#define Foam_decomposedBlockData_H
113 static void writeHeaderContent
117 const word& objectType,
120 const word& objectName
188 const bool writeOnProc
223 const word& objectType,
226 const word& objectName,
290 IOstreamOption streamOptData,
293 const bool withLocalHeader
359 const bool syncReturnState =
true
372 List<std::streamoff>& blockOffset,
374 const
UList<
char>& localData,
382 const
UPstream::commsTypes commsType,
383 const
bool syncReturnState = true
390 const auto* ptr = procData.get(proci);
391 if (ptr && !ptr->empty())
393 spans[proci] = std::string_view(ptr->cdata(), ptr->size());
419 const label localValue,
427 reinterpret_cast<const char*
>(&localValue),
428 allValues.data_bytes(),
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
const string & note() const noexcept
Return the optional note.
A simple container for options an IOstream can normally have.
Generic input stream using a standard (STL) stream.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Generic output stream using a standard (STL) stream.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
A non-owning sub-view of a List (allocated or unallocated storage).
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Inter-processor communications stream.
commsTypes
Communications types.
@ scheduled
"scheduled" (MPI standard) : (MPI_Send, MPI_Recv)
static void mpiGather(const Type *sendData, Type *recvData, int count, const int communicator=UPstream::worldComm)
Receive identically-sized (contiguous) data from all ranks.
static label nProcs(const label communicator=worldComm)
Number of ranks in parallel run (for given communicator). It is 1 for serial run.
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
virtual bool writeObject(IOstreamOption streamOpt, const bool writeOnProc) const
Write using stream options.
static std::streamoff writeBlockEntry(OSstream &os, const label blocki, std::string_view sv)
Helper: write block of (binary) character content.
static bool readBlockEntry(Istream &is, List< char > &charData)
Helper: read block of (binary) character data.
static bool hasBlock(Istream &is, const label blockNumber)
True if the given block number (starts at 0) has a corresponding decomposedBlockData block entry....
static void gatherProcData(const label comm, const UList< char > &localData, const labelUList &recvSizes, const labelRange &whichProcs, List< int > &recvOffsets, DynamicList< char > &recvData, const UPstream::commsTypes commsType)
Helper: gather data from (subset of) sub-ranks.
virtual bool writeData(Ostream &os) const
Write separated content (assumes content is the serialised data).
TypeName("decomposedBlockData")
Declare type-name, virtual type (with debug switch).
static autoPtr< ISstream > readBlock(const label blocki, ISstream &is, IOobject &headerIO)
Read selected block (non-seeking) + header information.
const label comm_
Communicator for all parallel comms.
static void writeHeader(Ostream &os, IOstreamOption streamOptContainer, const word &objectType, const string ¬e, const fileName &location, const word &objectName, const dictionary &extraEntries)
Helper: write FoamFile IOobject header.
static bool writeBlocks(const label comm, autoPtr< OSstream > &osPtr, List< std::streamoff > &blockOffset, const UList< char > &localData, const labelUList &recvSizes, const UList< std::string_view > &procData, const UPstream::commsTypes commsType, const bool syncReturnState=true)
Write *this. Ostream only valid on master.
static std::streamoff writeBlockEntry(OSstream &os, const label blocki, const char *str, const size_t len)
Helper: write block of (binary) character data.
static void writeExtraHeaderContent(dictionary &dict, IOstreamOption streamOptData, const IOobject &io)
Helper: generate additional entries for FoamFile header.
virtual ~decomposedBlockData()=default
Destructor.
static bool isCollatedType(const word &objectType)
True if object type is a known collated type.
decomposedBlockData(const label comm, const IOobject &io, const UPstream::commsTypes=UPstream::commsTypes::scheduled)
Construct given an IOobject.
List< char > contentData_
The block content.
static bool readBlocks(const label comm, autoPtr< ISstream > &isPtr, List< char > &localData, const UPstream::commsTypes commsType)
Read data (on master) and transmit.
static bool skipBlockEntry(Istream &is)
Helper: skip a block of (binary) character data.
static void gather(const label comm, const label localValue, labelList &allValues)
Deprecated(2023-09) - consider UPstream::listGatherValue.
static bool readHeader(IOobject &io, Istream &is)
Read header as per IOobject with additional handling of decomposedBlockData.
static std::streamoff writeBlockEntry(OSstream &os, const label blocki, const UList< char > &s)
Helper: write block of (binary) character data.
static label getNumBlocks(Istream &is, const label maxNumBlocks=-1)
Extract number of decomposedBlockData block entries, optionally with an upper limit....
virtual bool read()
Read object.
const UPstream::commsTypes commsType_
Type to use for gather.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
A class for handling file names.
A range or interval of labels defined by a start and a size.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
regIOobject(const IOobject &io, const bool isTimeObject=false)
Construct from IOobject. The optional flag adds special handling if the object is the top-level regIO...
A class for handling words, derived from Foam::string.
OBJstream os(runTime.globalPath()/outputName)
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))
List< label > labelList
A List of labels.
UList< label > labelUList
A UList of labels.
#define forAll(list, i)
Loop across all elements in list.
#define FOAM_DEPRECATED_FOR(since, replacement)
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.