1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
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
13 the Free Software Foundation, either version 3 of the License, or
14 (at your 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, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "writeRegisteredObject.H"
27 #include "dictionary.H"
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32 defineTypeNameAndDebug(Foam::writeRegisteredObject, 0);
35 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
37 Foam::writeRegisteredObject::writeRegisteredObject
40 const objectRegistry& obr,
41 const dictionary& dict,
42 const bool loadFromFiles
53 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
55 Foam::writeRegisteredObject::~writeRegisteredObject()
59 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
61 void Foam::writeRegisteredObject::read(const dictionary& dict)
63 dict.lookup("objectNames") >> objectNames_;
67 void Foam::writeRegisteredObject::execute()
69 // Do nothing - only valid on write
73 void Foam::writeRegisteredObject::end()
75 // Do nothing - only valid on write
79 void Foam::writeRegisteredObject::write()
81 forAll(objectNames_, i)
83 if (obr_.foundObject<regIOobject>(objectNames_[i]))
86 const_cast<regIOobject&>
88 obr_.lookupObject<regIOobject>(objectNames_[i])
90 // Switch off automatic writing to prevent double write
91 obj.writeOpt() = IOobject::NO_WRITE;
98 "Foam::writeRegisteredObject::read(const dictionary&)"
99 ) << "Object " << objectNames_[i] << " not found in "
100 << "database. Available objects:" << nl << obr_.sortedToc()
108 // ************************************************************************* //