All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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-2019 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 //- Types of root
50 enum class rootType
51 {
52  real = 0,
53  complex,
54  posInf,
55  negInf,
56  nan
57 };
58 
59 
60 /*---------------------------------------------------------------------------*\
61  Class Roots Declaration
62 \*---------------------------------------------------------------------------*/
63 
64 template<direction N>
65 class Roots
66 :
67  public VectorSpace<Roots<N>, scalar, N>
68 {
69  // Private Data
70 
71  //- Root types, encoded into a single integer
72  label types_;
73 
74 public:
75 
76  // Constructors
77 
78  //- Construct null
79  inline Roots();
80 
81  //- Construct with a uniform value
82  inline Roots(const rootType t, const scalar x);
83 
84  //- Construct by concatenation
85  inline Roots
86  (
87  const rootType t,
88  const scalar x,
89  const Roots<N - 1>& xs
90  );
91 
92  //- Construct by concatenation
93  inline Roots
94  (
95  const Roots<N - 1>& xs,
96  const rootType t,
97  const scalar x
98  );
99 
100  //- Construct by concatenation
101  template <direction M>
102  inline Roots(const Roots<M>& xs, const Roots<N - M>& ys);
103 
104 
105  // Member Functions
106 
107  //- Set the type of the i-th root
108  inline void type(const direction i, const rootType t);
109 
110  //- Return the type of the i-th root
111  inline rootType type(const direction i) const;
112 };
113 
114 
115 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
116 
117 } // End namespace Foam
118 
119 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
120 
121 #include "RootsI.H"
122 
123 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
124 
125 #endif
126 
127 // ************************************************************************* //
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:64
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488
Namespace for OpenFOAM.
rootType
Types of root.
Definition: Roots.H:49