CloudStateFieldRef.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) 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::CloudStateFieldRef
26 
27 Description
28  Wrapper for a reference to a dynamic Lagrangian field. It provides
29  convenient access consistent with that of the derived fields so that
30  expressions involving both kinds of field are readable. It also ensures
31  that old-time fields are maintained for a sub-mesh for the duration of the
32  inner correction iterations.
33 
34 See also
35  Foam::CloudStateField
36  Foam::CloudDerivedField
37 
38 SourceFiles
39  CloudStateFieldRef.C
40 
41 \*---------------------------------------------------------------------------*/
42 
43 #ifndef CloudStateFieldRef_H
44 #define CloudStateFieldRef_H
45 
46 #include "LagrangianModelRef.H"
47 #include "LagrangianFields.H"
48 
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 
51 namespace Foam
52 {
53 
54 /*---------------------------------------------------------------------------*\
55  Class CloudStateFieldRef Declaration
56 \*---------------------------------------------------------------------------*/
57 
58 template<class Type>
60 {
61 private:
62 
63  // Private Data
64 
65  //- The field reference
67 
68  //- The cached Lagrangian sub-all-field
69  mutable autoPtr<LagrangianSubSubField<Type>> psiAllPtr_;
70 
71  //- The cached Lagrangian sub-field
72  mutable autoPtr<LagrangianSubSubField<Type>> psiSubSubPtr_;
73 
74  //- The index of the sub-mesh
75  mutable uint64_t psiSubSubMeshIndex_;
76 
77 
78 public:
79 
80  // Constructors
81 
82  //- Construct from a field reference
84 
85 
86  // Member Functions
87 
88  //- Access the field's name
89  const word& name() const;
90 
91  //- Access the field's mesh
92  const LagrangianMesh& mesh() const;
93 
94  //- Access the field's dimensions
95  const dimensionSet& dimensions() const;
96 
97  //- Access a part of the field
99 
100  //- Access a part of the field
102 
103 
104  // Member Operators
105 
106  //- Cast to the field
107  operator const LagrangianDynamicField<Type>&() const;
108 
109  //- Cast to the field
110  operator LagrangianDynamicField<Type>&();
111 
112  //- Access the entire field
113  const LagrangianDynamicField<Type>& operator()
114  (
115  const LagrangianMesh&
116  ) const;
117 
118  //- Access a part of the field
119  const LagrangianSubSubField<Type>& operator()
120  (
121  const LagrangianSubMesh& subMesh
122  ) const;
123 
124  //- Compute and return part of the field associated with a model
126  (
127  const LagrangianModelRef& model,
128  const LagrangianSubMesh& subMesh
129  ) const;
130 };
131 
132 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
133 
134 } // End namespace Foam
135 
136 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
137 
138 #ifdef NoRepository
139  #include "CloudStateFieldRef.C"
140 #endif
141 
142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
143 
144 #endif
145 
146 // ************************************************************************* //
Wrapper for a reference to a dynamic Lagrangian field. It provides convenient access consistent with ...
const dimensionSet & dimensions() const
Access the field's dimensions.
CloudStateFieldRef(LagrangianDynamicField< Type > &)
Construct from a field reference.
const LagrangianMesh & mesh() const
Access the field's mesh.
const LagrangianSubSubField< Type > & ref(const LagrangianSubMesh &) const
Access a part of the field.
const word & name() const
Access the field's name.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Generic GeometricField class.
Class containing Lagrangian geometry and topology.
Simple wrapper to provide an optional reference to a Lagrangian model.
Mesh that relates to a sub-section of a Lagrangian mesh. This is used to construct fields that relate...
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
Dimension set for the base types.
Definition: dimensionSet.H:125
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.