Roots.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2017-2018 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::Roots
26 
27 Description
28  Templated storage for the roots of polynomial equations, plus flags to
29  indicate the nature of the roots.
30 
31 SourceFiles
32  RootsI.H
33  Roots.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef Roots_H
38 #define Roots_H
39 
40 #include "VectorSpace.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace roots
50 {
51 
52 //- Types of root
53 enum type
54 {
55  real = 0,
59  nan
60 };
61 
62 }
63 
64 /*---------------------------------------------------------------------------*\
65  Class Roots Declaration
66 \*---------------------------------------------------------------------------*/
67 
68 template<direction N>
69 class Roots
70 :
71  public VectorSpace<Roots<N>, scalar, N>
72 {
73  // Private data
74 
75  //- Root types, encoded into a single integer
76  label types_;
77 
78 public:
79 
80  // Constructors
81 
82  //- Construct null
83  inline Roots();
84 
85  //- Construct with a uniform value
86  inline Roots(const roots::type t, const scalar x);
87 
88  //- Construct by concatenation
89  inline Roots
90  (
91  const roots::type t,
92  const scalar x,
93  const Roots<N - 1>& xs
94  );
95 
96  //- Construct by concatenation
97  inline Roots
98  (
99  const Roots<N - 1>& xs,
100  const roots::type t,
101  const scalar x
102  );
103 
104  //- Construct by concatenation
105  template <direction M>
106  inline Roots(const Roots<M>& xs, const Roots<N - M>& ys);
107 
108 
109  // Member Functions
110 
111  //- Set the type of the i-th root
112  inline void type(const direction i, const roots::type t);
113 
114  //- Return the type of the i-th root
115  inline roots::type type(const direction i) const;
116 };
117 
118 
119 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
120 
121 } // End namespace Foam
122 
123 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
124 
125 #include "RootsI.H"
126 
127 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
128 
129 #endif
130 
131 // ************************************************************************* //
type
Types of root.
Definition: Roots.H:52
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
uint8_t direction
Definition: direction.H:45
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
Namespace for OpenFOAM.