1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend 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 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
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
55 << " for field " << iF.name() << " on patch " << p.name()
57 << "Valid patchField types are :" << endl
58 << patchConstructorTablePtr_->sortedToc()
62 typename patchConstructorTable::iterator patchTypeCstrIter =
63 patchConstructorTablePtr_->find(p.type());
65 if (patchTypeCstrIter != patchConstructorTablePtr_->end())
67 return patchTypeCstrIter()(p, iF);
71 return cstrIter()(p, iF);
77 Foam::tmp<Foam::fvPatchField<Type> > Foam::fvPatchField<Type>::New
80 const DimensionedField<Type, volMesh>& iF,
81 const dictionary& dict
84 word patchFieldType(dict.lookup("type"));
88 Info<< "fvPatchField<Type>::New(const fvPatch&, "
89 "const DimensionedField<Type, volMesh>&, "
90 "const dictionary&) : patchFieldType = " << patchFieldType
94 typename dictionaryConstructorTable::iterator cstrIter
95 = dictionaryConstructorTablePtr_->find(patchFieldType);
97 if (cstrIter == dictionaryConstructorTablePtr_->end())
99 if (!disallowGenericFvPatchField)
101 cstrIter = dictionaryConstructorTablePtr_->find("generic");
104 if (cstrIter == dictionaryConstructorTablePtr_->end())
108 "fvPatchField<Type>::New(const fvPatch&, "
109 "const DimensionedField<Type, volMesh>&, "
110 "const dictionary&)",
112 ) << "Unknown patch field type " << patchFieldType
113 << " for field " << iF.name() << " on patch " << p.name()
114 << " for patch type " << p.type() << endl << endl
115 << "Valid patch field types are :" << endl
116 << dictionaryConstructorTablePtr_->sortedToc()
117 << exit(FatalIOError);
123 !dict.found("patchType")
124 || word(dict.lookup("patchType")) != p.type()
127 typename dictionaryConstructorTable::iterator patchTypeCstrIter
128 = dictionaryConstructorTablePtr_->find(p.type());
132 patchTypeCstrIter != dictionaryConstructorTablePtr_->end()
133 && patchTypeCstrIter() != cstrIter()
138 "fvPatchField<Type>::New(const fvPatch&, "
139 "const DimensionedField<Type, volMesh>&, "
140 "const dictionary&)",
142 ) << "Inconsistent patch and patchField types for field "
143 << iF.name() << " on patch " << p.name() << "\n"
144 << " patch type " << p.type()
145 << " and patchField type " << patchFieldType
146 << exit(FatalIOError);
150 return cstrIter()(p, iF, dict);
155 Foam::tmp<Foam::fvPatchField<Type> > Foam::fvPatchField<Type>::New
157 const fvPatchField<Type>& ptf,
159 const DimensionedField<Type, volMesh>& iF,
160 const fvPatchFieldMapper& pfMapper
165 Info<< "fvPatchField<Type>::New(const fvPatchField<Type>&, "
166 "const fvPatch&, const DimensionedField<Type, volMesh>&, "
167 "const fvPatchFieldMapper&) : "
168 "constructing fvPatchField<Type>"
172 typename patchMapperConstructorTable::iterator cstrIter =
173 patchMapperConstructorTablePtr_->find(ptf.type());
175 if (cstrIter == patchMapperConstructorTablePtr_->end())
179 "fvPatchField<Type>::New(const fvPatchField<Type>&, "
180 "const fvPatch&, const DimensionedField<Type, volMesh>&, "
181 "const fvPatchFieldMapper&)"
182 ) << "unknown patch field type " << ptf.type()
183 << " for field " << iF.name() << " on patch " << p.name()
185 << "Valid patchField types are :" << endl
186 << patchMapperConstructorTablePtr_->sortedToc()
190 return cstrIter()(ptf, p, iF, pfMapper);
194 // ************************************************************************* //