1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
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
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 Global functions for expansion and contraction of tensor field
30 Hrvoje Jasak, Wikki Ltd. All rights reserved
32 \*---------------------------------------------------------------------------*/
34 #include "ExpandTensorNField.H"
35 #include "ExpandTensorN.H"
37 #include "VectorNFieldTypes.H"
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 #define UNARY_FUNCTION(typeF1, typeF2, FUNC) \
44 void FUNC(Field<typeF1>& f1, const UList<typeF2>& f2) \
46 checkFields(f1, f2, #FUNC "(f1,f2)"); \
48 List_ACCESS(typeF1, f1, f1P); \
49 List_CONST_ACCESS(typeF2, f2, f2P); \
52 FUNC(List_ELEM(f1, f1P, i), List_ELEM(f2, f2P, i)); \
56 void FUNC(Field<typeF1>& f1, const tmp<Field<typeF2> >& tf2) \
62 #define ExpandFieldFunctions(tensorType, diagTensorType, sphericalTensorType, \
63 vectorType, cmptType, args...) \
65 UNARY_FUNCTION(cmptType, tensorType, contractScalar) \
66 UNARY_FUNCTION(cmptType, diagTensorType, contractScalar) \
67 UNARY_FUNCTION(cmptType, sphericalTensorType, contractScalar) \
68 UNARY_FUNCTION(cmptType, vectorType, contractScalar) \
70 UNARY_FUNCTION(vectorType, tensorType, contractLinear) \
71 UNARY_FUNCTION(vectorType, diagTensorType, contractLinear) \
72 UNARY_FUNCTION(vectorType, sphericalTensorType, contractLinear) \
74 UNARY_FUNCTION(vectorType, cmptType, expandScalar) \
75 UNARY_FUNCTION(tensorType, cmptType, expandScalar) \
76 UNARY_FUNCTION(diagTensorType, cmptType, expandScalar) \
77 UNARY_FUNCTION(sphericalTensorType, cmptType, expandScalar) \
79 UNARY_FUNCTION(tensorType, vectorType, expandLinear) \
80 UNARY_FUNCTION(diagTensorType, vectorType, expandLinear) \
81 UNARY_FUNCTION(sphericalTensorType, vectorType, expandLinear)
86 // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
88 forAllVectorTensorNTypes(ExpandFieldFunctions)
90 // template<class Cmpt, int length>
91 // void contractScalar
94 // const UList<TensorN<Cmpt, length> >& f
99 // contractScalar(res[i], f[i]);
104 // template <class Cmpt, int length>
105 // void contractLinear
107 // Field<VectorN<Cmpt, length> >& res,
108 // const UList<TensorN<Cmpt, length> >& f
113 // contractLinear(res[i], f[i]);
118 // template <class Cmpt, int length>
121 // Field<VectorN<Cmpt, length> >& res,
122 // const UList<Cmpt>& f
127 // expandScalar(res[i], f[i]);
132 // template <class Cmpt, int length>
135 // Field<TensorN<Cmpt, length> >& res,
136 // const UList<Cmpt>& f
141 // expandScalar(res[i], f[i]);
146 // template <class Cmpt, int length>
149 // Field<TensorN<Cmpt, length> >& res,
150 // const UList<VectorN<Cmpt, length> >& f
155 // expandLinear(res[i], f[i]);
159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 } // End namespace Foam
163 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 #undef UNARY_FUNCTION
166 #undef ExpandFieldFunctions
168 // ************************************************************************* //