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 \*---------------------------------------------------------------------------*/
30 // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
33 tmp<faPatchField<Type> > faPatchField<Type>::New
35 const word& patchFieldType,
37 const DimensionedField<Type, areaMesh>& iF
42 Info<< "faPatchField<Type>::New(const word&, const faPatch&, "
43 "const DimensionedField<Type, areaMesh>&) : "
44 "constructing faPatchField<Type>"
48 typename patchConstructorTable::iterator cstrIter =
49 patchConstructorTablePtr_->find(patchFieldType);
51 if (cstrIter == patchConstructorTablePtr_->end())
55 "faPatchField<Type>::New(const word&, const faPatch&, "
56 "const DimensionedField<Type, areaMesh>&)"
57 ) << "Unknown patchTypefield type " << patchFieldType
59 << "Valid patchField types are :" << endl
60 << patchConstructorTablePtr_->toc()
64 typename patchConstructorTable::iterator patchTypeCstrIter =
65 patchConstructorTablePtr_->find(p.type());
67 if (patchTypeCstrIter != patchConstructorTablePtr_->end())
69 return patchTypeCstrIter()(p, iF);
73 return cstrIter()(p, iF);
79 tmp<faPatchField<Type> > faPatchField<Type>::New
82 const DimensionedField<Type, areaMesh>& iF,
83 const dictionary& dict
88 Info<< "faPatchField<Type>::New(const faPatch&, "
89 "const DimensionedField<Type, areaMesh>&, const dictionary&) : "
90 "constructing faPatchField<Type>"
94 word patchFieldType(dict.lookup("type"));
96 typename dictionaryConstructorTable::iterator cstrIter
97 = dictionaryConstructorTablePtr_->find(patchFieldType);
99 if (cstrIter == dictionaryConstructorTablePtr_->end())
101 if (!disallowDefaultFaPatchField)
103 cstrIter = dictionaryConstructorTablePtr_->find("default");
106 if (cstrIter == dictionaryConstructorTablePtr_->end())
110 "faPatchField<Type>::New(const faPatch&, "
111 "const DimensionedField<Type, areaMesh>&, const dictionary&)",
113 ) << "Unknown patchField type " << patchFieldType
114 << " for patch type " << p.type() << endl << endl
115 << "Valid patchField types are :" << endl
116 << dictionaryConstructorTablePtr_->toc()
117 << exit(FatalIOError);
121 typename dictionaryConstructorTable::iterator patchTypeCstrIter
122 = dictionaryConstructorTablePtr_->find(p.type());
126 patchTypeCstrIter != dictionaryConstructorTablePtr_->end()
127 && *patchTypeCstrIter != *cstrIter
132 "faPatchField<Type>const faPatch&, "
133 "const DimensionedField<Type, areaMesh>&, const dictionary&)",
135 ) << "inconsistent patch and patchField types for \n"
136 " patch type " << p.type()
137 << " and patchField type " << patchFieldType
138 << exit(FatalIOError);
141 return cstrIter()(p, iF, dict);
146 tmp<faPatchField<Type> > faPatchField<Type>::New
148 const faPatchField<Type>& ptf,
150 const DimensionedField<Type, areaMesh>& iF,
151 const faPatchFieldMapper& pfMapper
156 Info<< "faPatchField<Type>::New(const faPatchField<Type>&,"
157 " const faPatch&, const DimensionedField<Type, areaMesh>&, "
158 "const faPatchFieldMapper&) : "
159 "constructing faPatchField<Type>"
163 typename patchMapperConstructorTable::iterator cstrIter =
164 patchMapperConstructorTablePtr_->find(ptf.type());
166 if (cstrIter == patchMapperConstructorTablePtr_->end())
170 "faPatchField<Type>::New(const faPatchField<Type>&, "
171 "const faPatch&, const DimensionedField<Type, areaMesh>&, "
172 "const faPatchFieldMapper&)"
173 ) << "unknown patchTypefield type " << ptf.type() << endl << endl
174 << "Valid patchField types are :" << endl
175 << patchMapperConstructorTablePtr_->toc()
179 typename patchMapperConstructorTable::iterator
180 patchTypeCstrIter = patchMapperConstructorTablePtr_->find(p.type());
182 if (patchTypeCstrIter != patchMapperConstructorTablePtr_->end())
184 return patchTypeCstrIter()(ptf, p, iF, pfMapper);
188 return cstrIter()(ptf, p, iF, pfMapper);
193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
195 } // End namespace Foam
197 // ************************************************************************* //