1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
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
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "polyPatch.H"
28 #include "dictionary.H"
30 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
32 Foam::autoPtr<Foam::polyPatch> Foam::polyPatch::New
34 const word& patchType,
39 const polyBoundaryMesh& bm
44 Info<< "polyPatch::New(const word&, const word&, const label, "
45 "const label, const label, const polyBoundaryMesh&) : "
46 "constructing polyPatch"
50 wordConstructorTable::iterator cstrIter =
51 wordConstructorTablePtr_->find(patchType);
53 if (cstrIter == wordConstructorTablePtr_->end())
57 "polyPatch::New(const word&, const word&, const label, "
58 "const label, const label, const polyBoundaryMesh&) "
59 ) << "Unknown polyPatch type " << patchType << " for patch " << name
61 << "Valid polyPatch types are :" << endl
62 << wordConstructorTablePtr_->toc()
66 return autoPtr<polyPatch>(cstrIter()(name, size, start, index, bm));
70 Foam::autoPtr<Foam::polyPatch> Foam::polyPatch::New
73 const dictionary& dict,
75 const polyBoundaryMesh& bm
80 Info<< "polyPatch::New(const word&, const dictionary&, const label, "
81 "const polyBoundaryMesh&) : constructing polyPatch"
85 word patchType(dict.lookup("type"));
87 dict.readIfPresent("geometricType", patchType);
89 dictionaryConstructorTable::iterator cstrIter =
90 dictionaryConstructorTablePtr_->find(patchType);
92 if (cstrIter == dictionaryConstructorTablePtr_->end())
94 if (!disallowGenericPolyPatch)
96 cstrIter = dictionaryConstructorTablePtr_->find("genericPatch");
99 if (cstrIter == dictionaryConstructorTablePtr_->end())
103 "polyPatch::New(const word&, const dictionary&, "
104 "const label, const polyBoundaryMesh&)",
106 ) << "Unknown polyPatch type " << patchType
107 << " for patch " << name
109 << "Valid polyPatch types are :" << endl
110 << dictionaryConstructorTablePtr_->toc()
111 << exit(FatalIOError);
115 return autoPtr<polyPatch>(cstrIter()(name, dict, index, bm));
119 // ************************************************************************* //