src/Particle/PAssignDefs.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 /***************************************************************************
00003  *
00004  * The IPPL Framework
00005  * 
00006  *
00007  * Visit http://people.web.psi.ch/adelmann/ for more details
00008  *
00009  ***************************************************************************/
00010 
00011 #ifndef PASSIGN_DEFS_H
00012 #define PASSIGN_DEFS_H
00013 
00014 // include files
00015 #include "PETE/IpplExpressions.h"
00016 #include "AppTypes/AppTypeTraits.h"
00017 
00018 // forward declarations
00019 template<class T> class ParticleAttrib;
00020 template<class T, unsigned Dim> class ParticleAttribElem;
00021 
00022 
00024 //
00025 // Evaluation functor.
00026 //
00028 
00029 template<class T>
00030 inline T&
00031 for_each(ParticleAttribIterator<T>& p, EvalFunctor_0)
00032 {
00033   return *p;
00034 }
00035 
00036 #define DEFINE_EVALFUNCTOR_PAE(D)                                          \
00037                                                                            \
00038 template<class T>                                                          \
00039 inline typename AppTypeTraits<T>::Element_t&                               \
00040 for_each(ParticleAttribElemIterator<T,D>& p, EvalFunctor_0)                \
00041 {                                                                          \
00042   return *p;                                                               \
00043 }
00044 
00045 DEFINE_EVALFUNCTOR_PAE(1)
00046 DEFINE_EVALFUNCTOR_PAE(2)
00047 DEFINE_EVALFUNCTOR_PAE(3)
00048 DEFINE_EVALFUNCTOR_PAE(4)
00049 DEFINE_EVALFUNCTOR_PAE(5)
00050 DEFINE_EVALFUNCTOR_PAE(6)
00051 
00052 
00054 //
00055 // Count the elements in an expression.
00056 //
00058 
00059 template<class T, class C>
00060 inline int
00061 for_each(const ParticleAttribIterator<T>& p, PETE_CountElems, C)
00062 {
00063   return p.getParticleList().size();
00064 }
00065 
00066 #define DEFINE_COUNTFUNCTOR_PAE(D)                                          \
00067                                                                             \
00068 template<class T, class C>                                                  \
00069 inline int                                                                  \
00070 for_each(const ParticleAttribElemIterator<T,D>& p, PETE_CountElems, C)      \
00071 {                                                                           \
00072   return p.getParticleAttribElem().size();                                  \
00073 }
00074 
00075 DEFINE_COUNTFUNCTOR_PAE(1)
00076 DEFINE_COUNTFUNCTOR_PAE(2)
00077 DEFINE_COUNTFUNCTOR_PAE(3)
00078 DEFINE_COUNTFUNCTOR_PAE(4)
00079 DEFINE_COUNTFUNCTOR_PAE(5)
00080 DEFINE_COUNTFUNCTOR_PAE(6)
00081 
00082 
00084 //
00085 // Increment the pointers in an expression.
00086 //
00088 
00089 template<class T, class C>
00090 inline int
00091 for_each(ParticleAttribIterator<T>& p, PETE_Increment, C)
00092 {
00093   ++p;
00094   return 0;
00095 }
00096 
00097 #define DEFINE_INCFUNCTOR_PAE(D)                                            \
00098                                                                             \
00099 template<class T, class C>                                                  \
00100 inline int                                                                  \
00101 for_each(ParticleAttribElemIterator<T,D>& p, PETE_Increment, C)             \
00102 {                                                                           \
00103   ++p;                                                                      \
00104   return 0;                                                                 \
00105 }
00106 
00107 DEFINE_INCFUNCTOR_PAE(1)
00108 DEFINE_INCFUNCTOR_PAE(2)
00109 DEFINE_INCFUNCTOR_PAE(3)
00110 DEFINE_INCFUNCTOR_PAE(4)
00111 DEFINE_INCFUNCTOR_PAE(5)
00112 DEFINE_INCFUNCTOR_PAE(6)
00113 
00114 
00115 
00116 #endif // PASSIGN_DEFS_H
00117 
00118 /***************************************************************************
00119  * $RCSfile: PAssignDefs.h,v $   $Author: adelmann $
00120  * $Revision: 1.1.1.1 $   $Date: 2003/01/23 07:40:28 $
00121  * IPPL_VERSION_ID: $Id: PAssignDefs.h,v 1.1.1.1 2003/01/23 07:40:28 adelmann Exp $ 
00122  ***************************************************************************/
00123 

Generated on Mon Jan 16 13:23:53 2006 for IPPL by  doxygen 1.4.6