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 \*---------------------------------------------------------------------------*/
26 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
31 // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
34 tmp<fvsPatchField<Type> > fvsPatchField<Type>::New
36 const word& patchFieldType,
38 const DimensionedField<Type, surfaceMesh>& iF
43 Info<< "fvsPatchField<Type>::New(const word&, const fvPatch&, "
44 "const DimensionedField<Type, surfaceMesh>&) : "
45 "constructing fvsPatchField<Type>"
49 typename patchConstructorTable::iterator cstrIter =
50 patchConstructorTablePtr_->find(patchFieldType);
52 if (cstrIter == patchConstructorTablePtr_->end())
54 if (cstrIter == patchConstructorTablePtr_->end())
58 "fvsPatchField<Type>::New(const word&, const fvPatch&, "
59 "const DimensionedField<Type, surfaceMesh>)"
60 ) << "Unknown patch field type " << patchFieldType
62 << "Valid patchField types are :" << endl
63 << patchConstructorTablePtr_->sortedToc()
68 typename patchConstructorTable::iterator patchTypeCstrIter =
69 patchConstructorTablePtr_->find(p.type());
71 if (patchTypeCstrIter != patchConstructorTablePtr_->end())
73 return patchTypeCstrIter()(p, iF);
77 return cstrIter()(p, iF);
83 tmp<fvsPatchField<Type> > fvsPatchField<Type>::New
86 const DimensionedField<Type, surfaceMesh>& iF,
87 const dictionary& dict
92 Info<< "fvsPatchField<Type>::New(const fvPatch&, "
93 "const DimensionedField<Type, surfaceMesh>&, "
94 "const dictionary&) : "
95 "constructing fvsPatchField<Type>"
99 word patchFieldType(dict.lookup("type"));
101 typename dictionaryConstructorTable::iterator cstrIter
102 = dictionaryConstructorTablePtr_->find(patchFieldType);
104 if (cstrIter == dictionaryConstructorTablePtr_->end())
106 if (!disallowDefaultFvsPatchField)
108 cstrIter = dictionaryConstructorTablePtr_->find
110 fvsPatchField<Type>::calculatedType()
114 if (cstrIter == dictionaryConstructorTablePtr_->end())
118 "fvsPatchField<Type>::New(const fvPatch&, "
119 "const DimensionedField<Type, surfaceMesh>&, "
120 "const dictionary&)",
122 ) << "Unknown patchField type " << patchFieldType
123 << " for patch type " << p.type() << endl << endl
124 << "Valid patchField types are :" << endl
125 << dictionaryConstructorTablePtr_->sortedToc()
126 << exit(FatalIOError);
132 !dict.found("patchType")
133 || word(dict.lookup("patchType")) != p.type()
136 typename dictionaryConstructorTable::iterator patchTypeCstrIter
137 = dictionaryConstructorTablePtr_->find(p.type());
141 patchTypeCstrIter != dictionaryConstructorTablePtr_->end()
142 && patchTypeCstrIter() != cstrIter()
147 "fvsPatchField<Type>const fvPatch&, "
148 "const DimensionedField<Type, surfaceMesh>&, "
149 "const dictionary&)",
151 ) << "inconsistent patch and patchField types for field "
153 << " patch type " << p.type()
154 << " and patchField type " << patchFieldType
155 << exit(FatalIOError);
159 return cstrIter()(p, iF, dict);
163 // Return a pointer to a new patch created on freestore from
164 // a given fvsPatchField<Type> mapped onto a new patch
166 tmp<fvsPatchField<Type> > fvsPatchField<Type>::New
168 const fvsPatchField<Type>& ptf,
170 const DimensionedField<Type, surfaceMesh>& iF,
171 const fvPatchFieldMapper& pfMapper
176 Info<< "fvsPatchField<Type>::New(const fvsPatchField<Type>&,"
177 " const fvPatch&, const DimensionedField<Type, surfaceMesh>&, "
178 "const fvPatchFieldMapper&) : "
179 "constructing fvsPatchField<Type>"
183 typename patchMapperConstructorTable::iterator cstrIter =
184 patchMapperConstructorTablePtr_->find(ptf.type());
186 if (cstrIter == patchMapperConstructorTablePtr_->end())
190 "fvsPatchField<Type>::New(const fvsPatchField<Type>&, "
191 "const fvPatch&, const Field<Type>&, "
192 "const fvPatchFieldMapper&)"
193 ) << "unknown patch field type " << ptf.type() << endl << endl
194 << "Valid patchField types are :" << endl
195 << patchMapperConstructorTablePtr_->sortedToc()
199 typename patchMapperConstructorTable::iterator
200 patchTypeCstrIter = patchMapperConstructorTablePtr_->find(p.type());
202 if (patchTypeCstrIter != patchMapperConstructorTablePtr_->end())
204 return patchTypeCstrIter()(ptf, p, iF, pfMapper);
208 return cstrIter()(ptf, p, iF, pfMapper);
213 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
215 } // End namespace Foam
217 // ************************************************************************* //