49 const label lastMeshi = (meshes_.size() - 1);
53 meshi = (lastMeshi < 0 ? static_cast<label>(0) : lastMeshi);
56 if (meshi > lastMeshi)
59 <<
"Mesh " << meshi <<
" out of range: " << lastMeshi
63 return meshes_[meshi];
75 auto& gmesh = getMesh(meshi);
77 auto& bv = bufferViews_.create(
name);
78 bv.byteOffset() = bytes_;
79 bv.byteLength() =
fld.size()*3*
sizeof(float);
81 bytes_ += bv.byteLength();
83 auto& acc = accessors_.create(
name);
84 acc.bufferViewId() = bv.id();
87 auto& obj = objects_.create(
name);
95 bv.byteLength() +=
fld.size()*
sizeof(float);
96 bytes_ +=
fld.size()*
sizeof(float);
108 obj.addData(
fld, talpha());
111 gmesh.addColour(acc.id());
119 animations_.create(
name);
120 return animations_.size() - 1;
126 const label animationi,
128 const label outputId,
133 if (animationi > animations_.size() - 1)
136 <<
"Animation " << animationi <<
" out of range "
137 << (animations_.size() - 1)
141 const label nodeId = meshId + 1;
145 if (nodeId > meshes_.size())
148 <<
"Node " << nodeId <<
" out of range " << meshes_.size()
152 animations_[animationi].addTranslation
165 jsonFile.
ext(
"gltf");
189 label totalBytes = 0;
190 for (
const auto&
object : objects_.data())
192 for (
const auto&
data :
object.
data())
196 reinterpret_cast<const char*
>(&
data),
200 totalBytes +=
sizeof(float);
208 <<
indent <<
"\"generator\" : \"OpenFOAM - www.openfoam.com\"," <<
nl
237 const label nodeId = meshi + 1;
241 if (meshi != meshes_.size() - 1)
os <<
", ";
257 if (meshi != meshes_.size() - 1)
os <<
",";
266 bufferViews_.write(
os,
"bufferViews");
268 accessors_.write(
os,
"accessors");
270 animations_.write(
os,
"animations");
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
Info<< nl<< "Wrote faMesh in vtk format: "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.mesh().time().globalPath()/"finiteArea-edges"));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
Output to file stream, using an OSstream.
virtual std::ostream & stdStream()
Access to underlying std::ostream.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
Database for solution data, solver performance and other reduced data.
A class for handling file names.
word name() const
Return basename (part beyond last /), including its extension.
fileName lessExt() const
Return file name without extension (part before last .)
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 /)
virtual bool write()
Write the output fields.
scene()
Default construct.
label addColourToMesh(const vectorField &fld, const word &name, const label meshId, const scalarField &alpha=scalarField::null())
Add a colour field to the mesh, optionally with an alpha channel.
label createAnimation(const word &name)
Returns index of last animation.
void addToAnimation(const label animationi, const label inputId, const label outputId, const label meshId, const string &interpolation="LINEAR")
Add to existing animation.
Abstract base class for volume field interpolation.
A class for handling character strings derived from std::string.
A class for managing temporary objects.
A class for handling words, derived from Foam::string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
@ ARRAY_BUFFER
vertex attributes
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
bool mkDir(const fileName &pathName, mode_t mode=0777)
Make a directory and return an error if it could not be created.
Ostream & incrIndent(Ostream &os)
Increment the indent level.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Ostream & indent(Ostream &os)
Indent stream.
errorManip< error > abort(error &err)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
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)
#define forAll(list, i)
Loop across all elements in list.