43 "No operator()(unsigned) for this element type!!");
54 "No operator()(unsigned,unsigned) for this element type!!");
65 "No operator()(unsigned,unsigned,unsigned) for this element type!!");
81 ParticleList.insert(ParticleList.begin()+LocalSize, M,
T());
83 attributeIsDirty_ =
true;
111 if ((I + M) > (LocalSize - M))
115 while (getloc != endloc)
116 *putloc++ = *getloc++;
118 ParticleList.erase(endloc - M, endloc);
123 ParticleList.erase(loc, loc + M);
126 attributeIsDirty_ =
true;
145 if (dlist.empty())
return;
146 typedef std::vector< std::pair<size_t,size_t> > dlist_t;
149 dlist_t::const_reverse_iterator rbeg, rend = dlist.rend();
155 size_t I, M, numParts=0;
156 for (rbeg = dlist.rbegin(); rbeg != rend; ++rbeg) {
161 putloc = ParticleList.begin() + I;
163 if ((I + M) > ((getloc - ParticleList.begin()) - M)) {
168 while (getloc != saveloc) {
169 *putloc++ = *getloc++;
179 for (
size_t m=0; m<M; ++m)
180 *putloc++ = *getloc++;
187 ParticleList.erase( endloc - numParts, endloc );
191 dlist_t::const_iterator dnext = dlist.begin(), dend = dlist.end();
192 size_t putIndex, getIndex, endIndex = LocalSize;
193 putIndex = (*dnext).first;
194 getIndex = putIndex + (*dnext).second;
197 while (dnext != dend && getIndex == (*dnext).first) {
198 getIndex += (*dnext).second;
201 while (dnext != dend) {
203 ParticleList[putIndex++] = ParticleList[getIndex++];
205 while (dnext != dend && getIndex == (*dnext).first) {
206 getIndex += (*dnext).second;
211 while (getIndex < endIndex) {
213 ParticleList[putIndex++] = ParticleList[getIndex++];
217 ParticleList.erase(loc, ParticleList.begin()+LocalSize);
218 LocalSize -= ParticleList.begin()+LocalSize - loc;
221 attributeIsDirty_ =
true;
255 const std::vector<size_t>& putList)
258 std::vector<size_t>::size_type M = putList.size();
290 size_t currsize = size();
335 ParticleList.insert(ParticleList.end(), M,
T());
347 ParticleList.erase(ParticleList.begin() + LocalSize + I, ParticleList.begin() + LocalSize + I + M);
358 size_t currsize = ParticleList.size();
374 o <<
"PAttr: size = " << ParticleList.size()
375 <<
", capacity = " << ParticleList.capacity()
376 <<
", temporary = " << isTemporary();
390#define PA_SORT_COMPARE_SCALAR(SCALAR) \
392struct PASortCompare<SCALAR> \
394 static bool compare(const SCALAR &a, const SCALAR &b, bool ascending) \
396 return (ascending ? (a < b) : (a > b)); \
430 SortList_t::size_type slsize = slist.size();
431 size_t mysize = size();
432 if (slsize < mysize) {
441 for (i=0; i < mysize; ++i)
448 int lastindx = (mysize - 1);
449 for (i=0; i < mysize; ++i) {
450 int currindx = firstindx;
451 T currval = ParticleList[currindx];
453 for (j=(firstindx + 1); j <= lastindx; ++j) {
460 currval = ParticleList[currindx];
473 while (slist[firstindx] >= 0 && firstindx < lastindx)
475 while (slist[lastindx] >= 0 && firstindx < lastindx)
501 int i = 0, j = 0, k = -1, mysize = size();
502 while ( i < mysize ) {
507 if ( i == k || slist[i] < 0 ) {
514 j = ( k > 0 ) ? k : slist[i];
521 std::iter_swap(ParticleList.begin() + i, ParticleList.begin() + j);
532 for (i=0; i < mysize; ++i) {
560template <
class FT,
unsigned Dim,
class M,
class C,
class PT,
class IntOp>
563 const IntOp& , FT val) {
574 for (ppiter = pp.
cbegin(); i < pp.
size(); ++i,++ppiter)
584template <
class FT,
unsigned Dim,
class M,
class C,
class PT,
585 class IntOp,
class CacheData>
600 for (ppiter = pp.
begin(); i < pp.
size(); ++i, ++ppiter, ++citer)
610template <
class FT,
unsigned Dim,
class M,
class C,
611 class IntOp,
class CacheData>
623 for (citer = cache.
begin(); citer != cend; ++citer)
T * value_type(const SliceIterator< T > &)
void putMessage(Message &m, const T &t)
void getMessage_iter(Message &m, OutputIterator o)
void getMessage(Message &m, T &t)
void scatter(Field< FT, Dim, M, C > &f, const ParticleAttrib< Vektor< PT, Dim > > &pp, const IntOp &, FT val)
#define PA_SORT_COMPARE_SCALAR(SCALAR)
#define INCIPPLSTAT(stat)
std::string::iterator iterator
Mesh_t & get_mesh() const
ParticleAttribElem< T, 1U > operator()(unsigned)
virtual void printDebug(Inform &)
ParticleAttribBase::SortList_t SortList_t
virtual void ghostCreate(size_t)
virtual void sort(SortList_t &slist)
virtual size_t ghostGetMessage(Message &, size_t)
virtual size_t putMessage(Message &, size_t, size_t)
virtual void destroy(size_t M, size_t I, bool optDestroy=true)
virtual size_t getMessage(Message &, size_t)
const_iterator cbegin() const
virtual size_t ghostDestroy(size_t, size_t)
virtual size_t ghostPutMessage(Message &, size_t, size_t)
virtual void create(size_t)
void setGuardCells(const T &) const
static bool compare(const T &, const T &, bool)