QNANO
Distribute_Block_Local.h
1 #ifndef QNANO_NEW_DISTRIBUTE_BLOCK_LOCAL_DEINFED_H
2 #define QNANO_NEW_DISTRIBUTE_BLOCK_LOCAL_DEINFED_H
3 
4 #include "tools/Distribute_Block.h"
5 
6 /* Purpose: A Distribute_Block, but aniticipating that we might want to
7 parallelize with MPI, where each block belongs to one thread, we also want
8 a more abstract structure for the situation without MPI support.
9 In particular, we need a get_local_start and get_local_blocksize function.
10 We also specify the trivial case where there is only one such block for
11 situations without parallelization.
12 */
13 
14 
16 public:
17  size_t block;
18 
19  size_t get_block() const{
20  return block;
21  }
22  size_t get_local_start() const{
23  return Distribute_Block::get_start(get_block());
24  }
25  size_t get_local_blocksize() const{
26  return Distribute_Block::get_blocksize(get_block());
27  }
28  size_t get_local_end() const{
29  return get_local_start()+get_local_blocksize();
30  }
31  Distribute_Block_Local(size_t totalsize=0) : Distribute_Block(totalsize,1), block(0){
32  }
33  virtual ~Distribute_Block_Local(){
34  }
35 
36 };
37 
38 #endif
Definition: Distribute_Block.h:7
Definition: Distribute_Block_Local.h:15