Loading...
Searching...
No Matches
cloud.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) 2011-2016 OpenFOAM Foundation
9 Copyright (C) 2016-2024 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::cloud
29
30Description
31 A cloud is a registry collection of lagrangian particles.
32
33SourceFiles
34 cloud.C
35
36\*---------------------------------------------------------------------------*/
37
38#ifndef Foam_cloud_H
39#define Foam_cloud_H
40
41#include "objectRegistry.H"
42#include "Enum.H"
43#include "point.H"
44#include "IOField.H"
45
46// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47
48namespace Foam
49{
50
51// Forward Declarations
52class mapPolyMesh;
54/*---------------------------------------------------------------------------*\
55 Class cloud Declaration
56\*---------------------------------------------------------------------------*/
57
58class cloud
59:
60 public objectRegistry
61{
62public:
63
64 //- Cloud geometry type (internal or IO representations)
65 enum class geometryType
66 {
69 };
70
71 //- Named enumerations "coordinates", "positions"
73
74
75 // Static Data Members
76
77 //- The prefix to local: %lagrangian
78 static const word prefix;
80 //- The default cloud name: %defaultCloud
81 static word defaultName;
82
83
84 //- Runtime type information
85 TypeName("cloud");
86
87
88 // Generated Methods
89
90 //- No copy construct
91 cloud(const cloud&) = delete;
92
93 //- No copy assignment
94 void operator=(const cloud&) = delete;
95
96
97 // Constructors
99 //- Construct for given objectRegistry. Uses default cloud name
100 explicit cloud(const objectRegistry& obr);
101
102 //- Construct for given objectRegistry and named cloud
103 cloud(const objectRegistry& obr, const word& cloudName);
104
105
106 //- Destructor
107 virtual ~cloud() = default;
108
109
110 // Member Functions
111
112 // Sizes
113
114 //- Number of parcels for the hosting cloud
115 virtual label nParcels() const;
116
117
118 // Edit
119
120 //- Remap the cells of particles corresponding to the
121 //- mesh topology change
122 virtual void autoMap(const mapPolyMesh&);
123
124
125 // I-O
126
127 //- Read particle fields from objects in the obr registry
128 virtual void readObjects(const objectRegistry& obr);
129
130 //- Write particle fields as objects into the obr registry
131 virtual void writeObjects(objectRegistry& obr) const;
132
133 //- Helper to construct IOField on a supplied object registry
134 template<class Type>
136 (
137 const word& fieldName,
138 const label nParticle,
139 objectRegistry& obr
140 );
141
142 //- Locate an IOField within object registry
143 // \return nullptr if not found or wrong type
144 template<class Type>
145 static const IOField<Type>* findIOField
146 (
147 const word& fieldName,
148 const objectRegistry& obr
149 )
150 {
151 return obr.cfindObject<IOField<Type>>(fieldName);
152 }
153
154 //- Locate the "position" IOField within object registry
155 // \return nullptr if not found or wrong type
156 static const IOField<point>* findIOPosition
157 (
158 const objectRegistry& obr
159 )
161 return obr.cfindObject<IOField<point>>("position");
162 }
163
164 //- Lookup an IOField within object registry
165 // Fatal if not found or wrong type
166 template<class Type>
167 static const IOField<Type>& lookupIOField
168 (
169 const word& fieldName,
170 const objectRegistry& obr
171 )
172 {
173 return obr.lookupObject<IOField<Type>>(fieldName);
174 }
175
176 //- Lookup an IOField within object registry
177 // Fatal if not found or wrong type
178 //
179 // Note: const char signature to avoid spurious
180 // -Wdangling-reference with gcc-13
181 template<class Type>
182 static const IOField<Type>& lookupIOField
183 (
184 const char* fieldName,
185 const objectRegistry& obr
186 )
188 return obr.lookupObject<IOField<Type>>(word(fieldName));
189 }
190};
191
192
193// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194
195} // End namespace Foam
196
197// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198
199#ifdef NoRepository
200 #include "cloudTemplates.C"
201#endif
202
203// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204
205#endif
206
207// ************************************************************************* //
const word cloudName(propsDict.get< word >("cloud"))
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Definition Enum.H:57
A primitive field of type <T> with automated input and output.
Definition IOField.H:53
static const IOField< Type > * findIOField(const word &fieldName, const objectRegistry &obr)
Locate an IOField within object registry.
Definition cloud.H:174
virtual void readObjects(const objectRegistry &obr)
Read particle fields from objects in the obr registry.
Definition cloud.C:85
geometryType
Cloud geometry type (internal or IO representations).
Definition cloud.H:63
@ COORDINATES
barycentric coordinates
Definition cloud.H:64
@ POSITIONS
positions
Definition cloud.H:65
static const word prefix
The prefix to local: lagrangian.
Definition cloud.H:79
static const IOField< Type > & lookupIOField(const word &fieldName, const objectRegistry &obr)
Lookup an IOField within object registry.
Definition cloud.H:202
static const IOField< point > * findIOPosition(const objectRegistry &obr)
Locate the "position" IOField within object registry.
Definition cloud.H:188
cloud(const cloud &)=delete
No copy construct.
virtual label nParcels() const
Number of parcels for the hosting cloud.
Definition cloud.C:72
TypeName("cloud")
Runtime type information.
static const Enum< geometryType > geometryTypeNames
Named enumerations "coordinates", "positions".
Definition cloud.H:71
virtual void autoMap(const mapPolyMesh &)
Remap the cells of particles corresponding to the mesh topology change.
Definition cloud.C:79
static IOField< Type > & createIOField(const word &fieldName, const label nParticle, objectRegistry &obr)
Helper to construct IOField on a supplied object registry.
void operator=(const cloud &)=delete
No copy assignment.
static const IOField< Type > & lookupIOField(const char *fieldName, const objectRegistry &obr)
Lookup an IOField within object registry.
Definition cloud.H:220
virtual ~cloud()=default
Destructor.
static word defaultName
The default cloud name: defaultCloud.
Definition cloud.H:84
virtual void writeObjects(objectRegistry &obr) const
Write particle fields as objects into the obr registry.
Definition cloud.C:91
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Registry of regIOobjects.
const Type * cfindObject(const word &name, const bool recursive=false) const
Return const pointer to the object of the given Type.
const Type & lookupObject(const word &name, const bool recursive=false) const
Lookup and return const reference to the object of the given Type. Fatal if not found or the wrong ty...
A class for handling words, derived from Foam::string.
Definition word.H:66
Namespace for OpenFOAM.
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68