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