Merge branch 'master' of ssh://git.code.sf.net/p/foam-extend/foam-extend-3.2
[foam-extend-3.2.git] / src / mesh / cfMesh / utilities / octrees / meshOctree / refinementControls / objectRefinement / newObjectRefinement.C
blobe9d52d198a2401f27702b6395ea4a35904ae758a
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | cfMesh: A library for mesh generation
4    \\    /   O peration     |
5     \\  /    A nd           | Author: Franjo Juretic (franjo.juretic@c-fields.com)
6      \\/     M anipulation  | Copyright (C) Creative Fields, Ltd.
7 -------------------------------------------------------------------------------
8 License
9     This file is part of cfMesh.
11     cfMesh is free software; you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by the
13     Free Software Foundation; either version 3 of the License, or (at your
14     option) any later version.
16     cfMesh 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.
21     You should have received a copy of the GNU General Public License
22     along with cfMesh.  If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "objectRefinement.H"
27 #include "dictionary.H"
28 #include "error.H"
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32 namespace Foam
35 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
37 autoPtr<Foam::objectRefinement> Foam::objectRefinement::New
39     const word& name,
40     const dictionary& dict
43     if( debug )
44     {
45         Info<< "objectRefinement::New(const word&, const dictionary&) : "
46             << "constructing objectRefinement"
47             << endl;
48     }
50     // default type is self
51     word refType(typeName_());
52     if( dict.found("type") )
53     {
54         dict.lookup("type") >> refType;
55     }
57     dictionaryConstructorTable::iterator cstrIter =
58         dictionaryConstructorTablePtr_->find(refType);
60     if( cstrIter == dictionaryConstructorTablePtr_->end() )
61     {
62         FatalIOErrorIn
63         (
64             "objectRefinement::New(const word&, const dictionary&)",
65             dict
66         )   << "Unknown objectRefinement type " << refType << nl << nl
67             << "Valid objectRefinement types are :" << nl
68             << "[default: " << typeName_() << "]"
69             << dictionaryConstructorTablePtr_->toc()
70             << exit(FatalIOError);
71     }
73     return autoPtr<objectRefinement>(cstrIter()(name, dict));
76 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
78 } // End namespace Foam
80 // ************************************************************************* //