Forward compatibility: flex
[foam-extend-3.2.git] / src / foam / matrices / solution / solution.H
blobfe92b01569e70bbf5ccfd141641e0c95bd20411c
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | foam-extend: Open Source CFD
4    \\    /   O peration     | Version:     3.2
5     \\  /    A nd           | Web:         http://www.foam-extend.org
6      \\/     M anipulation  | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
8 License
9     This file is part of foam-extend.
11     foam-extend 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 3 of the License, or (at your
14     option) any later version.
16     foam-extend is distributed in the hope that it will be useful, but
17     WITHOUT ANY WARRANTY; without even the implied warranty of
18     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19     General Public License for more details.
21     You should have received a copy of the GNU General Public License
22     along with foam-extend.  If not, see <http://www.gnu.org/licenses/>.
24 Class
25     Foam::solution
27 Description
28     Selector class for relaxation factors, solver type and solution.
30 SourceFiles
31     solution.C
33 \*---------------------------------------------------------------------------*/
35 #ifndef solution_H
36 #define solution_H
38 #include "IOdictionary.H"
39 #include "debugSwitch.H"
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 namespace Foam
46 /*---------------------------------------------------------------------------*\
47                           Class solution Declaration
48 \*---------------------------------------------------------------------------*/
50 class solution
52     public IOdictionary
54     // Private data
56         //- Dictionary of relaxation factors for all the fields
57         dictionary relaxationFactors_;
59         //- Optional default relaxation factor for all the fields
60         scalar defaultRelaxationFactor_;
62         //- Dictionary of solver parameters for all the fields
63         dictionary solvers_;
66     // Private Member Functions
68         //- Disallow default bitwise copy construct and assignment
69         solution(const solution&);
70         void operator=(const solution&);
73 public:
75     //- Update from older solver controls syntax
76     //  Usually verbose, since we want to know about the changes
77     //  Returns the number of settings changed
78     static label upgradeSolverDict(dictionary& dict, const bool verbose=true);
80     //- Debug switch
81     static debug::debugSwitch debug;
84     // Constructors
86         //- Construct for given objectRegistry and dictionary
87         solution(const objectRegistry& obr, const fileName& dictName);
90     // Member Functions
92         // Access
94             //- Return true if the relaxation factor is given for the field
95             bool relax(const word& name) const;
97             //- Return the relaxation factor for the given field
98             scalar relaxationFactor(const word& name) const;
100             //- Return the solver controls dictionary for the given field
101             const dictionary& solverDict(const word& name) const;
103             //- Return the solver controls dictionary for the given field
104             const dictionary& solver(const word& name) const;
107         // Edit
109             //- Return access to relaxation factors dictionary
110             dictionary& relaxationFactors()
111             {
112                 return relaxationFactors_;
113             }
115             //- Return access to solvers dictionary
116             dictionary& solvers()
117             {
118                 return solvers_;
119             }
122         // Read
124             //- Read the solution dictionary
125             bool read();
128         // Write
130             //- WriteData function required for regIOobject write operation
131             virtual bool writeData(Ostream&) const;
135 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
137 } // End namespace Foam
139 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
141 #endif
143 // ************************************************************************* //