50#include "MR_rect_tree.hpp"
51#include "MR_cell_cplx.hpp"
52#include "MR_rt_to_cc.hpp"
55typedef mjr::tree15b2d1rT tt_t;
56typedef mjr::MRccT5 cc_t;
57typedef mjr::MR_rt_to_cc<tt_t, cc_t> tc_t;
61tt_t::rrpt_t half_sphere_hat(tt_t::drpt_t xvec) {
62 double m = xvec[0] * xvec[0] + xvec[1] * xvec[1];
63 return (std::sqrt(std::abs(1-m)));
67tt_t::src_t unit_circle_sdf(tt_t::drpt_t xvec) {
68 double m = xvec[0] * xvec[0] + xvec[1] * xvec[1];
74 tt_t tree({-1.1, -1.1},
79 tree.refine_grid(5, half_sphere_hat);
82 tree.refine_leaves_recursive_cell_pred(7, half_sphere_hat, [&tree](
int i) {
return (tree.cell_cross_sdf(i, unit_circle_sdf)); });
85 tree.balance_tree(1, half_sphere_hat);
91 tc_t::construct_geometry_fans(ccplx,
94 {{tc_t::val_src_spc_t::FDOMAIN, 0},
95 {tc_t::val_src_spc_t::FDOMAIN, 1},
96 {tc_t::val_src_spc_t::FRANGE, 0}});
99 ccplx.create_named_datasets({
"x",
"y",
"f(x,y)"});
105 ccplx.triangle_folder([](cc_t::node_data_t x){
return tc_t::tsampf_to_cdatf(half_sphere_hat, x); },
106 [](cc_t::node_data_t x){
return tc_t::tsdf_to_csdf(unit_circle_sdf, x); });
111 ccplx.write_xml_vtk(
"surface_plot_corner.vtu",
"surface_plot_corner");