70#include "Draw/DrawSphere.hpp"
86int main(
int argc,
char* argv[])
88 typedef double phi_type;
90 openfpm_init(&argc, &argv);
93 const std::string path_output = cwd +
"/output_sphere";
114 constexpr size_t grid_dim = 3;
120 const size_t Phi_0_grid = 0;
121 const size_t Phi_SDF_grid = 1;
144 const size_t sz[grid_dim] = {128, 128, 128};
149 grid_in_type g_dist(sz, box, ghost);
150 g_dist.setPropNames({
"Phi_0",
"Phi_SDF"});
174 phi_type radius = 1.0;
175 init_grid_with_sphere<Phi_0_grid>(g_dist, radius, 5, 5, 5);
177 g_dist.write(path_output +
"/grid_initial_sphere_preRedistancing_radius" + std::to_string((
int)radius) , FORMAT_BINARY);
222 redist_options.min_iter = 1e3;
223 redist_options.max_iter = 1e4;
225 redist_options.convTolChange.value = 1e-7;
226 redist_options.convTolChange.check =
true;
227 redist_options.convTolResidual.value = 1e-6;
228 redist_options.convTolResidual.check =
false;
230 redist_options.interval_check_convergence = 1e3;
231 redist_options.width_NB_in_grid_points = 10;
232 redist_options.print_current_iterChangeResidual =
true;
233 redist_options.print_steadyState_iter =
true;
234 redist_options.save_temp_grid =
true;
262 redist_obj.run_redistancing<Phi_0_grid, Phi_SDF_grid>();
264 g_dist.write(path_output +
"/grid_sphere_postRedistancing", FORMAT_BINARY);
265 g_dist.save(path_output +
"/grid_sphere_postRedistancing" +
".bin");
285 size_t bc[grid_dim] = {NON_PERIODIC, NON_PERIODIC, NON_PERIODIC};
293 vd_type vd_narrow_band(0, box, bc, ghost_vd);
294 vd_narrow_band.setPropNames({
"Phi_SDF",
"Phi_grad",
"Phi_magnOfGrad"});
316 size_t thickness_of_narrowBand_in_grid_points = 6;
336 const size_t Phi_SDF_vd = 0;
337 const size_t Phi_grad_vd = 1;
338 const size_t Phi_magnOfGrad_vd = 2;
371 narrowBand.get_narrow_band<Phi_SDF_grid, Phi_SDF_vd, Phi_grad_vd, Phi_magnOfGrad_vd>(g_dist, vd_narrow_band);
373 vd_narrow_band.write(path_output +
"/vd_narrow_band_sphere", FORMAT_BINARY);
374 vd_narrow_band.save(path_output +
"/vd_narrow_band_sphere.bin");
Class for getting the narrow band around the interface.
Header file containing functions for creating files and folders.
static void create_directory_if_not_exist(std::string path, bool silent=0)
Creates a directory if not already existent.
static std::string get_cwd()
Gets the current working directory and returns path as string.
Class for reinitializing a level-set function into a signed distance function using Sussman redistanc...
This class represent an N-dimensional box.
Class for getting the narrow band around the interface.
Class for reinitializing a level-set function into a signed distance function using Sussman redistanc...
This is a distributed grid.
Structure to bundle options for redistancing.
aggregate of properties, from a list of object if create a struct that follow the OPENFPM native stru...