Roots.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-------------------------------------------------------------------------------
10License
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
26Class
27 Foam::Roots
28
29Description
30 Templated storage for the roots of polynomial equations, plus flags to
31 indicate the nature of the roots.
32
33SourceFiles
34 RootsI.H
35 Roots.C
36
37\*---------------------------------------------------------------------------*/
38
39#ifndef Roots_H
40#define Roots_H
41
42#include "VectorSpace.H"
43
44// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45
46namespace Foam
47{
48
49// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51namespace roots
52{
53
54//- Types of root
55enum type
57 real = 0,
60 negInf,
62};
63
64}
65
66/*---------------------------------------------------------------------------*\
67 Class Roots Declaration
68\*---------------------------------------------------------------------------*/
69
70template<direction N>
71class Roots
72:
73 public VectorSpace<Roots<N>, scalar, N>
74{
75 // Private data
76
77 //- Root types, encoded into a single integer
78 label types_;
79
80public:
81
82 // Constructors
83
84 //- Construct null
85 inline Roots();
86
87 //- Construct with a uniform value
88 inline Roots(const roots::type t, const scalar x);
89
90 //- Construct by concatenation
91 inline Roots
92 (
93 const roots::type t,
94 const scalar x,
95 const Roots<N - 1>& xs
96 );
97
98 //- Construct by concatenation
99 inline Roots
100 (
101 const Roots<N - 1>& xs,
102 const roots::type t,
103 const scalar x
104 );
105
106 //- Construct by concatenation
107 template <direction M>
108 inline Roots(const Roots<M>& xs, const Roots<N - M>& ys);
109
110
111 // Member Functions
112
113 //- Set the type of the i-th root
114 inline void type(const direction i, const roots::type t);
115
116 //- Return the type of the i-th root
117 inline roots::type type(const direction i) const;
118};
119
120
121// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
122
123} // End namespace Foam
124
125// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
126
127#include "RootsI.H"
128
129// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
130
131#endif
132
133// ************************************************************************* //
Templated storage for the roots of polynomial equations, plus flags to indicate the nature of the roo...
Definition: Roots.H:73
void type(const direction i, const roots::type t)
Set the type of the i-th root.
Definition: RootsI.H:122
Roots()
Construct null.
Definition: RootsI.H:31
Templated vector space.
Definition: VectorSpace.H:79
type
Types of root.
Definition: Roots.H:55
@ posInf
Definition: Roots.H:58
@ complex
Definition: Roots.H:57
@ real
Definition: Roots.H:56
@ negInf
Definition: Roots.H:59
Namespace for OpenFOAM.
uint8_t direction
Definition: direction.H:56