00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include "transformField.H"
00028 #include "FieldM.H"
00029
00030
00031
00032 namespace Foam
00033 {
00034
00035
00036
00037 template<class Type>
00038 void transform
00039 (
00040 Field<Type>& rtf,
00041 const tensorField& trf,
00042 const Field<Type>& tf
00043 )
00044 {
00045 if (trf.size() == 1)
00046 {
00047 return transform(rtf, trf[0], tf);
00048 }
00049 else
00050 {
00051 TFOR_ALL_F_OP_FUNC_F_F
00052 (
00053 Type, rtf, =, transform, tensor, trf, Type, tf
00054 )
00055 }
00056 }
00057
00058
00059 template<class Type>
00060 tmp<Field<Type> > transform
00061 (
00062 const tensorField& trf,
00063 const Field<Type>& tf
00064 )
00065 {
00066 tmp<Field<Type> > tranf(new Field<Type> (tf.size()));
00067 transform(tranf(), trf, tf);
00068 return tranf;
00069 }
00070
00071
00072 template<class Type>
00073 tmp<Field<Type> > transform
00074 (
00075 const tensorField& trf,
00076 const tmp<Field<Type> >& ttf
00077 )
00078 {
00079 tmp<Field<Type> > tranf = reuseTmp<Type, Type>::New(ttf);
00080 transform(tranf(), trf, ttf());
00081 reuseTmp<Type, Type>::clear(ttf);
00082 return tranf;
00083 }
00084
00085
00086 template<class Type>
00087 tmp<Field<Type> > transform
00088 (
00089 const tmp<tensorField>& ttrf,
00090 const Field<Type>& tf
00091 )
00092 {
00093 tmp<Field<Type> > tranf(new Field<Type> (tf.size()));
00094 transform(tranf(), ttrf(), tf);
00095 ttrf.clear();
00096 return tranf;
00097 }
00098
00099
00100 template<class Type>
00101 tmp<Field<Type> > transform
00102 (
00103 const tmp<tensorField>& ttrf,
00104 const tmp<Field<Type> >& ttf
00105 )
00106 {
00107 tmp<Field<Type> > tranf = reuseTmp<Type, Type>::New(ttf);
00108 transform(tranf(), ttrf(), ttf());
00109 reuseTmp<Type, Type>::clear(ttf);
00110 ttrf.clear();
00111 return tranf;
00112 }
00113
00114
00115 template<class Type>
00116 void transform
00117 (
00118 Field<Type>& rtf,
00119 const tensor& t,
00120 const Field<Type>& tf
00121 )
00122 {
00123 TFOR_ALL_F_OP_FUNC_S_F(Type, rtf, =, transform, tensor, t, Type, tf)
00124 }
00125
00126
00127 template<class Type>
00128 tmp<Field<Type> > transform
00129 (
00130 const tensor& t,
00131 const Field<Type>& tf
00132 )
00133 {
00134 tmp<Field<Type> > tranf(new Field<Type>(tf.size()));
00135 transform(tranf(), t, tf);
00136 return tranf;
00137 }
00138
00139
00140 template<class Type>
00141 tmp<Field<Type> > transform
00142 (
00143 const tensor& t,
00144 const tmp<Field<Type> >& ttf
00145 )
00146 {
00147 tmp<Field<Type> > tranf = reuseTmp<Type, Type>::New(ttf);
00148 transform(tranf(), t, ttf());
00149 reuseTmp<Type, Type>::clear(ttf);
00150 return tranf;
00151 }
00152
00153
00154 template<class Type1, class Type2>
00155 tmp<Field<Type1> > transformFieldMask(const Field<Type2>& f)
00156 {
00157 return f;
00158 }
00159
00160 template<class Type1, class Type2>
00161 tmp<Field<Type1> > transformFieldMask(const tmp<Field<Type2> >& tf)
00162 {
00163 return tmp<Field<Type1> >(tf.ptr());
00164 }
00165
00166
00167
00168
00169 }
00170
00171