OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
 
Loading...
Searching...
No Matches
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
13#define INVALID_GHOST 9223372036854775807
14
38template<unsigned int dim, typename T>
39class Ghost : public Box<dim,T>
40{
41public:
42
48/* template <typename S> inline Ghost(const Ghost<dim,S> & g)
49 {
50 for (size_t i = 0 ; i < dim ; i++)
51 {
52 this->setLow(i,g.getLow(i));
53 this->setHigh(i,g.getHigh(i));
54 }
55 }*/
56
63 Ghost(std::initializer_list<T> p1, std::initializer_list<T> p2)
64 :Box<dim,T>(p1,p2)
65 {}
66
67 // construct a ghost based on interaction radius
68 inline Ghost(T r)
69 {
70 for (size_t i = 0 ; i < dim ; i++)
71 {
72 this->setLow(i,-r);
73 this->setHigh(i,r);
74 }
75 }
76
77 // Basic constructor
78 inline Ghost()
79 {
80 for (size_t i = 0 ; i < dim ; i++)
81 {
82 this->setLow(i,0);
83 this->setHigh(i,0);
84 }
85 }
86
95 {
97
98 return *this;
99 }
100
106 inline bool isInvalidGhost()
107 {
108 for (size_t i = 0 ; i < dim ; i++)
109 {
110 if (this->getLow(i) == -INVALID_GHOST) return true;
111 if (this->getHigh(i) == INVALID_GHOST) return true;
112 }
113
114 return false;
115 }
116};
117
125template<unsigned int dim>
126class Padding : public Ghost<dim,long int>
127{
128public:
135 Padding(std::initializer_list<long int> p1, std::initializer_list<long int> p2)
136 {
138 }
139};
140
141#endif /* GHOST_HPP_ */
This class represent an N-dimensional box.
Definition Box.hpp:61
Box< dim, T > & operator/=(const Point< dim, T > &p)
Divide component wise each box points with a point.
Definition Box.hpp:468
__device__ __host__ T getLow(int i) const
get the i-coordinate of the low bound interval of the box
Definition Box.hpp:556
static const unsigned int p1
Low point.
Definition Box.hpp:76
__device__ __host__ T getHigh(int i) const
get the high interval of the box
Definition Box.hpp:567
void set(std::initializer_list< T > p1, std::initializer_list< T > p2)
Constructor from initializer list.
Definition Box.hpp:506
__device__ __host__ void setHigh(int i, T val)
set the high interval of the box
Definition Box.hpp:544
static const unsigned int p2
High point.
Definition Box.hpp:78
__device__ __host__ void setLow(int i, T val)
set the low interval of the box
Definition Box.hpp:533
Ghost< dim, T > & operator/=(const Point< dim, T > &p)
Divide component wise the ghost box with a point.
Definition Ghost.hpp:94
bool isInvalidGhost()
check if the Ghost is valid
Definition Ghost.hpp:106
Ghost(std::initializer_list< T > p1, std::initializer_list< T > p2)
Constructor from initializer list.
Definition Ghost.hpp:63
Class that contain Padding information on each direction positive and Negative direction.
Definition Ghost.hpp:127
Padding(std::initializer_list< long int > p1, std::initializer_list< long int > p2)
Constructor from initializer list.
Definition Ghost.hpp:135
This class implement the point shape in an N-dimensional space.
Definition Point.hpp:28