ENH: patchCloud: return pTraits<Type>::max for unfound points
[OpenFOAM-1.7.x.git] / applications / utilities / preProcessing / foamUpgradeFvSolution / foamUpgradeFvSolution.C
blobd2f274480181d9add729162bd25c5237596cdb69
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
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
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
19     for more details.
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 Application
25     foamUpgradeFvSolution
27 Description
28     Simple tool to upgrade the syntax of system/fvSolution::solvers
30 Usage
32     - foamUpgradeFvSolution [OPTION]
34     @param -test \n
35     Suppress writing the updated fvSolution file
37 \*---------------------------------------------------------------------------*/
39 #include "argList.H"
40 #include "Time.H"
41 #include "IOdictionary.H"
42 #include "solution.H"
44 using namespace Foam;
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 // Main program:
49 int main(int argc, char *argv[])
51     argList::noParallel();
52     argList::validOptions.insert("test", "");
54 #   include "setRootCase.H"
55 #   include "createTime.H"
57     IOdictionary solutionDict
58     (
59         IOobject
60         (
61             "fvSolution",
62             runTime.system(),
63             runTime,
64             IOobject::MUST_READ,
65             IOobject::NO_WRITE,
66             false
67         )
68     );
70     label nChanged = 0;
71     entry* e = solutionDict.lookupEntryPtr("solvers", false, false);
72     if (e && e->isDict())
73     {
74         nChanged = solution::upgradeSolverDict(e->dict(), true);
75     }
77     Info<< nChanged << " solver settings changed" << nl << endl;
78     if (nChanged)
79     {
80         if (args.optionFound("test"))
81         {
82             Info<< "-test option: no changes made" << nl << endl;
83         }
84         else
85         {
86             mv
87             (
88                 solutionDict.objectPath(),
89                 solutionDict.objectPath() + ".old"
90             );
92             solutionDict.writeObject
93             (
94                 IOstream::ASCII,
95                 IOstream::currentVersion,
96                 IOstream::UNCOMPRESSED
97             );
99             Info<< "Backup to    " << (solutionDict.objectPath() + ".old") << nl
100                 << "Write  to    " << solutionDict.objectPath() << nl << endl;
101         }
102     }
104     return 0;
108 // ************************************************************************* //