63 if (!delimiters_.valid())
67 writeValueSeparator(oss);
68 delimiters_()[0] = oss.
str();
70 writeCoordSeparator(oss);
71 delimiters_()[1] = oss.
str();
73 writeSegmentSeparator(oss);
74 delimiters_()[2] = oss.
str();
87 const unsigned long alignPad
93 if (w.find(delimiters()[i]) != string::npos)
104 else if (s.size() < columnWidth(os) - alignPad)
106 os <<
string(columnWidth(os) - alignPad - s.size(),
' ').c_str()
111 os <<
s(columnWidth(os) - alignPad - 3).c_str() <<
"...";
128 const unsigned long alignPad
134 if (
set.hasScalarAxis())
136 if (!first) writeValueSeparator(os);
138 writeWord(
set.
scalarName(), os, align, first*alignPad);
141 if (
set.hasPointAxis())
143 for (
direction cmpt = 0; cmpt < pTraits<point>::nComponents; ++ cmpt)
145 if (!first) writeValueSeparator(os);
147 const bool separator =
148 !
set.pointName().empty()
153 + (separator ?
"_" :
"")
156 writeWord(w, os, align, first*alignPad);
162 forAll(scalarValueSets, fieldi)
164 #define WriteTypeValueSetNames(Type, nullArg) \ 165 if (Type##ValueSets.set(fieldi)) \ 167 const label nCmpt = pTraits<Type>::nComponents; \ 169 for (direction cmpt = 0; cmpt < nCmpt; ++ cmpt) \ 171 if (!first) writeValueSeparator(os); \ 173 const bool separator = \ 174 !valueSetNames[fieldi].empty() \ 175 && strlen(pTraits<Type>::componentNames[cmpt]) > 0; \ 178 valueSetNames[fieldi] \ 179 + (separator ? "_" : "") \ 180 + pTraits<Type>::componentNames[cmpt]; \ 182 writeWord(w, os, align, first*alignPad); \ 187 #undef WriteTypeValueSetNames 207 writeCoordSeparator(os);
209 if (
set.segments()[pointi] !=
set.segments()[pointi - 1])
211 writeSegmentSeparator(os);
217 if (
set.hasScalarAxis())
219 if (!first) writeValueSeparator(os);
220 writeValue(
set.scalarCoord(pointi), os, align);
223 if (
set.hasPointAxis())
225 if (!first) writeValueSeparator(os);
226 writeValue(
set.pointCoord(pointi), os, align);
230 forAll(scalarValueSets, fieldi)
232 #define WriteTypeValueSets(Type, nullArg) \ 233 if (Type##ValueSets.set(fieldi)) \ 235 if (!first) writeValueSeparator(os); \ 236 writeValue(Type##ValueSets[fieldi][pointi], os, align); \ 240 #undef WriteTypeValueSets 254 writeFormat_(writeFormat),
255 writeCompression_(writeCompression)
263 dict.
found(
"writeFormat")
269 dict.
found(
"writeCompression")
280 const word& writeType,
285 typename wordConstructorTable::iterator cstrIter =
286 wordConstructorTablePtr_->find(writeType);
288 if (cstrIter == wordConstructorTablePtr_->end())
291 <<
"Unknown write type " 292 << writeType <<
nl <<
nl 293 <<
"Valid write types : " <<
endl 294 << wordConstructorTablePtr_->sortedToc()
304 const word& writeType,
309 dictConstructorTable::iterator cstrIter =
310 dictConstructorTablePtr_->find(writeType);
312 if (cstrIter == dictConstructorTablePtr_->end())
315 dict.
found(
"writeFormat")
320 dict.
found(
"writeCompression")
static autoPtr< setWriter > New(const word &writeType, const IOstream::streamFormat writeFormat=IOstream::ASCII, const IOstream::compressionType writeCompression=IOstream::UNCOMPRESSED)
Select given write options.
labelList first(const UList< labelPair > &p)
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
#define forAll(list, i)
Loop across all elements in list.
static streamFormat formatEnum(const word &)
Return stream format of given format name.
static compressionType compressionEnum(const word &)
Return compression of given compression name.
Ostream & writeWord(const word &w, Ostream &os, const bool align=false, const unsigned long alignPad=0) const
Write a word.
errorManipArg< error, int > exit(error &err, const int errNo=1)
A list of keyword definitions, which are a keyword followed by any number of values (e...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void writeTableHeader(const coordSet &set, const wordList &valueSetNames, #define TypeValueSetsConstArg(Type, nullArg) Ostream &os, const bool align=false, const unsigned long alignPad=0) const
Write multi-column table header.
const List< string > & delimiters() const
Possible delimiters that need quoting.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Traits class for primitives.
#define TypeValueSetsConstArg(Type, nullArg)
void rewind()
Rewind the OStringStream.
virtual void writeValueSeparator(Ostream &os) const
Write a value separator.
virtual ~setWriter()=0
Destructor.
Macros for easy insertion into run-time selection tables.
void writeTable(const coordSet &set, #define TypeValueSetsConstArg(Type, nullArg) Ostream &os, const bool align=false) const
Write multi-column table of data.
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().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))
stressControl lookup("compactNormalStress") >> compactNormalStress
Holds list of sampling positions.
Pre-declare SubField and related Field type.
A class for handling words, derived from string.
virtual void writeSegmentSeparator(Ostream &os) const
Write a segment separator.
#define WriteTypeValueSets(Type, nullArg)
streamFormat
Enumeration for the format of data in the stream.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
virtual void writeCoordSeparator(Ostream &os) const
Write a coordinate separator.
setWriter(const IOstream::streamFormat writeFormat, const IOstream::compressionType writeCompression)
Construct given write options.
compressionType
Enumeration for the format of data in the stream.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
defineTypeNameAndDebug(combustionModel, 0)
An IOstream is an abstract base class for all input/output systems; be they streams, files, token lists etc.
string str() const
Return the string.
#define WriteTypeValueSetNames(Type, nullArg)
FOR_ALL_FIELD_TYPES(DefineFvWallInfoType)
A class for handling character strings derived from std::string.
Output to memory buffer stream.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.