HGridCell.h
Go to the documentation of this file.
1 //Copyright (c) 2013-2023, The MercuryDPM Developers Team. All rights reserved.
2 //For the list of developers, see <http://www.MercuryDPM.org/Team>.
3 //
4 //Redistribution and use in source and binary forms, with or without
5 //modification, are permitted provided that the following conditions are met:
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above copyright
9 // notice, this list of conditions and the following disclaimer in the
10 // documentation and/or other materials provided with the distribution.
11 // * Neither the name MercuryDPM nor the
12 // names of its contributors may be used to endorse or promote products
13 // derived from this software without specific prior written permission.
14 //
15 //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 //ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 //WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 //DISCLAIMED. IN NO EVENT SHALL THE MERCURYDPM DEVELOPERS TEAM BE LIABLE FOR ANY
19 //DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 //(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 //LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 //ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 //(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 //SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 
26 #ifndef MERCURYDPM_HGRIDCELL_H
27 #define MERCURYDPM_HGRIDCELL_H
28 
32 class HGridCell
33 {
34 public:
36  {}
37 
39  inline bool equals(int x, int y, int z, unsigned int level) const
40  {
41  return (x == hGridX_ && y == hGridY_ && z == hGridZ_ && level == hGridLevel_);
42  }
43 
45  inline bool equals(int x, int y, unsigned int level) const
46  {
47  return (x == hGridX_ && y == hGridY_ && level == hGridLevel_);
48  }
49 
51  inline bool operator==(const HGridCell& other) const
52  {
53  return equals(other.hGridX_, other.hGridY_, other.hGridZ_, other.hGridLevel_);
54  }
55 
56  inline int getHGridX() const
57  {
58  return hGridX_;
59  }
60 
61  inline void setHGridX(int HGridX)
62  {
63  hGridX_ = HGridX;
64  }
65 
66  inline int getHGridY() const
67  {
68  return hGridY_;
69  }
70 
71  inline void setHGridY(int HGridY)
72  {
73  hGridY_ = HGridY;
74  }
75 
76  inline int getHGridZ() const
77  {
78  return hGridZ_;
79  }
80 
81  inline void setHGridZ(int HGridZ)
82  {
83  hGridZ_ = HGridZ;
84  }
85 
86  inline unsigned int getHGridLevel() const
87  {
88  return hGridLevel_;
89  }
90 
91  inline void setHGridLevel(unsigned int HGridLevel)
92  {
93  hGridLevel_ = HGridLevel;
94  }
95 
96 private:
97 
101  unsigned int hGridLevel_;
102 
103 };
104 
105 
106 #endif //MERCURYDPM_HGRIDCELL_H
Definition: HGridCell.h:33
unsigned int getHGridLevel() const
Definition: HGridCell.h:86
unsigned int hGridLevel_
HGrid-level of the particle containing this cell.
Definition: HGridCell.h:101
bool equals(int x, int y, int z, unsigned int level) const
Checks if the given (x,y,z,level) is the same as the ones in this cell.
Definition: HGridCell.h:39
bool operator==(const HGridCell &other) const
Checks if the given cell is the same as the given cell.
Definition: HGridCell.h:51
int hGridY_
Definition: HGridCell.h:99
bool equals(int x, int y, unsigned int level) const
Checks if the given (x,y,z,level) is the same as the ones in this cell, 2D version.
Definition: HGridCell.h:45
int hGridZ_
Definition: HGridCell.h:99
void setHGridZ(int HGridZ)
Definition: HGridCell.h:81
HGridCell()
Definition: HGridCell.h:35
int getHGridX() const
Definition: HGridCell.h:56
void setHGridX(int HGridX)
Definition: HGridCell.h:61
int getHGridZ() const
Definition: HGridCell.h:76
void setHGridY(int HGridY)
Definition: HGridCell.h:71
int hGridX_
Cell position in the grid.
Definition: HGridCell.h:99
void setHGridLevel(unsigned int HGridLevel)
Definition: HGridCell.h:91
int getHGridY() const
Definition: HGridCell.h:66