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 #include "cyclicPointPatchField.H"
00027 #include <OpenFOAM/Swap.H>
00028
00029
00030
00031 namespace Foam
00032 {
00033
00034
00035
00036 template<class Type>
00037 cyclicPointPatchField<Type>::cyclicPointPatchField
00038 (
00039 const pointPatch& p,
00040 const DimensionedField<Type, pointMesh>& iF
00041 )
00042 :
00043 coupledPointPatchField<Type>(p, iF),
00044 cyclicPatch_(refCast<const cyclicPointPatch>(p))
00045 {}
00046
00047
00048 template<class Type>
00049 cyclicPointPatchField<Type>::cyclicPointPatchField
00050 (
00051 const pointPatch& p,
00052 const DimensionedField<Type, pointMesh>& iF,
00053 const dictionary& dict
00054 )
00055 :
00056 coupledPointPatchField<Type>(p, iF, dict),
00057 cyclicPatch_(refCast<const cyclicPointPatch>(p))
00058 {
00059 if (!isType<cyclicPointPatch>(p))
00060 {
00061 FatalIOErrorIn
00062 (
00063 "cyclicPointPatchField<Type>::cyclicPointPatchField\n"
00064 "(\n"
00065 " const pointPatch& p,\n"
00066 " const Field<Type>& field,\n"
00067 " const dictionary& dict\n"
00068 ")\n",
00069 dict
00070 ) << "patch " << this->patch().index() << " not cyclic type. "
00071 << "Patch type = " << p.type()
00072 << exit(FatalIOError);
00073 }
00074 }
00075
00076
00077 template<class Type>
00078 cyclicPointPatchField<Type>::cyclicPointPatchField
00079 (
00080 const cyclicPointPatchField<Type>& ptf,
00081 const pointPatch& p,
00082 const DimensionedField<Type, pointMesh>& iF,
00083 const pointPatchFieldMapper& mapper
00084 )
00085 :
00086 coupledPointPatchField<Type>(ptf, p, iF, mapper),
00087 cyclicPatch_(refCast<const cyclicPointPatch>(p))
00088 {
00089 if (!isType<cyclicPointPatch>(this->patch()))
00090 {
00091 FatalErrorIn
00092 (
00093 "cyclicPointPatchField<Type>::cyclicPointPatchField\n"
00094 "(\n"
00095 " const cyclicPointPatchField<Type>& ptf,\n"
00096 " const pointPatch& p,\n"
00097 " const DimensionedField<Type, pointMesh>& iF,\n"
00098 " const pointPatchFieldMapper& mapper\n"
00099 ")\n"
00100 ) << "Field type does not correspond to patch type for patch "
00101 << this->patch().index() << "." << endl
00102 << "Field type: " << typeName << endl
00103 << "Patch type: " << this->patch().type()
00104 << exit(FatalError);
00105 }
00106 }
00107
00108
00109 template<class Type>
00110 cyclicPointPatchField<Type>::cyclicPointPatchField
00111 (
00112 const cyclicPointPatchField<Type>& ptf,
00113 const DimensionedField<Type, pointMesh>& iF
00114 )
00115 :
00116 coupledPointPatchField<Type>(ptf, iF),
00117 cyclicPatch_(ptf.cyclicPatch_)
00118 {}
00119
00120
00121
00122
00123 template<class Type>
00124 void cyclicPointPatchField<Type>::swapAdd(Field<Type>& pField) const
00125 {
00126 Field<Type> pf(this->patchInternalField(pField));
00127
00128 const edgeList& pairs = cyclicPatch_.transformPairs();
00129
00130 if (doTransform())
00131 {
00132 forAll(pairs, pairi)
00133 {
00134 Type tmp = pf[pairs[pairi][0]];
00135 pf[pairs[pairi][0]] = transform(forwardT()[0], pf[pairs[pairi][1]]);
00136 pf[pairs[pairi][1]] = transform(reverseT()[0], tmp);
00137 }
00138 }
00139 else
00140 {
00141 forAll(pairs, pairi)
00142 {
00143 Swap(pf[pairs[pairi][0]], pf[pairs[pairi][1]]);
00144 }
00145 }
00146
00147 this->addToInternalField(pField, pf);
00148 }
00149
00150
00151
00152
00153 }
00154
00155