1/*
2 * vector_dist_ofb.hpp
3 *
4 * Created on: Jan 13, 2016
5 * Author: i-bird
6 */
7
8#ifndef SRC_VECTOR_VECTOR_DIST_OFB_HPP_
9#define SRC_VECTOR_VECTOR_DIST_OFB_HPP_
10
11/*! \brief Out of bound policy it detect out of bound particles and decide what to do
12 *
13 */
14
15
16struct KillParticle
17{
18 /*! \brief It decide what to do when the particle is out
19 *
20 * \param pp_id particle id
21 * \param p_id processor id
22 *
23 * \return -1
24 *
25 */
26 static long int out(size_t pp_id, size_t p_id)
27 {
28 return -1;
29 }
30};
31
32//! Out-of-bound policy kill the particle but print a warning
33struct KillParticleWithWarning
34{
35 /*! \brief It decide what to do when the particle is out
36 *
37 * \param pp_id particle id
38 * \param p_id processor id
39 *
40 * \return -1
41 *
42 */
43 static long int out(size_t pp_id, size_t p_id)
44 {
45 std::cerr << "Warning: " << __FILE__ << ":" << __LINE__ << " out of bound particle detected " << std::endl;
46
47 return -1;
48 }
49};
50
51//! Out-of-bound policy do nothing
52struct Nothing
53{
54 /*! \brief It decide what to do when the particle is out
55 *
56 * \param pp_id particle id
57 * \param p_id processor id
58 *
59 * \return -1
60 *
61 */
62 static long int out(size_t pp_id, size_t p_id)
63 {
64 return -1;
65 }
66};
67
68//! Out-of-bound policy kill the program
69struct Error
70{
71 /*! \brief It decide what to do when the particle is out
72 *
73 * \param pp_id particle id
74 * \param p_id processor id
75 *
76 * \return -1
77 *
78 */
79 static long int out(size_t pp_id, size_t p_id)
80 {
81 std::cerr << "Error: " << __FILE__ << ":" << __LINE__ << " out of bound particle detected " << std::endl;
82
83 exit(-1);
84
85 return -1;
86 }
87};
88
89#endif /* SRC_VECTOR_VECTOR_DIST_OFB_HPP_ */
90