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