39 namespace surfaceWriters
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);
205 if (useTimeDir() && !
timeName().empty())
208 outputFile = outputPath_.
path() /
timeName() / outputPath_.name();
210 outputFile.
ext(
"x3d");
214 Info<<
"Writing geometry to " << outputFile <<
endl;
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())
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";
static void printColour(Ostream &os, const vector &rgb)
virtual const pointField & points() const
The points used for the surface.
void size(const label n)
Older name for setAddressableSize.
A class for handling file names.
MinMax< scalar > scalarMinMax
A scalar min/max range.
static const Enum< predefinedType > predefinedNames
Enumeration names for predefinedType.
static void writeHeader(Ostream &os, const word &fieldName)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
A list of keyword definitions, which are a keyword followed by a number of values (eg...
bool equal(const T &a, const T &b)
Compare two values for equality.
virtual void open(const fileName &outputPath)
Open for output on specified path, using existing surface.
Output to file stream, using an OSstream.
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
defineSurfaceWriterWriteFields(Foam::surfaceWriters::x3dWriter)
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, any/none. Also accepts 0/1 as a string and shortcuts t/f, y/n.
x3dWriter()
Default construct.
scalar srange01(const scalarMinMax &range, scalar x)
A (0-1) range for colouring.
A simple container for options an IOstream can normally have.
static std::string path(const std::string &str)
Return directory path name (part before last /)
word ext() const
Return file name extension (part after last .)
Macros for easy insertion into run-time selection tables.
Abstract definition of a meshed surface defined by faces and points.
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...
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
Implements a meshed surface by referencing another meshed surface or faces/points components...
A class for handling words, derived from Foam::string.
virtual fileName write()
Write surface geometry to file.
bool valid() const
Range is non-inverted.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
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...
virtual const faceList & faces() const
The faces used for the surface.
OBJstream os(runTime.globalPath()/outputName)
A proxy for writing MeshedSurface, UnsortedMeshedSurface and surfMesh to various file formats...
A surfaceWriter for X3D files.
Convenience macros for instantiating surfaceWriter methods.
defineTypeName(abaqusWriter)
dimensioned< scalarMinMax > minMaxMag(const DimensionedField< Type, GeoMesh > &f1)
#define WarningInFunction
Report a warning using Foam::Warning.
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
messageStream Info
Information stream (stdout output on master, null elsewhere)
Base class for surface writers.
bool verbose_
Additional output verbosity.
A class for managing temporary objects.
addToRunTimeSelectionTable(surfaceWriter, abaqusWriter, word)
static const colourTable * ptr(const word &tableName)
Look up pointer to colourTable by name, or nullptr on failure.
static scalar rangex(const scalarMinMax &range, const Type &val)
A (0-1) range for colouring.