LagrangianFieldSourceBase.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2025-2026 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::LagrangianFieldSourceBase
26 
27 Description
28  Base class for Lagrangian source conditions
29 
30 SourceFiles
31  LagrangianFieldSourceBase.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef LagrangianFieldSourceBase_H
36 #define LagrangianFieldSourceBase_H
37 
38 #include "LagrangianFieldsFwd.H"
39 #include "LagrangianSubFieldsFwd.H"
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 // Forward declaration of classes
47 class Time;
48 class regIOobject;
49 class dimensionSet;
50 class objectRegistry;
51 class dictionary;
52 class LagrangianSubMesh;
53 class LagrangianModel;
54 class LagrangianSource;
55 class LagrangianInjection;
56 
57 /*---------------------------------------------------------------------------*\
58  Class LagrangianFieldSourceBase Declaration
59 \*---------------------------------------------------------------------------*/
60 
62 {
63 protected:
64 
65  // Protected Data
66 
67  //- Reference to the internal IO object
68  const regIOobject& internalIo_;
69 
70 
71 public:
72 
73  //- Runtime type information
74  TypeName("LagrangianFieldSourceBase");
75 
76 
77  // Constructors
78 
79  //- Construct from internal field
81 
82 
83  //- Destructor
85 
86 
87  // Member Functions
88 
89  // Access
90 
91  //- Return local objectRegistry
92  const objectRegistry& db() const;
93 
94  //- Return time
95  const Time& time() const;
96 
97  //- Return internal field name
98  const word& internalName() const;
99 
100  //- Return internal field group
101  word internalGroup() const;
102 
103  //- Return internal dimensions reference
104  virtual const dimensionSet& internalDimensions() const = 0;
105 
106 
107  // Evaluation
108 
109  //- Cast a to the specified type. Handle errors.
110  template<class OtherFieldSourceType>
111  const OtherFieldSourceType& fieldSourceCast
112  (
113  const LagrangianModel&
114  ) const;
115 
116  //- Lookup and return another field source
117  template<class OtherType>
119  (
120  const word& name,
121  const LagrangianModel&
122  ) const;
123 
124  //- Lookup and return another field source and then cast to a
125  // specified type. Handle errors.
126  template<class OtherType, class OtherFieldSourceType>
127  const OtherFieldSourceType& fieldSourceCast
128  (
129  const word& name,
130  const LagrangianModel&
131  ) const;
132 
133  //- Cast a model to the specified type. Handle errors.
134  template<class OtherModelType>
135  const OtherModelType& modelCast
136  (
137  const LagrangianModel&
138  ) const;
139 
140  //- Lookup and return the value of another field source
141  template<class OtherType>
143  (
144  const word& name,
145  const LagrangianSource&,
146  const LagrangianSubMesh&
147  ) const;
148 
149  //- Lookup and return the value of another field source
150  template<class OtherType>
152  (
153  const word& name,
154  const LagrangianInjection&,
155  const LagrangianSubMesh&
156  ) const;
157 };
158 
159 
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 
162 } // End namespace Foam
163 
164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 
166 #ifdef NoRepository
168 #endif
169 
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 
172 #endif
173 
174 // ************************************************************************* //
Base class for Lagrangian source conditions.
const Time & time() const
Return time.
const word & internalName() const
Return internal field name.
word internalGroup() const
Return internal field group.
const regIOobject & internalIo_
Reference to the internal IO object.
LagrangianFieldSourceBase(const regIOobject &)
Construct from internal field.
const OtherFieldSourceType & fieldSourceCast(const LagrangianModel &) const
Cast a to the specified type. Handle errors.
const objectRegistry & db() const
Return local objectRegistry.
const OtherModelType & modelCast(const LagrangianModel &) const
Cast a model to the specified type. Handle errors.
virtual const dimensionSet & internalDimensions() const =0
Return internal dimensions reference.
tmp< LagrangianSubField< OtherType > > value(const word &name, const LagrangianSource &, const LagrangianSubMesh &) const
Lookup and return the value of another field source.
const LagrangianFieldSource< OtherType > & fieldSource(const word &name, const LagrangianModel &) const
Lookup and return another field source.
TypeName("LagrangianFieldSourceBase")
Runtime type information.
Base class for Lagrangian source conditions.
Base class for Lagrangian injections. Minimal wrapper over LagrangianSource. Implements some utility ...
Base class for Lagrangian models.
Base class for Lagrangian sources. Minimal wrapper over LagrangianModel that provides an interface to...
Mesh that relates to a sub-section of a Lagrangian mesh. This is used to construct fields that relate...
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:76
Dimension set for the base types.
Definition: dimensionSet.H:125
Registry of regIOobjects.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:55
A class for managing temporary objects.
Definition: tmp.H:55
A class for handling words, derived from string.
Definition: word.H:63
Namespace for OpenFOAM.
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.