GAMGAgglomerationTemplates.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 #include "GAMGAgglomeration.H"
00028
00029
00030
00031 template<class Type>
00032 void Foam::GAMGAgglomeration::restrictField
00033 (
00034 Field<Type>& cf,
00035 const Field<Type>& ff,
00036 const label fineLevelIndex
00037 ) const
00038 {
00039 const labelList& fineToCoarse = restrictAddressing_[fineLevelIndex];
00040
00041 if (ff.size() != fineToCoarse.size())
00042 {
00043 FatalErrorIn
00044 (
00045 "void GAMGAgglomeration::restrictField"
00046 "(Field<Type>& cf, const Field<Type>& ff, "
00047 "const label fineLevelIndex) const"
00048 ) << "field does not correspond to level " << fineLevelIndex
00049 << " sizes: field = " << ff.size()
00050 << " level = " << fineToCoarse.size()
00051 << abort(FatalError);
00052 }
00053
00054 cf = pTraits<Type>::zero;
00055
00056 forAll(ff, i)
00057 {
00058 cf[fineToCoarse[i]] += ff[i];
00059 }
00060 }
00061
00062
00063 template<class Type>
00064 void Foam::GAMGAgglomeration::restrictFaceField
00065 (
00066 Field<Type>& cf,
00067 const Field<Type>& ff,
00068 const label fineLevelIndex
00069 ) const
00070 {
00071 const labelList& fineToCoarse = faceRestrictAddressing_[fineLevelIndex];
00072
00073 cf = pTraits<Type>::zero;
00074
00075 forAll(fineToCoarse, ffacei)
00076 {
00077 label cFace = fineToCoarse[ffacei];
00078
00079 if (cFace >= 0)
00080 {
00081 cf[cFace] += ff[ffacei];
00082 }
00083 }
00084 }
00085
00086
00087 template<class Type>
00088 void Foam::GAMGAgglomeration::prolongField
00089 (
00090 Field<Type>& ff,
00091 const Field<Type>& cf,
00092 const label coarseLevelIndex
00093 ) const
00094 {
00095 const labelList& fineToCoarse = restrictAddressing_[coarseLevelIndex];
00096
00097 forAll(fineToCoarse, i)
00098 {
00099 ff[i] = cf[fineToCoarse[i]];
00100 }
00101 }
00102
00103
00104
Copyright © 2000-2009 OpenCFD Ltd