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 template<class Type>
00029 Foam::autoPtr<Foam::pointPatchField<Type> > Foam::pointPatchField<Type>::New
00030 (
00031 const word& patchFieldType,
00032 const pointPatch& p,
00033 const DimensionedField<Type, pointMesh>& iF
00034 )
00035 {
00036 if (debug)
00037 {
00038 Info<< "PointPatchField<Type>::"
00039 "New(const word&, const pointPatch&, const Field<Type>&) : "
00040 "constructing pointPatchField<Type>"
00041 << endl;
00042 }
00043
00044 typename pointPatchConstructorTable::iterator cstrIter =
00045 pointPatchConstructorTablePtr_->find(patchFieldType);
00046
00047 if (cstrIter == pointPatchConstructorTablePtr_->end())
00048 {
00049 FatalErrorIn
00050 (
00051 "PointPatchField<Type>::New"
00052 "(const word&, const pointPatch&, const Field<Type>&)"
00053 ) << "Unknown patchTypefield type "
00054 << patchFieldType
00055 << endl << endl
00056 << "Valid patchField types are :" << endl
00057 << pointPatchConstructorTablePtr_->sortedToc()
00058 << exit(FatalError);
00059 }
00060
00061 typename pointPatchConstructorTable::iterator patchTypeCstrIter =
00062 pointPatchConstructorTablePtr_->find(p.type());
00063
00064 if (patchTypeCstrIter != pointPatchConstructorTablePtr_->end())
00065 {
00066 return autoPtr<pointPatchField<Type> >(patchTypeCstrIter()(p, iF));
00067 }
00068 else
00069 {
00070 return autoPtr<pointPatchField<Type> >(cstrIter()(p, iF));
00071 }
00072 }
00073
00074
00075 template<class Type>
00076 Foam::autoPtr<Foam::pointPatchField<Type> > Foam::pointPatchField<Type>::New
00077 (
00078 const pointPatch& p,
00079 const DimensionedField<Type, pointMesh>& iF,
00080 const dictionary& dict
00081 )
00082 {
00083 if (debug)
00084 {
00085 Info<< "PointPatchField<Type>::"
00086 "New(const pointPatch&, const Field<Type>&, const dictionary&)"
00087 " : constructing pointPatchField<Type>"
00088 << endl;
00089 }
00090
00091 word patchFieldType(dict.lookup("type"));
00092
00093 typename dictionaryConstructorTable::iterator cstrIter
00094 = dictionaryConstructorTablePtr_->find(patchFieldType);
00095
00096 if (cstrIter == dictionaryConstructorTablePtr_->end())
00097 {
00098 if (!disallowGenericPointPatchField)
00099 {
00100 cstrIter = dictionaryConstructorTablePtr_->find("generic");
00101 }
00102
00103 if (cstrIter == dictionaryConstructorTablePtr_->end())
00104 {
00105 FatalIOErrorIn
00106 (
00107 "PointPatchField<Type>::"
00108 "New(const pointPatch&, const Field<Type>&, const dictionary&)",
00109 dict
00110 ) << "Unknown patchField type " << patchFieldType
00111 << " for patch type " << p.type() << endl << endl
00112 << "Valid patchField types are :" << endl
00113 << dictionaryConstructorTablePtr_->sortedToc()
00114 << exit(FatalIOError);
00115 }
00116 }
00117
00118 if
00119 (
00120 !dict.found("patchType")
00121 || word(dict.lookup("patchType")) != p.type()
00122 )
00123 {
00124 typename dictionaryConstructorTable::iterator patchTypeCstrIter
00125 = dictionaryConstructorTablePtr_->find(p.type());
00126
00127 if
00128 (
00129 patchTypeCstrIter != dictionaryConstructorTablePtr_->end()
00130 && patchTypeCstrIter() != cstrIter()
00131 )
00132 {
00133 FatalIOErrorIn
00134 (
00135 "PointPatchField<Type>const pointPatch&, "
00136 "const Field<Type>&, const dictionary&)",
00137 dict
00138 ) << "inconsistent patch and patchField types for \n"
00139 << " patch type " << p.type()
00140 << " and patchField type " << patchFieldType
00141 << exit(FatalIOError);
00142 }
00143 }
00144
00145 return autoPtr<pointPatchField<Type> >(cstrIter()(p, iF, dict));
00146 }
00147
00148
00149
00150
00151 template<class Type>
00152 Foam::autoPtr<Foam::pointPatchField<Type> > Foam::pointPatchField<Type>::New
00153 (
00154 const pointPatchField<Type>& ptf,
00155 const pointPatch& p,
00156 const DimensionedField<Type, pointMesh>& iF,
00157 const pointPatchFieldMapper& pfMapper
00158 )
00159 {
00160 if (debug)
00161 {
00162 Info<< "PointPatchField<Type>::"
00163 "New(const pointPatchField<Type>&,"
00164 " const pointPatch&, const Field<Type>&, "
00165 "const pointPatchFieldMapper&) : "
00166 "constructing pointPatchField<Type>"
00167 << endl;
00168 }
00169
00170 typename patchMapperConstructorTable::iterator cstrIter =
00171 patchMapperConstructorTablePtr_->find(ptf.type());
00172
00173 if (cstrIter == patchMapperConstructorTablePtr_->end())
00174 {
00175 FatalErrorIn
00176 (
00177 "PointPatchField<Type>::"
00178 "New(const pointPatchField<Type>&, "
00179 "const pointPatch&, const Field<Type>&, "
00180 "const pointPatchFieldMapper&)"
00181 ) << "unknown patchTypefield type "
00182 << ptf.type() << endl << endl
00183 << "Valid patchField types are :" << endl
00184 << patchMapperConstructorTablePtr_->sortedToc()
00185 << exit(FatalError);
00186 }
00187
00188 return autoPtr<pointPatchField<Type> >(cstrIter()(ptf, p, iF, pfMapper));
00189 }
00190
00191
00192