multiNormal.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::multiNormal
28 
29 Description
30  A multiNormal distribution model
31 
32  \verbatim
33  model = sum_i strength_i * exp(-0.5*((x - expectation_i)/variance_i)^2 )
34  \endverbatim
35 
36 
37 SourceFiles
38  multiNormal.C
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef distributionModels_multiNormal_H
43 #define distributionModels_multiNormal_H
44 
45 #include "distributionModel.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 namespace distributionModels
52 {
53 
54 /*---------------------------------------------------------------------------*\
55  Class multiNormal Declaration
56 \*---------------------------------------------------------------------------*/
57 
58 class multiNormal
59 :
60  public distributionModel
61 {
62  // Private data
63 
64  //- Distribution minimum
65  scalar minValue_;
66 
67  //- Distribution maximum
68  scalar maxValue_;
69 
70  //- Distribution range
71  scalar range_;
72 
73 
74  // Model coefficients
75 
76  List<scalar> expectation_;
77  List<scalar> variance_;
78  List<scalar> strength_;
79 
80 
81 public:
82 
83  //- Runtime type information
84  TypeName("multiNormal");
85 
86 
87  // Constructors
88 
89  //- Construct from components
91 
92  //- Construct copy
93  multiNormal(const multiNormal& p);
94 
95  //- Construct and return a clone
96  virtual autoPtr<distributionModel> clone() const
97  {
98  return autoPtr<distributionModel>(new multiNormal(*this));
99  }
100 
101 
102  //- Destructor
103  virtual ~multiNormal();
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 
121 
122 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
123 
124 } // End namespace distributionModels
125 } // End namespace Foam
126 
127 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
128 
129 #endif
130 
131 // ************************************************************************* //
Foam::Random
Random number generator.
Definition: Random.H:59
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::distributionModels::multiNormal::~multiNormal
virtual ~multiNormal()
Destructor.
Definition: multiNormal.C:100
Foam::distributionModels::multiNormal::maxValue
virtual scalar maxValue() const
Return the maximum value.
Definition: multiNormal.C:144
Foam::distributionModels::multiNormal::TypeName
TypeName("multiNormal")
Runtime type information.
Foam::distributionModel
A library of runtime-selectable distribution models.
Definition: distributionModel.H:70
Foam::distributionModels::multiNormal
A multiNormal distribution model.
Definition: multiNormal.H:57
dict
dictionary dict
Definition: searchingEngine.H:14
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::multiNormal::clone
virtual autoPtr< distributionModel > clone() const
Construct and return a clone.
Definition: multiNormal.H:95
Foam::distributionModels::multiNormal::minValue
virtual scalar minValue() const
Return the minimum value.
Definition: multiNormal.C:138
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::List< scalar >
Foam::distributionModels::multiNormal::meanValue
virtual scalar meanValue() const
Return the mean value.
Definition: multiNormal.C:150
rndGen
Random rndGen
Definition: createFields.H:23
Foam::distributionModels::multiNormal::sample
virtual scalar sample() const
Sample the distributionModel.
Definition: multiNormal.C:106
Foam::distributionModels::multiNormal::multiNormal
multiNormal(const dictionary &dict, Random &rndGen)
Construct from components.
Definition: multiNormal.C:45
distributionModel.H