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.
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 label nProcs(const label communicator=0)
Number of processes in parallel run.
static bool & parRun()
Is this a parallel run?
streamFormat format() const noexcept
Get the current stream format.
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.
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)
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
static bool master(const label communicator=0)
Am I the master process.
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.
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of 'true' entries.
Output to string buffer, using a OSstream.
rAUs append(new volScalarField(IOobject::groupName("rAU", phase1.name()), 1.0/(U1Eqn.A()+byDt(max(phase1.residualAlpha() - alpha1, scalar(0)) *rho1))))
#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.