1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM 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 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "coordinateSystem.H"
28 #include "dictionary.H"
30 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
32 Foam::autoPtr<Foam::coordinateSystem> Foam::coordinateSystem::New
34 const word& coordType,
43 Pout<< "coordinateSystem::New(const word&, const word&, "
44 << "const vector&, const vector&, const vector&) : "
45 "constructing coordinateSystem"
49 origAxisDirConstructorTable::iterator cstrIter =
50 origAxisDirConstructorTablePtr_->find(coordType);
52 if (cstrIter == origAxisDirConstructorTablePtr_->end())
56 "coordinateSystem::New(const word&, const word&, "
57 "const vector&, const vector&, const vector&) : "
58 "constructing coordinateSystem"
59 ) << "Unknown coordinateSystem type " << coordType << nl << nl
60 << "Valid coordinateSystem types are :" << nl
61 << origAxisDirConstructorTablePtr_->toc()
65 return autoPtr<coordinateSystem>(cstrIter()(name, origin, axis, dir));
69 Foam::autoPtr<Foam::coordinateSystem> Foam::coordinateSystem::New
71 const word& coordType,
74 const coordinateRotation& cr
79 Pout<< "coordinateSystem::New(const word&, const word&, "
80 << "const vector&, const coordinateRotation&) : "
81 "constructing coordinateSystem"
85 origRotationConstructorTable::iterator cstrIter =
86 origRotationConstructorTablePtr_->find(coordType);
88 if (cstrIter == origRotationConstructorTablePtr_->end())
92 "coordinateSystem::New(const word&, const word&, "
93 "const vector&, const coordinateRotation&) : "
94 "constructing coordinateSystem"
95 ) << "Unknown coordinateSystem type " << coordType << nl << nl
96 << "Valid coordinateSystem types are :" << nl
97 << origRotationConstructorTablePtr_->toc()
101 return autoPtr<coordinateSystem>(cstrIter()(name, origin, cr));
105 Foam::autoPtr<Foam::coordinateSystem> Foam::coordinateSystem::New
108 const dictionary& dict
113 Pout<< "coordinateSystem::New(const word&, const dictionary&) : "
114 << "constructing coordinateSystem"
118 // default type is self
119 word coordType(typeName_());
120 if (dict.found("type"))
122 dict.lookup("type") >> coordType;
125 // can (must) construct base class directly
126 if (coordType == typeName_())
128 return autoPtr<coordinateSystem>(new coordinateSystem(name, dict));
131 dictionaryConstructorTable::iterator cstrIter =
132 dictionaryConstructorTablePtr_->find(coordType);
134 if (cstrIter == dictionaryConstructorTablePtr_->end())
138 "coordinateSystem::New(const word&, const dictionary&)",
140 ) << "Unknown coordinateSystem type " << coordType << nl << nl
141 << "Valid coordinateSystem types are :" << nl
142 << "[default: " << typeName_() << "]"
143 << dictionaryConstructorTablePtr_->toc()
144 << exit(FatalIOError);
147 return autoPtr<coordinateSystem>(cstrIter()(name, dict));
151 Foam::autoPtr<Foam::coordinateSystem> Foam::coordinateSystem::New
159 return New(name, dict);
162 // ************************************************************************* //