pdf.H 3.72 KB
Newer Older
1
2
3
4
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     |
5
    \\  /    A nd           | Copyright (C) 2004-2010 OpenCFD Ltd.
6
7
8
9
10
     \\/     M anipulation  |
-------------------------------------------------------------------------------
License
    This file is part of OpenFOAM.

11
12
13
14
    OpenFOAM is free software: you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
15
16
17
18
19
20
21

    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    for more details.

    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
25
26
27

Class
    Foam::pdf

Description
28
    A library of runtime-selectable PDF's.
29
30
31

    Returns a sampled value given the expectation (nu) and variance (sigma^2)

32
    Current PDF's include:
33
    - exponential
34
35
36
    - fixedValue
    - general
    - multi-normal
37
    - normal
38
39
    - Rosin-Rammler
    - uniform
40
41

    The pdf is tabulated in equidistant nPoints, in an interval.
42
    These values are integrated to obtain the cumulated PDF,
43
44
45
46
47
    which is then used to change the distribution from unifrom to
    the actual pdf.

SourceFiles
    pdf.C
48
    pdfNew.C
49
50
51
52
53
54
55
56

\*---------------------------------------------------------------------------*/

#ifndef pdf_H
#define pdf_H

#include "IOdictionary.H"
#include "autoPtr.H"
57
#include "cachedRandom.H"
58
59
60
61
62

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

namespace Foam
{
63
64
namespace pdfs
{
65
66
67
68
69
70
71
72
73
74
75
76

/*---------------------------------------------------------------------------*\
                           Class pdf Declaration
\*---------------------------------------------------------------------------*/

class pdf
{

protected:

    // Protected data

77
78
        //- Coefficients dictionary
        const dictionary pdfDict_;
79

80
        //- Reference to the random number generator
81
        cachedRandom& rndGen_;
82
83


84
    // Protected Member Functions
85
86
87
88
89

        //- Check that the PDF is valid
        virtual void check() const;


90
91
92
public:

    //-Runtime type information
Andrew Heather's avatar
Andrew Heather committed
93
    TypeName("pdf");
94
95


Andrew Heather's avatar
Andrew Heather committed
96
97
98
99
100
101
    //- Declare runtime constructor selection table
    declareRunTimeSelectionTable
    (
        autoPtr,
        pdf,
        dictionary,
102
        (
Andrew Heather's avatar
Andrew Heather committed
103
            const dictionary& dict,
104
            cachedRandom& rndGen
Andrew Heather's avatar
Andrew Heather committed
105
106
107
        ),
        (dict, rndGen)
    );
108
109
110
111


    // Constructors

Andrew Heather's avatar
Andrew Heather committed
112
        //- Construct from dictionary
113
114
115
116
117
118
119
120
121
122
        pdf(const word& name, const dictionary& dict, cachedRandom& rndGen);

        //- Construct copy
        pdf(const pdf& p);

        //- Construct and return a clone
        virtual autoPtr<pdf> clone() const
        {
            return autoPtr<pdf>(new pdf(*this));
        }
123
124


Andrew Heather's avatar
Andrew Heather committed
125
    //- Selector
126
    static autoPtr<pdf> New(const dictionary& dict, cachedRandom& rndGen);
127
128


Andrew Heather's avatar
Andrew Heather committed
129
130
    //- Destructor
    virtual ~pdf();
131
132
133
134
135


    // Member Functions

        //- Sample the pdf
136
        virtual scalar sample() const;
137

Andrew Heather's avatar
Andrew Heather committed
138
        //- Return the minimum value
139
        virtual scalar minValue() const;
Andrew Heather's avatar
Andrew Heather committed
140
141

        //- Return the maximum value
142
        virtual scalar maxValue() const;
143
144
145
146
147
};


// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

148
} // End namespace pdfs
149
150
151
152
153
154
155
} // End namespace Foam

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#endif

// ************************************************************************* //