coupledPolyPatch:transform() -> transformType()

to facilitate the change to using the transformer class.
This commit is contained in:
Henry Weller
2020-01-01 16:01:19 +00:00
parent 02fc637645
commit 745c95849e
11 changed files with 61 additions and 57 deletions

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -776,7 +776,11 @@ int main(int argc, char *argv[])
const cyclicPolyPatch& cycpp = const cyclicPolyPatch& cycpp =
refCast<const cyclicPolyPatch>(pp); refCast<const cyclicPolyPatch>(pp);
if (cycpp.transform() != cyclicPolyPatch::TRANSLATIONAL) if
(
cycpp.transformType()
!= cyclicPolyPatch::TRANSLATIONAL
)
{ {
const cyclicPolyPatch& nbr = cycpp.neighbPatch(); const cyclicPolyPatch& nbr = cycpp.neighbPatch();

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -48,7 +48,7 @@ namespace Foam
coupledPolyPatch::orderingTypeNames; coupledPolyPatch::orderingTypeNames;
template<> template<>
const char* NamedEnum<coupledPolyPatch::transformType, 4>::names[] = const char* NamedEnum<coupledPolyPatch::transformTypes, 4>::names[] =
{ {
"unspecified", "unspecified",
"none", "none",
@ -56,7 +56,7 @@ namespace Foam
"translational" "translational"
}; };
const NamedEnum<coupledPolyPatch::transformType, 4> const NamedEnum<coupledPolyPatch::transformTypes, 4>
coupledPolyPatch::transformTypeNames; coupledPolyPatch::transformTypeNames;
} }
@ -315,7 +315,7 @@ Foam::coupledPolyPatch::coupledPolyPatch
polyPatch(name, size, start, index, bm, patchType), polyPatch(name, size, start, index, bm, patchType),
matchTolerance_(defaultMatchTol_), matchTolerance_(defaultMatchTol_),
ordering_(ordering), ordering_(ordering),
transform_(UNSPECIFIED), transformType_(UNSPECIFIED),
parallel_(true), parallel_(true),
separated_(false) separated_(false)
{} {}
@ -339,10 +339,10 @@ Foam::coupledPolyPatch::coupledPolyPatch
? orderingTypeNames.read(dict.lookup("ordering")) ? orderingTypeNames.read(dict.lookup("ordering"))
: ordering : ordering
), ),
transform_ transformType_
( (
dict.found("transform") dict.found("transformType")
? transformTypeNames.read(dict.lookup("transform")) ? transformTypeNames.read(dict.lookup("transformType"))
: UNSPECIFIED : UNSPECIFIED
), ),
parallel_(true), parallel_(true),
@ -358,7 +358,7 @@ Foam::coupledPolyPatch::coupledPolyPatch
: :
polyPatch(pp, bm), polyPatch(pp, bm),
matchTolerance_(pp.matchTolerance_), matchTolerance_(pp.matchTolerance_),
transform_(pp.transform_), transformType_(pp.transformType_),
parallel_(true), parallel_(true),
separated_(false) separated_(false)
{} {}
@ -375,7 +375,7 @@ Foam::coupledPolyPatch::coupledPolyPatch
: :
polyPatch(pp, bm, index, newSize, newStart), polyPatch(pp, bm, index, newSize, newStart),
matchTolerance_(pp.matchTolerance_), matchTolerance_(pp.matchTolerance_),
transform_(pp.transform_), transformType_(pp.transformType_),
parallel_(true), parallel_(true),
separated_(false) separated_(false)
{} {}
@ -392,7 +392,7 @@ Foam::coupledPolyPatch::coupledPolyPatch
: :
polyPatch(pp, bm, index, mapAddressing, newStart), polyPatch(pp, bm, index, mapAddressing, newStart),
matchTolerance_(pp.matchTolerance_), matchTolerance_(pp.matchTolerance_),
transform_(pp.transform_), transformType_(pp.transformType_),
parallel_(true), parallel_(true),
separated_(false) separated_(false)
{} {}
@ -411,7 +411,7 @@ void Foam::coupledPolyPatch::write(Ostream& os) const
polyPatch::write(os); polyPatch::write(os);
writeEntry(os, "matchTolerance", matchTolerance_); writeEntry(os, "matchTolerance", matchTolerance_);
writeEntry(os, "ordering", orderingTypeNames[ordering_]); writeEntry(os, "ordering", orderingTypeNames[ordering_]);
writeEntry(os, "transform", transformTypeNames[transform_]); writeEntry(os, "transformType", transformTypeNames[transformType_]);
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -65,7 +65,7 @@ public:
static const NamedEnum<orderingType, 3> orderingTypeNames; static const NamedEnum<orderingType, 3> orderingTypeNames;
enum transformType enum transformTypes
{ {
UNSPECIFIED, // Unspecified -> automatic transformation UNSPECIFIED, // Unspecified -> automatic transformation
NONE, // No tranformation NONE, // No tranformation
@ -73,7 +73,7 @@ public:
TRANSLATIONAL // Translation TRANSLATIONAL // Translation
}; };
static const NamedEnum<transformType, 4> transformTypeNames; static const NamedEnum<transformTypes, 4> transformTypeNames;
protected: protected:
@ -90,7 +90,7 @@ protected:
orderingType ordering_; orderingType ordering_;
//- Type of transformation //- Type of transformation
transformType transform_; transformTypes transformType_;
//- Are coupled patches parallel //- Are coupled patches parallel
mutable bool parallel_; mutable bool parallel_;
@ -259,9 +259,9 @@ public:
} }
//- Type of transform //- Type of transform
virtual transformType transform() const virtual transformTypes transformType() const
{ {
return transform_; return transformType_;
} }
//- Transform a patch-based position from other side to this side //- Transform a patch-based position from other side to this side

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -58,7 +58,7 @@ void Foam::cyclicPolyPatch::calcTransformTensors
const scalarField& smallDist, const scalarField& smallDist,
const scalar absTol, const scalar absTol,
const orderingType ordering, const orderingType ordering,
const transformType transform const transformTypes transform
) const ) const
{ {
if (debug) if (debug)
@ -328,14 +328,14 @@ void Foam::cyclicPolyPatch::calcTransforms
<< exit(FatalError); << exit(FatalError);
} }
if (transform() != neighbPatch().transform()) if (transformType() != neighbPatch().transformType())
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Patch " << name() << "Patch " << name()
<< " has transform type " << transformTypeNames[transform()] << " has transform type " << transformTypeNames[transformType()]
<< ", neighbour patch " << neighbPatchName() << ", neighbour patch " << neighbPatchName()
<< " has transform type " << " has transform type "
<< neighbPatch().transformTypeNames[neighbPatch().transform()] << neighbPatch().transformTypeNames[neighbPatch().transformType()]
<< exit(FatalError); << exit(FatalError);
} }
@ -421,7 +421,7 @@ void Foam::cyclicPolyPatch::calcTransforms
// Calculate transformation // Calculate transformation
if (transform() == ROTATIONAL) if (transformType() == ROTATIONAL)
{ {
// Calculate using the given rotation axis and centre. Do not // Calculate using the given rotation axis and centre. Do not
// use calculated normals. // use calculated normals.
@ -464,7 +464,7 @@ void Foam::cyclicPolyPatch::calcTransforms
forwardT_ = revT.T(); forwardT_ = revT.T();
reverseT_ = revT; reverseT_ = revT;
} }
else if (transform() == TRANSLATIONAL) else if (transformType() == TRANSLATIONAL)
{ {
if (debug) if (debug)
{ {
@ -530,7 +530,7 @@ void Foam::cyclicPolyPatch::calcTransforms
half0Tols, half0Tols,
matchTolerance(), matchTolerance(),
ordering(), ordering(),
transform() transformType()
); );
} }
} }
@ -565,7 +565,7 @@ void Foam::cyclicPolyPatch::getCentresAndAnchors
if (half0Ctrs.size()) if (half0Ctrs.size())
{ {
switch (transform()) switch (transformType())
{ {
case ROTATIONAL: case ROTATIONAL:
{ {
@ -827,7 +827,7 @@ Foam::cyclicPolyPatch::cyclicPolyPatch
<< exit(FatalIOError); << exit(FatalIOError);
} }
switch (transform()) switch (transformType())
{ {
case ROTATIONAL: case ROTATIONAL:
{ {
@ -997,7 +997,7 @@ void Foam::cyclicPolyPatch::transformPosition(pointField& l) const
{ {
if (!parallel()) if (!parallel())
{ {
if (transform() == ROTATIONAL) if (transformType() == ROTATIONAL)
{ {
l = l =
Foam::transform(forwardT(), l-rotationCentre_) Foam::transform(forwardT(), l-rotationCentre_)
@ -1021,7 +1021,7 @@ void Foam::cyclicPolyPatch::transformPosition(point& l, const label facei) const
{ {
if (!parallel()) if (!parallel())
{ {
if (transform() == ROTATIONAL) if (transformType() == ROTATIONAL)
{ {
l = Foam::transform(forwardT(), l - rotationCentre_) l = Foam::transform(forwardT(), l - rotationCentre_)
+ rotationCentre_; + rotationCentre_;
@ -1567,7 +1567,7 @@ void Foam::cyclicPolyPatch::write(Ostream& os) const
writeEntry(os, "neighbourPatch", neighbPatchName_); writeEntry(os, "neighbourPatch", neighbPatchName_);
} }
coupleGroup_.write(os); coupleGroup_.write(os);
switch (transform()) switch (transformType())
{ {
case ROTATIONAL: case ROTATIONAL:
{ {

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -114,7 +114,7 @@ class cyclicPolyPatch
const scalarField& smallDist, const scalarField& smallDist,
const scalar absTol, const scalar absTol,
const orderingType = UNKNOWN, const orderingType = UNKNOWN,
const transformType = UNSPECIFIED const transformTypes = UNSPECIFIED
) const; ) const;
//- Find amongst selected faces the one with the largest area //- Find amongst selected faces the one with the largest area

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -301,7 +301,7 @@ void Foam::oldCyclicPolyPatch::getCentresAndAnchors
anchors0 = getAnchorPoints(half0Faces, pp.points()); anchors0 = getAnchorPoints(half0Faces, pp.points());
half1Ctrs = calcFaceCentres(half1Faces, pp.points()); half1Ctrs = calcFaceCentres(half1Faces, pp.points());
switch (transform()) switch (transformType())
{ {
case ROTATIONAL: case ROTATIONAL:
{ {
@ -586,7 +586,7 @@ Foam::oldCyclicPolyPatch::oldCyclicPolyPatch
dict.readIfPresent("featureCos", featureCos_); dict.readIfPresent("featureCos", featureCos_);
switch (transform()) switch (transformType())
{ {
case ROTATIONAL: case ROTATIONAL:
{ {
@ -1205,7 +1205,7 @@ void Foam::oldCyclicPolyPatch::write(Ostream& os) const
writeEntry(os, "featureCos", featureCos_); writeEntry(os, "featureCos", featureCos_);
switch (transform()) switch (transformType())
{ {
case ROTATIONAL: case ROTATIONAL:
{ {

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -248,7 +248,7 @@ void Foam::processorCyclicPolyPatch::calcGeometry(PstreamBuffers& pBufs)
matchTolerance()*calcFaceTol(*this, points(), faceCentres()), matchTolerance()*calcFaceTol(*this, points(), faceCentres()),
matchTolerance(), matchTolerance(),
ordering(), ordering(),
transform() transformType()
); );
// Where do we store the calculated transformation? // Where do we store the calculated transformation?

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -321,9 +321,9 @@ public:
} }
//- Type of transform //- Type of transform
virtual transformType transform() const virtual transformTypes transformType() const
{ {
return referPatch().transform(); return referPatch().transformType();
} }
//- Transform a patch-based position from other side to this side //- Transform a patch-based position from other side to this side

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -77,21 +77,21 @@ void Foam::cyclicAMIPolyPatch::calcTransforms
const vectorField& half1Areas const vectorField& half1Areas
) )
{ {
if (transform() != neighbPatch().transform()) if (transformType() != neighbPatch().transformType())
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Patch " << name() << "Patch " << name()
<< " has transform type " << transformTypeNames[transform()] << " has transform type " << transformTypeNames[transformType()]
<< ", neighbour patch " << neighbPatchName() << ", neighbour patch " << neighbPatchName()
<< " has transform type " << " has transform type "
<< neighbPatch().transformTypeNames[neighbPatch().transform()] << neighbPatch().transformTypeNames[neighbPatch().transformType()]
<< exit(FatalError); << exit(FatalError);
} }
// Calculate transformation tensors // Calculate transformation tensors
switch (transform()) switch (transformType())
{ {
case ROTATIONAL: case ROTATIONAL:
{ {
@ -560,7 +560,7 @@ Foam::cyclicAMIPolyPatch::cyclicAMIPolyPatch
<< exit(FatalIOError); << exit(FatalIOError);
} }
switch (transform()) switch (transformType())
{ {
case ROTATIONAL: case ROTATIONAL:
{ {
@ -874,7 +874,7 @@ void Foam::cyclicAMIPolyPatch::transformPosition(pointField& l) const
{ {
if (!parallel()) if (!parallel())
{ {
if (transform() == ROTATIONAL) if (transformType() == ROTATIONAL)
{ {
l = Foam::transform(forwardT(), l - rotationCentre_) l = Foam::transform(forwardT(), l - rotationCentre_)
+ rotationCentre_; + rotationCentre_;
@ -901,7 +901,7 @@ void Foam::cyclicAMIPolyPatch::transformPosition
{ {
if (!parallel()) if (!parallel())
{ {
if (transform() == ROTATIONAL) if (transformType() == ROTATIONAL)
{ {
l = Foam::transform(forwardT(), l - rotationCentre_) l = Foam::transform(forwardT(), l - rotationCentre_)
+ rotationCentre_; + rotationCentre_;
@ -939,7 +939,7 @@ void Foam::cyclicAMIPolyPatch::reverseTransformPosition
{ {
if (!parallel()) if (!parallel())
{ {
if (transform() == ROTATIONAL) if (transformType() == ROTATIONAL)
{ {
l = Foam::transform(reverseT(), l - rotationCentre_) l = Foam::transform(reverseT(), l - rotationCentre_)
+ rotationCentre_; + rotationCentre_;
@ -1144,7 +1144,7 @@ void Foam::cyclicAMIPolyPatch::write(Ostream& os) const
} }
coupleGroup_.write(os); coupleGroup_.write(os);
switch (transform()) switch (transformType())
{ {
case ROTATIONAL: case ROTATIONAL:
{ {

View File

@ -122,7 +122,7 @@ boundary
{ {
type cyclic; type cyclic;
neighbourPatch cyclic_half1; neighbourPatch cyclic_half1;
transform rotational; transformType rotational;
rotationAxis (0 0 1); rotationAxis (0 0 1);
rotationCentre (0 0 0); rotationCentre (0 0 0);
faces faces
@ -135,7 +135,7 @@ boundary
{ {
type cyclic; type cyclic;
neighbourPatch cyclic_half0; neighbourPatch cyclic_half0;
transform rotational; transformType rotational;
rotationAxis (0 0 1); rotationAxis (0 0 1);
rotationCentre (0 0 0); rotationCentre (0 0 0);
faces faces

View File

@ -84,7 +84,7 @@ boundary
(0 1 5 4) (0 1 5 4)
); );
transform rotational; transformType rotational;
rotationAxis (1 0 0); rotationAxis (1 0 0);
rotationCentre (0 0 0); rotationCentre (0 0 0);
} }
@ -98,7 +98,7 @@ boundary
(7 6 2 3) (7 6 2 3)
); );
transform rotational; transformType rotational;
rotationAxis (1 0 0); rotationAxis (1 0 0);
rotationCentre (0 0 0); rotationCentre (0 0 0);
} }