98 os << rgb[0] <<
' ' << rgb[1] <<
' ' << rgb[2] <<
',' <<
nl;
111 colourTablePtr_(nullptr)
127 colourTablePtr_(
nullptr)
137 if (!colourTablePtr_)
140 <<
"No colourMap " << tableName <<
" using default" <<
nl;
144 if (!colourTablePtr_)
152 Info<<
"X3D with colourMap '" << tableName <<
"' and range ";
177 open(surf, outputPath, parallel);
210 outputFile.
ext(
"x3d");
214 Info<<
"Writing geometry to " << outputFile <<
endl;
245 const word& fieldName,
249 if (!colourTablePtr_)
253 <<
"No output colours set" <<
endl;
255 return this->
write();
270 outputFile /= fieldName +
'_' +
outputPath_.name();
271 outputFile.
ext(
"x3d");
278 Info<<
" to " << outputFile <<
endl;
287 const auto& values = tfield();
302 range.min() -= VSMALL;
303 range.max() += VSMALL;
317 os <<
" <IndexedFaceSet"
319 <<
" coordIndex='" <<
nl;
321 for (
const auto&
f : surf.
faces())
323 for (
const label vrti :
f)
334 const label nFaces = surf.
faces().
size();
336 os <<
" colorIndex='";
338 for (label i=0; i < nFaces; ++i)
349 os <<
"<Color color='" <<
nl;
353 for (
const Type& val : values)
356 vector rgb = colourTablePtr_->value(
x);
363 " </IndexedFaceSet>\n";
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.
static compressionType compressionEnum(const word &compName, const compressionType deflt=compressionType::UNCOMPRESSED)
The compression enum corresponding to the string.
@ ASCII
"ascii" (normal default)
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,...
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
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.
static const colourTable * ptr(const word &tableName)
Look up pointer to colourTable by name, or nullptr on failure.
static const Enum< predefinedType > predefinedNames
Enumeration names for predefinedType.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry if present, and assign to T val. FatalIOError if it is found and the number of tokens i...
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 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?
bool isPointData() const noexcept
Are the field data to be treated as point data?
const word & timeName() const
The current time value/name.
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 X3D files.
x3dWriter()
Default construct.
virtual fileName write()
Write surface geometry to file.
A class for managing temporary objects.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
A class for handling words, derived from Foam::string.
#define defineTypeName(Type)
Define the typeName.
OBJstream os(runTime.globalPath()/outputName)
#define WarningInFunction
Report a warning using Foam::Warning.
Namespace for surface writers.
dimensioned< scalarMinMax > minMaxMag(const DimensionedField< Type, GeoMesh > &f1, const label comm)
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
static void printColour(Ostream &os, const vector &rgb)
bool equal(const T &a, const T &b)
Compare two values for equality.
static void writeHeader(Ostream &os, const word &fieldName)
messageStream Info
Information stream (stdout output on master, null elsewhere).
List< face > faceList
List of faces.
static scalar rangex(const scalarMinMax &range, const Type &val)
A (0-1) range for colouring.
MinMax< scalar > scalarMinMax
A scalar min/max range.
Ostream & endl(Ostream &os)
Add newline and flush stream.
scalar srange01(const scalarMinMax &range, scalar x)
A (0-1) range for colouring.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
vectorField pointField
pointField is a vectorField.
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)