bool FixedTupleListAdress::addT(tuple pids) {
        bool returnVal = true;
        System& system = storage->getSystemRef();
        esutil::Error err(system.comm);

        // ADD THE LOCAL PARTICLES (pointers)
        Particle* vp, *at;
        std::vector<Particle*> tmp; // temporary vector
        std::vector<longint> pidstmp; // temporary vector
        longint pidK; // the pid used as key

        tuple::iterator it = pids.begin();
        vp = storage->lookupRealParticle(*it);
        if (!vp) { // Particle does not exist here, return false
            //std::cout << "particle " << *it << " not found in localParticles \n";
            returnVal = false;
        }
        else{
          pidK = *it; // first pid is key
          //std::cout << "Add key: " << *it << "\n";

          for (++it; it != pids.end(); ++it) {

              at = storage->lookupAdrATParticle(*it);
              if (!at) { // Particle does not exist here, return false
                  std::stringstream msg;
                  msg << "ERROR: AT particle " << *it << " not found in localAdrATParticles \n";
                  err.setException( msg.str() );
                  returnVal = false;
                  break;
              }
              tmp.push_back(at);
              //std::cout << " add: " << *it << "\n";
              pidstmp.push_back(*it); // pidK is not in this vector
          }
        }
        err.checkException();
        
        if(returnVal){
            this->add(vp, tmp); // add to TupleList

            // ADD THE GLOBAL PARTICLES (ids)
            globalTuples.insert(make_pair(pidK, pidstmp));
        }
        LOG4ESPP_INFO(theLogger, "added fixed tuple to global tuples");

        tmp.clear();
        pids.clear();
        pidstmp.clear();

        //std::cout << "\n";

        return returnVal;
    }
Example #2
0
inline ISAACAPI size_t numgt1(tuple const & tp)
{ return std::accumulate(tp.begin(), tp.end(), 0, [](size_t a, size_t b){ return a + (b>1); }); }
Example #3
0
inline ISAACAPI int_t prod(tuple const & tp)
{ return std::accumulate(tp.begin(), tp.end(), 1, std::multiplies<int>()); }
Example #4
0
inline ISAACAPI int_t min(tuple const & tp)
{ return std::accumulate(tp.begin(), tp.end(), std::numeric_limits<int_t>::max(), [](int_t a, int_t b){ return std::min(a, b); }); }