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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2017 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::linearEqn
28 
29 Description
30  Linear equation of the form a*x + b = 0
31 
32 SourceFiles
33  linearEqnI.H
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef linearEqn_H
38 #define linearEqn_H
39 
40 #include "Roots.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 /*---------------------------------------------------------------------------*\
48  Class linearEqn Declaration
49 \*---------------------------------------------------------------------------*/
50 
51 class linearEqn
52 :
53  public VectorSpace<linearEqn, scalar, 2>
54 {
55 public:
56 
57  //- Component labeling enumeration
58  enum components { A, B };
59 
60 
61  // Constructors
62 
63  //- Construct null
64  inline linearEqn();
65 
66  //- Construct initialized to zero
67  inline linearEqn(const Foam::zero);
68 
69  //- Construct from components
70  inline linearEqn(const scalar a, const scalar b);
71 
72 
73  // Member Functions
74 
75  // Access
76 
77  inline scalar a() const;
78  inline scalar b() const;
79 
80  inline scalar& a();
81  inline scalar& b();
82 
83  //- Evaluate at x
84  inline scalar value(const scalar x) const;
85 
86  //- Evaluate the derivative at x
87  inline scalar derivative(const scalar x) const;
88 
89  //- Estimate the error of evaluation at x
90  inline scalar error(const scalar x) const;
91 
92  //- Get the roots
93  inline Roots<1> roots() const;
94 };
95 
96 
97 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
98 
99 } // End namespace Foam
100 
101 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
102 
103 #include "linearEqnI.H"
104 
105 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
106 
107 #endif
108 
109 // ************************************************************************* //
Foam::linearEqn::a
scalar a() const
Definition: linearEqnI.H:49
Foam::linearEqn::A
Definition: linearEqn.H:57
Foam::linearEqn::derivative
scalar derivative(const scalar x) const
Evaluate the derivative at x.
Definition: linearEqnI.H:79
Foam::linearEqn::b
scalar b() const
Definition: linearEqnI.H:55
Foam::linearEqn::B
Definition: linearEqn.H:57
Foam::linearEqn
Linear equation of the form a*x + b = 0.
Definition: linearEqn.H:50
Foam::VectorSpace
Templated vector space.
Definition: VectorSpace.H:56
Foam::linearEqn::value
scalar value(const scalar x) const
Evaluate at x.
Definition: linearEqnI.H:73
Foam::linearEqn::linearEqn
linearEqn()
Construct null.
Definition: linearEqnI.H:30
Foam::linearEqn::components
components
Component labeling enumeration.
Definition: linearEqn.H:57
Roots.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::linearEqn::roots
Roots< 1 > roots() const
Get the roots.
Definition: linearEqnI.H:91
linearEqnI.H
Foam::linearEqn::error
scalar error(const scalar x) const
Estimate the error of evaluation at x.
Definition: linearEqnI.H:85
x
x
Definition: LISASMDCalcMethod2.H:52
Foam::Roots
Templated storage for the roots of polynomial equations, plus flags to indicate the nature of the roo...
Definition: Roots.H:70
Foam::zero
A class representing the concept of 0 (zero), which can be used to avoid manipulating objects that ar...
Definition: zero.H:61