40 namespace coordSetWriters
61 precision_(
IOstream::defaultPrecision())
77 options.getOrDefault(
"precision",
IOstream::defaultPrecision())
93 open(coords, outputPath);
106 open(tracks, outputPath);
122 const bool old(buffering_);
135 return getExpectedPath(
"csv");
146 const auto& coords = coords_[0];
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);
virtual bool writeBuffered()
Write buffered data.
defineCoordSetWriterWriteFields(Foam::coordSetWriters::csvWriter)
addToRunTimeSelectionTable(coordSetWriter, abaqusWriter, word)
A class for handling file names.
csvWriter()
Default construct.
const word & axis() const
The sort axis name.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
static const fileName null
An empty fileName.
virtual bool buffering() const
True if the format uses internal buffering (eg, column output)
defineTypeName(abaqusWriter)
A simple container for options an IOstream can normally have.
Macros for easy insertion into run-time selection tables.
bool hasVectorAxis() const noexcept
True if axis specification is a vector.
bool isDir(const fileName &name, const bool followLink=true)
Does the name exist as a DIRECTORY in the file system?
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
Convenience macros for instantiating coordSetWriter methods.
#define doLocalCode(Type)
Holds list of sampling positions.
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
Generic templated field type.
SymmTensor< scalar > symmTensor
SymmTensor of scalars, i.e. SymmTensor<scalar>.
A class for handling words, derived from Foam::string.
Base class for writing coordSet(s) and tracks with fields.
bool buffering_
Writer with buffering output.
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
OBJstream os(runTime.globalPath()/outputName)
fileName path(UMean.rootPath()/UMean.caseName()/"graphs"/UMean.instance())
virtual ~csvWriter()
Destructor. Calls close()
An IOstream is an abstract base class for all input/output systems; be they streams, files, token lists etc.
virtual fileName path() const
Characteristic output file name - information only.
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...
SphericalTensor< scalar > sphericalTensor
SphericalTensor of scalars, i.e. SphericalTensor<scalar>.
Write coordSet(s) in csv format.