FreeFOAM The Cross-Platform CFD Toolkit
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 | Copyright (C) 1991-2010 OpenCFD Ltd.
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::normal
26 
27 Description
28  A normal pdf
29 
30  @verbatim
31  pdf = strength * exp(-0.5*((x - expectation)/variance)^2 )
32  @endverbatim
33 
34  strength only has meaning if there's more than one pdf
35 
36 SourceFiles
37  normal.C
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef normal_H
42 #define normal_H
43 
44 #include <pdf/pdf.H>
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 namespace pdfs
51 {
52 
53 /*---------------------------------------------------------------------------*\
54  Class normal Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 class normal
58 :
59  public pdf
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
88  normal
89  (
90  const dictionary& dict,
91  Random& rndGen
92  );
93 
94 
95  //- Destructor
96  virtual ~normal();
97 
98 
99  // Member Functions
100 
101  //- Sample the pdf
102  virtual scalar sample() const;
103 
104  //- Return the minimum value
105  virtual scalar minValue() const;
106 
107  //- Return the maximum value
108  virtual scalar maxValue() const;
109 
110  scalar erfInv(const scalar y) const;
111 };
112 
113 
114 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
115 
116 } // End namespace pdfs
117 } // End namespace Foam
118 
119 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
120 
121 #endif
122 
123 // ************************ vim: set sw=4 sts=4 et: ************************ //