OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

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-2009 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 the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     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, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 \*---------------------------------------------------------------------------*/
00026 
00027 #include "coordinateSystems.H"
00028 #include "IOPtrList.H"
00029 #include "Time.H"
00030 
00031 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
00032 
00033 namespace Foam
00034 {
00035     defineTypeNameAndDebug(coordinateSystems, 0);
00036     defineTemplateTypeNameAndDebug(IOPtrList<coordinateSystem>, 0);
00037 }
00038 
00039 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00040 
00041 Foam::coordinateSystems::coordinateSystems(const IOobject& io)
00042 :
00043     IOPtrList<coordinateSystem>(io)
00044 {}
00045 
00046 
00047 Foam::coordinateSystems::coordinateSystems
00048 (
00049     const IOobject& io,
00050     const PtrList<coordinateSystem>& lst
00051 )
00052 :
00053     IOPtrList<coordinateSystem>(io, lst)
00054 {}
00055 
00056 
00057 Foam::coordinateSystems::coordinateSystems
00058 (
00059     const IOobject& io,
00060     const Xfer<PtrList<coordinateSystem> >& lst
00061 )
00062 :
00063     IOPtrList<coordinateSystem>(io, lst)
00064 {}
00065 
00066 
00067 // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
00068 
00069 // Read construct from registry, or return previously registered
00070 const Foam::coordinateSystems& Foam::coordinateSystems::New
00071 (
00072     const objectRegistry& obr
00073 )
00074 {
00075     if (obr.foundObject<coordinateSystems>(typeName))
00076     {
00077         return obr.lookupObject<coordinateSystems>(typeName);
00078     }
00079     else
00080     {
00081         return obr.store
00082         (
00083             new coordinateSystems
00084             (
00085                 IOobject
00086                 (
00087                     typeName,
00088                     "constant",
00089                     obr,
00090                     IOobject::READ_IF_PRESENT,
00091                     IOobject::NO_WRITE
00092                 )
00093             )
00094         );
00095     }
00096 }
00097 
00098 
00099 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
00100 
00101 Foam::label Foam::coordinateSystems::find(const word& keyword) const
00102 {
00103     forAll(*this, i)
00104     {
00105         if (keyword == operator[](i).name())
00106         {
00107             return i;
00108         }
00109     }
00110 
00111     return -1;
00112 }
00113 
00114 
00115 bool Foam::coordinateSystems::found(const word& keyword) const
00116 {
00117     return find(keyword) >= 0;
00118 }
00119 
00120 
00121 Foam::wordList Foam::coordinateSystems::toc() const
00122 {
00123     wordList keywords(size());
00124 
00125     forAll(*this, i)
00126     {
00127         keywords[i] = operator[](i).name();
00128     }
00129 
00130     return keywords;
00131 }
00132 
00133 
00134 bool Foam::coordinateSystems::writeData(Ostream& os, bool subDict) const
00135 {
00136     os << nl << size() << nl << token::BEGIN_LIST;
00137 
00138     forAll(*this, i)
00139     {
00140         os << nl;
00141         operator[](i).writeDict(os, subDict);
00142     }
00143 
00144     os << token::END_LIST << nl;
00145 
00146     return os.good();
00147 }
00148 
00149 
00150 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd