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

11
12
13
14
    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.
15
16
17
18
19
20
21

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

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

26
#include "distributionModel.H"
27
28
29

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

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

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

    dictionaryConstructorTable::iterator cstrIter =
42
        dictionaryConstructorTablePtr_->find(modelType);
43

44
    if (!cstrIter.found())
45
    {
46
        FatalErrorInFunction
47
48
            << "Unknown distribution model type " << modelType << nl << nl
            << "Valid distribution model types are:" << nl
49
            << dictionaryConstructorTablePtr_->sortedToc()
Mattijs Janssens's avatar
tidy up    
Mattijs Janssens committed
50
            << exit(FatalError);
51
52
    }

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

    return autoPtr<distributionModel>(cstrIter()(distributionDict, rndGen));
57
58
59
}


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