57 for (
direction cmpt=0; cmpt < pTraits<Type>::nComponents; ++cmpt)
100 open(surf, outputPath, parallel);
128 if (useTimeDir() && !
timeName().empty())
131 outputFile = outputPath_.
path() /
timeName() / outputPath_.name();
133 outputFile.
ext(
"inp");
137 Info<<
"Writing geometry to " << outputFile <<
endl;
141 const meshedSurfRef& surf = adjustSurface();
150 const labelUList& origFaceIds = surf.faceIds();
160 MeshedSurfaceProxy<face>
185 const word& fieldName,
200 if (useTimeDir() && !
timeName().empty())
207 outputFile /= fieldName +
'_' + outputPath_.name();
208 outputFile.
ext(
"usr");
211 tmp<Field<Type>> tfield = adjustField(fieldName, mergeField(localValues));
215 Info<<
" to " << outputFile <<
endl;
220 const meshedSurfRef& surf = adjustSurface();
224 const auto&
values = tfield();
231 OFstream
os(outputFile, streamOpt_);
236 const bool useOrigFaceIds =
238 elemIds.size() ==
values.size()
245 for (
const Type& val : values)
248 (useOrigFaceIds ? elemIds[faceIndex] : faceIndex);
Various functions to operate on Lists.
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.
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.
A proxy for writing MeshedSurface, UnsortedMeshedSurface and surfMesh to various file formats.
static void write(const fileName &name, const MeshedSurfaceProxy &surf, IOstreamOption streamOpt=IOstreamOption(), const dictionary &options=dictionary::null)
Write to file, select based on its extension.
Output to file stream as an OSstream, normally using std::ofstream for the actual output.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
static const UList< label > & null() noexcept
void size(const label n)
Older name for setAddressableSize.
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
A class for handling file names.
word ext() const
Return file name extension (part after last .).
static std::string path(const std::string &str)
Return directory path name (part before last /).
Implements a meshed surface by referencing another meshed surface or faces/points components.
virtual const pointField & points() const
The points used for the surface.
virtual const labelList & faceIds() const
Per-face identifier (eg, element Id).
virtual const faceList & faces() const
The faces used for the surface.
Abstract definition of a meshed surface defined by faces and points.
Base class for surface writers.
surfaceWriter()
Default construct.
virtual void open(const fileName &outputPath)
Open for output on specified path, using existing surface.
bool wroteGeom_
Track if geometry has been written since the last open.
bool useTimeDir() const noexcept
Should a time directory be spliced into the output path?
void checkOpen() const
Verify that the outputPath_ has been set or FatalError.
bool parallel_
Writing in parallel (via master).
bool empty() const
The surface to write is empty if the global number of faces is zero.
tmp< Field< label > > adjustField(const word &fieldName, const tmp< Field< label > > &tfield) const
bool verbose_
Additional output verbosity.
const meshedSurfRef & adjustSurface() const
Merge surfaces (if not upToDate) and return merged (parallel) or regular surface (non-parallel) and a...
tmp< Field< label > > mergeField(const Field< label > &fld) const
fileName outputPath_
The full output directory and file (surface) name.
A surfaceWriter for STARCD files.
starcdWriter()
Default construct.
virtual fileName write()
Write surface geometry to file.
A class for managing temporary objects.
A class for handling words, derived from Foam::string.
#define defineTypeName(Type)
Define the typeName.
OBJstream os(runTime.globalPath()/outputName)
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
bool found(const ListType &input, const UnaryPredicate &pred, const label start=0)
Same as found_if.
Namespace for surface writers.
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
messageStream Info
Information stream (stdout output on master, null elsewhere).
List< face > faceList
List of faces.
Ostream & endl(Ostream &os)
Add newline and flush stream.
vectorField pointField
pointField is a vectorField.
static void writeData(Ostream &os, const Type &val)
UList< label > labelUList
A UList of labels.
bool isDir(const fileName &name, const bool followLink=true)
Does the name exist as a DIRECTORY in the file system?
constexpr char nl
The newline '\n' character (0x0a).
Convenience macros for instantiating surfaceWriter methods.
#define defineSurfaceWriterWriteFields(ThisClass)