newFvsPatchField.C
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 namespace Foam
00030 {
00031
00032
00033
00034 template<class Type>
00035 tmp<fvsPatchField<Type> > fvsPatchField<Type>::New
00036 (
00037 const word& patchFieldType,
00038 const fvPatch& p,
00039 const DimensionedField<Type, surfaceMesh>& iF
00040 )
00041 {
00042 if (debug)
00043 {
00044 Info<< "fvsPatchField<Type>::New(const word&, const fvPatch&, "
00045 "const Field<Type>&) : "
00046 "constructing fvsPatchField<Type>"
00047 << endl;
00048 }
00049
00050 typename patchConstructorTable::iterator cstrIter =
00051 patchConstructorTablePtr_->find(patchFieldType);
00052
00053 if (cstrIter == patchConstructorTablePtr_->end())
00054 {
00055 FatalErrorIn
00056 (
00057 "fvsPatchField<Type>::New(const word&, const fvPatch&, "
00058 "const Field<Type>&)"
00059 ) << "Unknown patchTypefield type " << patchFieldType
00060 << endl << endl
00061 << "Valid patchField types are :" << endl
00062 << patchConstructorTablePtr_->toc()
00063 << exit(FatalError);
00064 }
00065
00066 typename patchConstructorTable::iterator patchTypeCstrIter =
00067 patchConstructorTablePtr_->find(p.type());
00068
00069 if (patchTypeCstrIter != patchConstructorTablePtr_->end())
00070 {
00071 return patchTypeCstrIter()(p, iF);
00072 }
00073 else
00074 {
00075 return cstrIter()(p, iF);
00076 }
00077 }
00078
00079
00080 template<class Type>
00081 tmp<fvsPatchField<Type> > fvsPatchField<Type>::New
00082 (
00083 const fvPatch& p,
00084 const DimensionedField<Type, surfaceMesh>& iF,
00085 const dictionary& dict
00086 )
00087 {
00088 if (debug)
00089 {
00090 Info<< "fvsPatchField<Type>::New(const fvPatch&, const Field<Type>&, "
00091 "const dictionary&) : "
00092 "constructing fvsPatchField<Type>"
00093 << endl;
00094 }
00095
00096 word patchFieldType(dict.lookup("type"));
00097
00098 typename dictionaryConstructorTable::iterator cstrIter
00099 = dictionaryConstructorTablePtr_->find(patchFieldType);
00100
00101 if (cstrIter == dictionaryConstructorTablePtr_->end())
00102 {
00103 if (!disallowDefaultFvsPatchField)
00104 {
00105 cstrIter = dictionaryConstructorTablePtr_->find("default");
00106 }
00107
00108 if (cstrIter == dictionaryConstructorTablePtr_->end())
00109 {
00110 FatalIOErrorIn
00111 (
00112 "fvsPatchField<Type>::New(const fvPatch&, const Field<Type>&, "
00113 "const dictionary&)",
00114 dict
00115 ) << "Unknown patchField type " << patchFieldType
00116 << " for patch type " << p.type() << endl << endl
00117 << "Valid patchField types are :" << endl
00118 << dictionaryConstructorTablePtr_->toc()
00119 << exit(FatalIOError);
00120 }
00121 }
00122
00123 if
00124 (
00125 !dict.found("patchType")
00126 || word(dict.lookup("patchType")) != p.type()
00127 )
00128 {
00129 typename dictionaryConstructorTable::iterator patchTypeCstrIter
00130 = dictionaryConstructorTablePtr_->find(p.type());
00131
00132 if
00133 (
00134 patchTypeCstrIter != dictionaryConstructorTablePtr_->end()
00135 && patchTypeCstrIter() != cstrIter()
00136 )
00137 {
00138 FatalIOErrorIn
00139 (
00140 "fvsPatchField<Type>const fvPatch&, const Field<Type>&, "
00141 "const dictionary&)",
00142 dict
00143 ) << "inconsistent patch and patchField types for \n"
00144 " patch type " << p.type()
00145 << " and patchField type " << patchFieldType
00146 << exit(FatalIOError);
00147 }
00148 }
00149
00150 return cstrIter()(p, iF, dict);
00151 }
00152
00153
00154
00155
00156 template<class Type>
00157 tmp<fvsPatchField<Type> > fvsPatchField<Type>::New
00158 (
00159 const fvsPatchField<Type>& ptf,
00160 const fvPatch& p,
00161 const DimensionedField<Type, surfaceMesh>& iF,
00162 const fvPatchFieldMapper& pfMapper
00163 )
00164 {
00165 if (debug)
00166 {
00167 Info<< "fvsPatchField<Type>::New(const fvsPatchField<Type>&,"
00168 " const fvPatch&, const Field<Type>&, "
00169 "const fvPatchFieldMapper&) : "
00170 "constructing fvsPatchField<Type>"
00171 << endl;
00172 }
00173
00174 typename patchMapperConstructorTable::iterator cstrIter =
00175 patchMapperConstructorTablePtr_->find(ptf.type());
00176
00177 if (cstrIter == patchMapperConstructorTablePtr_->end())
00178 {
00179 FatalErrorIn
00180 (
00181 "fvsPatchField<Type>::New(const fvsPatchField<Type>&, "
00182 "const fvPatch&, const Field<Type>&, "
00183 "const fvPatchFieldMapper&)"
00184 ) << "unknown patchTypefield type " << ptf.type() << endl << endl
00185 << "Valid patchField types are :" << endl
00186 << patchMapperConstructorTablePtr_->toc()
00187 << exit(FatalError);
00188 }
00189
00190 typename patchMapperConstructorTable::iterator
00191 patchTypeCstrIter = patchMapperConstructorTablePtr_->find(p.type());
00192
00193 if (patchTypeCstrIter != patchMapperConstructorTablePtr_->end())
00194 {
00195 return patchTypeCstrIter()(ptf, p, iF, pfMapper);
00196 }
00197 else
00198 {
00199 return cstrIter()(ptf, p, iF, pfMapper);
00200 }
00201 }
00202
00203
00204
00205
00206 }
00207
00208
Copyright © 2000-2009 OpenCFD Ltd