mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: add invTransform for fields (#1076)
This commit is contained in:
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
Description
|
||||
Spatial transformation functions for FieldField.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "transformFieldField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * global functions * * * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<template<class> class Field, class Type>
|
||||
void transform
|
||||
void Foam::transform
|
||||
(
|
||||
FieldField<Field, Type>& rtf,
|
||||
const FieldField<Field, tensor>& trf,
|
||||
const FieldField<Field, Type>& tf
|
||||
FieldField<Field, Type>& result,
|
||||
const tensor& rot,
|
||||
const FieldField<Field, Type>& fld
|
||||
)
|
||||
{
|
||||
forAll(rtf, i)
|
||||
forAll(result, i)
|
||||
{
|
||||
transform(rtf[i], trf[i], tf[i]);
|
||||
transform(result[i], rot, fld[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<template<class> class Field, class Type>
|
||||
tmp<FieldField<Field, Type>> transform
|
||||
void Foam::transform
|
||||
(
|
||||
const FieldField<Field, tensor>& trf,
|
||||
const FieldField<Field, Type>& tf
|
||||
FieldField<Field, Type>& result,
|
||||
const FieldField<Field, tensor>& rot,
|
||||
const FieldField<Field, Type>& fld
|
||||
)
|
||||
{
|
||||
tmp<FieldField<Field, Type>> tranf
|
||||
(
|
||||
FieldField<Field, Type>::NewCalculatedType(tf)
|
||||
);
|
||||
transform(tranf(), trf, tf);
|
||||
return tranf;
|
||||
}
|
||||
|
||||
|
||||
template<template<class> class Field, class Type>
|
||||
tmp<FieldField<Field, Type>> transform
|
||||
(
|
||||
const FieldField<Field, tensor>& trf,
|
||||
const tmp<FieldField<Field, Type>>& ttf
|
||||
)
|
||||
{
|
||||
tmp<FieldField<Field, Type>> tranf(ttf.ptr());
|
||||
transform(tranf(), trf, tranf());
|
||||
return tranf;
|
||||
}
|
||||
|
||||
|
||||
template<template<class> class Field, class Type>
|
||||
tmp<FieldField<Field, Type>> transform
|
||||
(
|
||||
const tmp<FieldField<Field, tensor>>& ttrf,
|
||||
const FieldField<Field, Type>& tf
|
||||
)
|
||||
{
|
||||
tmp<FieldField<Field, Type>> tranf
|
||||
(
|
||||
FieldField<Field, Type>::NewCalculatedType(tf)
|
||||
);
|
||||
transform(tranf(), ttrf(), tf);
|
||||
ttrf.clear();
|
||||
return tranf;
|
||||
}
|
||||
|
||||
|
||||
template<template<class> class Field, class Type>
|
||||
tmp<FieldField<Field, Type>> transform
|
||||
(
|
||||
const tmp<FieldField<Field, tensor>>& ttrf,
|
||||
const tmp<FieldField<Field, Type>>& ttf
|
||||
)
|
||||
{
|
||||
tmp<FieldField<Field, Type>> tranf(ttf.ptr());
|
||||
transform(tranf(), ttrf(), tranf());
|
||||
ttrf.clear();
|
||||
return tranf;
|
||||
}
|
||||
|
||||
|
||||
template<template<class> class Field, class Type>
|
||||
void transform
|
||||
(
|
||||
FieldField<Field, Type>& rtf,
|
||||
const tensor& t,
|
||||
const FieldField<Field, Type>& tf
|
||||
)
|
||||
{
|
||||
forAll(rtf, i)
|
||||
forAll(result, i)
|
||||
{
|
||||
transform(rtf[i], t, tf[i]);
|
||||
transform(result[i], rot[i], fld[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<template<class> class Field, class Type>
|
||||
tmp<FieldField<Field, Type>> transform
|
||||
Foam::tmp<Foam::FieldField<Field, Type>>
|
||||
Foam::transform
|
||||
(
|
||||
const tensor& t,
|
||||
const FieldField<Field, Type>& tf
|
||||
const FieldField<Field, tensor>& rot,
|
||||
const FieldField<Field, Type>& fld
|
||||
)
|
||||
{
|
||||
tmp<FieldField<Field, Type>> tranf
|
||||
(
|
||||
FieldField<Field, Type>::NewCalculatedType(tf)
|
||||
FieldField<Field, Type>::NewCalculatedType(fld)
|
||||
);
|
||||
transform(tranf(), t, tf);
|
||||
transform(tranf(), rot, fld);
|
||||
return tranf;
|
||||
}
|
||||
|
||||
|
||||
template<template<class> class Field, class Type>
|
||||
tmp<FieldField<Field, Type>> transform
|
||||
Foam::tmp<Foam::FieldField<Field, Type>>
|
||||
Foam::transform
|
||||
(
|
||||
const tensor& t,
|
||||
const tmp<FieldField<Field, Type>>& ttf
|
||||
const FieldField<Field, tensor>& rot,
|
||||
const tmp<FieldField<Field, Type>>& tfld
|
||||
)
|
||||
{
|
||||
tmp<FieldField<Field, Type>> tranf(ttf.ptr());
|
||||
transform(tranf(), t, tranf());
|
||||
tmp<FieldField<Field, Type>> tresult(tfld.ptr());
|
||||
transform(tresult(), rot, tresult());
|
||||
return tresult;
|
||||
}
|
||||
|
||||
|
||||
template<template<class> class Field, class Type>
|
||||
Foam::tmp<Foam::FieldField<Field, Type>>
|
||||
Foam::transform
|
||||
(
|
||||
const tmp<FieldField<Field, tensor>>& trot,
|
||||
const FieldField<Field, Type>& fld
|
||||
)
|
||||
{
|
||||
tmp<FieldField<Field, Type>> tresult
|
||||
(
|
||||
FieldField<Field, Type>::NewCalculatedType(fld)
|
||||
);
|
||||
transform(tresult(), trot(), fld);
|
||||
trot.clear();
|
||||
return tresult;
|
||||
}
|
||||
|
||||
|
||||
template<template<class> class Field, class Type>
|
||||
Foam::tmp<Foam::FieldField<Field, Type>>
|
||||
Foam::transform
|
||||
(
|
||||
const tmp<FieldField<Field, tensor>>& trot,
|
||||
const tmp<FieldField<Field, Type>>& tfld
|
||||
)
|
||||
{
|
||||
tmp<FieldField<Field, Type>> tresult(tfld.ptr());
|
||||
transform(tresult(), trot(), tresult());
|
||||
trot.clear();
|
||||
return tresult;
|
||||
}
|
||||
|
||||
|
||||
template<template<class> class Field, class Type>
|
||||
Foam::tmp<Foam::FieldField<Field, Type>>
|
||||
Foam::transform
|
||||
(
|
||||
const tensor& rot,
|
||||
const FieldField<Field, Type>& fld
|
||||
)
|
||||
{
|
||||
tmp<FieldField<Field, Type>> tresult
|
||||
(
|
||||
FieldField<Field, Type>::NewCalculatedType(fld)
|
||||
);
|
||||
transform(tresult(), rot, fld);
|
||||
return tresult;
|
||||
}
|
||||
|
||||
|
||||
template<template<class> class Field, class Type>
|
||||
Foam::tmp<Foam::FieldField<Field, Type>>
|
||||
Foam::transform
|
||||
(
|
||||
const tensor& rot,
|
||||
const tmp<FieldField<Field, Type>>& tfld
|
||||
)
|
||||
{
|
||||
tmp<FieldField<Field, Type>> tresult(tfld.ptr());
|
||||
transform(tresult(), rot, tresult());
|
||||
return tresult;
|
||||
}
|
||||
|
||||
|
||||
template<template<class> class Field, class Type>
|
||||
void Foam::invTransform
|
||||
(
|
||||
FieldField<Field, Type>& result,
|
||||
const tensor& rot,
|
||||
const FieldField<Field, Type>& fld
|
||||
)
|
||||
{
|
||||
forAll(result, i)
|
||||
{
|
||||
invTransform(result[i], rot, fld[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<template<class> class Field, class Type>
|
||||
void Foam::invTransform
|
||||
(
|
||||
FieldField<Field, Type>& result,
|
||||
const FieldField<Field, tensor>& rot,
|
||||
const FieldField<Field, Type>& fld
|
||||
)
|
||||
{
|
||||
forAll(result, i)
|
||||
{
|
||||
invTransform(result[i], rot[i], fld[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<template<class> class Field, class Type>
|
||||
Foam::tmp<Foam::FieldField<Field, Type>>
|
||||
Foam::invTransform
|
||||
(
|
||||
const FieldField<Field, tensor>& rot,
|
||||
const FieldField<Field, Type>& fld
|
||||
)
|
||||
{
|
||||
tmp<FieldField<Field, Type>> tranf
|
||||
(
|
||||
FieldField<Field, Type>::NewCalculatedType(fld)
|
||||
);
|
||||
invTransform(tranf(), rot, fld);
|
||||
return tranf;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
template<template<class> class Field, class Type>
|
||||
Foam::tmp<Foam::FieldField<Field, Type>>
|
||||
Foam::invTransform
|
||||
(
|
||||
const FieldField<Field, tensor>& rot,
|
||||
const tmp<FieldField<Field, Type>>& tfld
|
||||
)
|
||||
{
|
||||
tmp<FieldField<Field, Type>> tresult(tfld.ptr());
|
||||
invTransform(tresult(), rot, tresult());
|
||||
return tresult;
|
||||
}
|
||||
|
||||
|
||||
template<template<class> class Field, class Type>
|
||||
Foam::tmp<Foam::FieldField<Field, Type>>
|
||||
Foam::invTransform
|
||||
(
|
||||
const tmp<FieldField<Field, tensor>>& trot,
|
||||
const FieldField<Field, Type>& fld
|
||||
)
|
||||
{
|
||||
tmp<FieldField<Field, Type>> tresult
|
||||
(
|
||||
FieldField<Field, Type>::NewCalculatedType(fld)
|
||||
);
|
||||
invTransform(tresult(), trot(), fld);
|
||||
trot.clear();
|
||||
return tresult;
|
||||
}
|
||||
|
||||
|
||||
template<template<class> class Field, class Type>
|
||||
Foam::tmp<Foam::FieldField<Field, Type>>
|
||||
Foam::invTransform
|
||||
(
|
||||
const tmp<FieldField<Field, tensor>>& trot,
|
||||
const tmp<FieldField<Field, Type>>& tfld
|
||||
)
|
||||
{
|
||||
tmp<FieldField<Field, Type>> tresult(tfld.ptr());
|
||||
invTransform(tresult(), trot(), tresult());
|
||||
trot.clear();
|
||||
return tresult;
|
||||
}
|
||||
|
||||
|
||||
template<template<class> class Field, class Type>
|
||||
Foam::tmp<Foam::FieldField<Field, Type>>
|
||||
Foam::invTransform
|
||||
(
|
||||
const tensor& rot,
|
||||
const FieldField<Field, Type>& fld
|
||||
)
|
||||
{
|
||||
tmp<FieldField<Field, Type>> tresult
|
||||
(
|
||||
FieldField<Field, Type>::NewCalculatedType(fld)
|
||||
);
|
||||
invTransform(tresult(), rot, fld);
|
||||
return tresult;
|
||||
}
|
||||
|
||||
|
||||
template<template<class> class Field, class Type>
|
||||
Foam::tmp<Foam::FieldField<Field, Type>>
|
||||
Foam::invTransform
|
||||
(
|
||||
const tensor& rot,
|
||||
const tmp<FieldField<Field, Type>>& tfld
|
||||
)
|
||||
{
|
||||
tmp<FieldField<Field, Type>> tresult(tfld.ptr());
|
||||
invTransform(tresult(), rot, tresult());
|
||||
return tresult;
|
||||
}
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -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<template<class> class Field, class Type>
|
||||
void transform
|
||||
(
|
||||
FieldField<Field, Type>&,
|
||||
const FieldField<Field, tensor>&,
|
||||
const FieldField<Field, Type>&
|
||||
);
|
||||
|
||||
template<template<class> class Field, class Type>
|
||||
tmp<FieldField<Field, Type>> transform
|
||||
(
|
||||
const FieldField<Field, tensor>&,
|
||||
const FieldField<Field, Type>&
|
||||
);
|
||||
|
||||
template<template<class> class Field, class Type>
|
||||
tmp<FieldField<Field, Type>> transform
|
||||
(
|
||||
const FieldField<Field, tensor>&,
|
||||
const tmp<FieldField<Field, Type>>&
|
||||
);
|
||||
|
||||
template<template<class> class Field, class Type>
|
||||
tmp<FieldField<Field, Type>> transform
|
||||
(
|
||||
const tmp<FieldField<Field, tensor>>&,
|
||||
const FieldField<Field, Type>&
|
||||
);
|
||||
|
||||
template<template<class> class Field, class Type>
|
||||
tmp<FieldField<Field, Type>> transform
|
||||
(
|
||||
const tmp<FieldField<Field, tensor>>&,
|
||||
const tmp<FieldField<Field, Type>>&
|
||||
);
|
||||
|
||||
// transform()
|
||||
|
||||
template<template<class> class Field, class Type>
|
||||
void transform
|
||||
(
|
||||
FieldField<Field, Type>&,
|
||||
const tensor&,
|
||||
const FieldField<Field, Type>&
|
||||
FieldField<Field, Type>& result,
|
||||
const tensor& rot,
|
||||
const FieldField<Field, Type>& fld
|
||||
);
|
||||
|
||||
template<template<class> class Field, class Type>
|
||||
void transform
|
||||
(
|
||||
FieldField<Field, Type>& result,
|
||||
const FieldField<Field, tensor>& rot,
|
||||
const FieldField<Field, Type>& fld
|
||||
);
|
||||
|
||||
template<template<class> class Field, class Type>
|
||||
tmp<FieldField<Field, Type>> transform
|
||||
(
|
||||
const tensor&,
|
||||
const FieldField<Field, Type>&
|
||||
const FieldField<Field, tensor>& rot,
|
||||
const FieldField<Field, Type>& fld
|
||||
);
|
||||
|
||||
template<template<class> class Field, class Type>
|
||||
tmp<FieldField<Field, Type>> transform
|
||||
(
|
||||
const tensor&,
|
||||
const tmp<FieldField<Field, Type>>&
|
||||
const FieldField<Field, tensor>& rot,
|
||||
const tmp<FieldField<Field, Type>>& tfld
|
||||
);
|
||||
|
||||
template<template<class> class Field, class Type>
|
||||
tmp<FieldField<Field, Type>> transform
|
||||
(
|
||||
const tmp<FieldField<Field, tensor>>& trot,
|
||||
const FieldField<Field, Type>& fld
|
||||
);
|
||||
|
||||
template<template<class> class Field, class Type>
|
||||
tmp<FieldField<Field, Type>> transform
|
||||
(
|
||||
const tmp<FieldField<Field, tensor>>& trot,
|
||||
const tmp<FieldField<Field, Type>>& tfld
|
||||
);
|
||||
|
||||
|
||||
template<template<class> class Field, class Type>
|
||||
tmp<FieldField<Field, Type>> transform
|
||||
(
|
||||
const tensor& rot,
|
||||
const FieldField<Field, Type>& fld
|
||||
);
|
||||
|
||||
template<template<class> class Field, class Type>
|
||||
tmp<FieldField<Field, Type>> transform
|
||||
(
|
||||
const tensor& rot,
|
||||
const tmp<FieldField<Field, Type>>& tfld
|
||||
);
|
||||
|
||||
|
||||
// invTransform()
|
||||
|
||||
template<template<class> class Field, class Type>
|
||||
void invTransform
|
||||
(
|
||||
FieldField<Field, Type>& result,
|
||||
const tensor& rot,
|
||||
const FieldField<Field, Type>& fld
|
||||
);
|
||||
|
||||
template<template<class> class Field, class Type>
|
||||
void invTransform
|
||||
(
|
||||
FieldField<Field, Type>& result,
|
||||
const FieldField<Field, tensor>& rot,
|
||||
const FieldField<Field, Type>& fld
|
||||
);
|
||||
|
||||
template<template<class> class Field, class Type>
|
||||
tmp<FieldField<Field, Type>> invTransform
|
||||
(
|
||||
const FieldField<Field, tensor>& rot,
|
||||
const FieldField<Field, Type>& fld
|
||||
);
|
||||
|
||||
template<template<class> class Field, class Type>
|
||||
tmp<FieldField<Field, Type>> invTransform
|
||||
(
|
||||
const FieldField<Field, tensor>& rot,
|
||||
const tmp<FieldField<Field, Type>>& tfld
|
||||
);
|
||||
|
||||
template<template<class> class Field, class Type>
|
||||
tmp<FieldField<Field, Type>> invTransform
|
||||
(
|
||||
const tmp<FieldField<Field, tensor>>& trot,
|
||||
const FieldField<Field, Type>& fld
|
||||
);
|
||||
|
||||
template<template<class> class Field, class Type>
|
||||
tmp<FieldField<Field, Type>> invTransform
|
||||
(
|
||||
const tmp<FieldField<Field, tensor>>& trot,
|
||||
const tmp<FieldField<Field, Type>>& tfld
|
||||
);
|
||||
|
||||
|
||||
template<template<class> class Field, class Type>
|
||||
tmp<FieldField<Field, Type>> invTransform
|
||||
(
|
||||
const tensor& rot,
|
||||
const FieldField<Field, Type>& fld
|
||||
);
|
||||
|
||||
template<template<class> class Field, class Type>
|
||||
tmp<FieldField<Field, Type>> invTransform
|
||||
(
|
||||
const tensor& rot,
|
||||
const tmp<FieldField<Field, Type>>& tfld
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -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::vectorField> Foam::transform
|
||||
(
|
||||
const quaternion& q,
|
||||
const vectorField& tf
|
||||
const vectorField& fld
|
||||
)
|
||||
{
|
||||
tmp<vectorField > tranf(new vectorField(tf.size()));
|
||||
transform(tranf.ref(), q, tf);
|
||||
return tranf;
|
||||
auto tresult = tmp<vectorField>::New(fld.size());
|
||||
transform(tresult.ref(), q, fld);
|
||||
return tresult;
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::vectorField> Foam::transform
|
||||
(
|
||||
const quaternion& q,
|
||||
const tmp<vectorField>& ttf
|
||||
const tmp<vectorField>& tfld
|
||||
)
|
||||
{
|
||||
tmp<vectorField > tranf = New(ttf);
|
||||
transform(tranf.ref(), q, ttf());
|
||||
ttf.clear();
|
||||
return tranf;
|
||||
tmp<vectorField> 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::vectorField> Foam::transformPoints
|
||||
(
|
||||
const septernion& tr,
|
||||
const vectorField& tf
|
||||
const vectorField& fld
|
||||
)
|
||||
{
|
||||
tmp<vectorField > tranf(new vectorField(tf.size()));
|
||||
transformPoints(tranf.ref(), tr, tf);
|
||||
return tranf;
|
||||
auto tresult = tmp<vectorField>::New(fld.size());
|
||||
transformPoints(tresult.ref(), tr, fld);
|
||||
return tresult;
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::vectorField> Foam::transformPoints
|
||||
(
|
||||
const septernion& tr,
|
||||
const tmp<vectorField>& ttf
|
||||
const tmp<vectorField>& tfld
|
||||
)
|
||||
{
|
||||
tmp<vectorField > tranf = New(ttf);
|
||||
transformPoints(tranf.ref(), tr, ttf());
|
||||
ttf.clear();
|
||||
return tranf;
|
||||
tmp<vectorField> tresult = New(tfld);
|
||||
transformPoints(tresult.ref(), tr, tfld());
|
||||
tfld.clear();
|
||||
return tresult;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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<class Type>
|
||||
void transform(Field<Type>&, const tensorField&, const Field<Type>&);
|
||||
// transform()
|
||||
|
||||
template<class Type>
|
||||
tmp<Field<Type>> transform(const tensorField&, const Field<Type>&);
|
||||
void transform
|
||||
(
|
||||
Field<Type>& result,
|
||||
const tensor& rot,
|
||||
const Field<Type>& fld
|
||||
);
|
||||
|
||||
template<class Type>
|
||||
tmp<Field<Type>> transform(const tensorField&, const tmp<Field<Type>>&);
|
||||
|
||||
template<class Type>
|
||||
tmp<Field<Type>> transform(const tmp<tensorField>&, const Field<Type>&);
|
||||
|
||||
template<class Type>
|
||||
tmp<Field<Type>> transform(const tmp<tensorField>&, const tmp<Field<Type>>&);
|
||||
void transform
|
||||
(
|
||||
Field<Type>& result,
|
||||
const tensorField& rot,
|
||||
const Field<Type>& fld
|
||||
);
|
||||
|
||||
|
||||
template<class Type>
|
||||
void transform(Field<Type>&, const tensor&, const Field<Type>&);
|
||||
tmp<Field<Type>> transform
|
||||
(
|
||||
const tensorField& rot,
|
||||
const Field<Type>& fld
|
||||
);
|
||||
|
||||
template<class Type>
|
||||
tmp<Field<Type>> transform(const tensor&, const Field<Type>&);
|
||||
tmp<Field<Type>> transform
|
||||
(
|
||||
const tensorField& rot,
|
||||
const tmp<Field<Type>>& tfld
|
||||
);
|
||||
|
||||
template<class Type>
|
||||
tmp<Field<Type>> transform(const tensor&, const tmp<Field<Type>>&);
|
||||
tmp<Field<Type>> transform
|
||||
(
|
||||
const tmp<tensorField>& trot,
|
||||
const Field<Type>& fld
|
||||
);
|
||||
|
||||
template<class Type>
|
||||
tmp<Field<Type>> transform
|
||||
(
|
||||
const tmp<tensorField>& trot,
|
||||
const tmp<Field<Type>>& tfld
|
||||
);
|
||||
|
||||
|
||||
template<class Type>
|
||||
tmp<Field<Type>> transform
|
||||
(
|
||||
const tensor& rot,
|
||||
const Field<Type>& fld
|
||||
);
|
||||
|
||||
template<class Type>
|
||||
tmp<Field<Type>> transform
|
||||
(
|
||||
const tensor& rot,
|
||||
const tmp<Field<Type>>& tfld
|
||||
);
|
||||
|
||||
|
||||
// invTransform()
|
||||
|
||||
template<class Type>
|
||||
void invTransform
|
||||
(
|
||||
Field<Type>& result,
|
||||
const tensor& rot,
|
||||
const Field<Type>& fld
|
||||
);
|
||||
|
||||
template<class Type>
|
||||
void invTransform
|
||||
(
|
||||
Field<Type>& result,
|
||||
const tensorField& rot,
|
||||
const Field<Type>& fld
|
||||
);
|
||||
|
||||
|
||||
template<class Type>
|
||||
tmp<Field<Type>> invTransform
|
||||
(
|
||||
const tensorField& rot,
|
||||
const Field<Type>& fld
|
||||
);
|
||||
|
||||
template<class Type>
|
||||
tmp<Field<Type>> invTransform
|
||||
(
|
||||
const tensorField& rot,
|
||||
const tmp<Field<Type>>& tfld
|
||||
);
|
||||
|
||||
template<class Type>
|
||||
tmp<Field<Type>> invTransform
|
||||
(
|
||||
const tmp<tensorField>& trot,
|
||||
const Field<Type>& fld
|
||||
);
|
||||
|
||||
template<class Type>
|
||||
tmp<Field<Type>> invTransform
|
||||
(
|
||||
const tmp<tensorField>& trot,
|
||||
const tmp<Field<Type>>& tfld
|
||||
);
|
||||
|
||||
|
||||
template<class Type>
|
||||
tmp<Field<Type>> invTransform
|
||||
(
|
||||
const tensor& rot,
|
||||
const Field<Type>& fld
|
||||
);
|
||||
|
||||
template<class Type>
|
||||
tmp<Field<Type>> invTransform
|
||||
(
|
||||
const tensor& rot,
|
||||
const tmp<Field<Type>>& tfld
|
||||
);
|
||||
|
||||
|
||||
|
||||
template<class Type1, class Type2>
|
||||
tmp<Field<Type1>> transformFieldMask(const Field<Type2>&);
|
||||
tmp<Field<Type1>> transformFieldMask(const Field<Type2>& fld);
|
||||
|
||||
template<class Type1, class Type2>
|
||||
tmp<Field<Type1>> transformFieldMask(const tmp<Field<Type2>>&);
|
||||
tmp<Field<Type1>> transformFieldMask(const tmp<Field<Type2>>& tfld);
|
||||
|
||||
|
||||
// Specializations
|
||||
|
||||
template<>
|
||||
tmp<Field<symmTensor>> transformFieldMask<symmTensor>
|
||||
(
|
||||
const tensorField&
|
||||
);
|
||||
tmp<Field<symmTensor>>
|
||||
transformFieldMask<symmTensor>(const tensorField&);
|
||||
|
||||
template<>
|
||||
tmp<Field<symmTensor>> transformFieldMask<symmTensor>
|
||||
(
|
||||
const tmp<tensorField>&
|
||||
);
|
||||
|
||||
tmp<Field<symmTensor>>
|
||||
transformFieldMask<symmTensor>(const tmp<tensorField>&);
|
||||
|
||||
template<>
|
||||
tmp<Field<sphericalTensor>> transformFieldMask<sphericalTensor>
|
||||
(
|
||||
const tensorField&
|
||||
);
|
||||
tmp<Field<sphericalTensor>>
|
||||
transformFieldMask<sphericalTensor>(const tensorField&);
|
||||
|
||||
template<>
|
||||
tmp<Field<sphericalTensor>> transformFieldMask<sphericalTensor>
|
||||
(
|
||||
const tmp<tensorField>&
|
||||
);
|
||||
tmp<Field<sphericalTensor>>
|
||||
transformFieldMask<sphericalTensor>(const tmp<tensorField>&);
|
||||
|
||||
|
||||
//- Rotate given vectorField with the given quaternion
|
||||
|
||||
@ -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.
|
||||
@ -26,145 +26,269 @@ License
|
||||
#include "transformField.H"
|
||||
#include "FieldM.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * global functions * * * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void transform
|
||||
void Foam::transform
|
||||
(
|
||||
Field<Type>& rtf,
|
||||
const tensorField& trf,
|
||||
const Field<Type>& tf
|
||||
Field<Type>& result,
|
||||
const tensor& rot,
|
||||
const Field<Type>& fld
|
||||
)
|
||||
{
|
||||
if (trf.size() == 1)
|
||||
TFOR_ALL_F_OP_FUNC_S_F
|
||||
(
|
||||
Type, result, =, transform, tensor, rot, Type, fld
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::transform
|
||||
(
|
||||
Field<Type>& result,
|
||||
const tensorField& rot,
|
||||
const Field<Type>& fld
|
||||
)
|
||||
{
|
||||
if (rot.size() == 1)
|
||||
{
|
||||
return transform(rtf, trf[0], tf);
|
||||
return transform(result, rot.first(), fld);
|
||||
}
|
||||
else
|
||||
|
||||
TFOR_ALL_F_OP_FUNC_F_F
|
||||
(
|
||||
Type, result, =, transform, tensor, rot, Type, fld
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::Field<Type>>
|
||||
Foam::transform
|
||||
(
|
||||
const tensorField& rot,
|
||||
const Field<Type>& fld
|
||||
)
|
||||
{
|
||||
auto tresult = tmp<Field<Type>>::New(fld.size());
|
||||
transform(tresult.ref(), rot, fld);
|
||||
return tresult;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::Field<Type>>
|
||||
Foam::transform
|
||||
(
|
||||
const tensorField& rot,
|
||||
const tmp<Field<Type>>& tfld
|
||||
)
|
||||
{
|
||||
tmp<Field<Type>> tresult = New(tfld);
|
||||
transform(tresult.ref(), rot, tfld());
|
||||
tfld.clear();
|
||||
return tresult;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::Field<Type>>
|
||||
Foam::transform
|
||||
(
|
||||
const tmp<tensorField>& trot,
|
||||
const Field<Type>& fld
|
||||
)
|
||||
{
|
||||
auto tresult = tmp<Field<Type>>::New(fld.size());
|
||||
transform(tresult.ref(), trot(), fld);
|
||||
trot.clear();
|
||||
return tresult;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::Field<Type>>
|
||||
Foam::transform
|
||||
(
|
||||
const tmp<tensorField>& trot,
|
||||
const tmp<Field<Type>>& tfld
|
||||
)
|
||||
{
|
||||
tmp<Field<Type>> tresult = New(tfld);
|
||||
transform(tresult.ref(), trot(), tfld());
|
||||
trot.clear();
|
||||
tfld.clear();
|
||||
return tresult;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::Field<Type>>
|
||||
Foam::transform
|
||||
(
|
||||
const tensor& rot,
|
||||
const Field<Type>& fld
|
||||
)
|
||||
{
|
||||
auto tresult = tmp<Field<Type>>::New(fld.size());
|
||||
transform(tresult.ref(), rot, fld);
|
||||
return tresult;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::Field<Type>>
|
||||
Foam::transform
|
||||
(
|
||||
const tensor& rot,
|
||||
const tmp<Field<Type>>& tfld
|
||||
)
|
||||
{
|
||||
tmp<Field<Type>> tresult = New(tfld);
|
||||
transform(tresult.ref(), rot, tfld());
|
||||
tfld.clear();
|
||||
return tresult;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::invTransform
|
||||
(
|
||||
Field<Type>& result,
|
||||
const tensor& rot,
|
||||
const Field<Type>& fld
|
||||
)
|
||||
{
|
||||
TFOR_ALL_F_OP_FUNC_S_F
|
||||
(
|
||||
Type, result, =, invTransform, tensor, rot, Type, fld
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::invTransform
|
||||
(
|
||||
Field<Type>& result,
|
||||
const tensorField& rot,
|
||||
const Field<Type>& fld
|
||||
)
|
||||
{
|
||||
if (rot.size() == 1)
|
||||
{
|
||||
TFOR_ALL_F_OP_FUNC_F_F
|
||||
(
|
||||
Type, rtf, =, transform, tensor, trf, Type, tf
|
||||
)
|
||||
return invTransform(result, rot.first(), fld);
|
||||
}
|
||||
|
||||
TFOR_ALL_F_OP_FUNC_F_F
|
||||
(
|
||||
Type, result, =, invTransform, tensor, rot, Type, fld
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
tmp<Field<Type>> transform
|
||||
Foam::tmp<Foam::Field<Type>>
|
||||
Foam::invTransform
|
||||
(
|
||||
const tensorField& trf,
|
||||
const Field<Type>& tf
|
||||
const tensorField& rot,
|
||||
const Field<Type>& fld
|
||||
)
|
||||
{
|
||||
tmp<Field<Type>> tranf(new Field<Type> (tf.size()));
|
||||
transform(tranf.ref(), trf, tf);
|
||||
return tranf;
|
||||
auto tresult = tmp<Field<Type>>::New(fld.size());
|
||||
invTransform(tresult.ref(), rot, fld);
|
||||
return tresult;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
tmp<Field<Type>> transform
|
||||
Foam::tmp<Foam::Field<Type>>
|
||||
Foam::invTransform
|
||||
(
|
||||
const tensorField& trf,
|
||||
const tmp<Field<Type>>& ttf
|
||||
const tensorField& rot,
|
||||
const tmp<Field<Type>>& tfld
|
||||
)
|
||||
{
|
||||
tmp<Field<Type>> tranf = New(ttf);
|
||||
transform(tranf.ref(), trf, ttf());
|
||||
ttf.clear();
|
||||
return tranf;
|
||||
tmp<Field<Type>> tresult = New(tfld);
|
||||
invTransform(tresult.ref(), rot, tfld());
|
||||
tfld.clear();
|
||||
return tresult;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
tmp<Field<Type>> transform
|
||||
Foam::tmp<Foam::Field<Type>>
|
||||
Foam::invTransform
|
||||
(
|
||||
const tmp<tensorField>& ttrf,
|
||||
const Field<Type>& tf
|
||||
const tmp<tensorField>& trot,
|
||||
const Field<Type>& fld
|
||||
)
|
||||
{
|
||||
tmp<Field<Type>> tranf(new Field<Type> (tf.size()));
|
||||
transform(tranf.ref(), ttrf(), tf);
|
||||
ttrf.clear();
|
||||
return tranf;
|
||||
auto tresult = tmp<Field<Type>>::New(fld.size());
|
||||
invTransform(tresult.ref(), trot(), fld);
|
||||
trot.clear();
|
||||
return tresult;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
tmp<Field<Type>> transform
|
||||
Foam::tmp<Foam::Field<Type>>
|
||||
Foam::invTransform
|
||||
(
|
||||
const tmp<tensorField>& ttrf,
|
||||
const tmp<Field<Type>>& ttf
|
||||
const tmp<tensorField>& trot,
|
||||
const tmp<Field<Type>>& tfld
|
||||
)
|
||||
{
|
||||
tmp<Field<Type>> tranf = New(ttf);
|
||||
transform(tranf.ref(), ttrf(), ttf());
|
||||
ttf.clear();
|
||||
ttrf.clear();
|
||||
return tranf;
|
||||
tmp<Field<Type>> tresult = New(tfld);
|
||||
invTransform(tresult.ref(), trot(), tfld());
|
||||
trot.clear();
|
||||
tfld.clear();
|
||||
return tresult;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void transform
|
||||
Foam::tmp<Foam::Field<Type>>
|
||||
Foam::invTransform
|
||||
(
|
||||
Field<Type>& rtf,
|
||||
const tensor& t,
|
||||
const Field<Type>& tf
|
||||
const tensor& rot,
|
||||
const Field<Type>& fld
|
||||
)
|
||||
{
|
||||
TFOR_ALL_F_OP_FUNC_S_F(Type, rtf, =, transform, tensor, t, Type, tf)
|
||||
auto tresult = tmp<Field<Type>>::New(fld.size());
|
||||
invTransform(tresult.ref(), rot, fld);
|
||||
return tresult;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
tmp<Field<Type>> transform
|
||||
Foam::tmp<Foam::Field<Type>>
|
||||
Foam::invTransform
|
||||
(
|
||||
const tensor& t,
|
||||
const Field<Type>& tf
|
||||
const tensor& rot,
|
||||
const tmp<Field<Type>>& tfld
|
||||
)
|
||||
{
|
||||
tmp<Field<Type>> tranf(new Field<Type>(tf.size()));
|
||||
transform(tranf.ref(), t, tf);
|
||||
return tranf;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
tmp<Field<Type>> transform
|
||||
(
|
||||
const tensor& t,
|
||||
const tmp<Field<Type>>& ttf
|
||||
)
|
||||
{
|
||||
tmp<Field<Type>> tranf = New(ttf);
|
||||
transform(tranf.ref(), t, ttf());
|
||||
ttf.clear();
|
||||
return tranf;
|
||||
tmp<Field<Type>> tresult = New(tfld);
|
||||
invTransform(tresult.ref(), rot, tfld());
|
||||
tfld.clear();
|
||||
return tresult;
|
||||
}
|
||||
|
||||
|
||||
template<class Type1, class Type2>
|
||||
tmp<Field<Type1>> transformFieldMask(const Field<Type2>& f)
|
||||
Foam::tmp<Foam::Field<Type1>>
|
||||
Foam::transformFieldMask(const Field<Type2>& fld)
|
||||
{
|
||||
return f;
|
||||
return fld;
|
||||
}
|
||||
|
||||
template<class Type1, class Type2>
|
||||
tmp<Field<Type1>> transformFieldMask(const tmp<Field<Type2>>& tf)
|
||||
Foam::tmp<Foam::Field<Type1>>
|
||||
Foam::transformFieldMask(const tmp<Field<Type2>>& tfld)
|
||||
{
|
||||
return tmp<Field<Type1>>(tf.ptr());
|
||||
return tmp<Field<Type1>>(tfld.ptr());
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -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.
|
||||
@ -29,169 +29,328 @@ Description
|
||||
#include "transformGeometricField.H"
|
||||
#include "transformField.H"
|
||||
#include "transformFieldField.H"
|
||||
#include "GeometricField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * global functions * * * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * Transform Global Functions * * * * * * * * * * * //
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
void transform
|
||||
void Foam::transform
|
||||
(
|
||||
GeometricField<Type, PatchField, GeoMesh>& rtf,
|
||||
const GeometricField<tensor, PatchField, GeoMesh>& trf,
|
||||
const GeometricField<Type, PatchField, GeoMesh>& tf
|
||||
GeometricField<Type, PatchField, GeoMesh>& result,
|
||||
const dimensionedTensor& rot,
|
||||
const GeometricField<Type, PatchField, GeoMesh>& fld
|
||||
)
|
||||
{
|
||||
transform
|
||||
(
|
||||
rtf.primitiveFieldRef(),
|
||||
trf.primitiveField(),
|
||||
tf.primitiveField()
|
||||
result.primitiveFieldRef(),
|
||||
rot.value(),
|
||||
fld.primitiveField()
|
||||
);
|
||||
transform
|
||||
(
|
||||
rtf.boundaryFieldRef(),
|
||||
trf.boundaryField(),
|
||||
tf.boundaryField()
|
||||
result.boundaryFieldRef(),
|
||||
rot.value(),
|
||||
fld.boundaryField()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
tmp<GeometricField<Type, PatchField, GeoMesh>> transform
|
||||
void Foam::transform
|
||||
(
|
||||
const GeometricField<tensor, PatchField, GeoMesh>& trf,
|
||||
const GeometricField<Type, PatchField, GeoMesh>& tf
|
||||
GeometricField<Type, PatchField, GeoMesh>& result,
|
||||
const GeometricField<tensor, PatchField, GeoMesh>& rot,
|
||||
const GeometricField<Type, PatchField, GeoMesh>& fld
|
||||
)
|
||||
{
|
||||
tmp<GeometricField<Type, PatchField, GeoMesh>> tranf
|
||||
transform
|
||||
(
|
||||
new GeometricField<Type, PatchField, GeoMesh>
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"transform(" + trf.name() + ',' + tf.name() + ')',
|
||||
tf.instance(),
|
||||
tf.db(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
tf.mesh(),
|
||||
tf.dimensions()
|
||||
)
|
||||
result.primitiveFieldRef(),
|
||||
rot.primitiveField(),
|
||||
fld.primitiveField()
|
||||
);
|
||||
|
||||
transform(tranf.ref(), trf, tf);
|
||||
|
||||
return tranf;
|
||||
}
|
||||
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
tmp<GeometricField<Type, PatchField, GeoMesh>> transform
|
||||
(
|
||||
const GeometricField<tensor, PatchField, GeoMesh>& trf,
|
||||
const tmp<GeometricField<Type, PatchField, GeoMesh>>& ttf
|
||||
)
|
||||
{
|
||||
tmp<GeometricField<Type, PatchField, GeoMesh>> tranf =
|
||||
transform(trf, ttf());
|
||||
ttf.clear();
|
||||
return tranf;
|
||||
}
|
||||
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
tmp<GeometricField<Type, PatchField, GeoMesh>> transform
|
||||
(
|
||||
const tmp<GeometricField<tensor, PatchField, GeoMesh>>& ttrf,
|
||||
const GeometricField<Type, PatchField, GeoMesh>& tf
|
||||
)
|
||||
{
|
||||
tmp<GeometricField<Type, PatchField, GeoMesh>> tranf =
|
||||
transform(ttrf(), tf);
|
||||
ttrf.clear();
|
||||
return tranf;
|
||||
}
|
||||
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
tmp<GeometricField<Type, PatchField, GeoMesh>> transform
|
||||
(
|
||||
const tmp<GeometricField<tensor, PatchField, GeoMesh>>& ttrf,
|
||||
const tmp<GeometricField<Type, PatchField, GeoMesh>>& ttf
|
||||
)
|
||||
{
|
||||
tmp<GeometricField<Type, PatchField, GeoMesh>> tranf =
|
||||
transform(ttrf(), ttf());
|
||||
ttf.clear();
|
||||
ttrf.clear();
|
||||
return tranf;
|
||||
}
|
||||
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
void transform
|
||||
(
|
||||
GeometricField<Type, PatchField, GeoMesh>& rtf,
|
||||
const dimensionedTensor& t,
|
||||
const GeometricField<Type, PatchField, GeoMesh>& tf
|
||||
)
|
||||
{
|
||||
transform(rtf.primitiveFieldRef(), t.value(), tf.primitiveField());
|
||||
transform(rtf.boundaryFieldRef(), t.value(), tf.boundaryField());
|
||||
}
|
||||
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
tmp<GeometricField<Type, PatchField, GeoMesh>> transform
|
||||
(
|
||||
const dimensionedTensor& t,
|
||||
const GeometricField<Type, PatchField, GeoMesh>& tf
|
||||
)
|
||||
{
|
||||
tmp<GeometricField<Type, PatchField, GeoMesh>> tranf
|
||||
transform
|
||||
(
|
||||
new GeometricField<Type, PatchField, GeoMesh>
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"transform(" + t.name() + ',' + tf.name() + ')',
|
||||
tf.instance(),
|
||||
tf.db(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
tf.mesh(),
|
||||
tf.dimensions()
|
||||
)
|
||||
result.boundaryFieldRef(),
|
||||
rot.boundaryField(),
|
||||
fld.boundaryField()
|
||||
);
|
||||
|
||||
transform(tranf.ref(), t, tf);
|
||||
|
||||
return tranf;
|
||||
}
|
||||
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
tmp<GeometricField<Type, PatchField, GeoMesh>> transform
|
||||
Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh>>
|
||||
Foam::transform
|
||||
(
|
||||
const dimensionedTensor& t,
|
||||
const tmp<GeometricField<Type, PatchField, GeoMesh>>& ttf
|
||||
const GeometricField<tensor, PatchField, GeoMesh>& rot,
|
||||
const GeometricField<Type, PatchField, GeoMesh>& fld
|
||||
)
|
||||
{
|
||||
tmp<GeometricField<Type, PatchField, GeoMesh>> tranf =
|
||||
transform(t, ttf());
|
||||
ttf.clear();
|
||||
return tranf;
|
||||
auto tresult = tmp<GeometricField<Type, PatchField, GeoMesh>>::New
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"transform(" + rot.name() + ',' + fld.name() + ')',
|
||||
fld.instance(),
|
||||
fld.db(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
fld.mesh(),
|
||||
fld.dimensions()
|
||||
);
|
||||
|
||||
transform(tresult.ref(), rot, fld);
|
||||
|
||||
return tresult;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh>>
|
||||
Foam::transform
|
||||
(
|
||||
const GeometricField<tensor, PatchField, GeoMesh>& rot,
|
||||
const tmp<GeometricField<Type, PatchField, GeoMesh>>& tfld
|
||||
)
|
||||
{
|
||||
auto tresult = transform(rot, tfld());
|
||||
tfld.clear();
|
||||
return tresult;
|
||||
}
|
||||
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh>>
|
||||
Foam::transform
|
||||
(
|
||||
const tmp<GeometricField<tensor, PatchField, GeoMesh>>& trot,
|
||||
const GeometricField<Type, PatchField, GeoMesh>& fld
|
||||
)
|
||||
{
|
||||
auto tresult = transform(trot(), fld);
|
||||
trot.clear();
|
||||
return tresult;
|
||||
}
|
||||
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh>>
|
||||
Foam::transform
|
||||
(
|
||||
const tmp<GeometricField<tensor, PatchField, GeoMesh>>& trot,
|
||||
const tmp<GeometricField<Type, PatchField, GeoMesh>>& tfld
|
||||
)
|
||||
{
|
||||
auto tresult = transform(trot(), tfld());
|
||||
tfld.clear();
|
||||
trot.clear();
|
||||
return tresult;
|
||||
}
|
||||
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh>>
|
||||
Foam::transform
|
||||
(
|
||||
const dimensionedTensor& rot,
|
||||
const GeometricField<Type, PatchField, GeoMesh>& fld
|
||||
)
|
||||
{
|
||||
auto tresult = tmp<GeometricField<Type, PatchField, GeoMesh>>::New
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"transform(" + rot.name() + ',' + fld.name() + ')',
|
||||
fld.instance(),
|
||||
fld.db(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
fld.mesh(),
|
||||
fld.dimensions()
|
||||
);
|
||||
|
||||
transform(tresult.ref(), rot, fld);
|
||||
|
||||
return tresult;
|
||||
}
|
||||
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh>>
|
||||
Foam::transform
|
||||
(
|
||||
const dimensionedTensor& rot,
|
||||
const tmp<GeometricField<Type, PatchField, GeoMesh>>& tfld
|
||||
)
|
||||
{
|
||||
auto tresult = transform(rot, tfld());
|
||||
tfld.clear();
|
||||
return tresult;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * invTransform Global Functions * * * * * * * * * * * //
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
void Foam::invTransform
|
||||
(
|
||||
GeometricField<Type, PatchField, GeoMesh>& result,
|
||||
const dimensionedTensor& rot,
|
||||
const GeometricField<Type, PatchField, GeoMesh>& fld
|
||||
)
|
||||
{
|
||||
invTransform
|
||||
(
|
||||
result.primitiveFieldRef(),
|
||||
rot.value(),
|
||||
fld.primitiveField()
|
||||
);
|
||||
invTransform
|
||||
(
|
||||
result.boundaryFieldRef(),
|
||||
rot.value(),
|
||||
fld.boundaryField()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
void Foam::invTransform
|
||||
(
|
||||
GeometricField<Type, PatchField, GeoMesh>& result,
|
||||
const GeometricField<tensor, PatchField, GeoMesh>& rot,
|
||||
const GeometricField<Type, PatchField, GeoMesh>& fld
|
||||
)
|
||||
{
|
||||
invTransform
|
||||
(
|
||||
result.primitiveFieldRef(),
|
||||
rot.primitiveField(),
|
||||
fld.primitiveField()
|
||||
);
|
||||
invTransform
|
||||
(
|
||||
result.boundaryFieldRef(),
|
||||
rot.boundaryField(),
|
||||
fld.boundaryField()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh>>
|
||||
Foam::invTransform
|
||||
(
|
||||
const GeometricField<tensor, PatchField, GeoMesh>& rot,
|
||||
const GeometricField<Type, PatchField, GeoMesh>& fld
|
||||
)
|
||||
{
|
||||
auto tresult = tmp<GeometricField<Type, PatchField, GeoMesh>>::New
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"invTransform(" + rot.name() + ',' + fld.name() + ')',
|
||||
fld.instance(),
|
||||
fld.db(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
fld.mesh(),
|
||||
fld.dimensions()
|
||||
);
|
||||
|
||||
invTransform(tresult.ref(), rot, fld);
|
||||
|
||||
return tresult;
|
||||
}
|
||||
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh>>
|
||||
Foam::invTransform
|
||||
(
|
||||
const GeometricField<tensor, PatchField, GeoMesh>& rot,
|
||||
const tmp<GeometricField<Type, PatchField, GeoMesh>>& tfld
|
||||
)
|
||||
{
|
||||
auto tresult = invTransform(rot, tfld());
|
||||
tfld.clear();
|
||||
return tresult;
|
||||
}
|
||||
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh>>
|
||||
Foam::invTransform
|
||||
(
|
||||
const tmp<GeometricField<tensor, PatchField, GeoMesh>>& trot,
|
||||
const GeometricField<Type, PatchField, GeoMesh>& fld
|
||||
)
|
||||
{
|
||||
auto tresult = invTransform(trot(), fld);
|
||||
trot.clear();
|
||||
return tresult;
|
||||
}
|
||||
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh>>
|
||||
Foam::invTransform
|
||||
(
|
||||
const tmp<GeometricField<tensor, PatchField, GeoMesh>>& trot,
|
||||
const tmp<GeometricField<Type, PatchField, GeoMesh>>& tfld
|
||||
)
|
||||
{
|
||||
auto tresult = invTransform(trot(), tfld());
|
||||
tfld.clear();
|
||||
trot.clear();
|
||||
return tresult;
|
||||
}
|
||||
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh>>
|
||||
Foam::invTransform
|
||||
(
|
||||
const dimensionedTensor& rot,
|
||||
const GeometricField<Type, PatchField, GeoMesh>& fld
|
||||
)
|
||||
{
|
||||
auto tresult = tmp<GeometricField<Type, PatchField, GeoMesh>>::New
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"invTransform(" + rot.name() + ',' + fld.name() + ')',
|
||||
fld.instance(),
|
||||
fld.db(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
fld.mesh(),
|
||||
fld.dimensions()
|
||||
);
|
||||
|
||||
invTransform(tresult.ref(), rot, fld);
|
||||
|
||||
return tresult;
|
||||
}
|
||||
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh>>
|
||||
Foam::invTransform
|
||||
(
|
||||
const dimensionedTensor& rot,
|
||||
const tmp<GeometricField<Type, PatchField, GeoMesh>>& tfld
|
||||
)
|
||||
{
|
||||
auto tresult = invTransform(rot, tfld());
|
||||
tfld.clear();
|
||||
return tresult;
|
||||
}
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -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.
|
||||
@ -25,7 +25,7 @@ InClass
|
||||
Foam::transformGeometricField
|
||||
|
||||
Description
|
||||
Spatial transformation functions for FieldFields.
|
||||
Spatial transformation functions for GeometricField
|
||||
|
||||
SourceFiles
|
||||
transformGeometricField.C
|
||||
@ -45,63 +45,128 @@ namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
void transform
|
||||
(
|
||||
GeometricField<Type, PatchField, GeoMesh>&,
|
||||
const GeometricField<tensor, PatchField, GeoMesh>&,
|
||||
const GeometricField<Type, PatchField, GeoMesh>&
|
||||
);
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
tmp<GeometricField<Type, PatchField, GeoMesh>> transform
|
||||
(
|
||||
const GeometricField<tensor, PatchField, GeoMesh>&,
|
||||
const GeometricField<Type, PatchField, GeoMesh>&
|
||||
);
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
tmp<GeometricField<Type, PatchField, GeoMesh>> transform
|
||||
(
|
||||
const GeometricField<tensor, PatchField, GeoMesh>&,
|
||||
const tmp<GeometricField<Type, PatchField, GeoMesh>>&
|
||||
);
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
tmp<GeometricField<Type, PatchField, GeoMesh>> transform
|
||||
(
|
||||
const tmp<GeometricField<tensor, PatchField, GeoMesh>>&,
|
||||
const GeometricField<Type, PatchField, GeoMesh>&
|
||||
);
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
tmp<GeometricField<Type, PatchField, GeoMesh>> transform
|
||||
(
|
||||
const tmp<GeometricField<tensor, PatchField, GeoMesh>>&,
|
||||
const tmp<GeometricField<Type, PatchField, GeoMesh>>&
|
||||
);
|
||||
|
||||
// transform()
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
void transform
|
||||
(
|
||||
GeometricField<Type, PatchField, GeoMesh>&,
|
||||
const dimensionedTensor&,
|
||||
const GeometricField<Type, PatchField, GeoMesh>&
|
||||
GeometricField<Type, PatchField, GeoMesh>& result,
|
||||
const dimensionedTensor& rot,
|
||||
const GeometricField<Type, PatchField, GeoMesh>& fld
|
||||
);
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
void transform
|
||||
(
|
||||
GeometricField<Type, PatchField, GeoMesh>& result,
|
||||
const GeometricField<tensor, PatchField, GeoMesh>& rot,
|
||||
const GeometricField<Type, PatchField, GeoMesh>& fld
|
||||
);
|
||||
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
tmp<GeometricField<Type, PatchField, GeoMesh>> transform
|
||||
(
|
||||
const GeometricField<tensor, PatchField, GeoMesh>& rot,
|
||||
const GeometricField<Type, PatchField, GeoMesh>& fld
|
||||
);
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
tmp<GeometricField<Type, PatchField, GeoMesh>> transform
|
||||
(
|
||||
const dimensionedTensor&,
|
||||
const GeometricField<Type, PatchField, GeoMesh>&
|
||||
const GeometricField<tensor, PatchField, GeoMesh>& rot,
|
||||
const tmp<GeometricField<Type, PatchField, GeoMesh>>& tfld
|
||||
);
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
tmp<GeometricField<Type, PatchField, GeoMesh>> transform
|
||||
(
|
||||
const dimensionedTensor&,
|
||||
const tmp<GeometricField<Type, PatchField, GeoMesh>>&
|
||||
const tmp<GeometricField<tensor, PatchField, GeoMesh>>& trot,
|
||||
const GeometricField<Type, PatchField, GeoMesh>& fld
|
||||
);
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
tmp<GeometricField<Type, PatchField, GeoMesh>> transform
|
||||
(
|
||||
const tmp<GeometricField<tensor, PatchField, GeoMesh>>& trot,
|
||||
const tmp<GeometricField<Type, PatchField, GeoMesh>>& tfld
|
||||
);
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
tmp<GeometricField<Type, PatchField, GeoMesh>> transform
|
||||
(
|
||||
const dimensionedTensor& rot,
|
||||
const GeometricField<Type, PatchField, GeoMesh>& fld
|
||||
);
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
tmp<GeometricField<Type, PatchField, GeoMesh>> transform
|
||||
(
|
||||
const dimensionedTensor& rot,
|
||||
const tmp<GeometricField<Type, PatchField, GeoMesh>>& tfld
|
||||
);
|
||||
|
||||
|
||||
|
||||
// invTransform()
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
void invTransform
|
||||
(
|
||||
GeometricField<Type, PatchField, GeoMesh>& result,
|
||||
const dimensionedTensor& rot,
|
||||
const GeometricField<Type, PatchField, GeoMesh>& fld
|
||||
);
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
void invTransform
|
||||
(
|
||||
GeometricField<Type, PatchField, GeoMesh>& result,
|
||||
const GeometricField<tensor, PatchField, GeoMesh>& rot,
|
||||
const GeometricField<Type, PatchField, GeoMesh>& fld
|
||||
);
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
tmp<GeometricField<Type, PatchField, GeoMesh>> invTransform
|
||||
(
|
||||
const GeometricField<tensor, PatchField, GeoMesh>& rot,
|
||||
const GeometricField<Type, PatchField, GeoMesh>& fld
|
||||
);
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
tmp<GeometricField<Type, PatchField, GeoMesh>> invTransform
|
||||
(
|
||||
const GeometricField<tensor, PatchField, GeoMesh>& rot,
|
||||
const tmp<GeometricField<Type, PatchField, GeoMesh>>& tfld
|
||||
);
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
tmp<GeometricField<Type, PatchField, GeoMesh>> invTransform
|
||||
(
|
||||
const tmp<GeometricField<tensor, PatchField, GeoMesh>>& trot,
|
||||
const GeometricField<Type, PatchField, GeoMesh>& fld
|
||||
);
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
tmp<GeometricField<Type, PatchField, GeoMesh>> invTransform
|
||||
(
|
||||
const tmp<GeometricField<tensor, PatchField, GeoMesh>>& trot,
|
||||
const tmp<GeometricField<Type, PatchField, GeoMesh>>& tfld
|
||||
);
|
||||
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
tmp<GeometricField<Type, PatchField, GeoMesh>> invTransform
|
||||
(
|
||||
const dimensionedTensor& rot,
|
||||
const GeometricField<Type, PatchField, GeoMesh>& fld
|
||||
);
|
||||
|
||||
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||
tmp<GeometricField<Type, PatchField, GeoMesh>> invTransform
|
||||
(
|
||||
const dimensionedTensor& rot,
|
||||
const tmp<GeometricField<Type, PatchField, GeoMesh>>& tfld
|
||||
);
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user