uniform.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-2016 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::uniform
28 
29 Description
30  Uniform/equally-weighted distribution model
31 
32 SourceFiles
33  uniform.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef distributionModels_uniform_H
38 #define distributionModels_uniform_H
39 
40 #include "distributionModel.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 namespace distributionModels
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class uniform Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 class uniform
54 :
55  public distributionModel
56 {
57  // Private data
58 
59  //- Distribution minimum
60  scalar minValue_;
61 
62  //- Distribution maximum
63  scalar maxValue_;
64 
65 
66 public:
67 
68  //- Runtime type information
69  TypeName("uniform");
70 
71 
72  // Constructors
73 
74  //- Construct from components
76 
77  //- Construct copy
78  uniform(const uniform& p);
79 
80  //- Construct and return a clone
81  virtual autoPtr<distributionModel> clone() const
82  {
83  return autoPtr<distributionModel>(new uniform(*this));
84  }
85 
86 
87  //- Destructor
88  virtual ~uniform();
89 
90 
91  // Member Functions
92 
93  //- Sample the distributionModel
94  virtual scalar sample() const;
95 
96  //- Return the minimum value
97  virtual scalar minValue() const;
98 
99  //- Return the maximum value
100  virtual scalar maxValue() const;
101 
102  //- Return the mean value
103  virtual scalar meanValue() const;
104 };
105 
106 
107 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
108 
109 } // End namespace distributionModels
110 } // End namespace Foam
111 
112 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
113 
114 #endif
115 
116 // ************************************************************************* //
Foam::Random
Random number generator.
Definition: Random.H:59
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::distributionModels::uniform::maxValue
virtual scalar maxValue() const
Return the maximum value.
Definition: uniform.C:86
Foam::distributionModels::uniform::minValue
virtual scalar minValue() const
Return the minimum value.
Definition: uniform.C:80
Foam::distributionModel
A library of runtime-selectable distribution models.
Definition: distributionModel.H:70
Foam::distributionModels::uniform::sample
virtual scalar sample() const
Sample the distributionModel.
Definition: uniform.C:74
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::uniform::uniform
uniform(const dictionary &dict, Random &rndGen)
Construct from components.
Definition: uniform.C:45
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::distributionModels::uniform
Uniform/equally-weighted distribution model.
Definition: uniform.H:52
Foam::distributionModels::uniform::clone
virtual autoPtr< distributionModel > clone() const
Construct and return a clone.
Definition: uniform.H:80
rndGen
Random rndGen
Definition: createFields.H:23
Foam::distributionModels::uniform::meanValue
virtual scalar meanValue() const
Return the mean value.
Definition: uniform.C:92
Foam::distributionModels::uniform::TypeName
TypeName("uniform")
Runtime type information.
distributionModel.H
Foam::distributionModels::uniform::~uniform
virtual ~uniform()
Destructor.
Definition: uniform.C:68