1/*
2 * grid_dist_amr_key.hpp
3 *
4 * Created on: Sep 23, 2017
5 * Author: i-bird
6 */
7
8#ifndef SRC_AMR_GRID_DIST_AMR_KEY_HPP_
9#define SRC_AMR_GRID_DIST_AMR_KEY_HPP_
10
11/*! \brief Amr grid distributed key
12 *
13 * \tparam dim dimensionality
14 *
15 */
16template<unsigned int dim>
17class grid_dist_amr_key
18{
19 //! actual level
20 size_t lvl;
21
22 //! actual position in the distributed grid
23 grid_dist_key_dx<dim> key;
24
25
26public:
27
28 /*! \constructor
29 *
30 * \param lvl level
31 * \param key distributed grid key
32 * \param offsets to move between levels
33 *
34 */
35 inline grid_dist_amr_key(size_t lvl,
36 grid_dist_key_dx<dim> key)
37 :lvl(lvl),key(key)
38 {}
39
40 /*! \brief Return the grid key
41 *
42 * \return the distributed key
43 *
44 */
45 inline const grid_dist_key_dx<dim> & getKey() const
46 {
47 return key;
48 }
49
50 /*! \brief Return the grid key (as reference)
51 *
52 * \return the distributed key
53 *
54 */
55 inline grid_dist_key_dx<dim> & getKeyRef()
56 {
57 return key;
58 }
59
60
61 /*! \brief Return the level
62 *
63 * \return the level
64 *
65 */
66 inline size_t getLvl() const
67 {
68 return lvl;
69 }
70
71 /*! \brief Return the level
72 *
73 * \param lvl level to set
74 *
75 */
76 inline void setLvl(size_t lvl)
77 {
78 this->lvl = lvl;
79 }
80
81 /*! \brief Create a new key moving the old one
82 *
83 * \param s dimension id
84 * \param s number of steps
85 *
86 * \return new key
87 *
88 */
89 inline grid_dist_amr_key<dim> moveSpace(size_t d,size_t s)
90 {
91 return grid_dist_amr_key<dim>(lvl,key.move(d,s));
92 }
93};
94
95
96
97
98#endif /* SRC_AMR_GRID_DIST_AMR_KEY_HPP_ */
99