39namespace surfaceWriters
98 os << rgb[0] <<
' ' << rgb[1] <<
' ' << rgb[2] <<
',' <<
nl;
111 colourTablePtr_(nullptr)
127 colourTablePtr_(nullptr)
136 colourTablePtr_ = colourTable::ptr(tableName);
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);
205 if (useTimeDir() && !
timeName().empty())
208 outputFile = outputPath_.
path() /
timeName() / outputPath_.name();
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();
263 if (useTimeDir() && !
timeName().empty())
270 outputFile /= fieldName +
'_' + outputPath_.name();
271 outputFile.
ext(
"x3d");
274 tmp<Field<Type>> tfield = adjustField(fieldName, mergeField(localValues));
278 Info<<
" to " << outputFile <<
endl;
287 const auto& values = tfield();
302 range.min() -= VSMALL;
303 range.max() += VSMALL;
317 os <<
" <IndexedFaceSet"
318 <<
" colorPerVertex='" <<
Switch(this->isPointData()) <<
"'"
319 <<
" coordIndex='" <<
nl;
321 for (
const auto&
f : surf.
faces())
323 for (
const label vrti :
f)
332 if (!this->isPointData())
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.
The IOstreamOption is 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.
bool valid() const
Range is valid if it is not inverted.
Output to file stream, using an OSstream.
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 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
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.
splitCell * master() const
Base class for surface writers.
virtual void open(const fileName &outputPath)
Open for output on specified path, using existing surface.
bool verbose_
Additional output verbosity.
A surfaceWriter for X3D files.
x3dWriter()
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)
const labelList nFaces(UPstream::listGatherValues< label >(aMesh.nFaces()))
#define WarningInFunction
Report a warning using Foam::Warning.
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)
static void writeHeader(Ostream &os, const word &fieldName)
messageStream Info
Information stream (stdout output on master, null elsewhere)
static scalar rangex(const scalarMinMax &range, const Type &val)
A (0-1) range for colouring.
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool equal(const T &s1, const T &s2)
Compare two values for equality.
scalar srange01(const scalarMinMax &range, scalar x)
A (0-1) range for colouring.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
dimensioned< scalarMinMax > minMaxMag(const DimensionedField< Type, GeoMesh > &df)
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)