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 "processorPointPatchField.H"
00027 #include <OpenFOAM/transformField.H>
00028 #include <OpenFOAM/processorPolyPatch.H>
00029
00030
00031
00032 namespace Foam
00033 {
00034
00035
00036
00037 template<class Type>
00038 processorPointPatchField<Type>::processorPointPatchField
00039 (
00040 const pointPatch& p,
00041 const DimensionedField<Type, pointMesh>& iF
00042 )
00043 :
00044 coupledPointPatchField<Type>(p, iF),
00045 procPatch_(refCast<const processorPointPatch>(p))
00046 {}
00047
00048
00049 template<class Type>
00050 processorPointPatchField<Type>::processorPointPatchField
00051 (
00052 const pointPatch& p,
00053 const DimensionedField<Type, pointMesh>& iF,
00054 const dictionary& dict
00055 )
00056 :
00057 coupledPointPatchField<Type>(p, iF, dict),
00058 procPatch_(refCast<const processorPointPatch>(p))
00059 {}
00060
00061
00062 template<class Type>
00063 processorPointPatchField<Type>::processorPointPatchField
00064 (
00065 const processorPointPatchField<Type>& ptf,
00066 const pointPatch& p,
00067 const DimensionedField<Type, pointMesh>& iF,
00068 const pointPatchFieldMapper& mapper
00069 )
00070 :
00071 coupledPointPatchField<Type>(ptf, p, iF, mapper),
00072 procPatch_(refCast<const processorPointPatch>(ptf.patch()))
00073 {}
00074
00075
00076 template<class Type>
00077 processorPointPatchField<Type>::processorPointPatchField
00078 (
00079 const processorPointPatchField<Type>& ptf,
00080 const DimensionedField<Type, pointMesh>& iF
00081 )
00082 :
00083 coupledPointPatchField<Type>(ptf, iF),
00084 procPatch_(refCast<const processorPointPatch>(ptf.patch()))
00085 {}
00086
00087
00088
00089
00090 template<class Type>
00091 processorPointPatchField<Type>::~processorPointPatchField()
00092 {}
00093
00094
00095
00096
00097 template<class Type>
00098 void processorPointPatchField<Type>::initSwapAdd(Field<Type>& pField) const
00099 {
00100 if (Pstream::parRun())
00101 {
00102
00103 Field<Type> pf(this->patchInternalField(pField));
00104
00105 OPstream::write
00106 (
00107 Pstream::blocking,
00108 procPatch_.neighbProcNo(),
00109 reinterpret_cast<const char*>(pf.begin()),
00110 pf.byteSize()
00111 );
00112 }
00113 }
00114
00115
00116 template<class Type>
00117 void processorPointPatchField<Type>::swapAdd(Field<Type>& pField) const
00118 {
00119 if (Pstream::parRun())
00120 {
00121 Field<Type> pnf(this->size());
00122
00123 IPstream::read
00124 (
00125 Pstream::blocking,
00126 procPatch_.neighbProcNo(),
00127 reinterpret_cast<char*>(pnf.begin()),
00128 pnf.byteSize()
00129 );
00130
00131 if (doTransform())
00132 {
00133 const processorPolyPatch& ppp = procPatch_.procPolyPatch();
00134 const tensorField& forwardT = ppp.forwardT();
00135
00136 if (forwardT.size() == 1)
00137 {
00138 transform(pnf, forwardT[0], pnf);
00139 }
00140 else
00141 {
00142 const labelList& nonGlobalPatchPoints =
00143 procPatch_.nonGlobalPatchPoints();
00144 const labelListList& pointFaces = ppp.pointFaces();
00145
00146 forAll(nonGlobalPatchPoints, pfi)
00147 {
00148 pnf[pfi] = transform
00149 (
00150 forwardT[pointFaces[nonGlobalPatchPoints[pfi]][0]],
00151 pnf[pfi]
00152 );
00153 }
00154 }
00155 }
00156
00157 this->addToInternalField(pField, pnf);
00158 }
00159 }
00160
00161
00162
00163
00164 }
00165
00166