12#ifndef ACCURACY_TESTS_SPHERE_HPP
13#define ACCURACY_TESTS_SPHERE_HPP
29template <
typename po
int_type,
typename radius_type>
30bool inside_sphere(point_type coords, radius_type radius,
double center_x=0,
double center_y=0,
double center_z=0)
32 typedef typename std::remove_const_t<std::remove_reference_t<
decltype(coords.get(0))>> space_type;
33 if(!(std::is_same<space_type, radius_type>::value))
35 std::cout <<
"Radius type and space type of grid must be the same! Aborting..." << std::endl;
38 const space_type EPSILON = std::numeric_limits<space_type>::epsilon();
39 const space_type X = coords.get(0), Y = coords.get(1), Z = coords.get(2);
40 return (X - center_x) * (X - center_x)
41 + (Y - center_y) * (Y - center_y)
42 + (Z - center_z) * (Z - center_z)
43 <= radius * radius + EPSILON;
63template <
size_t Phi_0,
typename gr
id_type,
typename radius_type>
64void init_grid_with_sphere(
grid_type &
grid, radius_type radius,
double center_x=0,
double center_y=0,
double center_z=0)
66 if(!(std::is_same<typename grid_type::stype, radius_type>::value))
68 std::cout <<
"Radius type and space type of grid must be the same! Aborting..." << std::endl;
72 auto dom =
grid.getDomainIterator();
79 if (inside_sphere(coords, radius, center_x, center_y, center_z))
81 grid.template get<Phi_0> (key) = 1;
85 grid.template get<Phi_0> (key) = -1;
This class implement the point shape in an N-dimensional space.
This is a distributed grid.