linearEqn.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2017 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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.
20 
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/>.
23 
24 Class
25  Foam::linearEqn
26 
27 Description
28  Linear equation of the form a*x + b = 0
29 
30 SourceFiles
31  linearEqnI.H
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef linearEqn_H
36 #define linearEqn_H
37 
38 #include "Roots.H"
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 
45 /*---------------------------------------------------------------------------*\
46  Class linearEqn Declaration
47 \*---------------------------------------------------------------------------*/
48 
49 class linearEqn
50 :
51  public VectorSpace<linearEqn, scalar, 2>
52 {
53 public:
54 
55  //- Component labeling enumeration
56  enum components { A, B };
57 
58 
59  // Constructors
60 
61  //- Construct null
62  inline linearEqn();
63 
64  //- Construct initialized to zero
65  inline linearEqn(const Foam::zero);
66 
67  //- Construct from components
68  inline linearEqn(const scalar a, const scalar b);
69 
70 
71  // Member Functions
72 
73  // Access
74 
75  inline scalar a() const;
76  inline scalar b() const;
77 
78  inline scalar& a();
79  inline scalar& b();
80 
81  //- Evaluate at x
82  inline scalar value(const scalar x) const;
83 
84  //- Evaluate the derivative at x
85  inline scalar derivative(const scalar x) const;
86 
87  //- Estimate the error of evaluation at x
88  inline scalar error(const scalar x) const;
89 
90  //- Get the roots
91  inline Roots<1> roots() const;
92 };
93 
94 
95 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
96 
97 } // End namespace Foam
98 
99 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
100 
101 #include "linearEqnI.H"
102 
103 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
104 
105 #endif
106 
107 // ************************************************************************* //
scalar b() const
Definition: linearEqnI.H:53
Templated vector space.
Definition: VectorSpace.H:53
Templated storage for the roots of polynomial equations, plus flags to indicate the nature of the roo...
Definition: Roots.H:68
components
Component labeling enumeration.
Definition: linearEqn.H:55
scalar a() const
Definition: linearEqnI.H:47
linearEqn()
Construct null.
Definition: linearEqnI.H:28
scalar value(const scalar x) const
Evaluate at x.
Definition: linearEqnI.H:71
scalar error(const scalar x) const
Estimate the error of evaluation at x.
Definition: linearEqnI.H:83
Linear equation of the form a*x + b = 0.
Definition: linearEqn.H:48
Roots< 1 > roots() const
Get the roots.
Definition: linearEqnI.H:89
A class representing the concept of 0 used to avoid unnecessary manipulations for objects that are kn...
Definition: zero.H:49
scalar derivative(const scalar x) const
Evaluate the derivative at x.
Definition: linearEqnI.H:77
Namespace for OpenFOAM.