OpenFPM_data  0.1.0
Project that contain the implementation and interfaces for basic structure like vectors, grids, graph ... .
 All Data Structures Namespaces Functions Variables Typedefs Friends
Ghost.hpp
1 /*
2  * Ghost.hpp
3  *
4  * Created on: Apr 28, 2015
5  * Author: Pietro Incardona
6  */
7 
8 #ifndef GHOST_HPP_
9 #define GHOST_HPP_
10 
11 #include "SpaceBox.hpp"
12 
36 template<unsigned int dim, typename T>
37 class Ghost : public Box<dim,T>
38 {
39 public:
40 
46  template <typename S> inline Ghost(const Ghost<dim,S> & g)
47  {
48  for (size_t i = 0 ; i < dim ; i++)
49  {
50  this->setLow(i,g.getLow(i));
51  this->setHigh(i,g.getHigh(i));
52  }
53  }
54 
55  // construct a ghost based on interaction radius
56  inline Ghost(T r)
57  {
58  for (size_t i = 0 ; i < dim ; i++)
59  {
60  this->setLow(i,-r);
61  this->setHigh(i,r);
62  }
63  }
64 
65  // Basic constructor
66  inline Ghost()
67  {
68  for (size_t i = 0 ; i < dim ; i++)
69  {
70  this->setLow(i,0);
71  this->setHigh(i,0);
72  }
73  }
74 
82  inline Ghost<dim,T> & operator/=(const Point<dim,T> & p)
83  {
85 
86  return *this;
87  }
88 };
89 
97 template<unsigned int dim>
98 class Padding : public Ghost<dim,size_t>
99 {
100 public:
107  Padding(std::initializer_list<size_t> p1, std::initializer_list<size_t> p2)
108  {
109  Box<dim,size_t>::set(p1,p2);
110  }
111 };
112 
113 #endif /* GHOST_HPP_ */
Padding(std::initializer_list< size_t > p1, std::initializer_list< size_t > p2)
Constructor from initializer list.
Definition: Ghost.hpp:107
T getLow(int i) const
get the i-coordinate of the low bound interval of the box
Definition: Box.hpp:484
Ghost(const Ghost< dim, S > &g)
Definition: Ghost.hpp:46
T getHigh(int i) const
get the high interval of the box
Definition: Box.hpp:495
Class that contain Padding information on each direction positive and Negative direction.
Definition: Ghost.hpp:98
void setHigh(int i, T val)
set the high interval of the box
Definition: Box.hpp:472
This class implement the point shape in an N-dimensional space.
Definition: Point.hpp:20
Ghost< dim, T > & operator/=(const Point< dim, T > &p)
Divide component wise the ghost box with a point.
Definition: Ghost.hpp:82
Definition: Ghost.hpp:37
static const unsigned int p1
Low point.
Definition: Box.hpp:69
void setLow(int i, T val)
set the low interval of the box
Definition: Box.hpp:461
This class represent an N-dimensional box.
Definition: Box.hpp:56
static const unsigned int p2
High point.
Definition: Box.hpp:71
Box< dim, T > & operator/=(const Point< dim, T > &p)
Divide component wise each box points with a point.
Definition: Box.hpp:396
void set(std::initializer_list< T > p1, std::initializer_list< T > p2)
Constructor from initializer list.
Definition: Box.hpp:434