BUGFIX: Illegal use of uninitialised value (backport)
[foam-extend-3.2.git] / src / multiSolver / dummyControlDict / dummyControlDict.C
blob3a47418805a68b49437b1444c52f0b8b725693e4
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright held by original author
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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 the
13     Free Software Foundation; either version 2 of the License, or (at your
14     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
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "dummyControlDict.H"
28 #include "IFstream.H"
30 // * * * * * * * * * * * * * Static Member Data  * * * * * * * * * * * * * * //
32 namespace Foam
34     defineTypeNameAndDebug(dummyControlDict, 0);
38 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
40 Foam::dummyControlDict::dummyControlDict()
42     this->set("deltaT", 1);
43     this->set("writeFrequency", 1);
47 Foam::dummyControlDict::dummyControlDict(const fileName& mcdFile)
49     this->set("deltaT", 1);
50     this->set("writeFrequency", 1);
52     IFstream mcdStream(mcdFile);
53     if (!mcdStream.good())
54     {
55         FatalErrorIn("dummyControlDict::dummyControlDict")
56             << "Cannot find the multiControlDict file " << mcdFile << "."
57             << abort(FatalError);
58     }
59     dictionary mcdDict(mcdStream);
60     if (mcdDict.subDict("multiSolverControl").found("timeFormat"))
61     {
62         word tf(mcdDict.subDict("multiSolverControl").lookup("timeFormat"));
63         this->set("timeFormat", tf);
64     }
65     if (mcdDict.subDict("multiSolverControl").found("timePrecision"))
66     {
67         label tp
68         (
69             readLabel
70             (
71                 mcdDict.subDict("multiSolverControl").lookup("timePrecision")
72             )
73         );
74         this->set("timePrecision", tp);
75     }
79 Foam::dummyControlDict::dummyControlDict(const dictionary& mcdDict)
81     this->set("deltaT", 1);
82     this->set("writeFrequency", 1);
84     if (mcdDict.subDict("multiSolverControl").found("timeFormat"))
85     {
86         word tf(mcdDict.subDict("multiSolverControl").lookup("timeFormat"));
87         this->set("timeFormat", tf);
88     }
89     if (mcdDict.subDict("multiSolverControl").found("timePrecision"))
90     {
91         label tp
92         (
93             readLabel
94             (
95                 mcdDict.subDict("multiSolverControl").lookup("timePrecision")
96             )
97         );
98         this->set("timePrecision", tp);
99     }
104 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
106 Foam::dummyControlDict::~dummyControlDict()
110 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //