LagrangianCoeff.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 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::LagrangianCoeff
26 
27 Description
28  Class to store a coefficient of a Lagrangian equation
29 
30 SourceFiles
31  LagrangianCoeff.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef LagrangianCoeff_H
36 #define LagrangianCoeff_H
37 
38 #include "LagrangianMesh.H"
39 #include "LagrangianSubFields.H"
40 #include "LagrangianEqnBase.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 /*---------------------------------------------------------------------------*\
48  Class LagrangianCoeff Declaration
49 \*---------------------------------------------------------------------------*/
50 
51 template<class Type, bool Implicit>
52 class LagrangianCoeff
53 :
54  public tmp<LagrangianCoeff<Type, Implicit>>::refCount
55 {
56  // Private Data
57 
58  //- Reference to the equation
59  const LagrangianEqnBase& eqn_;
60 
61  //- Coefficient
63 
64 
65  // Private Member Functions
66 
67  //- Construct the coefficient field for given dimensions
68  void initialise(const dimensionSet& dims);
69 
70 
71 public:
72 
73  // Constructors
74 
75  //- Construct from a reference to the equation
77 
78  //- Construct as copy
80 
81  //- Construct as copy or reuse as specified
83  (
85  const bool reuse
86  );
87 
88  //- Move construct
90 
91  //- Construct from a field
92  template<template<class> class PrimitiveField>
94  (
95  const LagrangianEqnBase& eqn,
97  );
98 
99  //- Construct from a tmp field
100  template<template<class> class PrimitiveField>
102  (
103  const LagrangianEqnBase& eqn,
105  );
106 
107 
108  // Member Functions
109 
110  //- Access the equation
111  const LagrangianEqnBase& eqn() const;
112 
113  //- Determine whether this coefficient has values or not
114  bool valid() const;
115 
116  //- Access the coefficient
117  const LagrangianSubField<Type>& S() const;
118 
119  //- In-place negation
120  void negate();
121 
122 
123  // Member Operators
124 
125  //- Addition assignment
126  template<template<class> class PrimitiveField>
128 
129  //- Addition assignment
130  template<template<class> class PrimitiveField>
132 
133  //- Addition assignment
135 
136  //- Addition assignment
137  void operator+=(const dimensioned<Type>&);
138 
139  //- Addition assignment
140  void operator+=(const zero);
141 
142  //- Subtraction assignment
143  template<template<class> class PrimitiveField>
145 
146  //- Subtraction assignment
147  template<template<class> class PrimitiveField>
149 
150  //- Subtraction assignment
152 
153  //- Subtraction assignment
154  void operator-=(const dimensioned<Type>&);
155 
156  //- Subtraction assignment
157  void operator-=(const zero);
158 
159  //- Multiply assignment
160  template<template<class> class PrimitiveField>
162 
163  //- Multiply assignment
164  template<template<class> class PrimitiveField>
166 
167  //- Multiply assignment
168  void operator*=(const dimensioned<scalar>&);
169 
170  //- Multiply assignment
171  void operator*=(const zero&);
172 
173  //- Division assignment
174  template<template<class> class PrimitiveField>
176 
177  //- Division assignment
178  template<template<class> class PrimitiveField>
180 
181  //- Division assignment
182  void operator/=(const dimensioned<scalar>& dt);
183 };
184 
185 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186 
187 } // End namespace Foam
188 
189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190 
191 #ifdef NoRepository
192  #include "LagrangianCoeff.C"
193 #endif
194 
195 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
196 
197 #endif
198 
199 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Class to store a coefficient of a Lagrangian equation.
bool valid() const
Determine whether this coefficient has values or not.
LagrangianCoeff(const LagrangianEqnBase &eqn)
Construct from a reference to the equation.
void operator-=(const LagrangianSubField< Type, PrimitiveField > &)
Subtraction assignment.
const LagrangianEqnBase & eqn() const
Access the equation.
void operator/=(const LagrangianSubField< scalar, PrimitiveField > &)
Division assignment.
void operator*=(const LagrangianSubField< scalar, PrimitiveField > &)
Multiply assignment.
void operator+=(const LagrangianSubField< Type, PrimitiveField > &)
Addition assignment.
void negate()
In-place negation.
const LagrangianSubField< Type > & S() const
Access the coefficient.
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
Generic dimensioned Type class.
Reference counter for various OpenFOAM components.
Definition: refCount.H:50
A class for managing temporary objects.
Definition: tmp.H:55
A class representing the concept of 0 used to avoid unnecessary manipulations for objects that are kn...
Definition: zero.H:50
Namespace for OpenFOAM.