All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
normal.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) 2011-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::distributionModels::normal
26 
27 Description
28  A normal distribution model
29 
30  \verbatim
31  model = strength * exp(-0.5*((x - expectation)/variance)^2 )
32  \endverbatim
33 
34  strength only has meaning if there's more than one distribution model
35 
36 SourceFiles
37  normal.C
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef normal_H
42 #define normal_H
43 
44 #include "distributionModel.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 namespace distributionModels
51 {
52 
53 /*---------------------------------------------------------------------------*\
54  Class normal Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 class normal
58 :
59  public distributionModel
60 {
61  // Private Data
62 
63 
64  //- Distribution minimum
65  scalar minValue_;
66 
67  //- Distribution maximum
68  scalar maxValue_;
69 
70 
71  // Model coefficients
72 
73  scalar expectation_;
74  scalar variance_;
75 
76  scalar a_;
77 
78 
79 public:
80 
81  //- Runtime type information
82  TypeName("normal");
83 
84 
85  // Constructors
86 
87  //- Construct from components
89 
90  //- Construct copy
91  normal(const normal& p);
92 
93  //- Construct and return a clone
94  virtual autoPtr<distributionModel> clone() const
95  {
96  return autoPtr<distributionModel>(new normal(*this));
97  }
98 
99 
100  //- Destructor
101  virtual ~normal();
102 
103 
104  // Member Functions
105 
106  //- Sample the distributionModel
107  virtual scalar sample() const;
108 
109  //- Return the minimum value
110  virtual scalar minValue() const;
111 
112  //- Return the maximum value
113  virtual scalar maxValue() const;
114 
115  //- Return the mean value
116  virtual scalar meanValue() const;
117 
118  virtual scalar erfInv(const scalar y) const;
119 };
120 
121 
122 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
123 
124 } // End namespace distributionModels
125 } // End namespace Foam
126 
127 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
128 
129 #endif
130 
131 // ************************************************************************* //
A normal distribution model.
Definition: normal.H:56
dictionary dict
virtual scalar sample() const
Sample the distributionModel.
Definition: normal.C:80
virtual autoPtr< distributionModel > clone() const
Construct and return a clone.
Definition: normal.H:93
virtual scalar minValue() const
Return the minimum value.
Definition: normal.C:98
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
virtual scalar erfInv(const scalar y) const
Definition: normal.C:116
Random rndGen(label(0))
virtual scalar maxValue() const
Return the maximum value.
Definition: normal.C:104
scalar y
virtual scalar meanValue() const
Return the mean value.
Definition: normal.C:110
virtual ~normal()
Destructor.
Definition: normal.C:74
Random number generator.
Definition: Random.H:57
normal(const dictionary &dict, Random &rndGen)
Construct from components.
Definition: normal.C:44
A library of runtime-selectable distribution models.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
volScalarField & p
TypeName("normal")
Runtime type information.
Namespace for OpenFOAM.