/**
- * A structure whose explicit specializations contain pointers to the
+ * A structure whose explicit specializations represent the
* relevant p4est_* and p8est_* functions. Using this structure, for
- * example by saying functions<dim>::quadrant_compare, we can write code
- * in a dimension independent way, either calling p4est_quadrant_compare
- * or p8est_quadrant_compare, depending on template argument.
+ * example by saying functions<dim>::quadrant_compare(...), we can write
+ * code in a dimension independent way, either calling
+ * p4est_quadrant_compare or p8est_quadrant_compare, depending on template
+ * argument.
+ *
+ * In most cases, the members of this class are simply pointers to
+ * p4est_* or p8est_* functions. In one case, it's simply a static
+ * member function that dispatches to things p4est chooses to
+ * implement via a macro.
*/
template <int dim>
struct functions;
int level,
std::uint64_t id);
+ static void
+ quadrant_init(types<2>::quadrant &q);
+
static int (&quadrant_is_equal)(const types<2>::quadrant *q1,
const types<2>::quadrant *q2);
int level,
std::uint64_t id);
+ static void
+ quadrant_init(types<3>::quadrant &q);
+
static int (&quadrant_is_equal)(const types<3>::quadrant *q1,
const types<3>::quadrant *q2);
std::uint64_t id) =
p4est_quadrant_set_morton;
+ void
+ functions<2>::quadrant_init(types<2>::quadrant &q)
+ {
+ P4EST_QUADRANT_INIT(&q);
+ }
+
int (&functions<2>::quadrant_is_equal)(const types<2>::quadrant *q1,
const types<2>::quadrant *q2) =
p4est_quadrant_is_equal;
std::uint64_t id) =
p8est_quadrant_set_morton;
+ void
+ functions<3>::quadrant_init(types<3>::quadrant &q)
+ {
+ P8EST_QUADRANT_INIT(&q);
+ }
+
int (&functions<3>::quadrant_is_equal)(const types<3>::quadrant *q1,
const types<3>::quadrant *q2) =
p8est_quadrant_is_equal;
for (unsigned int c = 0;
c < dealii::GeometryInfo<dim>::max_children_per_cell;
++c)
- switch (dim)
- {
- case 2:
- P4EST_QUADRANT_INIT(&p4est_children[c]);
- break;
- case 3:
- P8EST_QUADRANT_INIT(&p4est_children[c]);
- break;
- default:
- DEAL_II_NOT_IMPLEMENTED();
- }
-
+ functions<dim>::quadrant_init(p4est_children[c]);
functions<dim>::quadrant_childrenv(&p4est_cell, p4est_children);
}
void
init_coarse_quadrant(typename types<dim>::quadrant &quad)
{
- switch (dim)
- {
- case 2:
- P4EST_QUADRANT_INIT(&quad);
- break;
- case 3:
- P8EST_QUADRANT_INIT(&quad);
- break;
- default:
- DEAL_II_NOT_IMPLEMENTED();
- }
+ functions<dim>::quadrant_init(quad);
functions<dim>::quadrant_set_morton(&quad,
/*level=*/0,
/*index=*/0);
p4est_child[GeometryInfo<dim>::max_children_per_cell];
for (unsigned int c = 0; c < GeometryInfo<dim>::max_children_per_cell;
++c)
- switch (dim)
- {
- case 2:
- P4EST_QUADRANT_INIT(&p4est_child[c]);
- break;
- case 3:
- P8EST_QUADRANT_INIT(&p4est_child[c]);
- break;
- default:
- DEAL_II_NOT_IMPLEMENTED();
- }
+ internal::p4est::functions<dim>::quadrant_init(p4est_child[c]);
internal::p4est::functions<dim>::quadrant_childrenv(&p4est_cell,
for (unsigned int c = 0;
c < GeometryInfo<dim>::max_children_per_cell;
++c)
- switch (dim)
- {
- case 2:
- P4EST_QUADRANT_INIT(&p4est_child[c]);
- break;
- case 3:
- P8EST_QUADRANT_INIT(&p4est_child[c]);
- break;
- default:
- DEAL_II_NOT_IMPLEMENTED();
- }
-
+ internal::p4est::functions<dim>::quadrant_init(p4est_child[c]);
internal::p4est::functions<dim>::quadrant_childrenv(&p4est_cell,
p4est_child);
p4est_child[GeometryInfo<dim>::max_children_per_cell];
for (unsigned int c = 0; c < GeometryInfo<dim>::max_children_per_cell;
++c)
- switch (dim)
- {
- case 2:
- P4EST_QUADRANT_INIT(&p4est_child[c]);
- break;
- case 3:
- P8EST_QUADRANT_INIT(&p4est_child[c]);
- break;
- default:
- DEAL_II_NOT_IMPLEMENTED();
- }
+ internal::p4est::functions<dim>::quadrant_init(p4est_child[c]);
internal::p4est::functions<dim>::quadrant_childrenv(&p4est_cell,
p4est_child);
for (unsigned int c = 0; c < GeometryInfo<dim>::max_children_per_cell;
for (unsigned int c = 0; c < GeometryInfo<dim>::max_children_per_cell;
++c)
- switch (dim)
- {
- case 2:
- P4EST_QUADRANT_INIT(&p4est_child[c]);
- break;
- case 3:
- P8EST_QUADRANT_INIT(&p4est_child[c]);
- break;
- default:
- DEAL_II_NOT_IMPLEMENTED();
- }
+ internal::p4est::functions<dim>::quadrant_init(p4est_child[c]);
dealii::internal::p4est::functions<dim>::quadrant_childrenv(
&p4est_cell, p4est_child);
p4est_child[GeometryInfo<dim>::max_children_per_cell];
for (unsigned int c = 0; c < GeometryInfo<dim>::max_children_per_cell;
++c)
- switch (dim)
- {
- case 2:
- P4EST_QUADRANT_INIT(&p4est_child[c]);
- break;
- case 3:
- P8EST_QUADRANT_INIT(&p4est_child[c]);
- break;
- default:
- DEAL_II_NOT_IMPLEMENTED();
- }
+ internal::p4est::functions<dim>::quadrant_init(p4est_child[c]);
dealii::internal::p4est::functions<dim>::quadrant_childrenv(
&p4est_cell, p4est_child);