coupled patches: Refactored transformPosition function

reducing code duplication and removing associated errors thus simplifying
maintenance.
This commit is contained in:
Henry Weller
2020-01-07 21:23:09 +00:00
parent a79f8966b0
commit 50d1355fa1
39 changed files with 412 additions and 908 deletions

View File

@ -310,7 +310,7 @@ namespace Foam
// Now ptsAtIndex will have for every face either zero or
// the position of the i'th vertex. Transform.
cpp.transformPosition(ptsAtIndex);
cpp.transform().transformPosition(ptsAtIndex, ptsAtIndex);
// Extract back from ptsAtIndex into newPts
forAll(cpp, facei)

View File

@ -357,15 +357,10 @@ void syncPoints
// Null any value which is not on neighbouring processor
nbrPatchInfo.setSize(procPatch.nPoints(), nullValue);
if (procPatch.transform().rotates())
if (procPatch.transform().transformsPosition())
{
hasTransformation = true;
transformList(procPatch.transform().R(), nbrPatchInfo);
}
else if (procPatch.transform().translates())
{
hasTransformation = true;
nbrPatchInfo -= procPatch.transform().t();
procPatch.transform().transformPosition(nbrPatchInfo);
}
const labelList& meshPts = procPatch.meshPoints();
@ -398,31 +393,26 @@ void syncPoints
const cyclicPolyPatch& nbrPatch = cycPatch.nbrPatch();
const labelList& nbrMeshPts = nbrPatch.meshPoints();
pointField half0Values(coupledPoints.size());
pointField patchPoints(coupledPoints.size());
forAll(coupledPoints, i)
{
const edge& e = coupledPoints[i];
label point0 = meshPts[e[0]];
half0Values[i] = points[point0];
patchPoints[i] = points[point0];
}
if (cycPatch.transform().rotates())
if (cycPatch.transform().transformsPosition())
{
hasTransformation = true;
transformList(cycPatch.transform().R().T(), half0Values);
}
else if (cycPatch.transform().translates())
{
hasTransformation = true;
half0Values += cycPatch.transform().t();
cycPatch.transform().invTransformPosition(patchPoints);
}
forAll(coupledPoints, i)
{
const edge& e = coupledPoints[i];
label point1 = nbrMeshPts[e[1]];
points[point1] = half0Values[i];
points[point1] = patchPoints[i];
}
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -48,6 +48,10 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
List<Type> transform(const tensor&, const UList<Type>&);
template<class Type>
void transform(Field<Type>&, const tensorField&, const Field<Type>&);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -33,6 +33,20 @@ namespace Foam
// * * * * * * * * * * * * * * * global functions * * * * * * * * * * * * * //
template<class Type>
List<Type> transform(const tensor& t, const UList<Type>& list)
{
List<Type> newList(list.size());
forAll(list, i)
{
newList[i] = transform(t, list[i]);
}
return newList;
}
template<class Type>
void transform
(

View File

@ -1,145 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "transformList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class T>
Foam::List<T> Foam::transform
(
const tensor& rotTensor,
const UList<T>& field
)
{
List<T> newField(field.size());
forAll(field, i)
{
newField[i] = transform(rotTensor, field[i]);
}
return newField;
}
template<class T>
void Foam::transformList(const tensor& rotTensor, UList<T>& field)
{
forAll(field, i)
{
field[i] = transform(rotTensor, field[i]);
}
}
template<class T>
void Foam::transformList(const tensorField& rotTensor, UList<T>& field)
{
if (rotTensor.size() == 1)
{
forAll(field, i)
{
field[i] = transform(rotTensor[0], field[i]);
}
}
else if (rotTensor.size() == field.size())
{
forAll(field, i)
{
field[i] = transform(rotTensor[i], field[i]);
}
}
else
{
FatalErrorInFunction
<< "Sizes of field and transformation not equal. field:"
<< field.size() << " transformation:" << rotTensor.size()
<< abort(FatalError);
}
}
template<class T>
void Foam::transformList(const tensor& rotTensor, Map<T>& field)
{
forAllIter(typename Map<T>, field, iter)
{
iter() = transform(rotTensor[0], iter());
}
}
template<class T>
void Foam::transformList(const tensorField& rotTensor, Map<T>& field)
{
if (rotTensor.size() == 1)
{
forAllIter(typename Map<T>, field, iter)
{
iter() = transform(rotTensor[0], iter());
}
}
else
{
FatalErrorInFunction
<< "Multiple transformation tensors not supported. field:"
<< field.size() << " transformation:" << rotTensor.size()
<< abort(FatalError);
}
}
template<class T>
void Foam::transformList(const tensor& rotTensor, EdgeMap<T>& field)
{
forAllIter(typename EdgeMap<T>, field, iter)
{
iter() = transform(rotTensor[0], iter());
}
}
template<class T>
void Foam::transformList(const tensorField& rotTensor, EdgeMap<T>& field)
{
if (rotTensor.size() == 1)
{
forAllIter(typename EdgeMap<T>, field, iter)
{
iter() = transform(rotTensor[0], iter());
}
}
else
{
FatalErrorInFunction
<< "Multiple transformation tensors not supported. field:"
<< field.size() << " transformation:" << rotTensor.size()
<< abort(FatalError);
}
}
// ************************************************************************* //

View File

@ -1,155 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
InClass
Foam
Description
Spatial transformation functions for primitive fields.
SourceFiles
transformList.C
\*---------------------------------------------------------------------------*/
#ifndef transformList_H
#define transformList_H
#include "transform.H"
#include "List.H"
#include "Map.H"
#include "EdgeMap.H"
#include "tensorField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Extend transform to work on list.
template<class T>
List<T> transform
(
const tensor& rotTensor,
const UList<T>& field
);
//- Apply transformation to list. Either single transformation tensor
// or one tensor per element.
template<class T>
void transformList(const tensor&, UList<T>&);
template<class T>
void transformList(const tensorField&, UList<T>&);
template<class T>
void transformList(const tensor&, Map<T>&);
template<class T>
void transformList(const tensorField&, Map<T>&);
template<class T>
void transformList(const tensor&, EdgeMap<T>&);
template<class T>
void transformList(const tensorField&, EdgeMap<T>&);
// Specialisations for bool
template<>
inline void transformList(const tensor&, UList<bool>&)
{}
template<>
inline void transformList(const tensorField&, UList<bool>&)
{}
template<>
inline void transformList(const tensor&, Map<bool>&)
{}
template<>
inline void transformList(const tensorField&, Map<bool>&)
{}
template<>
inline void transformList(const tensor&, EdgeMap<bool>&)
{}
template<>
inline void transformList(const tensorField&, EdgeMap<bool>&)
{}
// Specialisations for label
template<>
inline void transformList(const tensor&, labelUList&)
{}
template<>
inline void transformList(const tensorField&, labelUList&)
{}
template<>
inline void transformList(const tensor&, Map<label>&)
{}
template<>
inline void transformList(const tensorField&, Map<label>&)
{}
template<>
inline void transformList(const tensor&, EdgeMap<label>&)
{}
template<>
inline void transformList(const tensorField&, EdgeMap<label>&)
{}
// Specialisations for scalar
template<>
inline void transformList(const tensor&, UList<scalar>&)
{}
template<>
inline void transformList(const tensorField&, UList<scalar>&)
{}
template<>
inline void transformList(const tensor&, Map<scalar>&)
{}
template<>
inline void transformList(const tensorField&, Map<scalar>&)
{}
template<>
inline void transformList(const tensor&, EdgeMap<scalar>&)
{}
template<>
inline void transformList(const tensorField&, EdgeMap<scalar>&)
{}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "transformList.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -134,9 +134,9 @@ SourceFiles
#define mapDistribute_H
#include "mapDistributeBase.H"
#include "transformList.H"
#include "transformer.H"
#include "coupledPolyPatch.H"
#include "EdgeMap.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -216,8 +216,14 @@ public:
List<Type>& fld
) const
{
const tensor T(forward ? vt.R() : vt.R().T());
transformList(T, fld);
if (forward)
{
vt.transformList(fld);
}
else
{
vt.invTransformList(fld);
}
}
template<class Type>
@ -240,7 +246,7 @@ public:
{
if (cpp.transform().transforms())
{
transformList(cpp.transform().R(), fld);
cpp.transform().transformList(fld);
}
}
@ -251,7 +257,7 @@ public:
{
if (cpp.transform().transforms())
{
transformList(cpp.transform().R(), map);
cpp.transform().transformList(map);
}
}
};
@ -278,6 +284,7 @@ public:
fld = vt.invTransformPosition(pfld);
}
}
void operator()
(
const transformer& vt,
@ -290,22 +297,27 @@ public:
operator()(vt, forward, flds[i]);
}
}
//- Transform patch-based field
void operator()(const coupledPolyPatch& cpp, pointField& fld) const
{
cpp.transformPosition(fld);
cpp.transform().transformPosition(fld, fld);
}
template<template<class> class Container>
void operator()(const coupledPolyPatch& cpp, Container<point>& map)
const
{
Field<point> fld(map.size());
label i = 0;
forAllConstIter(typename Container<point>, map, iter)
{
fld[i++] = iter();
}
cpp.transformPosition(fld);
cpp.transform().transformPosition(fld, fld);
i = 0;
forAllIter(typename Container<point>, map, iter)
{

View File

@ -233,12 +233,6 @@ public:
//- Return transformation between the coupled patches
virtual const transformer& transform() const = 0;
//- Transform a patch-based position from other side to this side
virtual void transformPosition(pointField&) const = 0;
//- Transform a patch-based position from other side to this side
virtual void transformPosition(point&, const label facei) const = 0;
scalar matchTolerance() const
{
return matchTolerance_;

View File

@ -150,7 +150,7 @@ void Foam::cyclicPolyPatch::calcTransformTensors
bool sameSeparation = true;
bool doneWarning = false;
const vectorField separation(nbrPatchCtrs - thisPatchCtrs);
const vectorField separation(thisPatchCtrs - nbrPatchCtrs);
forAll(separation, facei)
{
@ -455,9 +455,21 @@ void Foam::cyclicPolyPatch::calcTransforms
(-n1 ^ rotationAxis_),
-n1
);
const tensor revT(E1.T() & E0);
transform_ = transformer(revT.T());
if (mag(rotationCentre_) > small)
{
transform_ = transformer
(
(revT.T() - I) & rotationCentre_,
revT.T()
);
}
else
{
transform_ = transformer(revT.T());
}
}
else if (transformType() == TRANSLATIONAL)
{
@ -627,11 +639,8 @@ void Foam::cyclicPolyPatch::getCentresAndAnchors
<< endl;
}
// Note: getCentresAndAnchors gets called on the slave side
// so separation is owner-slave points.
thisPatchCtrs -= separation_;
anchors0 -= separation_;
thisPatchCtrs += separation_;
anchors0 += separation_;
break;
}
default:
@ -989,51 +998,6 @@ Foam::label Foam::cyclicPolyPatch::nbrPatchID() const
}
void Foam::cyclicPolyPatch::transformPosition(pointField& l) const
{
if (transform().rotates())
{
if (transformType() == ROTATIONAL)
{
l =
Foam::transform(transform().R(), l-rotationCentre_)
+ rotationCentre_;
}
else
{
l = Foam::transform(transform().R(), l);
}
}
else if (transform().translates())
{
// transformPosition gets called on the receiving side,
// separation gets calculated on the sending side so subtract.
l -= transform().t();
}
}
void Foam::cyclicPolyPatch::transformPosition(point& l, const label facei) const
{
if (transform().rotates())
{
if (transformType() == ROTATIONAL)
{
l = Foam::transform(transform().R(), l - rotationCentre_)
+ rotationCentre_;
}
else
{
l = Foam::transform(transform().R(), l);
}
}
else if (transform().translates())
{
l -= transform().t();
}
}
void Foam::cyclicPolyPatch::initGeometry(PstreamBuffers& pBufs)
{
polyPatch::initGeometry(pBufs);

View File

@ -364,12 +364,6 @@ public:
return cyclicTransform::transform();
}
//- Transform a patch-based position from other side to this side
virtual void transformPosition(pointField& l) const;
//- Transform a patch-based position from other side to this side
virtual void transformPosition(point&, const label facei) const;
// Transformation

