FreeFOAM The Cross-Platform CFD Toolkit
pdf.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::pdf
26 
27 Description
28  A library of runtime-selectable PDF's.
29 
30  Returns a sampled value given the expectation (nu) and variance (sigma^2)
31 
32  Current PDF's include:
33  - exponential
34  - fixedValue
35  - general
36  - multi-normal
37  - normal
38  - Rosin-Rammler
39  - uniform
40 
41  The pdf is tabulated in equidistant nPoints, in an interval.
42  These values are integrated to obtain the cumulated PDF,
43  which is then used to change the distribution from unifrom to
44  the actual pdf.
45 
46 SourceFiles
47  pdf.C
48  pdfNew.C
49 
50 \*---------------------------------------------------------------------------*/
51 
52 #ifndef pdf_H
53 #define pdf_H
54 
55 #include <OpenFOAM/IOdictionary.H>
56 #include <OpenFOAM/autoPtr.H>
57 #include <OpenFOAM/Random.H>
58 
59 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
60 
61 namespace Foam
62 {
63 namespace pdfs
64 {
65 
66 /*---------------------------------------------------------------------------*\
67  Class pdf Declaration
68 \*---------------------------------------------------------------------------*/
69 
70 class pdf
71 {
72 
73 protected:
74 
75  // Protected data
76 
77  //- Coefficients dictionary
79 
80  //- Reference to the randmo number generator
82 
83 
84  // Protected Member Functions
85 
86  //- Check that the PDF is valid
87  virtual void check() const;
88 
89 
90 public:
91 
92  //-Runtime type information
93  TypeName("pdf");
94 
95 
96  //- Declare runtime constructor selection table
98  (
99  autoPtr,
100  pdf,
101  dictionary,
102  (
103  const dictionary& dict,
104  Random& rndGen
105  ),
106  (dict, rndGen)
107  );
108 
109 
110  // Constructors
111 
112  //- Construct from dictionary
113  pdf(const word& name, const dictionary& dict, Random& rndGen);
114 
115 
116  //- Selector
117  static autoPtr<pdf> New(const dictionary& dict, Random& rndGen);
118 
119 
120  //- Destructor
121  virtual ~pdf();
122 
123 
124  // Member Functions
125 
126  //- Sample the pdf
127  virtual scalar sample() const = 0;
128 
129  //- Return the minimum value
130  virtual scalar minValue() const = 0;
131 
132  //- Return the maximum value
133  virtual scalar maxValue() const = 0;
134 };
135 
136 
137 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
138 
139 } // End namespace pdfs
140 } // End namespace Foam
141 
142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
143 
144 #endif
145 
146 // ************************ vim: set sw=4 sts=4 et: ************************ //