38 auto& bv = bufferViews_.create(
name);
39 bv.byteOffset() = bytes_;
40 bv.byteLength() =
fld.size()*nCmpts*
sizeof(float);
45 bytes_ += bv.byteLength();
47 auto& acc = accessors_.create(
name);
48 acc.bufferViewId() = bv.id();
51 auto& obj = objects_.create(
name);
61 const label accessorId =
64 auto& gmesh = meshes_.create(
name);
65 gmesh.accessorId() = accessorId;
67 return meshes_.size() - 1;
79 auto& gmesh = getMesh(meshi);
81 const label accessorId = addField(
fld,
name);
83 gmesh.addField(
name, accessorId);
Info<< nl;Info<< "Write faMesh in vtk format:"<< nl;{ vtk::uindirectPatchWriter writer(aMesh.patch(), fileName(aMesh.time().globalPath()/vtkBaseFileName));writer.writeGeometry();globalIndex procAddr(aMesh.nFaces());labelList cellIDs;if(UPstream::master()) { cellIDs.resize(procAddr.totalSize());for(const labelRange &range :procAddr.ranges()) { auto slice=cellIDs.slice(range);slice=identity(range);} } writer.beginCellData(4);writer.writeProcIDs();writer.write("cellID", cellIDs);writer.write("area", aMesh.S().field());writer.write("normal", aMesh.faceAreaNormals());writer.beginPointData(1);writer.write("normal", aMesh.pointAreaNormals());Info<< " "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.time().globalPath()/(vtkBaseFileName+"-edges")));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
label addField(const Type &fld, const word &name, const label target=-1)
Returns accessor index.
label addFieldToMesh(const Type &fld, const word &name, const label meshId)
Returns accessor index.
label addMesh(const Type &fld, const word &name)
Returns index of last mesh.
A traits class, which is primarily used for primitives and vector-space.
A class for handling words, derived from Foam::string.
constexpr auto key(const Type &t) noexcept
Helper function to return the enum value.
@ ARRAY_BUFFER
vertex attributes
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.