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