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 -------------------------------------------------------------------------------
10 License
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 
26 Class
27  Foam::glTF::object
28 
29 Description
30  glTF binary object
31 
32 Note
33  Implements the glTF v2 specification
34 
35 SourceFiles
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 
49 namespace Foam
50 {
51 namespace glTF
52 {
53 
54 /*---------------------------------------------------------------------------*\
55  Class glTF::object Declaration
56 \*---------------------------------------------------------------------------*/
57 
58 class object
59 :
60  public base
61 {
62  // Private Data
63 
64  //- Buffer storage
65  Foam::List<float> data_;
66 
67 
68 public:
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
103  #include "foamGltfObjectTemplates.C"
104 #endif
105 
106 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
107 
108 #endif
109 
110 // ************************************************************************* //
List.H
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::glTF::base::name
const word & name() const noexcept
Return const access to the name.
Definition: foamGltfBase.H:165
Foam::glTF::base
Base class for glTF entities.
Definition: foamGltfBase.H:121
Foam::glTF::object::data
const Foam::List< float > & data() const noexcept
Return const access to the data buffer.
Definition: foamGltfObject.C:63
foamGltfBase.H
Foam::glTF::object
glTF binary object
Definition: foamGltfObject.H:57
fld
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< ' ';}gmvFile<< nl;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Definition: gmvOutputLagrangian.H:23
foamGltfObjectTemplates.C
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::List< float >
Foam::glTF::object::object
object()
Default construct.
Definition: foamGltfObject.C:33
Foam::glTF::object::addData
void addData(const Type &fld)
Add data to the buffer.
Definition: foamGltfObjectTemplates.C:29