/* Creation of Bezier patches for testing purposes. */ /* Last edited on 2009-08-21 15:30:22 by stolfilocal */ #ifndef dg_makegrid_H #define dg_makegrid_H #include "mdg_grid.h" #include "dg_tree.h" #include "bz_patch.h" typedef bool_t mdg_cell_predicate_t ( mdg_cell_index_t k, mdg_rank_t r, bz_patch_t *b, dg_tree_node_t *p ); /* A client-defined predicate that is used in recursive traversals of the dyadic cell tree. The arguments are the index {k} of a cell {C}, the corresponding rank {r}, the cell's shape {b}, and a node of some tree that encloses {C}. The node {p} and/or the shape {b} may be null. */ dg_tree_node_t *dg_make_grid ( mdg_dim_t d, mdg_cell_index_t k, mdg_rank_t r, bz_patch_t *b, dg_tree_node_t *p, mdg_cell_predicate_t *split ); /* Creates a finite multigrid whose root is the dyadic cell {C} of level {r} with index {k}. If {b} is not NULL, it is taken to define the shape and/or function values of {C}. If the node {p} is not NULL, it is taken to be a node, from some other tree, that encloses {C}. The procedure generates the grid by recursive subdivision of the initial cell {C}. It uses the predicate {split} to decide when they should have children. More precisely, the procedure calls {split} for every candidate subcell {C'} of {C}, including {C} itself. If {split} returns FALSE, then {C'} is included in the grid as a leaf cell. If {split} returns TRUE, the procedure recursively generates subgrids for the two halves of {C'}. The procedure then creates a node for {C'}, and returns it. Note that the {count} fields of {n}'s ancestors will need fixing after the split. The shape {b} may be null. */ #endif