1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "ellipticCylindricalCS.H"
29 #include "mathematicalConstants.H"
31 #include "addToRunTimeSelectionTable.H"
33 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
37 defineTypeNameAndDebug(ellipticCylindricalCS, 0);
38 addToRunTimeSelectionTable
41 ellipticCylindricalCS,
47 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
49 Foam::ellipticCylindricalCS::ellipticCylindricalCS(const bool inDegrees)
57 Foam::ellipticCylindricalCS::ellipticCylindricalCS
59 const coordinateSystem& cs,
69 Foam::ellipticCylindricalCS::ellipticCylindricalCS
72 const coordinateSystem& cs,
76 coordinateSystem(name, cs),
82 Foam::ellipticCylindricalCS::ellipticCylindricalCS
86 const coordinateRotation& cr,
91 coordinateSystem(name, origin, cr),
97 Foam::ellipticCylindricalCS::ellipticCylindricalCS
102 const vector& direction,
107 coordinateSystem(name, origin, axis, direction),
109 inDegrees_(inDegrees)
113 Foam::ellipticCylindricalCS::ellipticCylindricalCS
116 const dictionary& dict
119 coordinateSystem(name, dict),
120 a_(readScalar(dict.lookup("a"))),
121 inDegrees_(dict.lookupOrDefault<Switch>("degrees", true))
125 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
127 Foam::coordinateSystem::spanInfo
128 Foam::ellipticCylindricalCS::spanLimited() const
130 spanInfo b(Pair<bool>(true, true));
132 // Upper bound or r is unlimited
133 b[0] = Pair<bool>(true, false);
136 b[2] = Pair<bool>(false, false);
142 Foam::boundBox Foam::ellipticCylindricalCS::spanBounds() const
149 ( inDegrees_ ? -180.0 : -mathematicalConstant::pi ),
155 ( inDegrees_ ? 180.0 : mathematicalConstant::pi ),
162 bool Foam::ellipticCylindricalCS::inDegrees() const
168 Foam::Switch& Foam::ellipticCylindricalCS::inDegrees()
174 Foam::vector Foam::ellipticCylindricalCS::localToGlobal
180 // Notation: u = local.x() v = local.y() z = local.z();
182 local.y()*( inDegrees_ ? mathematicalConstant::pi/180.0 : 1.0 );
184 return coordinateSystem::localToGlobal
188 a_*cosh(local.x())*cos(theta),
189 a_*sinh(local.x())*sin(theta),
196 Foam::tmp<Foam::vectorField> Foam::ellipticCylindricalCS::localToGlobal
198 const vectorField& local,
203 local.component(vector::Y)*
204 ( inDegrees_ ? mathematicalConstant::pi/180.0 : 1.0 );
206 vectorField lc(local.size());
210 a_*cosh(local.component(vector::X))*cos(theta)
216 a_*sinh(local.component(vector::X))*sin(theta)
222 local.component(vector::Z)
225 return coordinateSystem::localToGlobal(lc, translate);
229 Foam::vector Foam::ellipticCylindricalCS::globalToLocal
231 const vector& global,
237 "ellipticCylindricalCS::globalToLocal(const vector&, bool) const"
243 Foam::tmp<Foam::vectorField> Foam::ellipticCylindricalCS::globalToLocal
245 const vectorField& global,
251 "ellipticCylindricalCS::globalToLocal(const vectorField&, bool) const"
254 return tmp<vectorField>(vectorField::null());
258 void Foam::ellipticCylindricalCS::write(Ostream& os) const
260 coordinateSystem::write(os);
261 os << "inDegrees: " << inDegrees() << endl;
265 void Foam::ellipticCylindricalCS::writeDict(Ostream& os, bool subDict) const
270 << indent << token::BEGIN_BLOCK << incrIndent << nl;
273 coordinateSystem::writeDict(os, false);
274 os.writeKeyword("inDegrees") << inDegrees_ << token::END_STATEMENT << nl;
278 os << decrIndent << indent << token::END_BLOCK << endl;
283 // ************************************************************************* //