transformFieldField.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011 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 Description
25  Spatial transformation functions for FieldField.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "transformFieldField.H"
30 
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
35 
36 // * * * * * * * * * * * * * * * global functions * * * * * * * * * * * * * //
37 
38 template<template<class> class Field, class Type>
39 void transform
40 (
42  const FieldField<Field, tensor>& trf,
43  const FieldField<Field, Type>& tf
44 )
45 {
46  forAll(rtf, i)
47  {
48  transform(rtf[i], trf[i], tf[i]);
49  }
50 }
51 
52 
53 template<template<class> class Field, class Type>
55 (
56  const FieldField<Field, tensor>& trf,
57  const FieldField<Field, Type>& tf
58 )
59 {
61  (
63  );
64  transform(tranf(), trf, tf);
65  return tranf;
66 }
67 
68 
69 template<template<class> class Field, class Type>
71 (
72  const FieldField<Field, tensor>& trf,
73  const tmp<FieldField<Field, Type> >& ttf
74 )
75 {
76  tmp<FieldField<Field, Type> > tranf(ttf.ptr());
77  transform(tranf(), trf, tranf());
78  return tranf;
79 }
80 
81 
82 template<template<class> class Field, class Type>
84 (
85  const tmp<FieldField<Field, tensor> >& ttrf,
86  const FieldField<Field, Type>& tf
87 )
88 {
90  (
92  );
93  transform(tranf(), ttrf(), tf);
94  ttrf.clear();
95  return tranf;
96 }
97 
98 
99 template<template<class> class Field, class Type>
101 (
102  const tmp<FieldField<Field, tensor> >& ttrf,
103  const tmp<FieldField<Field, Type> >& ttf
104 )
105 {
106  tmp<FieldField<Field, Type> > tranf(ttf.ptr());
107  transform(tranf(), ttrf(), tranf());
108  ttrf.clear();
109  return tranf;
110 }
111 
112 
113 template<template<class> class Field, class Type>
114 void transform
115 (
117  const tensor& t,
118  const FieldField<Field, Type>& tf
119 )
120 {
121  forAll(rtf, i)
122  {
123  transform(rtf[i], t, tf[i]);
124  }
125 }
126 
127 
128 template<template<class> class Field, class Type>
130 (
131  const tensor& t,
132  const FieldField<Field, Type>& tf
133 )
134 {
136  (
138  );
139  transform(tranf(), t, tf);
140  return tranf;
141 }
142 
143 
144 template<template<class> class Field, class Type>
146 (
147  const tensor& t,
148  const tmp<FieldField<Field, Type> >& ttf
149 )
150 {
151  tmp<FieldField<Field, Type> > tranf(ttf.ptr());
152  transform(tranf(), t, tranf());
153  return tranf;
154 }
155 
156 
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 
159 } // End namespace Foam
160 
161 // ************************************************************************* //
Generic field type.
Definition: FieldField.H:51
Namespace for OpenFOAM.
dimensionSet transform(const dimensionSet &)
Definition: dimensionSet.C:465
#define forAll(list, i)
Definition: UList.H:421
Pre-declare SubField and related Field type.
Definition: Field.H:57
A class for managing temporary objects.
Definition: PtrList.H:118
transformFieldField Spatial transformation functions for FieldField.