Loading...
Searching...
No Matches
foamGltfObject.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2021 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26Class
27 Foam::glTF::object
28
29Description
30 glTF binary object
31
32Note
33 Implements the glTF v2 specification
34
35SourceFiles
36 foamGltfObject.C
37 foamGltfObjectTemplates.C
38
39\*---------------------------------------------------------------------------*/
40
41#ifndef foam_gltf_object_H
42#define foam_gltf_object_H
43
44#include "foamGltfBase.H"
45#include "List.H"
46
47// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48
49namespace Foam
50{
51namespace glTF
52{
54/*---------------------------------------------------------------------------*\
55 Class glTF::object Declaration
56\*---------------------------------------------------------------------------*/
57
58class object
59:
60 public base
61{
62 // Private Data
63
64 //- Buffer storage
66
67
68public:
69
70 // Constructors
71
72 //- Default construct
73 object();
74
75 //- Construct with name
76 explicit object(const word& name);
77
78
79 // Public Member Functions
80
81 //- Add data to the buffer
82 template<class Type>
83 void addData(const Type& fld);
84
85 //- Add data to the buffer from 2 containers of the same size
86 // E.g. to combine vector and scalar to create RGBA data
87 template<class Type1, class Type2>
88 void addData(const Type1& fld1, const Type2& fld2);
89
90 //- Return const access to the data buffer
91 const Foam::List<float>& data() const noexcept;
92};
93
94
95// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
96
97} // End namespace glTF
98} // End namespace Foam
99
100// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
101
102#ifdef NoRepository
104#endif
105
106// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
107
108#endif
109
110// ************************************************************************* //
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))
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition List.H:72
const word & name() const noexcept
Return const access to the name.
base()
Default construct.
const Foam::List< float > & data() const noexcept
Return const access to the data buffer.
object()
Default construct.
void addData(const Type &fld)
Add data to the buffer.
A class for handling words, derived from Foam::string.
Definition word.H:66
Namespace for handling glTF creation. https://www.khronos.org/registry/glTF/.
Namespace for OpenFOAM.