View File

@ -32,7 +32,6 @@ License
#include "patchZones.H"
#include "matchPoints.H"
#include "Time.H"
#include "transformList.H"
#include "cyclicPolyPatch.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //

View File

@ -256,18 +256,6 @@ public:
return cyclicTransform::transform();
}
//- Transform a patch-based position from other side to this side
virtual void transformPosition(pointField& l) const
{
NotImplemented;
}
//- Transform a patch-based position from other side to this side
virtual void transformPosition(point&, const label facei) const
{
NotImplemented;
}
//- Calculate the patch geometry
virtual void calcGeometry
(

View File

@ -32,7 +32,6 @@ License
#include "OFstream.H"
#include "polyMesh.H"
#include "Time.H"
#include "transformList.H"
#include "PstreamBuffers.H"
#include "ConstCirculator.H"

View File

@ -336,14 +336,6 @@ public:
return transformer::null;
}
//- Transform a patch-based position from other side to this side
virtual void transformPosition(pointField& l) const
{}
//- Transform a patch-based position from other side to this side
virtual void transformPosition(point&, const label facei) const
{}
//- Initialize ordering for primitivePatch. Does not
// refer to *this (except for name() and type() etc.)
virtual void initOrder(PstreamBuffers&, const primitivePatch&) const;

