Go to the documentation of this file.
39 void Foam::masterOFstream::checkWrite
41 const fileName& fName,
63 <<
"Could not open file " << fName <<
nl
70 os.writeRaw(
str, len);
75 <<
"Failed writing to " << fName <<
nl
81 void Foam::masterOFstream::checkWrite
83 const fileName& fName,
87 checkWrite(fName, &
s[0],
s.length());
91 void Foam::masterOFstream::commit()
111 checkWrite(pathName_, this->str());
130 string s(this->str());
137 pBufs.finishedSends(recvSizes);
152 *std::max_element(recvSizes.cbegin(), recvSizes.cend())
157 UIPstream is(proci, pBufs);
159 const std::streamsize
count(recvSizes[proci]);
160 is.read(buf.data(),
count);
164 checkWrite(filePaths[proci], buf.cdata(),
count);
171 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?
constexpr IOstreamOption(streamFormat fmt=streamFormat::ASCII, compressionType comp=compressionType::UNCOMPRESSED) noexcept
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))))
virtual Ostream & write(const char c)
Write character.
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.
OBJstream os(runTime.globalPath()/outputName)
errorManipArg< error, int > exit(error &err, const int errNo=1)
meshPtr reset(new Foam::fvMesh(Foam::IOobject(regionName, runTime.timeName(), runTime, Foam::IOobject::MUST_READ), false))
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.
static bool & parRun() noexcept
Test if this a parallel run.
Output to string buffer, using a OSstream. Always UNCOMPRESSED.
#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.