1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
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 // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
30 Foam::tmp<Foam::fvPatchField<Type> > Foam::fvPatchField<Type>::New
32 const word& patchFieldType,
34 const DimensionedField<Type, volMesh>& iF
39 Info<< "fvPatchField<Type>::New(const word&, const fvPatch&, "
40 "const DimensionedField<Type, volMesh>&) : patchFieldType="
45 typename patchConstructorTable::iterator cstrIter =
46 patchConstructorTablePtr_->find(patchFieldType);
48 if (cstrIter == patchConstructorTablePtr_->end())
52 "fvPatchField<Type>::New(const word&, const fvPatch&, "
53 "const DimensionedField<Type, volMesh>&)"
54 ) << "Unknown patch field type " << patchFieldType
56 << "Valid patchField types are :" << endl
57 << patchConstructorTablePtr_->toc()
61 typename patchConstructorTable::iterator patchTypeCstrIter =
62 patchConstructorTablePtr_->find(p.type());
64 if (patchTypeCstrIter != patchConstructorTablePtr_->end())
66 return patchTypeCstrIter()(p, iF);
70 return cstrIter()(p, iF);
76 Foam::tmp<Foam::fvPatchField<Type> > Foam::fvPatchField<Type>::New
79 const DimensionedField<Type, volMesh>& iF,
80 const dictionary& dict
83 word patchFieldType(dict.lookup("type"));
87 Info<< "fvPatchField<Type>::New(const fvPatch&, "
88 "const DimensionedField<Type, volMesh>&, "
89 "const dictionary&) : patchFieldType=" << patchFieldType
93 typename dictionaryConstructorTable::iterator cstrIter
94 = dictionaryConstructorTablePtr_->find(patchFieldType);
96 if (cstrIter == dictionaryConstructorTablePtr_->end())
98 if (!disallowGenericFvPatchField)
100 cstrIter = dictionaryConstructorTablePtr_->find("generic");
103 if (cstrIter == dictionaryConstructorTablePtr_->end())
107 "fvPatchField<Type>::New(const fvPatch&, "
108 "const DimensionedField<Type, volMesh>&, "
109 "const dictionary&)",
111 ) << "Unknown patch field type " << patchFieldType
112 << " for patch type " << p.type() << endl << endl
113 << "Valid patch field types are :" << endl
114 << dictionaryConstructorTablePtr_->toc()
115 << exit(FatalIOError);
121 !dict.found("patchType")
122 || word(dict.lookup("patchType")) != p.type()
125 typename dictionaryConstructorTable::iterator patchTypeCstrIter
126 = dictionaryConstructorTablePtr_->find(p.type());
130 patchTypeCstrIter != dictionaryConstructorTablePtr_->end()
131 && patchTypeCstrIter() != cstrIter()
136 "fvPatchField<Type>::New(const fvPatch&, "
137 "const DimensionedField<Type, volMesh>&, "
138 "const dictionary&)",
140 ) << "inconsistent patch and patchField types for \n"
141 " patch type " << p.type()
142 << " and patchField type " << patchFieldType
143 << exit(FatalIOError);
147 return cstrIter()(p, iF, dict);
152 Foam::tmp<Foam::fvPatchField<Type> > Foam::fvPatchField<Type>::New
154 const fvPatchField<Type>& ptf,
156 const DimensionedField<Type, volMesh>& iF,
157 const fvPatchFieldMapper& pfMapper
162 Info<< "fvPatchField<Type>::New(const fvPatchField<Type>&, "
163 "const fvPatch&, const DimensionedField<Type, volMesh>&, "
164 "const fvPatchFieldMapper&) : "
165 "constructing fvPatchField<Type>"
169 typename patchMapperConstructorTable::iterator cstrIter =
170 patchMapperConstructorTablePtr_->find(ptf.type());
172 if (cstrIter == patchMapperConstructorTablePtr_->end())
176 "fvPatchField<Type>::New(const fvPatchField<Type>&, "
177 "const fvPatch&, const DimensionedField<Type, volMesh>&, "
178 "const fvPatchFieldMapper&)"
179 ) << "unknown patch field type " << ptf.type() << endl << endl
180 << "Valid patchField types are :" << endl
181 << patchMapperConstructorTablePtr_->toc()
185 return cstrIter()(ptf, p, iF, pfMapper);
189 // ************************************************************************* //