5 #ifndef OPENFPM_PDATA_ANALYTICALSDF_HPP 6 #define OPENFPM_PDATA_ANALYTICALSDF_HPP 20 #ifndef ANALYTICAL_SDF_HPP 21 #define ANALYTICAL_SDF_HPP 24 #include "Vector/vector_dist.hpp" 25 #include "Grid/grid_dist_id.hpp" 45 template <
typename po
int_type,
typename space_type>
47 space_type center_x=0, space_type center_y=0, space_type center_z=0)
49 typedef typename std::remove_const_t<std::remove_reference_t<decltype(coords.get(0))>> coord_type;
50 if(!(std::is_same<space_type, coord_type>::value))
52 std::cout <<
"Radius-, Center- and Space-type of grid must be the same! Aborting..." << std::endl;
55 const space_type X = coords.get(0), Y = coords.get(1), Z = coords.get(2);
57 sqrt((X - center_x) * (X - center_x)
58 + (Y - center_y) * (Y - center_y)
59 + (Z - center_z) * (Z - center_z)));
76 template <
size_t SDF_exact,
typename gr
id_type,
typename space_type>
78 space_type center_z=0)
80 if(!(std::is_same<typename grid_type::stype, space_type>::value))
82 std::cout <<
"Radius-, Center- and Space-type of grid must be the same! Aborting..." << std::endl;
86 auto dom =
grid.getDomainIterator();
115 template <
typename po
int_type,
typename space_type>
117 space_type center_x=0, space_type center_y=0)
119 typedef typename std::remove_const_t<std::remove_reference_t<decltype(coords.get(0))>> coord_type;
120 if(!(std::is_same<space_type, coord_type>::value))
122 std::cout <<
"Radius-, Center- and Space-type of grid must be the same! Aborting..." << std::endl;
125 const space_type X = coords.get(0), Y = coords.get(1);
127 sqrt((X - center_x) * (X - center_x)
128 + (Y - center_y) * (Y - center_y)));
143 template <
size_t SDF_exact,
typename gr
id_type,
typename space_type>
146 if(!(std::is_same<typename grid_type::stype, space_type>::value))
148 std::cout <<
"Radius-, Center- and Space-type of grid must be the same! Aborting..." << std::endl;
151 auto dom =
grid.getDomainIterator();
154 auto key = dom.get();
162 #endif //ANALYTICAL_SDF_HPP 165 #endif //OPENFPM_PDATA_ANALYTICALSDF_HPP space_type get_analytic_sdf_sphere(point_type coords, space_type radius, space_type center_x=0, space_type center_y=0, space_type center_z=0)
Computes the analytical signed distance function of a sphere for a given point in space.
space_type get_analytic_sdf_circle(point_type coords, space_type radius, space_type center_x=0, space_type center_y=0)
Computes the analytical signed distance function of a circle for a given point in space.
void init_analytic_sdf_circle(grid_type &grid, space_type radius, space_type center_x=0, space_type center_y=0)
Initializes the exact solution of the signed distance function of a circle on an OpenFPM grid.
This class implement the point shape in an N-dimensional space.
void init_analytic_sdf_sphere(grid_type &grid, space_type radius, space_type center_x=0, space_type center_y=0, space_type center_z=0)
Initializes the exact solution of the signed distance function of a sphere on an OpenFPM grid.
This is a distributed grid.