View File

@ -326,18 +326,6 @@ public:
return referPatch().transformType();
}
//- Transform a patch-based position from other side to this side
virtual void transformPosition(pointField& l) const
{
referPatch().transformPosition(l);
}
//- Transform a patch-based position from other side to this side
virtual void transformPosition(point& l, const label facei) const
{
referPatch().transformPosition(l, facei);
}
//- Return transformation between the coupled patches
virtual const transformer& transform() const
{

View File

@ -30,7 +30,6 @@ License
#include "globalMeshData.H"
#include "contiguous.H"
#include "transform.H"
#include "transformList.H"
#include "SubField.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //

View File

@ -141,54 +141,24 @@ void Foam::globalIndexAndTransform::determineTransforms()
{
const coupledPolyPatch& cpp = refCast<const coupledPolyPatch>(pp);
if (cpp.transform().translates())
const transformer transform(inv(cpp.transform()));
if (transform.transformsPosition())
{
const vector& sepVec = cpp.transform().t();
if (mag(sepVec) > small)
{
transformer transform(sepVec);
if
if
(
matchTransform
(
matchTransform
(
localTransforms,
dummyMatch,
transform,
cpp.matchTolerance(),
false
) == 0
)
{
localTransforms.append(transform);
localTols.append(cpp.matchTolerance());
}
}
}
else if (cpp.transform().rotates())
{
const tensor& transT = cpp.transform().R().T();
if (mag(transT - I) > small)
localTransforms,
dummyMatch,
transform,
cpp.matchTolerance(),
false
) == 0
)
{
transformer transform(transT);
if
(
matchTransform
(
localTransforms,
dummyMatch,
transform,
cpp.matchTolerance(),
false
) == 0
)
{
localTransforms.append(transform);
localTols.append(cpp.matchTolerance());
}
localTransforms.append(transform);
localTols.append(cpp.matchTolerance());
}
}
}
@ -218,7 +188,7 @@ void Foam::globalIndexAndTransform::determineTransforms()
{
const transformer& transform = procTransVecs[pSVI];
if (transform.translates() || transform.rotates())
if (transform.transformsPosition())
{
if
(
@ -299,46 +269,20 @@ void Foam::globalIndexAndTransform::determinePatchTransformSign()
{
const coupledPolyPatch& cpp = refCast<const coupledPolyPatch>(pp);
if (cpp.transform().translates())
const transformer transform(inv(cpp.transform()));
if (transform.transformsPosition())
{
const vector& sepVec = cpp.transform().t();
if (mag(sepVec) > small)
{
transformer t(sepVec);
label matchTransI;
label sign = matchTransform
(
transforms_,
matchTransI,
t,
cpp.matchTolerance(),
true
);
patchTransformSign_[patchi] = labelPair(matchTransI, sign);
}
}
else if (cpp.transform().rotates())
{
const tensor& transT = cpp.transform().R().T();
if (mag(transT - I) > small)
{
transformer t(transT);
label matchTransI;
label sign = matchTransform
(
transforms_,
matchTransI,
t,
cpp.matchTolerance(),
true
);
patchTransformSign_[patchi] = labelPair(matchTransI, sign);
}
label matchTransI;
label sign = matchTransform
(
transforms_,
matchTransI,
transform,
cpp.matchTolerance(),
true
);
patchTransformSign_[patchi] = labelPair(matchTransI, sign);
}
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -192,7 +192,7 @@ Foam::label Foam::globalIndexAndTransform::addToTransformIndex
{
const tensor& R = vt.R();
scalar sumDiag = tr(R);
scalar sumMagDiag = mag(R.xx())+mag(R.yy())+mag(R.zz());
scalar sumMagDiag = mag(R.xx()) + mag(R.yy())+mag(R.zz());
if (mag(sumMagDiag-3) < tol && mag(sumDiag+1) < tol)
{
@ -593,16 +593,12 @@ Foam::pointField Foam::globalIndexAndTransform::transformPatches
{
labelList transIs = transformIndicesForPatches(patchis);
// Pout<< patchis << nl << transIs << endl;
pointField transPts(transIs.size());
forAll(transIs, tII)
{
transPts[tII] = transformPermutations_[transIs[tII]].transformPosition
(
pt
);
transPts[tII] =
transformPermutations_[transIs[tII]].transformPosition(pt);
}
return transPts;

View File

@ -71,6 +71,96 @@ Foam::word Foam::name(const transformer& s)
}
void Foam::transformer::transformPosition
(
pointField& res,
const pointField& pts
) const
{
if (translates_ && !rotates_)
{
res = pts + t();
}
else if (!translates_ && rotates_)
{
res = R() & pts;
}
else if (translates_ && rotates_)
{
res = (R() & pts) + t();
}
}
Foam::tmp<Foam::pointField> Foam::transformer::transformPosition
(
const pointField& pts
) const
{
if (translates_ && !rotates_)
{
return pts + t();
}
else if (!translates_ && rotates_)
{
return R() & pts;
}
else if (translates_ && rotates_)
{
return (R() & pts) + t();
}
else
{
return pts;
}
}
Foam::tmp<Foam::pointField> Foam::transformer::invTransformPosition
(
const pointField& pts
) const
{
if (translates_ && !rotates_)
{
return pts - t();
}
else if (!translates_ && rotates_)
{
return R().T() & pts;
}
else if (translates_ && rotates_)
{
return (R().T() & (pts - t()));
}
else
{
return pts;
}
}
void Foam::transformer::invTransformPosition
(
pointField& res,
const pointField& pts
) const
{
if (translates_ && !rotates_)
{
res = pts - t();
}
else if (!translates_ && rotates_)
{
res = R().T() & pts;
}
else if (translates_ && rotates_)
{
res = (R().T() & (pts - t()));
}
}
template<>
Foam::tmp<Foam::Field<bool>> Foam::transformer::transform
(

View File

@ -56,6 +56,27 @@ Istream& operator>>(Istream& is, transformer&);
Ostream& operator<<(Ostream& os, const transformer& C);
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
//- Return the inverse of the given transformer
inline transformer inv(const transformer& tr);
// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
inline bool operator==(const transformer& tr1, const transformer& tr2);
inline bool operator!=(const transformer& tr1, const transformer& tr2);
inline transformer operator+(const transformer& tr, const vector& t);
inline transformer operator+(const vector& t, const transformer& tr);
inline transformer operator-(const transformer& tr, const vector& t);
inline transformer operator&(const transformer& tr1, const transformer& tr2);
/*---------------------------------------------------------------------------*\
Class transformer Declaration
\*---------------------------------------------------------------------------*/
@ -124,18 +145,20 @@ public:
// Access
//- Return true if the transformer performs pure translation
// i.e. the translation vector is non-zero and the rotation tensor
// is I
inline bool translates() const;
//- Return the translation vector
inline const vector& t() const;
//- Return true is the translation vector is non-zero
inline bool translates() const;
//- Return true if the rotation tensor is non-I
inline bool rotates() const;
//- Return the rotation tensor
inline const tensor& R() const;
//- Return true if the rotation tensor is non-I
inline bool rotates() const;
//- Return true if the transformer transforms a type
// (i.e. rotates)
inline bool transforms() const;
@ -165,19 +188,19 @@ public:
inline vector transformPosition(const vector& v) const;
//- Transform the given pointField
inline tmp<pointField> transformPosition
(
const pointField& pts
) const;
void transformPosition(pointField&, const pointField&) const;
//- Transform the given pointField
tmp<pointField> transformPosition(const pointField&) const;
//- Inverse transform the given position
inline vector invTransformPosition(const vector& v) const;
//- Inverse transform the given pointField
inline tmp<pointField> invTransformPosition
(
const pointField& pts
) const;
void invTransformPosition(pointField&, const pointField&) const;
//- Inverse transform the given pointField
tmp<pointField> invTransformPosition(const pointField&) const;
//- Transform the given type
template<class Type>
@ -195,6 +218,10 @@ public:
template<class Type>
tmp<Field<Type>> transform(const tmp<Field<Type>>&) const;
//- Transform the given container
template<class Type, template<class> class Container>
void transformList(Container<Type>&) const;
//- Inverse transform the given type
template<class Type>
Type invTransform(const Type&) const;
@ -211,6 +238,10 @@ public:
template<class Type>
tmp<Field<Type>> invTransform(const tmp<Field<Type>>&) const;
//- Inverse transform the given container
template<class Type, template<class> class Container>
void invTransformList(Container<Type>&) const;
// Member Operators
@ -224,6 +255,51 @@ public:
inline void operator&=(const tensor&);
// Global Functions
//- Return the inverse of the given transformer
friend inline transformer inv(const transformer& tr);
// Global Operators
friend inline bool operator==
(
const transformer& tr1,
const transformer& tr2
);
friend inline bool operator!=
(
const transformer& tr1,
const transformer& tr2
);
friend inline transformer operator+
(
const transformer& tr,
const vector& t
);
friend inline transformer operator+
(
const vector& t,
const transformer& tr
);
friend inline transformer operator-
(
const transformer& tr,
const vector& t
);
friend inline transformer operator&
(
const transformer& tr1,
const transformer& tr2
);
// IOstream Operators
friend Istream& operator>>(Istream& is, transformer&);
@ -234,9 +310,6 @@ public:
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
//- Return the inverse of the given transformer
inline transformer inv(const transformer& tr);
//- Return a string representation of a transformer
word name(const transformer&);
@ -267,21 +340,6 @@ tmp<Field<scalar>> transformer::transform(const tmp<Field<scalar>>&)
const;
// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
inline bool operator==(const transformer& tr1, const transformer& tr2);
inline bool operator!=(const transformer& tr1, const transformer& tr2);
inline transformer operator+(const transformer& tr, const vector& t);
inline transformer operator+(const vector& t, const transformer& tr);
inline transformer operator-(const transformer& tr, const vector& t);
inline transformer operator&(const transformer& tr1, const transformer& tr2);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -78,15 +78,21 @@ inline Foam::transformer::transformer
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline bool Foam::transformer::translates() const
{
return translates_ && !rotates_;
}
inline const Foam::vector& Foam::transformer::t() const
{
return t_;
}
inline bool Foam::transformer::translates() const
inline bool Foam::transformer::rotates() const
{
return translates_;
return rotates_;
}
@ -96,12 +102,6 @@ inline const Foam::tensor& Foam::transformer::R() const
}
inline bool Foam::transformer::rotates() const
{
return rotates_;
}
inline bool Foam::transformer::transforms() const
{
return rotates_;
@ -111,7 +111,7 @@ inline bool Foam::transformer::transforms() const
template<typename Type>
inline bool Foam::transformer::transforms() const
{
return pTraits<Type>::rank != 0 && (translates_ || rotates_);
return pTraits<Type>::rank != 0 && rotates_;
}
@ -141,96 +141,48 @@ inline Foam::tensor& Foam::transformer::R()
inline Foam::vector Foam::transformer::transformPosition
(
const vector& v
const vector& p
) const
{
if (translates_ && !rotates_)
{
return v + t();
return p + t();
}
else if (!translates_ && rotates_)
{
return R() & v;
return R() & p;
}
else if (translates_ && rotates_)
{
return (R() & v) + t();
return (R() & p) + t();
}
else
{
return v;
}
}
inline Foam::tmp<Foam::pointField> Foam::transformer::transformPosition
(
const pointField& pts
) const
{
if (translates_ && !rotates_)
{
return pts + t();
}
else if (!translates_ && rotates_)
{
return R() & pts;
}
else if (translates_ && rotates_)
{
return (R() & pts) + t();
}
else
{
return pts;
return p;
}
}
inline Foam::vector Foam::transformer::invTransformPosition
(
const vector& v
const vector& p
) const
{
if (translates_ && !rotates_)
{
return v - t();
return p - t();
}
else if (!translates_ && rotates_)
{
return R().T() & v;
return R().T() & p;
}
else if (translates_ && rotates_)
{
return (R().T() & (v - t()));
return (R().T() & (p - t()));
}
else
{
return v;
}
}
inline Foam::tmp<Foam::pointField> Foam::transformer::invTransformPosition
(
const pointField& pts
) const
{
if (translates_ && !rotates_)
{
return pts - t();
}
else if (!translates_ && rotates_)
{
return R().T() & pts;
}
else if (translates_ && rotates_)
{
return (R().T() & (pts - t()));
}
else
{
return pts;
return p;
}
}
@ -295,15 +247,15 @@ inline void Foam::transformer::operator&=(const tensor& R)
inline Foam::transformer Foam::inv(const transformer& tr)
{
if (tr.translates() && !tr.rotates())
if (tr.translates_ && !tr.rotates_)
{
return transformer(-tr.t());
}
else if (!tr.translates() && tr.rotates())
else if (!tr.translates_ && tr.rotates_)
{
return transformer(tr.R().T());
}
else if (tr.translates() && tr.rotates())
else if (tr.translates_ && tr.rotates_)
{
return transformer(tr.R().T() & (-tr.t()), tr.R().T());
}
@ -330,19 +282,19 @@ inline bool Foam::operator!=(const transformer& tr1, const transformer& tr2)
inline Foam::transformer Foam::operator+(const transformer& tr, const vector& t)
{
return transformer(tr.t() + t, true, tr.R(), tr.rotates());
return transformer(tr.t() + t, true, tr.R(), tr.rotates_);
}
inline Foam::transformer Foam::operator+(const vector& t, const transformer& tr)
{
return transformer(t + tr.t(), true, tr.R(), tr.rotates());
return transformer(t + tr.t(), true, tr.R(), tr.rotates_);
}
inline Foam::transformer Foam::operator-(const transformer& tr, const vector& t)
{
return transformer(tr.t() - t, true, tr.R(), tr.rotates());
return transformer(tr.t() - t, true, tr.R(), tr.rotates_);
}
@ -355,9 +307,9 @@ inline Foam::transformer Foam::operator&
return transformer
(
tr1.t() + tr2.t(),
tr1.translates() || tr2.translates(),
tr1.translates_ || tr2.translates_,
tr1.R() & tr2.R(),
tr1.rotates() || tr2.rotates()
tr1.rotates_ || tr2.rotates_
);
}

View File

@ -87,6 +87,19 @@ Foam::tmp<Foam::Field<Type>> Foam::transformer::transform
}
template<class Type, template<class> class Container>
void Foam::transformer::transformList(Container<Type>& l) const
{
if (rotates_)
{
forAllIter(typename Container<Type>, l, iter)
{
*iter = Foam::transform(R(), *iter);
}
}
}
template<class Type>
Type Foam::transformer::invTransform(const Type& x) const
{
@ -149,4 +162,17 @@ Foam::tmp<Foam::Field<Type>> Foam::transformer::invTransform
}
template<class Type, template<class> class Container>
void Foam::transformer::invTransformList(Container<Type>& l) const
{
if (rotates_)
{
forAllIter(typename Container<Type>, l, iter)
{
*iter = Foam::transform(R().T(), *iter);
}
}
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -183,21 +183,14 @@ void Foam::DSMCParcel<ParcelType>::hitWallPatch
}
template<class ParcelType>
void Foam::DSMCParcel<ParcelType>::transformProperties(const tensor& T)
{
ParcelType::transformProperties(T);
U_ = transform(T, U_);
}
template<class ParcelType>
void Foam::DSMCParcel<ParcelType>::transformProperties
(
const vector& separation
const transformer& transform
)
{
ParcelType::transformProperties(separation);
ParcelType::transformProperties(transform);
U_ = transform.transform(U_);
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -275,11 +275,7 @@ public:
//- Transform the physical properties of the particle
// according to the given transformation tensor
virtual void transformProperties(const tensor& T);
//- Transform the physical properties of the particle
// according to the given separation vector
virtual void transformProperties(const vector& separation);
virtual void transformProperties(const transformer&);
// I-O

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -1029,10 +1029,10 @@ void Foam::InteractionLists<ParticleType>::prepareWallDataToRefer()
// supported
referredWallData_[rWVI] = U.boundaryField()[patchi][patchFacei];
if (transform.rotates())
if (transform.transforms())
{
referredWallData_[rWVI] =
transform.R().T() & referredWallData_[rWVI];
transform.invTransform(referredWallData_[rWVI]);
}
}
}

View File

@ -1043,11 +1043,7 @@ Foam::vector Foam::particle::deviationFromMeshCentre() const
}
void Foam::particle::transformProperties(const tensor&)
{}
void Foam::particle::transformProperties(const vector&)
void Foam::particle::transformProperties(const transformer&)
{}
@ -1067,19 +1063,16 @@ void Foam::particle::correctAfterParallelTransfer
const coupledPolyPatch& ppp =
refCast<const coupledPolyPatch>(mesh_.boundaryMesh()[patchi]);
if (ppp.transform().rotates())
if (ppp.transform().transformsPosition())
{
transformProperties(ppp.transform().R());
}
else if (ppp.transform().translates())
{
transformProperties(-ppp.transform().t());
transformProperties(ppp.transform());
}
// Set the topology
celli_ = ppp.faceCells()[facei_];
facei_ += ppp.start();
tetFacei_ = facei_;
// Faces either side of a coupled patch are numbered in opposite directions
// as their normals both point away from their connected cells. The tet
// point therefore counts in the opposite direction from the base point.
@ -1113,10 +1106,9 @@ void Foam::particle::prepareForInteractionListReferral
coordinates_ = barycentric(1 - cmptSum(pos), pos.x(), pos.y(), pos.z());
// Transform the properties
transformProperties(- transform.t());
if (transform.rotates())
if (transform.transformsPosition())
{
transformProperties(transform.R().T());
transformProperties(inv(transform));
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -625,11 +625,7 @@ public:
//- Transform the physical properties of the particle
// according to the given transformation tensor
virtual void transformProperties(const tensor& T);
//- Transform the physical properties of the particle
// according to the given separation vector
virtual void transformProperties(const vector& separation);
virtual void transformProperties(const transformer&);
// Parallel transfer

View File

@ -256,7 +256,7 @@ template<class TrackCloudType>
void Foam::particle::hitSymmetryPatch(TrackCloudType&, trackingData&)
{
const vector nf = normal();
transformProperties(I - 2.0*nf*nf);
transformProperties(transformer(I - 2.0*nf*nf));
}
@ -270,6 +270,7 @@ void Foam::particle::hitCyclicPatch(TrackCloudType&, trackingData&)
// Set the topology
facei_ = tetFacei_ = cpp.transformGlobalFace(facei_);
celli_ = mesh_.faceOwner()[facei_];
// See note in correctAfterParallelTransfer for tetPti addressing ...
tetPti_ = mesh_.faces()[tetFacei_].size() - 1 - tetPti_;
@ -277,13 +278,9 @@ void Foam::particle::hitCyclicPatch(TrackCloudType&, trackingData&)
reflect();
// Transform the properties
if (receiveCpp.transform().rotates())
if (receiveCpp.transform().transformsPosition())
{
transformProperties(receiveCpp.transform().R());
}
else if (receiveCpp.transform().translates())
{
transformProperties(-receiveCpp.transform().t());
transformProperties(receiveCpp.transform());
}
}
@ -363,24 +360,17 @@ void Foam::particle::hitCyclicAMIPatch
receiveCpp.owner()
? receiveCpp.AMITransforms()[receiveAMIi]
: inv(cpp.AMITransforms()[receiveAMIi]);
if (AMITransform.rotates())
if (AMITransform.transformsPosition())
{
transformProperties(AMITransform.R());
displacementT = transform(AMITransform.R(), displacementT);
}
else if (AMITransform.t() != vector::zero)
{
transformProperties(AMITransform.t());
transformProperties(AMITransform);
displacementT = AMITransform.transform(displacementT);
}
if (receiveCpp.transform().rotates())
if (receiveCpp.transform().transformsPosition())
{
transformProperties(receiveCpp.transform().R());
displacementT = transform(receiveCpp.transform().R(), displacementT);
}
else if (receiveCpp.transform().translates())
{
transformProperties(-receiveCpp.transform().t());
transformProperties(receiveCpp.transform());
displacementT = receiveCpp.transform().transform(displacementT);
}
// If on a boundary and the displacement points into the receiving face

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -113,26 +113,16 @@ bool Foam::CollidingParcel<ParcelType>::move
}
template<class ParcelType>
void Foam::CollidingParcel<ParcelType>::transformProperties(const tensor& T)
{
ParcelType::transformProperties(T);
f_ = transform(T, f_);
angularMomentum_ = transform(T, angularMomentum_);
torque_ = transform(T, torque_);
}
template<class ParcelType>
void Foam::CollidingParcel<ParcelType>::transformProperties
(
const vector& separation
const transformer& transform
)
{
ParcelType::transformProperties(separation);
ParcelType::transformProperties(transform);
f_ = transform.transform(f_);
angularMomentum_ = transform.transform(angularMomentum_);
torque_ = transform.transform(torque_);
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -300,11 +300,7 @@ public:
//- Transform the physical properties of the particle
// according to the given transformation tensor
virtual void transformProperties(const tensor& T);
//- Transform the physical properties of the particle
// according to the given separation vector
virtual void transformProperties(const vector& separation);
virtual void transformProperties(const transformer&);
// I-O

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -425,22 +425,14 @@ void Foam::KinematicParcel<ParcelType>::hitWallPatch
}
template<class ParcelType>
void Foam::KinematicParcel<ParcelType>::transformProperties(const tensor& T)
{
ParcelType::transformProperties(T);
U_ = transform(T, U_);
}
template<class ParcelType>
void Foam::KinematicParcel<ParcelType>::transformProperties
(
const vector& separation
const transformer& transform
)
{
ParcelType::transformProperties(separation);
ParcelType::transformProperties(transform);
U_ = transform.transform(U_);
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -633,12 +633,8 @@ public:
void hitWallPatch(TrackCloudType& cloud, trackingData& td);
//- Transform the physical properties of the particle
// according to the given transformation tensor
virtual void transformProperties(const tensor& T);
//- Transform the physical properties of the particle
// according to the given separation vector
virtual void transformProperties(const vector& separation);
// according to the given transformation
virtual void transformProperties(const transformer&);
// I-O

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -186,38 +186,32 @@ bool Foam::molecule::move
}
void Foam::molecule::transformProperties(const tensor& T)
void Foam::molecule::transformProperties(const transformer& transform)
{
particle::transformProperties(T);
particle::transformProperties(transform);
Q_ = T & Q_;
Q_ = transform.R() & Q_;
v_ = transform(T, v_);
v_ = transform.transform(v_);
a_ = transform(T, a_);
a_ = transform.transform(a_);
pi_ = Q_.T() & transform(T, Q_ & pi_);
pi_ = Q_.T() & transform.transform(Q_ & pi_);
tau_ = Q_.T() & transform(T, Q_ & tau_);
tau_ = Q_.T() & transform.transform(Q_ & tau_);
rf_ = transform(T, rf_);
rf_ = transform.transform(rf_);
sitePositions_ = position() + (T & (sitePositions_ - position()));
transform.transformList(siteForces_);
siteForces_ = T & siteForces_;
}
vectorField sitePositions(sitePositions_ - position());
transform.transformPosition(sitePositions, sitePositions);
sitePositions_ = sitePositions + position();
void Foam::molecule::transformProperties(const vector& separation)
{
particle::transformProperties(separation);
if (special_ == SPECIAL_TETHERED)
if (transform.translates() && special_ == SPECIAL_TETHERED)
{
specialPosition_ += separation;
specialPosition_ += transform.t();
}
sitePositions_ = sitePositions_ + separation;
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -312,9 +312,7 @@ public:
bool move(moleculeCloud&, trackingData&, const scalar trackTime);
virtual void transformProperties(const tensor& T);
virtual void transformProperties(const vector& separation);
virtual void transformProperties(const transformer&);
void setSitePositions(const constantProperties& constProps);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -118,16 +118,10 @@ void Foam::solidParticle::hitWallPatch(solidParticleCloud& cloud, trackingData&)
}
void Foam::solidParticle::transformProperties(const tensor& T)
void Foam::solidParticle::transformProperties(const transformer& transform)
{
particle::transformProperties(T);
U_ = transform(T, U_);
}
void Foam::solidParticle::transformProperties(const vector& separation)
{
particle::transformProperties(separation);
particle::transformProperties(transform);
U_ = transform.transform(U_);
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -206,12 +206,8 @@ public:
void hitWallPatch(solidParticleCloud& cloud, trackingData& td);
//- Transform the physical properties of the particle
// according to the given transformation tensor
virtual void transformProperties(const tensor& T);
//- Transform the physical properties of the particle
// according to the given separation vector
virtual void transformProperties(const vector& separation);
// according to the given transformation
virtual void transformProperties(const transformer&);
// I-O

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -36,7 +36,6 @@ License
#include "polyTopoChange.H"
#include "mapDistributePolyMesh.H"
#include "Cloud.H"
//#include "globalIndex.H"
#include "OBJstream.H"
#include "cellSet.H"
#include "treeDataCell.H"

View File

@ -229,7 +229,18 @@ void Foam::cyclicAMIPolyPatch::calcTransforms
separation_ = Zero;
transform_ = transformer(revT.T());
if (mag(rotationCentre_) > small)
{
transform_ = transformer
(
(I - revT.T()) & rotationCentre_,
revT.T()
);
}
else
{
transform_ = transformer(revT.T());
}
break;
}
@ -291,7 +302,8 @@ void Foam::cyclicAMIPolyPatch::resetAMI() const
}
// Transform neighbour patch to local system
transformPosition(nbrPoints);
transform().transformPosition(nbrPoints, nbrPoints);
primitivePatch nbrPatch0
(
SubList<face>
@ -862,105 +874,6 @@ const Foam::scalarField& Foam::cyclicAMIPolyPatch::nbrWeightsSum() const
}
void Foam::cyclicAMIPolyPatch::transformPosition(pointField& l) const
{
if (transform().rotates())
{
if (transformType() == ROTATIONAL)
{
l = Foam::transform(transform().R(), l - rotationCentre_)
+ rotationCentre_;
}
else
{
l = Foam::transform(transform().R(), l);
}
}
else if (transform().translates())
{
// transformPosition gets called on the receiving side,
// separation gets calculated on the sending side so subtract
l -= transform().t();
}
}
void Foam::cyclicAMIPolyPatch::transformPosition
(
point& l,
const label facei
) const
{
if (transform().rotates())
{
if (transformType() == ROTATIONAL)
{
l = Foam::transform(transform().R(), l - rotationCentre_)
+ rotationCentre_;
}
else
{
l = Foam::transform(transform().R(), l);
}
}
else if (transform().translates())
{
l -= transform().t();
}
}
void Foam::cyclicAMIPolyPatch::transformDirection
(
vector& d,
const label facei
) const
{
if (transform().rotates())
{
d = Foam::transform(transform().R(), d);
}
}
void Foam::cyclicAMIPolyPatch::reverseTransformPosition
(
point& l,
const label facei
) const
{
if (transform().rotates())
{
if (transformType() == ROTATIONAL)
{
l = Foam::transform(transform().R().T(), l - rotationCentre_)
+ rotationCentre_;
}
else
{
l = Foam::transform(transform().R().T(), l);
}
}
else if (transform().translates())
{
l += transform().t();
}
}
void Foam::cyclicAMIPolyPatch::reverseTransformDirection
(
vector& d,
const label facei
) const
{
if (transform().rotates())
{
d = Foam::transform(transform().R().T(), d);
}
}
Foam::tmp<Foam::scalarField> Foam::cyclicAMIPolyPatch::interpolate
(
const scalarField& fld,
@ -1055,11 +968,8 @@ Foam::labelPair Foam::cyclicAMIPolyPatch::pointAMIAndFace
point& p
) const
{
point pt(p);
reverseTransformPosition(pt, facei);
vector nt(n);
reverseTransformDirection(nt, facei);
point pt(transform().invTransformPosition(p));
vector nt(transform().invTransform(n));
if (owner())
{

View File

@ -335,37 +335,6 @@ public:
//- Point on axis of rotation for rotational cyclic AMI
inline const point& rotationCentre() const;
//- Transform patch-based positions from nbr side to this side
virtual void transformPosition(pointField&) const;
//- Transform a patch-based position from nbr side to this side
virtual void transformPosition
(
point& l,
const label facei
) const;
//- Transform a patch-based direction from nbr side to this side
virtual void transformDirection
(
vector& d,
const label facei
) const;
//- Transform a patch-based position from this side to nbr side
virtual void reverseTransformPosition
(
point& l,
const label facei
) const;
//- Transform a patch-based direction from this side to nbr side
virtual void reverseTransformDirection
(
vector& d,
const label facei
) const;
// Interpolations