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 #include "coordinateSystem.H"
00027 #include <OpenFOAM/dictionary.H>
00028 
00029 
00030 
00031 Foam::autoPtr<Foam::coordinateSystem> Foam::coordinateSystem::New
00032 (
00033     const word& name,
00034     const dictionary& dict
00035 )
00036 {
00037     if (debug)
00038     {
00039         Pout<< "coordinateSystem::New(const word&, const dictionary&) : "
00040             << "constructing coordinateSystem"
00041             << endl;
00042     }
00043 
00044     
00045     word coordType(typeName_());
00046     if
00047     (
00048         !dict.readIfPresent("type", coordType)
00049      || coordType == typeName_()
00050      || coordType == "cartesian"
00051     )
00052     {
00053         return autoPtr<coordinateSystem>(new coordinateSystem(name, dict));
00054     }
00055 
00056     dictionaryConstructorTable::iterator cstrIter =
00057         dictionaryConstructorTablePtr_->find(coordType);
00058 
00059     if (cstrIter == dictionaryConstructorTablePtr_->end())
00060     {
00061         FatalIOErrorIn
00062         (
00063             "coordinateSystem::New(const word&, const dictionary&)",
00064             dict
00065         )   << "Unknown coordinateSystem type " << coordType << nl << nl
00066             << "Valid coordinateSystem types are :" << nl
00067             << "[default: " << typeName_() << "]"
00068             << dictionaryConstructorTablePtr_->sortedToc()
00069             << exit(FatalIOError);
00070     }
00071 
00072     return autoPtr<coordinateSystem>(cstrIter()(name, dict));
00073 }
00074 
00075 
00076 Foam::autoPtr<Foam::coordinateSystem> Foam::coordinateSystem::New
00077 (
00078     const word& coordType,
00079     const word& name,
00080     const point& origin,
00081     const coordinateRotation& cr
00082 )
00083 {
00084     if (debug)
00085     {
00086         Pout<< "coordinateSystem::New(const word&, const word&, "
00087             << "const point&, const coordinateRotation&) : "
00088                "constructing coordinateSystem"
00089             << endl;
00090     }
00091 
00092     origRotationConstructorTable::iterator cstrIter =
00093         origRotationConstructorTablePtr_->find(coordType);
00094 
00095     if (cstrIter == origRotationConstructorTablePtr_->end())
00096     {
00097         FatalErrorIn
00098         (
00099             "coordinateSystem::New(const word&, const word&, "
00100             "const point&, const coordinateRotation&) : "
00101             "constructing coordinateSystem"
00102         )   << "Unknown coordinateSystem type " << coordType << nl << nl
00103             << "Valid coordinateSystem types are :" << nl
00104             << origRotationConstructorTablePtr_->sortedToc()
00105             << exit(FatalError);
00106     }
00107 
00108     return autoPtr<coordinateSystem>(cstrIter()(name, origin, cr));
00109 }
00110 
00111 
00112 Foam::autoPtr<Foam::coordinateSystem> Foam::coordinateSystem::New
00113 (
00114     Istream& is
00115 )
00116 {
00117     word name(is);
00118     dictionary dict(is);
00119 
00120     return New(name, dict);
00121 }
00122 
00123