diff --git a/src/OpenFOAM/fields/FieldFields/transformFieldField/transformFieldField.C b/src/OpenFOAM/fields/FieldFields/transformFieldField/transformFieldField.C
index a1069a53fc..950815dead 100644
--- a/src/OpenFOAM/fields/FieldFields/transformFieldField/transformFieldField.C
+++ b/src/OpenFOAM/fields/FieldFields/transformFieldField/transformFieldField.C
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -21,141 +21,260 @@ License
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see .
-Description
- Spatial transformation functions for FieldField.
-
\*---------------------------------------------------------------------------*/
#include "transformFieldField.H"
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-
-// * * * * * * * * * * * * * * * global functions * * * * * * * * * * * * * //
+// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
template class Field, class Type>
-void transform
+void Foam::transform
(
- FieldField& rtf,
- const FieldField& trf,
- const FieldField& tf
+ FieldField& result,
+ const tensor& rot,
+ const FieldField& fld
)
{
- forAll(rtf, i)
+ forAll(result, i)
{
- transform(rtf[i], trf[i], tf[i]);
+ transform(result[i], rot, fld[i]);
}
}
template class Field, class Type>
-tmp> transform
+void Foam::transform
(
- const FieldField& trf,
- const FieldField& tf
+ FieldField& result,
+ const FieldField& rot,
+ const FieldField& fld
)
{
- tmp> tranf
- (
- FieldField::NewCalculatedType(tf)
- );
- transform(tranf(), trf, tf);
- return tranf;
-}
-
-
-template class Field, class Type>
-tmp> transform
-(
- const FieldField& trf,
- const tmp>& ttf
-)
-{
- tmp> tranf(ttf.ptr());
- transform(tranf(), trf, tranf());
- return tranf;
-}
-
-
-template class Field, class Type>
-tmp> transform
-(
- const tmp>& ttrf,
- const FieldField& tf
-)
-{
- tmp> tranf
- (
- FieldField::NewCalculatedType(tf)
- );
- transform(tranf(), ttrf(), tf);
- ttrf.clear();
- return tranf;
-}
-
-
-template class Field, class Type>
-tmp> transform
-(
- const tmp>& ttrf,
- const tmp>& ttf
-)
-{
- tmp> tranf(ttf.ptr());
- transform(tranf(), ttrf(), tranf());
- ttrf.clear();
- return tranf;
-}
-
-
-template class Field, class Type>
-void transform
-(
- FieldField& rtf,
- const tensor& t,
- const FieldField& tf
-)
-{
- forAll(rtf, i)
+ forAll(result, i)
{
- transform(rtf[i], t, tf[i]);
+ transform(result[i], rot[i], fld[i]);
}
}
template class Field, class Type>
-tmp> transform
+Foam::tmp>
+Foam::transform
(
- const tensor& t,
- const FieldField& tf
+ const FieldField& rot,
+ const FieldField& fld
)
{
tmp> tranf
(
- FieldField::NewCalculatedType(tf)
+ FieldField::NewCalculatedType(fld)
);
- transform(tranf(), t, tf);
+ transform(tranf(), rot, fld);
return tranf;
}
template class Field, class Type>
-tmp> transform
+Foam::tmp>
+Foam::transform
(
- const tensor& t,
- const tmp>& ttf
+ const FieldField& rot,
+ const tmp>& tfld
)
{
- tmp> tranf(ttf.ptr());
- transform(tranf(), t, tranf());
+ tmp> tresult(tfld.ptr());
+ transform(tresult(), rot, tresult());
+ return tresult;
+}
+
+
+template class Field, class Type>
+Foam::tmp>
+Foam::transform
+(
+ const tmp>& trot,
+ const FieldField& fld
+)
+{
+ tmp> tresult
+ (
+ FieldField::NewCalculatedType(fld)
+ );
+ transform(tresult(), trot(), fld);
+ trot.clear();
+ return tresult;
+}
+
+
+template class Field, class Type>
+Foam::tmp>
+Foam::transform
+(
+ const tmp>& trot,
+ const tmp>& tfld
+)
+{
+ tmp> tresult(tfld.ptr());
+ transform(tresult(), trot(), tresult());
+ trot.clear();
+ return tresult;
+}
+
+
+template class Field, class Type>
+Foam::tmp>
+Foam::transform
+(
+ const tensor& rot,
+ const FieldField& fld
+)
+{
+ tmp> tresult
+ (
+ FieldField::NewCalculatedType(fld)
+ );
+ transform(tresult(), rot, fld);
+ return tresult;
+}
+
+
+template class Field, class Type>
+Foam::tmp>
+Foam::transform
+(
+ const tensor& rot,
+ const tmp>& tfld
+)
+{
+ tmp> tresult(tfld.ptr());
+ transform(tresult(), rot, tresult());
+ return tresult;
+}
+
+
+template class Field, class Type>
+void Foam::invTransform
+(
+ FieldField& result,
+ const tensor& rot,
+ const FieldField& fld
+)
+{
+ forAll(result, i)
+ {
+ invTransform(result[i], rot, fld[i]);
+ }
+}
+
+
+template class Field, class Type>
+void Foam::invTransform
+(
+ FieldField& result,
+ const FieldField& rot,
+ const FieldField& fld
+)
+{
+ forAll(result, i)
+ {
+ invTransform(result[i], rot[i], fld[i]);
+ }
+}
+
+
+template class Field, class Type>
+Foam::tmp>
+Foam::invTransform
+(
+ const FieldField& rot,
+ const FieldField& fld
+)
+{
+ tmp> tranf
+ (
+ FieldField::NewCalculatedType(fld)
+ );
+ invTransform(tranf(), rot, fld);
return tranf;
}
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+template class Field, class Type>
+Foam::tmp>
+Foam::invTransform
+(
+ const FieldField& rot,
+ const tmp>& tfld
+)
+{
+ tmp> tresult(tfld.ptr());
+ invTransform(tresult(), rot, tresult());
+ return tresult;
+}
+
+
+template class Field, class Type>
+Foam::tmp>
+Foam::invTransform
+(
+ const tmp>& trot,
+ const FieldField& fld
+)
+{
+ tmp> tresult
+ (
+ FieldField::NewCalculatedType(fld)
+ );
+ invTransform(tresult(), trot(), fld);
+ trot.clear();
+ return tresult;
+}
+
+
+template class Field, class Type>
+Foam::tmp>
+Foam::invTransform
+(
+ const tmp>& trot,
+ const tmp>& tfld
+)
+{
+ tmp> tresult(tfld.ptr());
+ invTransform(tresult(), trot(), tresult());
+ trot.clear();
+ return tresult;
+}
+
+
+template class Field, class Type>
+Foam::tmp>
+Foam::invTransform
+(
+ const tensor& rot,
+ const FieldField& fld
+)
+{
+ tmp> tresult
+ (
+ FieldField::NewCalculatedType(fld)
+ );
+ invTransform(tresult(), rot, fld);
+ return tresult;
+}
+
+
+template class Field, class Type>
+Foam::tmp>
+Foam::invTransform
+(
+ const tensor& rot,
+ const tmp>& tfld
+)
+{
+ tmp> tresult(tfld.ptr());
+ invTransform(tresult(), rot, tresult());
+ return tresult;
+}
-} // End namespace Foam
// ************************************************************************* //
diff --git a/src/OpenFOAM/fields/FieldFields/transformFieldField/transformFieldField.H b/src/OpenFOAM/fields/FieldFields/transformFieldField/transformFieldField.H
index 28cd315077..cd659e05bf 100644
--- a/src/OpenFOAM/fields/FieldFields/transformFieldField/transformFieldField.H
+++ b/src/OpenFOAM/fields/FieldFields/transformFieldField/transformFieldField.H
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -46,63 +46,127 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-template class Field, class Type>
-void transform
-(
- FieldField&,
- const FieldField&,
- const FieldField&
-);
-
-template class Field, class Type>
-tmp> transform
-(
- const FieldField&,
- const FieldField&
-);
-
-template class Field, class Type>
-tmp> transform
-(
- const FieldField&,
- const tmp>&
-);
-
-template class Field, class Type>
-tmp> transform
-(
- const tmp>&,
- const FieldField&
-);
-
-template class Field, class Type>
-tmp> transform
-(
- const tmp>&,
- const tmp>&
-);
-
+// transform()
template class Field, class Type>
void transform
(
- FieldField&,
- const tensor&,
- const FieldField&
+ FieldField& result,
+ const tensor& rot,
+ const FieldField& fld
+);
+
+template class Field, class Type>
+void transform
+(
+ FieldField& result,
+ const FieldField& rot,
+ const FieldField& fld
);
template class Field, class Type>
tmp> transform
(
- const tensor&,
- const FieldField&
+ const FieldField& rot,
+ const FieldField& fld
);
template class Field, class Type>
tmp> transform
(
- const tensor&,
- const tmp>&
+ const FieldField& rot,
+ const tmp>& tfld
+);
+
+template class Field, class Type>
+tmp> transform
+(
+ const tmp>& trot,
+ const FieldField& fld
+);
+
+template class Field, class Type>
+tmp> transform
+(
+ const tmp>& trot,
+ const tmp>& tfld
+);
+
+
+template class Field, class Type>
+tmp> transform
+(
+ const tensor& rot,
+ const FieldField& fld
+);
+
+template class Field, class Type>
+tmp> transform
+(
+ const tensor& rot,
+ const tmp>& tfld
+);
+
+
+// invTransform()
+
+template class Field, class Type>
+void invTransform
+(
+ FieldField& result,
+ const tensor& rot,
+ const FieldField& fld
+);
+
+template class Field, class Type>
+void invTransform
+(
+ FieldField& result,
+ const FieldField& rot,
+ const FieldField& fld
+);
+
+template class Field, class Type>
+tmp> invTransform
+(
+ const FieldField& rot,
+ const FieldField& fld
+);
+
+template class Field, class Type>
+tmp> invTransform
+(
+ const FieldField& rot,
+ const tmp>& tfld
+);
+
+template class Field, class Type>
+tmp> invTransform
+(
+ const tmp>& trot,
+ const FieldField& fld
+);
+
+template class Field, class Type>
+tmp> invTransform
+(
+ const tmp>& trot,
+ const tmp>& tfld
+);
+
+
+template class Field, class Type>
+tmp> invTransform
+(
+ const tensor& rot,
+ const FieldField& fld
+);
+
+template class Field, class Type>
+tmp> invTransform
+(
+ const tensor& rot,
+ const tmp>& tfld
);
diff --git a/src/OpenFOAM/fields/Fields/transformField/transformField.C b/src/OpenFOAM/fields/Fields/transformField/transformField.C
index 564632e1c1..a4730e8ea3 100644
--- a/src/OpenFOAM/fields/Fields/transformField/transformField.C
+++ b/src/OpenFOAM/fields/Fields/transformField/transformField.C
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -36,59 +36,59 @@ void Foam::transform
const vectorField& tf
)
{
- tensor t = q.R();
- TFOR_ALL_F_OP_FUNC_S_F(vector, rtf, =, transform, tensor, t, vector, tf)
+ tensor rot = q.R();
+ TFOR_ALL_F_OP_FUNC_S_F(vector, rtf, =, transform, tensor, rot, vector, tf)
}
Foam::tmp Foam::transform
(
const quaternion& q,
- const vectorField& tf
+ const vectorField& fld
)
{
- tmp tranf(new vectorField(tf.size()));
- transform(tranf.ref(), q, tf);
- return tranf;
+ auto tresult = tmp::New(fld.size());
+ transform(tresult.ref(), q, fld);
+ return tresult;
}
Foam::tmp Foam::transform
(
const quaternion& q,
- const tmp& ttf
+ const tmp& tfld
)
{
- tmp tranf = New(ttf);
- transform(tranf.ref(), q, ttf());
- ttf.clear();
- return tranf;
+ tmp tresult = New(tfld);
+ transform(tresult.ref(), q, tfld());
+ tfld.clear();
+ return tresult;
}
void Foam::transformPoints
(
- vectorField& rtf,
+ vectorField& result,
const septernion& tr,
- const vectorField& tf
+ const vectorField& fld
)
{
- vector T = tr.t();
+ vector trans = tr.t();
// Check if any translation
- if (mag(T) > VSMALL)
+ if (mag(trans) > VSMALL)
{
- TFOR_ALL_F_OP_F_OP_S(vector, rtf, =, vector, tf, -, vector, T);
+ TFOR_ALL_F_OP_F_OP_S(vector, result, =, vector, fld, -, vector, trans);
}
else
{
- rtf = tf;
+ result = fld;
}
// Check if any rotation
if (mag(tr.r().R() - I) > SMALL)
{
- transform(rtf, tr.r(), rtf);
+ transform(result, tr.r(), result);
}
}
@@ -96,25 +96,25 @@ void Foam::transformPoints
Foam::tmp Foam::transformPoints
(
const septernion& tr,
- const vectorField& tf
+ const vectorField& fld
)
{
- tmp tranf(new vectorField(tf.size()));
- transformPoints(tranf.ref(), tr, tf);
- return tranf;
+ auto tresult = tmp::New(fld.size());
+ transformPoints(tresult.ref(), tr, fld);
+ return tresult;
}
Foam::tmp Foam::transformPoints
(
const septernion& tr,
- const tmp& ttf
+ const tmp& tfld
)
{
- tmp tranf = New(ttf);
- transformPoints(tranf.ref(), tr, ttf());
- ttf.clear();
- return tranf;
+ tmp tresult = New(tfld);
+ transformPoints(tresult.ref(), tr, tfld());
+ tfld.clear();
+ return tresult;
}
diff --git a/src/OpenFOAM/fields/Fields/transformField/transformField.H b/src/OpenFOAM/fields/Fields/transformField/transformField.H
index e466ab2021..7d0ed3c854 100644
--- a/src/OpenFOAM/fields/Fields/transformField/transformField.H
+++ b/src/OpenFOAM/fields/Fields/transformField/transformField.H
@@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
- \\/ M anipulation |
+ \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@@ -48,63 +48,157 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-template
-void transform(Field&, const tensorField&, const Field&);
+// transform()
template
-tmp> transform(const tensorField&, const Field&);
+void transform
+(
+ Field& result,
+ const tensor& rot,
+ const Field& fld
+);
template
-tmp> transform(const tensorField&, const tmp>&);
-
-template
-tmp> transform(const tmp&, const Field&);
-
-template
-tmp> transform(const tmp&, const tmp>&);
+void transform
+(
+ Field& result,
+ const tensorField& rot,
+ const Field& fld
+);
template
-void transform(Field&, const tensor&, const Field&);
+tmp> transform
+(
+ const tensorField& rot,
+ const Field& fld
+);
template
-tmp> transform(const tensor&, const Field&);
+tmp> transform
+(
+ const tensorField& rot,
+ const tmp>& tfld
+);
template
-tmp> transform(const tensor&, const tmp>&);
+tmp> transform
+(
+ const tmp& trot,
+ const Field& fld
+);
+
+template
+tmp> transform
+(
+ const tmp& trot,
+ const tmp>& tfld
+);
+
+
+template
+tmp> transform
+(
+ const tensor& rot,
+ const Field& fld
+);
+
+template
+tmp> transform
+(
+ const tensor& rot,
+ const tmp>& tfld
+);
+
+
+// invTransform()
+
+template