FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

coordinateSystems.C

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software: you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
00023 
00024 \*---------------------------------------------------------------------------*/
00025 
00026 #include "coordinateSystems.H"
00027 #include <OpenFOAM/IOPtrList.H>
00028 #include <OpenFOAM/Time.H>
00029 
00030 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
00031 
00032 namespace Foam
00033 {
00034     defineTypeNameAndDebug(coordinateSystems, 0);
00035     defineTemplateTypeNameAndDebug(IOPtrList<coordinateSystem>, 0);
00036 }
00037 
00038 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00039 
00040 Foam::coordinateSystems::coordinateSystems(const IOobject& io)
00041 :
00042     IOPtrList<coordinateSystem>(io)
00043 {}
00044 
00045 
00046 Foam::coordinateSystems::coordinateSystems
00047 (
00048     const IOobject& io,
00049     const PtrList<coordinateSystem>& lst
00050 )
00051 :
00052     IOPtrList<coordinateSystem>(io, lst)
00053 {}
00054 
00055 
00056 Foam::coordinateSystems::coordinateSystems
00057 (
00058     const IOobject& io,
00059     const Xfer<PtrList<coordinateSystem> >& lst
00060 )
00061 :
00062     IOPtrList<coordinateSystem>(io, lst)
00063 {}
00064 
00065 
00066 // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
00067 
00068 // Read construct from registry, or return previously registered
00069 const Foam::coordinateSystems& Foam::coordinateSystems::New
00070 (
00071     const objectRegistry& obr
00072 )
00073 {
00074     if (obr.foundObject<coordinateSystems>(typeName))
00075     {
00076         return obr.lookupObject<coordinateSystems>(typeName);
00077     }
00078     else
00079     {
00080         return obr.store
00081         (
00082             new coordinateSystems
00083             (
00084                 IOobject
00085                 (
00086                     typeName,
00087                     "constant",
00088                     obr,
00089                     IOobject::READ_IF_PRESENT,
00090                     IOobject::NO_WRITE
00091                 )
00092             )
00093         );
00094     }
00095 }
00096 
00097 
00098 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00099 
00100 Foam::label Foam::coordinateSystems::find(const word& keyword) const
00101 {
00102     forAll(*this, i)
00103     {
00104         if (keyword == operator[](i).name())
00105         {
00106             return i;
00107         }
00108     }
00109 
00110     return -1;
00111 }
00112 
00113 
00114 bool Foam::coordinateSystems::found(const word& keyword) const
00115 {
00116     return find(keyword) >= 0;
00117 }
00118 
00119 
00120 Foam::wordList Foam::coordinateSystems::toc() const
00121 {
00122     wordList keywords(size());
00123 
00124     forAll(*this, i)
00125     {
00126         keywords[i] = operator[](i).name();
00127     }
00128 
00129     return keywords;
00130 }
00131 
00132 
00133 bool Foam::coordinateSystems::writeData(Ostream& os, bool subDict) const
00134 {
00135     os << nl << size() << nl << token::BEGIN_LIST;
00136 
00137     forAll(*this, i)
00138     {
00139         os << nl;
00140         operator[](i).writeDict(os, subDict);
00141     }
00142 
00143     os << token::END_LIST << nl;
00144 
00145     return os.good();
00146 }
00147 
00148 
00149 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines