61 precision_(
IOstream::defaultPrecision())
77 options.getOrDefault(
"precision",
IOstream::defaultPrecision())
93 open(coords, outputPath);
106 open(tracks, outputPath);
146 const auto& coords = coords_[0];
153 if (coords.hasVectorAxis())
156 headCols.append(
"x");
157 headCols.append(
"y");
158 headCols.append(
"z");
162 headCols.append(coords.axis());
166 headCols.append(labelNames_);
167 headCols.append(scalarNames_);
171 #define doLocalCode(Type) \
173 for (const word& fldName : Type##Names_) \
175 for (direction d=0; d < pTraits<Type>::nComponents; ++d) \
177 headCols.append(fldName + '_' + Foam::name(d)); \
194 fileName outputFile =
path();
196 if (!
isDir(outputFile.path()))
198 mkDir(outputFile.path());
201 OFstream
os(outputFile, streamOpt_);
202 os.precision(precision_);
204 writeLine(
os, headCols,
",");
206 writeBufferContents(
os, coords,
",");
219 const word& fieldName,
229 if (useTracks_ || !buffering_)
232 return writeTemplate(fieldName, fieldPtrs);
244 const word& fieldName,
256 return writeTemplate(fieldName, fieldPtrs);
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void append(const T &val)
Copy append an element to the end of this list.
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
A simple container for options an IOstream can normally have.
An IOstream is an abstract base class for all input/output systems; be they streams,...
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Output to file stream as an OSstream, normally using std::ofstream for the actual output.
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
Base class for writing coordSet(s) and tracks with fields.
void appendField(const word &fieldName, const Field< label > &vals)
virtual void open(const fileName &outputPath)
Write separate geometry to file.
fileName getExpectedPath(const word &fileExt=word::null) const
Get expected (characteristic) output file name - information only.
DynamicList< word > labelNames_
void writeBufferContents(Ostream &os, const coordSet &coords, const char *sep) const
Write buffered data.
label nDataColumns() const
The number of buffer data columns, after splitting into components.
bool buffering_
Writer with buffering output.
virtual bool buffering() const
True if the format uses internal buffering (eg, column output).
static UPtrList< const Field< Type > > repackageFields(const Field< Type > &field)
Repackage field into a UPtrList.
void checkOpen() const
Verify that the outputPath_ has been set or FatalError.
DynamicList< word > scalarNames_
coordSetWriter(const coordSetWriter &)=delete
No copy construct.
bool useTracks_
Prefer tracks to points during single set writing.
void clearBuffers()
Clear out buffering.
UPtrList< const coordSet > coords_
Reference to coordinate set(s).
static void writeLine(Ostream &, const UList< word > &, const char *sep)
Write line contents (eg, buffered).
virtual void close(bool force=false)
Finish output, performing any necessary cleanup.
Write coordSet(s) in csv format.
virtual ~csvWriter()
Destructor. Calls close().
csvWriter()
Default construct.
virtual bool writeBuffered()
Write buffered data.
virtual fileName path() const
Characteristic output file name - information only.
Holds list of sampling positions.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T, or return the given default value. FatalIOError if it is found and the number of...
A class for handling file names.
static const fileName null
An empty fileName.
static std::string path(const std::string &str)
Return directory path name (part before last /).
A class for handling words, derived from Foam::string.
#define defineTypeName(Type)
Define the typeName.
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
Convenience macros for instantiating coordSetWriter methods.
#define defineCoordSetWriterWriteFields(ThisClass)
OBJstream os(runTime.globalPath()/outputName)
#define doLocalCode(FieldType, Variable)
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
SphericalTensor< scalar > sphericalTensor
SphericalTensor of scalars, i.e. SphericalTensor<scalar>.
bool isDir(const fileName &name, const bool followLink=true)
Does the name exist as a DIRECTORY in the file system?
SymmTensor< scalar > symmTensor
SymmTensor of scalars, i.e. SymmTensor<scalar>.