1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
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
13 the Free Software Foundation, either version 3 of the License, or
14 (at your 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, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "transformList.H"
28 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
31 Foam::List<T> Foam::transform
33 const tensor& rotTensor,
37 List<T> newField(field.size());
41 newField[i] = transform(rotTensor, field[i]);
49 void Foam::transformList(const tensor& rotTensor, UList<T>& field)
53 field[i] = transform(rotTensor, field[i]);
59 void Foam::transformList(const tensorField& rotTensor, UList<T>& field)
61 if (rotTensor.size() == 1)
65 field[i] = transform(rotTensor[0], field[i]);
68 else if (rotTensor.size() == field.size())
72 field[i] = transform(rotTensor[i], field[i]);
79 "transformList(const tensorField&, UList<T>&)"
80 ) << "Sizes of field and transformation not equal. field:"
81 << field.size() << " transformation:" << rotTensor.size()
88 void Foam::transformList(const tensor& rotTensor, Map<T>& field)
90 forAllIter(typename Map<T>, field, iter)
92 iter() = transform(rotTensor[0], iter());
98 void Foam::transformList(const tensorField& rotTensor, Map<T>& field)
100 if (rotTensor.size() == 1)
102 forAllIter(typename Map<T>, field, iter)
104 iter() = transform(rotTensor[0], iter());
111 "transformList(const tensorField&, Map<T>&)"
112 ) << "Multiple transformation tensors not supported. field:"
113 << field.size() << " transformation:" << rotTensor.size()
114 << abort(FatalError);
120 void Foam::transformList(const tensor& rotTensor, EdgeMap<T>& field)
122 forAllIter(typename EdgeMap<T>, field, iter)
124 iter() = transform(rotTensor[0], iter());
130 void Foam::transformList(const tensorField& rotTensor, EdgeMap<T>& field)
132 if (rotTensor.size() == 1)
134 forAllIter(typename EdgeMap<T>, field, iter)
136 iter() = transform(rotTensor[0], iter());
143 "transformList(const tensorField&, EdgeMap<T>&)"
144 ) << "Multiple transformation tensors not supported. field:"
145 << field.size() << " transformation:" << rotTensor.size()
146 << abort(FatalError);
151 // ************************************************************************* //