Go to the documentation of this file.
39 namespace surfaceWriters
98 os << rgb[0] <<
' ' << rgb[1] <<
' ' << rgb[2] <<
',' <<
nl;
111 colourTablePtr_(nullptr)
124 IOstream::compressionEnum(
"compression", options)
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;
248 if (!colourTablePtr_)
252 <<
"No output colours set" <<
endl;
254 return this->
write();
262 if (useTimeDir() && !
timeName().empty())
269 outputFile /= fieldName +
'_' + outputPath_.name();
270 outputFile.
ext(
"x3d");
274 Info<<
"Writing field " << fieldName <<
" to " << outputFile <<
endl;
284 const auto&
values = tfield();
299 range.min() -= VSMALL;
300 range.max() += VSMALL;
314 os <<
" <IndexedFaceSet"
315 <<
" colorPerVertex='" <<
Switch(this->isPointData()) <<
"'"
316 <<
" coordIndex='" <<
nl;
318 for (
const auto&
f : surf.
faces())
320 for (
const label vrti :
f)
329 if (!this->isPointData())
331 const label nFaces = surf.
faces().size();
333 os <<
" colorIndex='";
335 for (label i=0; i < nFaces; ++i)
346 os <<
"<Color color='" <<
nl;
350 for (
const Type& val :
values)
353 vector rgb = colourTablePtr_->value(
x);
360 " </IndexedFaceSet>\n";
static const Enum< predefinedType > predefinedNames
A surfaceWriter for X3D files.
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
static const colourTable * ptr(const word &tableName)
scalar srange01(const scalarMinMax &range, scalar x)
A class for handling words, derived from Foam::string.
Base class for surface writers.
A class for handling file names.
defineTypeName(abaqusWriter)
static std::string path(const std::string &str)
A class for managing temporary objects.
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
virtual const faceList & faces() const =0
An IOstream is an abstract base class for all input/output systems; be they streams,...
Abstract definition of a meshed surface defined by faces and points.
static bool master(const label communicator=worldComm)
static scalar rangex(const scalarMinMax &range, const Type &val)
Ostream & endl(Ostream &os)
static void writeHeader(Ostream &os, const word &fieldName)
Convenience macros for instantiating surfaceWriter methods.
A proxy for writing MeshedSurface, UnsortedMeshedSurface and surfMesh to various file formats.
addToRunTimeSelectionTable(surfaceWriter, abaqusWriter, word)
Generic templated field type.
static void printColour(Ostream &os, const vector &rgb)
MinMax< scalar > scalarMinMax
A scalar min/max range.
virtual const pointField & points() const =0
static compressionType compressionEnum(const word &compName, const compressionType deflt=compressionType::UNCOMPRESSED)
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
dimensioned< scalarMinMax > minMaxMag(const DimensionedField< Type, GeoMesh > &df)
OBJstream os(runTime.globalPath()/outputName)
Macros for easy insertion into run-time selection tables.
Vector< scalar > vector
A scalar version of the templated Vector.
static void write(const fileName &name, const MeshedSurfaceProxy &surf, IOstreamOption streamOpt=IOstreamOption(), const dictionary &options=dictionary::null)
Output to file stream, using an OSstream.
@ ASCII
"ascii" (normal default)
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
void write(vtk::formatter &fmt, const Type &val, const label n=1)
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
bool mkDir(const fileName &pathName, mode_t mode=0777)
bool equal(const T &s1, const T &s2)
#define WarningInFunction
A min/max value pair with additional methods. In addition to conveniently storing values,...
defineSurfaceWriterWriteFields(Foam::surfaceWriters::x3dWriter)
virtual void open(const fileName &outputPath)
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
bool isDir(const fileName &name, const bool followLink=true)