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

14 15 16 17
    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.
18 19 20 21 22 23 24

    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
25
    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
26 27 28

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

29
#include "distributionModel.H"
30 31 32

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

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

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

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

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

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

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


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