00001 /*---------------------------------------------------------------------------*\ 00002 ========= | 00003 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 00004 \\ / O peration | 00005 \\ / A nd | Copyright (C) 1991-2010 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 00013 the Free Software Foundation, either version 3 of the License, or 00014 (at your 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, see <http://www.gnu.org/licenses/>. 00023 00024 Class 00025 Foam::solution 00026 00027 Description 00028 Selector class for relaxation factors, solver type and solution. 00029 00030 SourceFiles 00031 solution.C 00032 00033 \*---------------------------------------------------------------------------*/ 00034 00035 #ifndef solution_H 00036 #define solution_H 00037 00038 #include <OpenFOAM/IOdictionary.H> 00039 00040 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00041 00042 namespace Foam 00043 { 00044 00045 /*---------------------------------------------------------------------------*\ 00046 Class solution Declaration 00047 \*---------------------------------------------------------------------------*/ 00048 00049 class solution 00050 : 00051 public IOdictionary 00052 { 00053 // Private data 00054 00055 //- Dictionary of relaxation factors for all the fields 00056 dictionary relaxationFactors_; 00057 00058 //- Optional default relaxation factor for all the fields 00059 scalar defaultRelaxationFactor_; 00060 00061 //- Dictionary of solver parameters for all the fields 00062 dictionary solvers_; 00063 00064 // Private Member Functions 00065 00066 //- Disallow default bitwise copy construct and assignment 00067 solution(const solution&); 00068 void operator=(const solution&); 00069 00070 00071 public: 00072 00073 //- Update from older solver controls syntax 00074 // Usually verbose, since we want to know about the changes 00075 // Returns the number of settings changed 00076 static label upgradeSolverDict(dictionary& dict, const bool verbose=true); 00077 00078 //- Debug switch 00079 static int debug; 00080 00081 00082 // Constructors 00083 00084 //- Construct for given objectRegistry and dictionary 00085 solution(const objectRegistry& obr, const fileName& dictName); 00086 00087 00088 // Member Functions 00089 00090 // Access 00091 00092 //- Return the selected sub-dictionary of solvers if the "select" 00093 // keyword is given, otherwise return the complete dictionary 00094 const dictionary& solutionDict() const; 00095 00096 //- Return true if the relaxation factor is given for the field 00097 bool relax(const word& name) const; 00098 00099 //- Return the relaxation factor for the given field 00100 scalar relaxationFactor(const word& name) const; 00101 00102 //- Return the solver controls dictionary for the given field 00103 const dictionary& solverDict(const word& name) const; 00104 00105 //- Return the solver controls dictionary for the given field 00106 const dictionary& solver(const word& name) const; 00107 00108 // Read 00109 00110 //- Read the solution dictionary 00111 bool read(); 00112 }; 00113 00114 00115 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00116 00117 } // End namespace Foam 00118 00119 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00120 00121 #endif 00122 00123 // ************************ vim: set sw=4 sts=4 et: ************************ //