general.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) 2011-2015 OpenFOAM Foundation
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::general
26 
27 Description
28  general distribution model
29 
30 SourceFiles
31  general.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef general_H
36 #define general_H
37 
38 #include "distributionModel.H"
39 #include "Vector.H"
40 #include "VectorSpace.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 namespace distributionModels
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class general Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 class general
54 :
55  public distributionModel
56 {
57  // Private data
58 
59  typedef VectorSpace<Vector<scalar>, scalar, 2> pair;
60 
61  List<pair> xy_;
62 
63  label nEntries_;
64 
65  //- Min and max values of the distribution
66  scalar minValue_;
67  scalar maxValue_;
68 
69  scalar meanValue_;
70 
71  List<scalar> integral_;
72 
73 
74 public:
75 
76  //- Runtime type information
77  TypeName("general");
78 
79 
80  // Constructors
81 
82  //- Construct from components
84 
85  //- Construct copy
86  general(const general& p);
87 
88  //- Construct and return a clone
89  virtual autoPtr<distributionModel> clone() const
90  {
91  return autoPtr<distributionModel>(new general(*this));
92  }
93 
94 
95  //- Destructor
96  virtual ~general();
97 
98 
99  // Member Functions
100 
101  //- Sample the distributionModel
102  virtual scalar sample() const;
103 
104  //- Return the minimum value
105  virtual scalar minValue() const;
106 
107  //- Return the maximum value
108  virtual scalar maxValue() const;
109 
110  //- Return the mean value
111  virtual scalar meanValue() const;
112 };
113 
114 
115 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
116 
117 } // End namespace distributionModels
118 } // End namespace Foam
119 
120 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
121 
122 #endif
123 
124 // ************************************************************************* //
general(const dictionary &dict, cachedRandom &rndGen)
Construct from components.
Definition: general.C:43
cachedRandom rndGen(label(0),-1)
virtual scalar minValue() const
Return the minimum value.
Definition: general.C:149
virtual ~general()
Destructor.
Definition: general.C:99
virtual autoPtr< distributionModel > clone() const
Construct and return a clone.
Definition: general.H:88
TypeName("general")
Runtime type information.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
Namespace for OpenFOAM.
virtual scalar maxValue() const
Return the maximum value.
Definition: general.C:155
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
dictionary dict
volScalarField & p
Definition: createFields.H:51
virtual scalar meanValue() const
Return the mean value.
Definition: general.C:161
Random number generator.
Definition: cachedRandom.H:63
Templated vector space.
Definition: VectorSpace.H:52
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
virtual scalar sample() const
Sample the distributionModel.
Definition: general.C:105