51#ifndef Foam_OFstreamCollator_H
52#define Foam_OFstreamCollator_H
79 const word objectType_;
90 writeData(
const writeData&) =
delete;
91 writeData(writeData&&) =
delete;
92 void operator=(
const writeData&) =
delete;
93 void operator=(writeData&&) =
delete;
99 const word& objectType,
109 objectType_(objectType),
112 streamOpt_(streamOpt),
115 headerEntries_(headerEntries)
127 off_t total = localData_.
size();
128 for (
const auto& data : procData_)
130 total += data.size();
140 const off_t maxBufferSize_;
142 mutable std::mutex mutex_;
144 std::unique_ptr<std::thread> thread_;
162 static bool writeFile
165 const word& objectType,
177 static void* writeAll(
void *threadarg);
181 void waitForBufferSpace(
const off_t wantedSize)
const;
213 const word& objectType,
219 const bool useThread =
true,
227 const
word& objectType,
229 const std::
string&
s,
233 const
bool useThread = true,
238 charData.resize(
s.size());
239 std::copy(
s.begin(),
s.end(), charData.begin());
A simple list of objects of type <T> that is intended to be used as a circular buffer (eg,...
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void transfer(List< T > &list)
Transfer contents of the argument List into this.
void resize(const label len)
Alter addressable list size, allocating new space if required while recovering old content.
A simple container for options an IOstream can normally have.
atomicType
Atomic operations (output).
appendType
File appending (NO_APPEND | APPEND_APP | APPEND_ATE).
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
bool write(const word &objectType, const fileName &fName, DynamicList< char > &&localData, IOstreamOption streamOpt, IOstreamOption::atomicType atomic, IOstreamOption::appendType append, const bool useThread=true, const dictionary &headerEntries=dictionary::null)
Write file with contents, possibly taking ownership of the content.
virtual ~OFstreamCollator()
Destructor.
OFstreamCollator(const off_t maxBufferSize)
Construct from buffer size (0 = do not use thread) and with worldComm.
TypeName("OFstreamCollator")
void waitAll()
Wait for all thread actions to have finished.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
iterator begin() noexcept
Return an iterator to begin traversing the UList.
void size(const label n)
Older name for setAddressableSize.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
static const dictionary null
An empty dictionary, which is also the parent for all dictionaries.
A class for handling file names.
A class for handling words, derived from Foam::string.
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))
rAUs append(new volScalarField(IOobject::groupName("rAU", phase1.name()), 1.0/(U1Eqn.A()+byDt(max(phase1.residualAlpha() - alpha1, scalar(0)) *rho1))))
List< label > labelList
A List of labels.
UList< label > labelUList
A UList of labels.
#define FOAM_DEPRECATED_FOR(since, replacement)
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.