Go to the documentation of this file.
39 void Foam::masterOFstream::checkWrite
41 const fileName& fName,
65 <<
"Could not open file " << fName <<
nl
72 os.writeRaw(
str, len);
77 <<
"Failed writing to " << fName <<
nl
83 void Foam::masterOFstream::checkWrite
85 const fileName& fName,
89 checkWrite(fName, &
s[0],
s.length());
93 void Foam::masterOFstream::commit()
113 checkWrite(pathName_, this->str());
132 string s(this->str());
135 os.write(&
s[0],
s.length());
139 pBufs.finishedSends(recvSizes);
154 *std::max_element(recvSizes.cbegin(), recvSizes.cend())
159 UIPstream is(proci, pBufs);
161 const std::streamsize
count(recvSizes[proci]);
162 is.read(buf.data(),
count);
166 checkWrite(filePaths[proci], buf.cdata(),
count);
173 checkWrite(pathName_, this->str());
List< label > labelList
A List of labels.
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
static constexpr int masterNo() noexcept
Process index of the master (always 0)
A class for handling file names.
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))
static bool uniformFile(const fileNameList &)
Same file?
static bool & parRun()
Test if this a parallel run, or allow modify access.
streamFormat format() const noexcept
Get the current stream format.
static bool master(const label communicator=worldComm)
Am I the master process.
static void scatter(const List< commsStruct > &comms, T &Value, const int tag, const label comm)
Scatter data. Distribute without modification. Reverse of gather.
List< bool > boolList
A List of bools.
~masterOFstream()
Destructor - commits buffered information to file.
rAUs append(new volScalarField(IOobject::groupName("rAU", phase1.name()), 1.0/(U1Eqn.A()+byDt(max(phase1.residualAlpha() - alpha1, scalar(0)) *rho1))))
static rangeType subProcs(const label communicator=worldComm)
Range of process indices for sub-processes.
The IOstreamOption is a simple container for options an IOstream can normally have.
masterOFstream(const fileName &pathname, IOstreamOption streamOpt=IOstreamOption(), const bool append=false, const bool valid=true)
Construct from pathname and set stream status.
versionNumber version() const noexcept
Get the stream version.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Foam::string str() const
Get the string - as Foam::string rather than std::string.
static void gatherList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Gather data but keep individual values separate.
static int myProcNo(const label communicator=worldComm)
Number of this process (starting from masterNo() = 0)
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of 'true' entries.
Output to string buffer, using a OSstream.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
compressionType compression() const noexcept
Get the stream compression.
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
static label nProcs(const label communicator=worldComm)
Number of processes in parallel run, and 1 for serial run.