LagrangianPatchFieldFunctions.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 \*---------------------------------------------------------------------------*/
25 
26 #include "LagrangianPatchField.H"
27 
28 #define FIELD_TYPE LagrangianPatchField
29 
30 #define COMMA ,
31 
32 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
36 
37 // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
38 
39 template<class Type>
40 inline void component
41 (
42  FIELD_TYPE<typename FIELD_TYPE<Type>::cmptType>& sf,
43  const FIELD_TYPE<Type>& f,
44  const direction d
45 )
46 {}
47 
48 
49 #define UNARY_FUNCTION(Template, Type, Type1, func) \
50  \
51 Template \
52 inline void func \
53 ( \
54  FIELD_TYPE<Type>& f, \
55  const FIELD_TYPE<Type1>& f1 \
56 ) \
57 {}
58 
59 UNARY_FUNCTION(template<class Type>, scalar, Type, magSqr)
60 UNARY_FUNCTION(template<class Type>, scalar, Type, mag)
62 (
63  template<class Type>,
64  typename FIELD_TYPE<Type>::cmptType,
65  Type,
66  cmptAv
67 )
68 UNARY_FUNCTION(template<class Type>, Type, Type, cmptMag)
70 (
71  template<class Type COMMA direction r>,
72  typename powProduct<Type COMMA r>::type,
73  Type,
74  pow
75 )
77 (
78  template<class Type>,
79  typename outerProduct<Type COMMA Type>::type,
80  Type,
81  sqr
82 )
83 UNARY_FUNCTION(, scalar, scalar, pow3)
84 UNARY_FUNCTION(, scalar, scalar, pow4)
85 UNARY_FUNCTION(, scalar, scalar, pow5)
86 UNARY_FUNCTION(, scalar, scalar, pow6)
87 UNARY_FUNCTION(, scalar, scalar, pow025)
88 UNARY_FUNCTION(, scalar, scalar, sqrt)
89 UNARY_FUNCTION(, scalar, scalar, cbrt)
90 UNARY_FUNCTION(template<class Type>, Type, Type, T)
104 
105 #undef UNARY_FUNCTION
106 
107 
108 #define BINARY_FUNCTION(func) \
109  \
110 template<class Type> \
111 inline void func \
112 ( \
113  FIELD_TYPE<Type>& f, \
114  const FIELD_TYPE<Type>& f1, \
115  const FIELD_TYPE<Type>& f2 \
116 ) \
117 {} \
118  \
119 template<class Type> \
120 inline void func \
121 ( \
122  FIELD_TYPE<Type>& f, \
123  const FIELD_TYPE<Type>& f1, \
124  const Type& s \
125 ) \
126 {}
127 
132 
133 #undef BINARY_FUNCTION
134 
135 
136 // * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
137 
138 #define UNARY_OPERATOR(op, opFunc) \
139  \
140 template<class Type> \
141 inline void opFunc(FIELD_TYPE<Type>& f, const FIELD_TYPE<Type>& f1) \
142 {}
143 
145 
146 #undef UNARY_OPERATOR
147 
148 
149 #define BINARY_OPERATOR(Template, Type, Type1, Type2, op, opFunc) \
150  \
151 Template \
152 inline void opFunc \
153 ( \
154  FIELD_TYPE<Type>& f, \
155  const FIELD_TYPE<Type1>& f1, \
156  const FIELD_TYPE<Type2>& f2 \
157 ) \
158 {}
159 
160 BINARY_OPERATOR(template<class Type>, Type, scalar, Type, *, multiply)
161 BINARY_OPERATOR(template<class Type>, Type, Type, scalar, *, multiply)
162 BINARY_OPERATOR(, scalar, scalar, scalar, *, multiply)
163 BINARY_OPERATOR(template<class Type>, Type, Type, scalar, /, divide)
164 
165 #undef BINARY_OPERATOR
166 
167 
168 #define BINARY_TYPE_OPERATOR_SF(TYPE, op, opFunc) \
169  \
170 template<class Type> \
171 inline void opFunc \
172 ( \
173  FIELD_TYPE<Type>& f, \
174  const TYPE& s, \
175  const FIELD_TYPE<Type>& f1 \
176 ) \
177 {}
178 
179 #define BINARY_TYPE_OPERATOR_FS(TYPE, op, opFunc) \
180  \
181 template<class Type> \
182 inline void opFunc \
183 ( \
184  FIELD_TYPE<Type>& f, \
185  const FIELD_TYPE<Type>& f1, \
186  const TYPE& s \
187 ) \
188 {}
189 
193 
194 #undef BINARY_TYPE_OPERATOR_SF
195 #undef BINARY_TYPE_OPERATOR_FS
196 
197 
198 #define PRODUCT_OPERATOR(product, op, opFunc) \
199  \
200 template<class Type1, class Type2> \
201 inline void opFunc \
202 ( \
203  FIELD_TYPE<typename product<Type1, Type2>::type>& f, \
204  const FIELD_TYPE<Type1>& f1, \
205  const FIELD_TYPE<Type2>& f2 \
206 ) \
207 {} \
208  \
209 template<class Type, class Form, class Cmpt, direction nCmpt> \
210 inline void opFunc \
211 ( \
212  FIELD_TYPE<typename product<Type, Form>::type>& f, \
213  const FIELD_TYPE<Type>& f1, \
214  const VectorSpace<Form,Cmpt,nCmpt>& vs \
215 ) \
216 {} \
217  \
218 template<class Form, class Cmpt, direction nCmpt, class Type> \
219 inline void opFunc \
220 ( \
221  FIELD_TYPE<typename product<Form, Type>::type>& f, \
222  const VectorSpace<Form,Cmpt,nCmpt>& vs, \
223  const FIELD_TYPE<Type>& f1 \
224 ) \
225 {}
226 
233 
234 #undef PRODUCT_OPERATOR
235 
236 
237 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
238 
239 } // End namespace Foam
240 
241 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
242 
243 #undef COMMA
244 
245 #undef FIELD_TYPE
246 
247 // ************************************************************************* //
#define BINARY_TYPE_OPERATOR_FS(TYPE, op, opFunc)
#define BINARY_FUNCTION(func)
#define BINARY_OPERATOR(Template, Type, Type1, Type2, op, opFunc)
#define FIELD_TYPE
#define PRODUCT_OPERATOR(product, op, opFunc)
#define UNARY_OPERATOR(op, opFunc)
#define UNARY_FUNCTION(Template, Type, Type1, func)
#define BINARY_TYPE_OPERATOR_SF(TYPE, op, opFunc)
volScalarField sf(fieldObject, mesh)
Namespace for OpenFOAM.
void subtract(LagrangianPatchField< typename typeOfSum< Type1, Type2 >::type > &f, const LagrangianPatchField< Type1 > &f1, const LagrangianPatchField< Type2 > &f2)
void dot(LagrangianPatchField< typename innerProduct< Type1, Type2 >::type > &f, const LagrangianPatchField< Type1 > &f1, const LagrangianPatchField< Type2 > &f2)
void skew(LagrangianPatchField< tensor > &f, const LagrangianPatchField< tensor > &f1)
void negate(LagrangianPatchField< Type > &f, const LagrangianPatchField< Type > &f1)
void cmptMultiply(LagrangianPatchField< Type > &f, const LagrangianPatchField< Type > &f1, const LagrangianPatchField< Type > &f2)
void outer(LagrangianPatchField< typename outerProduct< Type1, Type2 >::type > &f, const LagrangianPatchField< Type1 > &f1, const LagrangianPatchField< Type2 > &f2)
void divide(LagrangianPatchField< Type > &f, const LagrangianPatchField< Type > &f1, const LagrangianPatchField< scalar > &f2)
void dotdot(LagrangianPatchField< typename scalarProduct< Type1, Type2 >::type > &f, const LagrangianPatchField< Type1 > &f1, const LagrangianPatchField< Type2 > &f2)
void dev2(LagrangianPatchField< tensor > &f, const LagrangianPatchField< tensor > &f1)
void cmptDivide(LagrangianPatchField< Type > &f, const LagrangianPatchField< Type > &f1, const LagrangianPatchField< Type > &f2)
void dev(LagrangianPatchField< tensor > &f, const LagrangianPatchField< tensor > &f1)
void pow025(LagrangianPatchField< scalar > &f, const LagrangianPatchField< scalar > &f1)
void twoSymm(LagrangianPatchField< tensor > &f, const LagrangianPatchField< tensor > &f1)
void eigenValues(LagrangianPatchField< vector > &f, const LagrangianPatchField< tensor > &f1)
void T(LagrangianPatchField< Type > &f, const LagrangianPatchField< Type > &f1)
void pow4(LagrangianPatchField< scalar > &f, const LagrangianPatchField< scalar > &f1)
void cross(LagrangianPatchField< typename crossProduct< Type1, Type2 >::type > &f, const LagrangianPatchField< Type1 > &f1, const LagrangianPatchField< Type2 > &f2)
void pow6(LagrangianPatchField< scalar > &f, const LagrangianPatchField< scalar > &f1)
void det(LagrangianPatchField< scalar > &f, const LagrangianPatchField< tensor > &f1)
void mag(LagrangianPatchField< scalar > &f, const LagrangianPatchField< Type > &f1)
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
void component(LagrangianPatchField< typename LagrangianPatchField< Type >::cmptType > &sf, const LagrangianPatchField< Type > &f, const direction d)
void symm(LagrangianPatchField< tensor > &f, const LagrangianPatchField< tensor > &f1)
void pow(LagrangianPatchField< typename powProduct< Type, r >::type > &f, const LagrangianPatchField< Type > &f1)
void multiply(LagrangianPatchField< Type > &f, const LagrangianPatchField< scalar > &f1, const LagrangianPatchField< Type > &f2)
void hdual(LagrangianPatchField< vector > &f, const LagrangianPatchField< tensor > &f1)
void pow5(LagrangianPatchField< scalar > &f, const LagrangianPatchField< scalar > &f1)
void cmptAv(LagrangianPatchField< typename LagrangianPatchField< Type >::cmptType > &f, const LagrangianPatchField< Type > &f1)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
void diag(LagrangianPatchField< vector > &f, const LagrangianPatchField< tensor > &f1)
void pow3(LagrangianPatchField< scalar > &f, const LagrangianPatchField< scalar > &f1)
void eigenVectors(LagrangianPatchField< tensor > &f, const LagrangianPatchField< tensor > &f1)
void cbrt(LagrangianPatchField< scalar > &f, const LagrangianPatchField< scalar > &f1)
void sqr(LagrangianPatchField< typename outerProduct< Type, Type >::type > &f, const LagrangianPatchField< Type > &f1)
void tr(LagrangianPatchField< scalar > &f, const LagrangianPatchField< tensor > &f1)
void inv(LagrangianPatchField< tensor > &f, const LagrangianPatchField< tensor > &f1)
void magSqr(LagrangianPatchField< scalar > &f, const LagrangianPatchField< Type > &f1)
void add(LagrangianPatchField< typename typeOfSum< Type1, Type2 >::type > &f, const LagrangianPatchField< Type1 > &f1, const LagrangianPatchField< Type2 > &f2)
void sqrt(LagrangianPatchField< scalar > &f, const LagrangianPatchField< scalar > &f1)
void cmptMag(LagrangianPatchField< Type > &f, const LagrangianPatchField< Type > &f1)
uint8_t direction
Definition: direction.H:45
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488
labelList f(nPoints)