distributionModel.C
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 \*---------------------------------------------------------------------------*/
25 
26 #include "distributionModel.H"
27 
28 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
29 
30 
31 // Symbol to force loading at runtime
32 extern "C"
34 {}
35 
36 
37 namespace Foam
38 {
39  namespace distributionModels
40  {
43  }
44 }
45 
46 
47 // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
48 
50 {
51  if (minValue() < 0)
52  {
54  << type() << "distribution: Minimum value must be greater than "
55  << "zero." << nl << "Supplied minValue = " << minValue()
56  << abort(FatalError);
57  }
58 
59  if (maxValue() < minValue())
60  {
62  << type() << "distribution: Maximum value is smaller than the "
63  << "minimum value:" << nl << " maxValue = " << maxValue()
64  << ", minValue = " << minValue()
65  << abort(FatalError);
66  }
67 }
68 
69 
70 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
71 
73 (
74  const word& name,
75  const dictionary& dict,
77 )
78 :
79  distributionModelDict_(dict.subDict(name + "Distribution")),
80  rndGen_(rndGen)
81 {}
82 
83 
85 (
86  const distributionModel& p
87 )
88 :
89  distributionModelDict_(p.distributionModelDict_),
90  rndGen_(p.rndGen_)
91 {}
92 
93 
94 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
95 
97 {}
98 
99 
100 // ************************************************************************* //
p
p
Definition: pEqn.H:62
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::distributionModels::distributionModel::distributionModel
distributionModel(const word &name, const dictionary &dict, cachedRandom &rndGen)
Construct from dictionary.
Definition: distributionModel.C:73
Foam::distributionModels::defineRunTimeSelectionTable
defineRunTimeSelectionTable(distributionModel, dictionary)
Foam::cachedRandom
Random number generator.
Definition: cachedRandom.H:63
Foam::nl
static const char nl
Definition: Ostream.H:260
Foam::distributionModels::distributionModel
Definition: distributionModel.H:69
distributionModelsLoad
void distributionModelsLoad()
Definition: distributionModel.C:33
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::FatalError
error FatalError
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::distributionModels::distributionModel::minValue
virtual scalar minValue() const =0
Return the minimum value.
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:131
Foam::distributionModels::distributionModel::maxValue
virtual scalar maxValue() const =0
Return the maximum value.
Foam::distributionModels::distributionModel::~distributionModel
virtual ~distributionModel()
Destructor.
Definition: distributionModel.C:96
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:318
Foam::distributionModels::defineTypeNameAndDebug
defineTypeNameAndDebug(distributionModel, 0)
Foam::type
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
Definition: POSIX.C:588
rndGen
cachedRandom rndGen(label(0), -1)
Foam::name
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
distributionModel.H
Foam::distributionModels::distributionModel::check
virtual void check() const
Check that the distribution model is valid.
Definition: distributionModel.C:49