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/ParticleInteractAttrib.h"
00028 #include "Message/Message.h"
00029 #include "Profile/Profiler.h"
00030
00031
00033
00034
00035 template<class T>
00036 size_t
00037 ParticleInteractAttrib<T>::putMessage(Message& msg,
00038 size_t M, size_t I) {
00039 TAU_PROFILE("ParticleInteractAttrib::putMessage()",
00040 "unsigned (Message, unsigned, unsigned)", TAU_PARTICLE);
00041
00042 if (I >= this->size()) {
00043
00044 typename ParticleList_t::iterator currp = GhostList.begin() + (I - this->size());
00045 typename ParticleList_t::iterator endp = currp + M;
00046 ::putMessage(msg, currp, endp);
00047 }
00048 else {
00049 typename ParticleList_t::iterator currp = this->ParticleList.begin() + I;
00050 typename ParticleList_t::iterator endp = currp + M;
00051 ::putMessage(msg, currp, endp);
00052 }
00053 return M;
00054 }
00055
00056
00058
00059
00060
00061 template<class T>
00062 size_t
00063 ParticleInteractAttrib<T>::ghostDestroy(size_t M, size_t I) {
00064 TAU_PROFILE("ParticleInteractAttrib::ghostDestroy()",
00065 "unsigned (unsigned, unsigned)", TAU_PARTICLE);
00066
00067 if (M > 0) {
00068
00069
00070 typename ParticleList_t::iterator putloc = GhostList.begin() + I;
00071 typename ParticleList_t::iterator getloc = GhostList.end() - M;
00072 typename ParticleList_t::iterator endloc = GhostList.end();
00073
00074
00075 if ((I + M) > (GhostList.size() - M))
00076 getloc = putloc + M;
00077
00078
00079 while (getloc != endloc)
00080 *putloc++ = *getloc++;
00081
00082
00083 GhostList.erase(GhostList.end() - M, GhostList.end());
00084 }
00085
00086 return M;
00087 }
00088
00089
00091
00092
00093
00094 template<class T>
00095 size_t
00096 ParticleInteractAttrib<T>::ghostGetMessage(Message& msg, size_t M) {
00097 TAU_PROFILE("ParticleInteractAttrib::ghostGetMessage()",
00098 "unsigned (Message, unsigned)", TAU_PARTICLE);
00099
00100 size_t currsize = GhostList.size();
00101 GhostList.insert(GhostList.end(), M, T());
00102 ::getMessage_iter(msg, GhostList.begin() + currsize);
00103 return M;
00104 }
00105
00106
00108
00109
00110 template<class T>
00111 void ParticleInteractAttrib<T>::printDebug(Inform& o) {
00112 TAU_PROFILE("ParticleInteractAttrib::printDebug()",
00113 "void (Inform)", TAU_PARTICLE | TAU_IO);
00114
00115 o << "PAttr: size = " << this->ParticleList.size()
00116 << ", capacity = " << this->ParticleList.capacity()
00117 << ", ghosts = " << GhostList.size();
00118 }
00119
00120
00121
00122
00123
00124
00125