00001
00007 #include "common.h"
00008
00009
00010
00011
00012
00013
00014
00015 inline void pp_clamp(int &n, int nslabs) {
00016 int a = n < 0 ? nslabs : 0;
00017 int b = n >= nslabs ? nslabs : 0;
00018 n += a-b;
00019 }
00020
00021
00022 inline void pp_reduction(int nslabs, int n1, int n2,
00023 int atype1, int atype2, int numtypes,
00024 BigReal vxx, BigReal vyy, BigReal vzz,
00025 BigReal *reduction) {
00026
00027 int slaboffset = atype1*numtypes + atype2;
00028 reduction += slaboffset * 3*nslabs;
00029
00030 vxx *= 0.5;
00031 vyy *= 0.5;
00032 vzz *= 0.5;
00033 reduction[3*n1 ] += vxx;
00034 reduction[3*n1+1] += vyy;
00035 reduction[3*n1+2] += vzz;
00036 reduction[3*n2 ] += vxx;
00037 reduction[3*n2+1] += vyy;
00038 reduction[3*n2+2] += vzz;
00039 }
00040