Exemple #1
0
 void flip(index_t b)
 {
   _data[windex(b)] ^= 1 << woffset(b); 
 }
Exemple #2
0
 void clear(index_t b)
 {
   _data[windex(b)] &= ~(1 << woffset(b));
 }
Exemple #3
0
 bool get(index_t b) const
 {
   return _data[windex(b)] & (1 << woffset(b));
 }
Exemple #4
0
 void set(index_t b)
 {
   _data[windex(b)] |= 1 << woffset(b); 
 }
  void HDFWalkerIOEngine::readAll(hid_t grp, const char* name, Communicate* comm) 
  {
    int mynode=comm->rank();
    int nprocs=comm->size();
    vector<int> woffset(nprocs+1,0);

    const int RANK = 3;
    hsize_t offset[]={1,1,1};
    hsize_t gcount[RANK],count[RANK];
    hsize_t stride[]={1,1,1};

    hid_t dataset = H5Dopen(grp,name);
    hid_t dataspace = H5Dget_space(dataset);
    int rank_n = H5Sget_simple_extent_ndims(dataspace);
    int status_n = H5Sget_simple_extent_dims(dataspace, gcount, NULL);

    //assign offsets and size
    FairDivideLow(gcount[0],nprocs,woffset);
    offset[0]=woffset[mynode]; offset[1] = 0; offset[2] = 0;
    count[0]=woffset[mynode+1]-woffset[mynode];
    count[1]=gcount[1];
    count[2]=gcount[2];

    app_log() << "   Initial walker distribution: ";
    std::copy(woffset.begin(),woffset.end(),ostream_iterator<int>(app_log()," "));
    app_log() << endl;

    vector<MCWalkerConfiguration::PosType> posIn(count[0]*count[1]);

    hid_t memspace = H5Screate_simple(RANK, count, NULL);
    herr_t status = H5Sselect_hyperslab(dataspace,H5S_SELECT_SET, offset,NULL,count,NULL);

#if defined(H5_HAVE_PARALLEL)
    xfer_plist = H5Pcreate(H5P_DATASET_XFER);
    H5Pset_dxpl_mpio(xfer_plist,H5FD_MPIO_COLLECTIVE);
#else
    xfer_plist =  H5P_DEFAULT;
#endif
    hid_t type_id=get_h5_datatype(posIn[0][0]);
    status = H5Dread(dataset, type_id, memspace, dataspace, xfer_plist, &(posIn[0][0]));

    H5Sclose(dataspace);
    H5Sclose(memspace);
    H5Dclose(dataset);

#if defined(H5_HAVE_PARALLEL)
    H5Pclose(xfer_plist);
#endif

    int curWalker = W.getActiveWalkers();
    if(curWalker) {
      W.createWalkers(count[0]);
    } else {
      W.resize(count[0],count[1]);
    }

    MCWalkerConfiguration::iterator it = W.begin()+curWalker; 
    int ii=0;
    for(int iw=0; iw<count[0]; iw++) {
      //std::copy(Post_temp[iw],Post_temp[iw+1], (*it)->R.begin());
      for(int iat=0; iat < count[1]; iat++,ii++){
        (*it)->R(iat) = posIn[ii];
      }
      ++it;
    }
  }