5#ifndef SUSSMAN_REDISTANCING_REMOVELINES_HPP
6#define SUSSMAN_REDISTANCING_REMOVELINES_HPP
16template <
size_t Phi_0_gr
id,
int sign_ins
ide,
typename gr
id_type>
21 std::cout <<
"sign_inside was set to 0. However, it must be set to +1 or -1 depending on the level-set "
22 "convention used. Aborting..." << std::endl;
25 for(
int repeat = 0; repeat < 2; ++repeat)
27 grid.template ghost_get<Phi_0_grid>(KEEP_PROPERTIES);
30 auto dom =
grid.getDomainIterator();
34 if (
grid.template getProp<Phi_0_grid>(key) > 0)
38 if (
grid.template getProp<Phi_0_grid>(key.move(d, -1)) < 0
39 &&
grid.template getProp<Phi_0_grid>(key.move(d, +1)) < 0)
41 grid.template getProp<Phi_0_grid>(key) =
grid.template getProp<Phi_0_grid>(key.move(d, +1));
51 auto dom =
grid.getDomainIterator();
55 if (
grid.template getProp<Phi_0_grid>(key) < 0)
59 if (
grid.template getProp<Phi_0_grid>(key.move(d, -1)) > 0
60 &&
grid.template getProp<Phi_0_grid>(key.move(d, +1)) > 0)
62 grid.template getProp<Phi_0_grid>(key) =
grid.template getProp<Phi_0_grid>(key.move(d, +1));
77 return phi >= 0 - std::numeric_limits<T>::epsilon();
83 return phi < 0 + std::numeric_limits<T>::epsilon();
93template <
size_t Phi_0_gr
id,
typename gr
id_type>
96 for(
int k = 0; k < repeat; ++k)
98 grid.template ghost_get<Phi_0_grid>(KEEP_PROPERTIES);
99 auto dom =
grid.getDomainIterator();
102 auto key = dom.get();
105 if (is_inside(
grid.template getProp<Phi_0_grid>(key)))
107 if (is_outside(
grid.template getProp<Phi_0_grid>(key.move(d, -1)))
108 && is_outside(
grid.template getProp<Phi_0_grid>(key.move(d, +1))))
110 grid.template getProp<Phi_0_grid>(key) =
grid.template getProp<Phi_0_grid>(key.move(d, +1));
114 else if (is_outside(
grid.template getProp<Phi_0_grid>(key)))
116 if (is_inside(
grid.template getProp<Phi_0_grid>(key.move(d, -1)))
117 && is_inside(
grid.template getProp<Phi_0_grid>(key.move(d, +1))))
119 grid.template getProp<Phi_0_grid>(key) =
grid.template getProp<Phi_0_grid>(key.move(d, +1));
This is a distributed grid.
static const unsigned int dims
Number of dimensions.