8 #ifndef OPENFPM_IO_SRC_HDF5_WR_HDF5_READER_GD_HPP_ 
    9 #define OPENFPM_IO_SRC_HDF5_WR_HDF5_READER_GD_HPP_ 
   12 #include "Packer_Unpacker/Pack_selector.hpp" 
   13 #include "Packer_Unpacker/Packer.hpp" 
   14 #include "Packer_Unpacker/Unpacker.hpp" 
   15 #include "util/GBoxes.hpp" 
   20     template<
typename device_gr
id> 
void load_block(
long int bid,
 
   21                     hssize_t mpi_size_old,
 
   32         if (bid < mpi_size_old && bid != -1)
 
   34             offset[0] = metadata_accum.get(bid);
 
   35             block[0] = metadata_out[bid];
 
   43         hsize_t count[1] = {1};
 
   46         hid_t file_dataspace_id_2 = H5Dget_space(dataset_2);
 
   48         H5Sselect_hyperslab(file_dataspace_id_2, H5S_SELECT_SET, offset, NULL, count, block);
 
   50         hsize_t mdim_2[1] = {block[0]};
 
   53         hid_t mem_dataspace_id_2 = H5Screate_simple(1, mdim_2, NULL);
 
   62         H5Dread(dataset_2, H5T_NATIVE_CHAR, mem_dataspace_id_2, file_dataspace_id_2, plist_id, (
char *)mem.
getPointer());
 
   74         for (
size_t i = 0; i < loc_grid_old_unp.
size(); i++)
 
   75             loc_grid_old.add(loc_grid_old_unp.get(i));
 
   77         for (
size_t i = 0; i < gdb_ext_old_unp.
size(); i++)
 
   78             gdb_ext_old.add(gdb_ext_old_unp.get(i));
 
   87     template<
typename device_gr
id> 
inline void load(
const std::string & filename,
 
   94         MPI_Info info  = MPI_INFO_NULL;
 
  100         hid_t plist_id = H5Pcreate(H5P_FILE_ACCESS);
 
  101         H5Pset_fapl_mpio(plist_id, comm, info);
 
  104         hid_t file = H5Fopen (filename.c_str(), H5F_ACC_RDONLY, plist_id);
 
  108         hid_t dataset = H5Dopen (file, 
"metadata", H5P_DEFAULT);
 
  111         plist_id = H5Pcreate(H5P_DATASET_XFER);
 
  112         H5Pset_dxpl_mpio(plist_id, H5FD_MPIO_COLLECTIVE);
 
  115         hid_t file_dataspace_id = H5Dget_space(dataset);
 
  117         hssize_t mpi_size_old = H5Sget_select_npoints (file_dataspace_id);
 
  123         int metadata_out[mpi_size_old];
 
  125         for (
int i = 0; i < mpi_size_old; i++)
 
  131         hsize_t mdim[1] = {(size_t)mpi_size_old};
 
  134         hid_t mem_dataspace_id = H5Screate_simple(1, mdim, NULL);
 
  148         H5Dread(dataset, H5T_NATIVE_INT, mem_dataspace_id, file_dataspace_id, plist_id, metadata_out);
 
  162         metadata_accum.resize(mpi_size_old);
 
  164         metadata_accum.get(0) = 0;
 
  165         for (
int i = 1 ; i < mpi_size_old ; i++)
 
  166             metadata_accum.get(i) = metadata_accum.get(i-1) + metadata_out[i-1];
 
  169         hid_t dataset_2 = H5Dopen (file, 
"grid_dist", H5P_DEFAULT);
 
  172         plist_id = H5Pcreate(H5P_DATASET_XFER);
 
  173         H5Pset_dxpl_mpio(plist_id, H5FD_MPIO_COLLECTIVE);
 
  181         for(
size_t i = 0 ; i < n_block.
size() ; i++)
 
  195             max_block = n_block.get(0) + 1;
 
  197             max_block = n_block.get(0);
 
  200         for(
size_t i = 0 ; i < rest_block ; i++)
 
  207         size_t start_block = 0;
 
  208         size_t stop_block = 0;
 
  214                 start_block += n_block.get(i);
 
  221         if (mpi_rank >= mpi_size_old)
 
  222             load_block(start_block,mpi_size_old,metadata_out,metadata_accum,plist_id,dataset_2,loc_grid_old,gdb_ext_old);
 
  226             size_t lb = start_block;
 
  227             for ( ; lb < stop_block ; lb++, n_bl++)
 
  228                 load_block(lb,mpi_size_old,metadata_out,metadata_accum,plist_id,dataset_2,loc_grid_old,gdb_ext_old);
 
  230             if (n_bl < max_block)
 
  231                 load_block(-1,mpi_size_old,metadata_out,metadata_accum,plist_id,dataset_2,loc_grid_old,gdb_ext_old);
 
size_t getProcessUnitID()
Get the process unit id. 
 
MPI_Comm getMPIComm()
Get the MPI_Communicator (or processor group) this VCluster is using. 
 
virtual void * getPointer()
Return the pointer of the last allocation. 
 
virtual size_t size() const 
the the size of the allocated memory 
 
This class allocate, and destroy CPU memory. 
 
virtual bool allocate(size_t sz)
Allocate a chunk of memory. 
 
Implementation of VCluster class. 
 
This structure store the Box that define the domain inside the Ghost + domain box. 
 
virtual void incRef()
Increment the reference counter. 
 
virtual void decRef()
Decrement the reference counter. 
 
size_t getProcessingUnits()
Get the total number of processors.