19#ifndef REDISTANCING_SUSSMAN_NARROWBAND_HPP
20#define REDISTANCING_SUSSMAN_NARROWBAND_HPP
26#include "Vector/vector_dist.hpp"
27#include "Grid/grid_dist_id.hpp"
28#include "data_type/aggregate.hpp"
29#include "Decomposition/CartDecomposition.hpp"
41template <
typename gr
id_in_type,
typename phi_type=
double>
53 :
g_temp(grid_in.getDecomposition(), grid_in.getGridInfoVoid().getSize(),
Ghost<grid_in_type::dims, long int>(3))
65 :
g_temp(grid_in.getDecomposition(), grid_in.getGridInfoVoid().getSize(),
Ghost<grid_in_type::dims, long int>(3))
77 :
g_temp(grid_in.getDecomposition(), grid_in.getGridInfoVoid().getSize(),
Ghost<grid_in_type::dims, long int>(3))
88 template<
typename w
idth_type>
90 width_type width_outside,
91 width_type width_inside)
92 :
g_temp(grid_in.getDecomposition(), grid_in.getGridInfoVoid().getSize(),
Ghost<grid_in_type::dims, long int>(3))
94 set_bounds(width_outside, width_inside, grid_in);
124 template <
size_t Phi_SDF_gr
id,
size_t Phi_SDF_vd,
typename vector_type,
typename gr
id_type>
127 auto dom =
grid.getDomainIterator();
130 auto key = dom.get();
140 vd.template getLastProp<Phi_SDF_vd>() =
grid.template get<Phi_SDF_grid>(key);
158 template <
size_t Phi_SDF_gr
id,
size_t Phi_SDF_vd,
size_t Phi_grad,
typename vector_type,
typename gr
id_type>
161 initialize_temporary_grid<Phi_SDF_grid>(
grid);
162 auto dom =
grid.getDomainIterator();
165 auto key = dom.get();
174 vd.template getLastProp<Phi_grad>()[d] =
g_temp.template get<Phi_grad_temp>(key)[d];
176 vd.template getLastProp<Phi_SDF_vd>() =
grid.template get<Phi_SDF_temp>(key);
195 template <
size_t Phi_SDF_grid,
size_t Phi_SDF_vd,
size_t Phi_grad,
size_t Phi_magnOfGrad,
typename vector_type,
199 initialize_temporary_grid<Phi_SDF_grid>(
grid);
200 auto dom =
grid.getDomainIterator();
203 auto key = dom.get();
212 vd.template getLastProp<Phi_grad>()[d] =
g_temp.template get<Phi_grad_temp>(key)[d];
214 vd.template getLastProp<Phi_SDF_vd>() =
g_temp.template get<Phi_SDF_temp>(key);
215 vd.template getLastProp<Phi_magnOfGrad>() = get_vector_magnitude<Phi_grad_temp>(
g_temp, key);
235 template <
size_t Phi_SDF_gr
id,
size_t Prop1_gr
id,
size_t Prop1_vd,
typename vector_type,
typename gr
id_type>
238 auto dom =
grid.getDomainIterator();
241 auto key = dom.get();
251 vd.template getLastProp<Prop1_vd>() =
grid.template get<Prop1_grid>(key);
273 template <
size_t Phi_SDF_grid,
size_t Index1Grid,
size_t Index2Grid,
size_t Index3Grid,
size_t Index1Vd,
size_t
278 auto dom =
grid.getDomainIterator();
281 auto key = dom.get();
282 auto key_g =
grid.getGKey(key);
292 vd.template getLastProp<Index1Vd>() =
grid.template get<Index1Grid>(key);
293 vd.template getLastProp<Index2Vd>() =
grid.template get<Index2Grid>(key);
294 vd.template getLastProp<Index3Vd>() =
grid.template get<Index3Grid>(key);
314 void set_bounds(
const size_t thickness,
const grid_in_type & grid_in)
316 const phi_type EPSILON = std::numeric_limits<phi_type>::epsilon();
325 template<
typename thickness_type>
326 void set_bounds(
const thickness_type thickness,
const grid_in_type & grid_in)
328 const thickness_type EPSILON = std::numeric_limits<thickness_type>::epsilon();
329 b_low = - thickness / 2.0 - EPSILON;
330 b_up = thickness / 2.0 + EPSILON;
338 template<
typename w
idth_type>
339 void set_bounds(width_type lower_bound, width_type upper_bound,
const grid_in_type & grid_in)
341 const width_type EPSILON = std::numeric_limits<width_type>::epsilon();
342 b_low = lower_bound - EPSILON;
343 b_up = upper_bound + EPSILON;
353 template <
size_t Phi_SDF>
356 copy_gridTogrid<Phi_SDF, Phi_SDF_temp>(grid_in,
g_temp);
357 init_sign_prop<Phi_SDF_temp, Phi_sign_temp>(
g_temp);
359 get_upwind_gradient<Phi_SDF_temp, Phi_sign_temp, Phi_grad_temp>(
g_temp, 1,
true);
Header file containing help-functions that perform on OpenFPM-grids.
grid_type::stype get_biggest_spacing(grid_type &grid)
Determines the biggest spacing of a grid which is potentially anisotropic when comparing x,...
Header file containing small mathematical help-functions that are needed e.g. for the Sussman redista...
Approximating upwind gradients on a grid with the following options for the order of accuracy: 1,...
Class for getting the narrow band around the interface.
NarrowBand(const grid_in_type &grid_in, width_type width_outside, width_type width_inside)
Constructor taking the inside and outside physical width of the narrow band in order to initialize th...
phi_type b_up
Narrow band extension towards the object inside.
void set_bounds(const size_t thickness, const grid_in_type &grid_in)
Set the member variable NarrowBand::b_low and NarrowBand::b_up.
void set_bounds(const thickness_type thickness, const grid_in_type &grid_in)
Set the member variable NarrowBand::b_low and NarrowBand::b_up.
NarrowBand(const grid_in_type &grid_in, float thickness)
Constructor taking the thickness of the narrow band as physical width in space in order to initialize...
phi_type b_low
Narrow band extension towards the object outside.
aggregate< phi_type, phi_type[grid_in_type::dims], int > props_temp
Aggregated properties for the temporary grid.
void get_narrow_band(grid_type &grid, vector_type &vd)
Places particles within a narrow band around the interface. SDF and Phi_grad_temp are copied from the...
void initialize_temporary_grid(const grid_in_type &grid_in)
Initialize the internal temporary grid.
bool within_narrow_band(T Phi)
Checks if a value for Phi_SDF lays within the narrow band.
void get_narrow_band_copy_specific_property(grid_type &grid, vector_type &vd)
Places particles within a narrow band around the interface. An arbitrary property is copied from the ...
NarrowBand(const grid_in_type &grid_in, double thickness)
Constructor taking the thickness of the narrow band as physical width in space in order to initialize...
g_temp_type g_temp
Create temporary grid, which is only used inside the class to get the gradients.
static const size_t Phi_grad_temp
Property index of gradient of Phi on the temporary grid.
grid_dist_id< grid_in_type::dims, typename grid_in_type::stype, props_temp > g_temp_type
Type definition for the temporary grid.
void get_narrow_band_copy_three_scalar_properties(grid_type &grid, vector_type &vd)
Places particles within a narrow band around the interface. An arbitrary property is copied from the ...
void get_narrow_band(grid_type &grid, vector_type &vd)
Places particles within a narrow band around the interface. Only the SDF is copied from the grid prop...
NarrowBand(const grid_in_type &grid_in, size_t thickness)
Constructor taking the thickness of the narrow band as grid points in order to initialize the lower a...
static const size_t Phi_sign_temp
Property index of sign of Phi on the temporary grid.
static const size_t Phi_SDF_temp
Property index of Phi_SDF on the temporary grid.
void get_narrow_band(grid_type &grid, vector_type &vd)
Places particles within a narrow band around the interface. SDF and Phi_grad_temp are copied from the...
void set_bounds(width_type lower_bound, width_type upper_bound, const grid_in_type &grid_in)
Set the member variable NarrowBand::b_low and NarrowBand::b_up.
This is a distributed grid.
static const unsigned int dims
Number of dimensions.
void map(size_t opt=NONE)
It move all the particles that does not belong to the local processor to the respective processor.
auto getLastPos() -> decltype(v_pos.template get< 0 >(0))
Get the position of the last element.
void add()
Add local particle.
aggregate of properties, from a list of object if create a struct that follow the OPENFPM native stru...