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-2019 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 cloud_H
39#define 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;
53
54/*---------------------------------------------------------------------------*\
55 Class cloud Declaration
56\*---------------------------------------------------------------------------*/
58class cloud
59:
60 public objectRegistry
61{
62
63 // Private Member Functions
64
65 //- No copy construct
66 cloud(const cloud&) = delete;
67
68 //- No copy assignment
69 void operator=(const cloud&) = delete;
70
71
72public:
73
74 //- Cloud geometry type (internal or IO representations)
75 enum class geometryType
76 {
79 };
82
83
84 //- Runtime type information
85 TypeName("cloud");
86
87 //- The prefix to local: %lagrangian
88 static const word prefix;
89
90 //- The default cloud name: %defaultCloud
91 static word defaultName;
92
93
94 // Constructors
95
96 //- Construct for given objectRegistry and default cloud name
97 explicit cloud(const objectRegistry& obr);
98
99 //- Construct for given objectRegistry and named cloud instance
100 cloud(const objectRegistry& obr, const word& cloudName);
101
102
103 //- Destructor
104 virtual ~cloud() = default;
105
106
107 // Member Functions
108
109 // Sizes
110
111 //- Number of parcels for the hosting cloud
112 virtual label nParcels() const;
113
114
115 // Edit
116
117 //- Remap the cells of particles corresponding to the
118 //- mesh topology change
119 virtual void autoMap(const mapPolyMesh&);
120
121
122 // I-O
123
124 //- Read particle fields from objects in the obr registry
125 virtual void readObjects(const objectRegistry& obr);
126
127 //- Write particle fields as objects into the obr registry
128 virtual void writeObjects(objectRegistry& obr) const;
129
130 //- Helper to construct IOField on a supplied object registry
131 template<class Type>
133 (
134 const word& fieldName,
135 const label nParticle,
136 objectRegistry& obr
137 );
138
139 //- Locate an IOField within object registry
140 // \return nullptr if not found or wrong type
141 template<class Type>
142 inline static const IOField<Type>* findIOField
143 (
144 const word& fieldName,
145 const objectRegistry& obr
146 )
147 {
148 return obr.cfindObject<IOField<Type>>(fieldName);
149 }
150
151 //- Locate the "position" IOField within object registry
152 // \return nullptr if not found or wrong type
153 inline static const IOField<point>* findIOPosition
154 (
155 const objectRegistry& obr
156 )
157 {
158 return obr.cfindObject<IOField<point>>("position");
159 }
160
161 //- Lookup an IOField within object registry
162 // Fatal if not found or wrong type
163 template<class Type>
164 inline static const IOField<Type>& lookupIOField
165 (
166 const word& fieldName,
167 const objectRegistry& obr
168 )
169 {
170 return obr.lookupObject<IOField<Type>>(fieldName);
171 }
172};
173
174
175// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176
177} // End namespace Foam
178
179// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180
181#ifdef NoRepository
182 #include "cloudTemplates.C"
183#endif
184
185// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186
187#endif
188
189// ************************************************************************* //
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Definition: Enum.H:61
A primitive field of type <T> with automated input and output.
Definition: IOField.H:58
A cloud is a registry collection of lagrangian particles.
Definition: cloud.H:60
static const IOField< Type > * findIOField(const word &fieldName, const objectRegistry &obr)
Locate an IOField within object registry.
Definition: cloud.H:142
virtual void readObjects(const objectRegistry &obr)
Read particle fields from objects in the obr registry.
Definition: cloud.C:90
geometryType
Cloud geometry type (internal or IO representations)
Definition: cloud.H:75
@ COORDINATES
barycentric coordinates
static const word prefix
The prefix to local: lagrangian.
Definition: cloud.H:87
static const IOField< Type > & lookupIOField(const word &fieldName, const objectRegistry &obr)
Lookup an IOField within object registry.
Definition: cloud.H:164
static const IOField< point > * findIOPosition(const objectRegistry &obr)
Locate the "position" IOField within object registry.
Definition: cloud.H:153
virtual label nParcels() const
Number of parcels for the hosting cloud.
Definition: cloud.C:77
TypeName("cloud")
Runtime type information.
static const Enum< geometryType > geometryTypeNames
Definition: cloud.H:80
virtual void autoMap(const mapPolyMesh &)
Definition: cloud.C:84
static IOField< Type > & createIOField(const word &fieldName, const label nParticle, objectRegistry &obr)
Helper to construct IOField on a supplied object registry.
virtual ~cloud()=default
Destructor.
static word defaultName
The default cloud name: defaultCloud.
Definition: cloud.H:90
virtual void writeObjects(objectRegistry &obr) const
Write particle fields as objects into the obr registry.
Definition: cloud.C:96
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:162
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
A class for handling words, derived from Foam::string.
Definition: word.H:68
Namespace for OpenFOAM.
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73
const word cloudName(propsDict.get< word >("cloud"))