13using Point = std::pair<double, double>;
15using Index = std::pair<int, int>;
16using Path = std::vector<Point>;
45 static inline const std::vector<Index>
EDGES {{0, 1}, {1, 2}, {2, 3}, {3, 0}};
51 std::optional<std::array<std::unique_ptr<Cell>, 4>>
children;
66 std::unique_ptr<Cell> build(
int i,
int j,
int depth,
int force_refine = 2);
70 std::array<Index, 4> cell_vertices(
Index ij, std::size_t depth)
const;
71 double vertex_value(
Index ij);
74 std::set<std::pair<int, int>> get_crossed_edges(
Cell* cell);
75 bool point_on_boundary(
Point xy,
double tol = 1e-8)
const;
77 void set_iso_value(
double lvl);
78 void update_active_cells(
Cell* cell);
79 std::vector<Segment> compute_segments();
80 MSGraph build_adjacency(std::vector<Segment> segments)
const;
81 std::set<Path> extract_paths(
MSGraph graph)
const;
82 std::set<Point> detect_dangling_ends(std::set<Path> paths)
const;
83 void refine_leaf(
Cell *leaf);
84 std::set<Path> correct_topology(std::set<Path> raw_paths);
87 double xmin, xmax, ymin, ymax;
88 std::size_t max_depth;
90 std::map<Index, double> vertices;
91 std::set<Cell*> active_cells;
92 std::unique_ptr<Cell> root;
99 struct hash<
std::pair<int, int>> {
100 std::size_t operator()(
const Index& p)
const noexcept {
101 std::size_t h =
static_cast<std::size_t
>(p.first);
102 h ^= (
static_cast<std::size_t
>(p.second) + 0x9e3779b97f4a7c15ULL + (h<<6) + (h>>2));
std::pair< int, int > Index
std::pair< Point, Point > Segment
const std::vector< std::set< Index > > MASK_LOOKUP
std::vector< Point > Path
std::function< double(double, double)> ScalarField2D
std::pair< double, double > Point
Hash specialization for SymbolId<Tag>.
double f(double x)
Wilson special function f depending on x.
std::array< Index, 4 > vertices
std::array< double, 4 > values
static const std::vector< Index > EDGES
std::optional< std::array< std::unique_ptr< Cell >, 4 > > children
std::map< Index, Point > vertices
std::map< Index, std::vector< Index > > adjacency