distributionModelNew.C 2.17 KB
Newer Older
1
2
3
4
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     |
5
    \\  /    A nd           | Copyright (C) 2016-2019 OpenCFD Ltd.
OpenFOAM bot's avatar
OpenFOAM bot committed
6
7
8
     \\/     M anipulation  |
-------------------------------------------------------------------------------
                            | Copyright (C) 2011-2017 OpenFOAM Foundation
9
10
11
12
-------------------------------------------------------------------------------
License
    This file is part of OpenFOAM.

13
14
15
16
    OpenFOAM is free software: you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
17
18
19
20
21
22
23

    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    for more details.

    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
27

\*---------------------------------------------------------------------------*/

28
#include "distributionModel.H"
29
30
31

// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //

32
Foam::autoPtr<Foam::distributionModel> Foam::distributionModel::New
33
34
(
    const dictionary& dict,
35
    Random& rndGen
36
37
)
{
38
    const word modelType(dict.get<word>("type"));
39

40
    Info<< "Selecting distribution model " << modelType << endl;
41

42
    auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
43

44
    if (!cstrIter.found())
45
    {
46
        FatalIOErrorInLookup
47
        (
48
            dict,
49
50
51
            "distribution model",
            modelType,
            *dictionaryConstructorTablePtr_
52
        ) << exit(FatalIOError);
53
54
    }

55
56
57
58
    const dictionary distributionDict =
        dict.subOrEmptyDict(modelType & "Distribution");

    return autoPtr<distributionModel>(cstrIter()(distributionDict, rndGen));
59
60
61
}


Andrew Heather's avatar
Andrew Heather committed
62
// ************************************************************************* //