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 "Particle/PAssign.h"
00028 #include "Particle/PAssignDefs.h"
00029 #include "Particle/ParticleAttrib.h"
00030 #include "Particle/ParticleAttribElem.h"
00031 #include "PETE/IpplExpressions.h"
00032 #include "Utility/IpplStats.h"
00033 #include "Profile/Profiler.h"
00034
00035
00037
00038 template<class T, unsigned Dim, class RHS, class OP>
00039 void
00040 assign(const ParticleAttribElem<T,Dim>& ca, RHS b, OP op)
00041 {
00042 TAU_TYPE_STRING(taustr, "void (" + CT(ca) + ", " + CT(b) + ", "
00043 + CT(op) + " )" );
00044 TAU_PROFILE("assign()", taustr, TAU_ASSIGN | TAU_PARTICLE);
00045
00046
00047 ParticleAttribElem<T,Dim>& a = (ParticleAttribElem<T,Dim>&) ca;
00048 typename RHS::Wrapped& bb = b.PETE_unwrap();
00049
00050
00051 typename ParticleAttribElem<T,Dim>::iterator pa = a.begin(), aend = a.end();
00052 for ( ; pa != aend ; ++pa) {
00053 PETE_apply( op, *pa, for_each(bb,EvalFunctor_0()) );
00054 for_each(bb,PETE_Increment(),PETE_NullCombiner());
00055 }
00056
00057 INCIPPLSTAT(incParticleExpressions);
00058 }
00059
00060 template<class T, class RHS, class OP>
00061 void
00062 assign(const ParticleAttrib<T>& ca, RHS b, OP op)
00063 {
00064 TAU_TYPE_STRING(taustr, "void (" + CT(ca) + ", " + CT(b) + ", "
00065 + CT(op) + " )" );
00066 TAU_PROFILE("assign()", taustr, TAU_ASSIGN | TAU_PARTICLE);
00067
00068
00069 ParticleAttrib<T>& a = (ParticleAttrib<T>&) ca;
00070 typename RHS::Wrapped& bb = b.PETE_unwrap();
00071
00072
00073 typename ParticleAttrib<T>::iterator pa = a.begin(), aend = a.end();
00074 for ( ; pa != aend ; ++pa) {
00075 PETE_apply( op, *pa, for_each(bb,EvalFunctor_0()) );
00076 for_each(bb,PETE_Increment(),PETE_NullCombiner());
00077 }
00078
00079 INCIPPLSTAT(incParticleExpressions);
00080 }
00081
00083
00084
00085
00086
00087
00088