fixed writing out entries in advective bc
[OpenFOAM-1.6-ext.git] / src / VectorN / OpenFOAM / expandContract / ExpandTensorNField.C
blobddb379780f47d0d2e05e48b24131024c03a32e4c
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright held by original author
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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
25 Description
26     Global functions for expansion and contraction of tensor field
27     to diagonal type
29 Author
30     Hrvoje Jasak, Wikki Ltd.  All rights reserved
32 \*---------------------------------------------------------------------------*/
34 #include "ExpandTensorNField.H"
35 #include "ExpandTensorN.H"
36 #include "Field.H"
37 #include "VectorNFieldTypes.H"
38 #include "FieldM.H"
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 #define UNARY_FUNCTION(typeF1, typeF2, FUNC)                                 \
43                                                                              \
44 void FUNC(Field<typeF1>& f1, const UList<typeF2>& f2)                        \
45 {                                                                            \
46     checkFields(f1, f2, #FUNC "(f1,f2)");                                    \
47                                                                              \
48     List_ACCESS(typeF1, f1, f1P);                                            \
49     List_CONST_ACCESS(typeF2, f2, f2P);                                      \
50                                                                              \
51     List_FOR_ALL(f1,i)                                                       \
52         FUNC(List_ELEM(f1, f1P, i), List_ELEM(f2, f2P, i));                  \
53     List_END_FOR_ALL                                                         \
54 }                                                                            \
55                                                                              \
56 void FUNC(Field<typeF1>& f1, const tmp<Field<typeF2> >& tf2)                 \
57 {                                                                            \
58      FUNC(f1,tf2());                                                         \
59      tf2.clear();                                                            \
61    
62 #define ExpandFieldFunctions(tensorType, diagTensorType, sphericalTensorType, \
63         vectorType, cmptType, args...)                                        \
64                                                                               \
65 UNARY_FUNCTION(cmptType, tensorType, contractScalar)                          \
66 UNARY_FUNCTION(cmptType, diagTensorType, contractScalar)                      \
67 UNARY_FUNCTION(cmptType, sphericalTensorType, contractScalar)                 \
68 UNARY_FUNCTION(cmptType, vectorType, contractScalar)                          \
69                                                                               \
70 UNARY_FUNCTION(vectorType, tensorType, contractLinear)                        \
71 UNARY_FUNCTION(vectorType, diagTensorType, contractLinear)                    \
72 UNARY_FUNCTION(vectorType, sphericalTensorType, contractLinear)               \
73                                                                               \
74 UNARY_FUNCTION(vectorType, cmptType, expandScalar)                            \
75 UNARY_FUNCTION(tensorType, cmptType, expandScalar)                            \
76 UNARY_FUNCTION(diagTensorType, cmptType, expandScalar)                        \
77 UNARY_FUNCTION(sphericalTensorType, cmptType, expandScalar)                   \
78                                                                               \
79 UNARY_FUNCTION(tensorType, vectorType, expandLinear)                          \
80 UNARY_FUNCTION(diagTensorType, vectorType, expandLinear)                      \
81 UNARY_FUNCTION(sphericalTensorType, vectorType, expandLinear)
83 namespace Foam
86 // * * * * * * * * * * * * * * * Global Functions  * * * * * * * * * * * * * //
88 forAllVectorTensorNTypes(ExpandFieldFunctions)
90 // template<class Cmpt, int length>
91 // void contractScalar
92 // (
93 //     Field<Cmpt>& res,
94 //     const UList<TensorN<Cmpt, length> >& f
95 // )
96 // {
97 //     forAll (res, i)
98 //     {
99 //         contractScalar(res[i], f[i]);
100 //     }
101 // }
102 // 
103 // 
104 // template <class Cmpt, int length>
105 // void contractLinear
106 // (
107 //     Field<VectorN<Cmpt, length> >& res,
108 //     const UList<TensorN<Cmpt, length> >& f
109 // )
110 // {
111 //     forAll (res, i)
112 //     {
113 //         contractLinear(res[i], f[i]);
114 //     }
115 // }
116 // 
117 // 
118 // template <class Cmpt, int length>
119 // void expandScalar
120 // (
121 //     Field<VectorN<Cmpt, length> >& res,
122 //     const UList<Cmpt>& f
123 // )
124 // {
125 //     forAll (res, i)
126 //     {
127 //         expandScalar(res[i], f[i]);
128 //     }
129 // }
130 // 
131 // 
132 // template <class Cmpt, int length>
133 // void expandScalar
134 // (
135 //     Field<TensorN<Cmpt, length> >& res,
136 //     const UList<Cmpt>& f
137 // )
138 // {
139 //     forAll (res, i)
140 //     {
141 //         expandScalar(res[i], f[i]);
142 //     }
143 // }
144 // 
145 // 
146 // template <class Cmpt, int length>
147 // void expandLinear
148 // (
149 //     Field<TensorN<Cmpt, length> >& res,
150 //     const UList<VectorN<Cmpt, length> >& f
151 // )
152 // {
153 //     forAll (res, i)
154 //     {
155 //         expandLinear(res[i], f[i]);
156 //     }
157 // }
159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 } // End namespace Foam
163 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 #undef UNARY_FUNCTION
166 #undef ExpandFieldFunctions
168 // ************************************************************************* //