coordinateSystemNew.C
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include "coordinateSystem.H"
00028 #include "dictionary.H"
00029
00030
00031
00032 Foam::autoPtr<Foam::coordinateSystem> Foam::coordinateSystem::New
00033 (
00034 const word& name,
00035 const dictionary& dict
00036 )
00037 {
00038 if (debug)
00039 {
00040 Pout<< "coordinateSystem::New(const word&, const dictionary&) : "
00041 << "constructing coordinateSystem"
00042 << endl;
00043 }
00044
00045
00046 word coordType(typeName_());
00047 if
00048 (
00049 !dict.readIfPresent("type", coordType)
00050 || coordType == typeName_()
00051 || coordType == "cartesian"
00052 )
00053 {
00054 return autoPtr<coordinateSystem>(new coordinateSystem(name, dict));
00055 }
00056
00057 dictionaryConstructorTable::iterator cstrIter =
00058 dictionaryConstructorTablePtr_->find(coordType);
00059
00060 if (cstrIter == dictionaryConstructorTablePtr_->end())
00061 {
00062 FatalIOErrorIn
00063 (
00064 "coordinateSystem::New(const word&, const dictionary&)",
00065 dict
00066 ) << "Unknown coordinateSystem type " << coordType << nl << nl
00067 << "Valid coordinateSystem types are :" << nl
00068 << "[default: " << typeName_() << "]"
00069 << dictionaryConstructorTablePtr_->toc()
00070 << exit(FatalIOError);
00071 }
00072
00073 return autoPtr<coordinateSystem>(cstrIter()(name, dict));
00074 }
00075
00076
00077 Foam::autoPtr<Foam::coordinateSystem> Foam::coordinateSystem::New
00078 (
00079 const word& coordType,
00080 const word& name,
00081 const point& origin,
00082 const coordinateRotation& cr
00083 )
00084 {
00085 if (debug)
00086 {
00087 Pout<< "coordinateSystem::New(const word&, const word&, "
00088 << "const point&, const coordinateRotation&) : "
00089 "constructing coordinateSystem"
00090 << endl;
00091 }
00092
00093 origRotationConstructorTable::iterator cstrIter =
00094 origRotationConstructorTablePtr_->find(coordType);
00095
00096 if (cstrIter == origRotationConstructorTablePtr_->end())
00097 {
00098 FatalErrorIn
00099 (
00100 "coordinateSystem::New(const word&, const word&, "
00101 "const point&, const coordinateRotation&) : "
00102 "constructing coordinateSystem"
00103 ) << "Unknown coordinateSystem type " << coordType << nl << nl
00104 << "Valid coordinateSystem types are :" << nl
00105 << origRotationConstructorTablePtr_->toc()
00106 << exit(FatalError);
00107 }
00108
00109 return autoPtr<coordinateSystem>(cstrIter()(name, origin, cr));
00110 }
00111
00112
00113 Foam::autoPtr<Foam::coordinateSystem> Foam::coordinateSystem::New
00114 (
00115 Istream& is
00116 )
00117 {
00118 word name(is);
00119 dictionary dict(is);
00120
00121 return New(name, dict);
00122 }
00123
00124
Copyright © 2000-2009 OpenCFD Ltd