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 "timeActivatedFileUpdate.H"
27 #include "objectRegistry.H"
29 #include "dictionary.H"
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33 defineTypeNameAndDebug(Foam::timeActivatedFileUpdate, 0);
36 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
38 void Foam::timeActivatedFileUpdate::updateFile()
43 i < timeVsFile_.size()-1
44 && timeVsFile_[i+1].first() < obr_.time().value()
52 Info<< nl << type() << ": copying file" << nl << timeVsFile_[i].second()
53 << nl << "to:" << nl << fileToUpdate_ << nl << endl;
55 cp(timeVsFile_[i].second(), fileToUpdate_);
61 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
63 Foam::timeActivatedFileUpdate::timeActivatedFileUpdate
66 const objectRegistry& obr,
67 const dictionary& dict,
68 const bool loadFromFiles
74 fileToUpdate_(dict.lookup("fileToUpdate")),
82 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
84 Foam::timeActivatedFileUpdate::~timeActivatedFileUpdate()
88 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
90 void Foam::timeActivatedFileUpdate::read(const dictionary& dict)
94 dict.lookup("fileToUpdate") >> fileToUpdate_;
95 dict.lookup("timeVsFile") >> timeVsFile_;
98 fileToUpdate_.expand();
100 Info<< type() << ": time vs file list:" << nl;
101 forAll(timeVsFile_, i)
103 timeVsFile_[i].second() = timeVsFile_[i].second().expand();
104 if (!isFile(timeVsFile_[i].second()))
106 FatalErrorIn("timeActivatedFileUpdate::read(const dictionary&)")
107 << "File: " << timeVsFile_[i].second() << " not found"
108 << nl << exit(FatalError);
111 Info<< " " << timeVsFile_[i].first() << tab
112 << timeVsFile_[i].second() << endl;
121 void Foam::timeActivatedFileUpdate::execute()
130 void Foam::timeActivatedFileUpdate::end()
136 void Foam::timeActivatedFileUpdate::write()
142 // ************************************************************************* //