Пример #1
0
/** Get the coordinates of the midpoint of a quadrant.
 *
 * \param [in]  p4est      the forest
 * \param [in]  which_tree the tree in the forest containing \a q
 * \param [in]  q          the quadrant
 * \param [out] xyz        the coordinates of the midpoint of \a q
 */
static void
step3_get_midpoint (p4est_t * p4est, p4est_topidx_t which_tree,
                    p4est_quadrant_t * q, double xyz[3])
{
  p4est_qcoord_t      half_length = P4EST_QUADRANT_LEN (q->level) / 2;

  p4est_qcoord_to_vertex (p4est->connectivity, which_tree,
                          q->x + half_length, q->y + half_length,
#ifdef P4_TO_P8
                          q->z + half_length,
#endif
                          xyz);
}
Пример #2
0
static p4est_wrap_leaf_t *
p4est_wrap_leaf_info (p4est_wrap_leaf_t * leaf)
{
#ifdef P4EST_ENABLE_DEBUG
  p4est_t            *p4est = leaf->pp->p4est;
#endif
#if 0
  p4est_quadrant_t    corner;
#endif
  p4est_quadrant_t   *mirror;

  /* complete information on current quadrant */
  leaf->local_quad = leaf->tree->quadrants_offset + leaf->which_quad;
  leaf->quad =
    p4est_quadrant_array_index (leaf->tquadrants, leaf->which_quad);

#if 0
  p4est_qcoord_to_vertex (leaf->pp->conn, leaf->which_tree,
                          leaf->quad->x, leaf->quad->y,
#ifdef P4_TO_P8
                          leaf->quad->z,
#endif
                          leaf->lowerleft);
  p4est_quadrant_corner_node (leaf->quad, P4EST_CHILDREN - 1, &corner);
  p4est_qcoord_to_vertex (leaf->pp->conn, leaf->which_tree,
                          corner.x, corner.y,
#ifdef P4_TO_P8
                          corner.z,
#endif
                          leaf->upperright);
#endif

#if 0
#ifdef P4EST_ENABLE_DEBUG
  printf ("C: Leaf level %d tree %d tree_leaf %d local_leaf %d\n",
          (int) leaf->quad->level, leaf->which_tree, leaf->which_quad,
          leaf->local_quad);
#endif
#endif

  /* track parallel mirror quadrants */
  if (leaf->mirrors != NULL) {
    if (leaf->local_quad == leaf->next_mirror_quadrant) {
      if (++leaf->nm + 1 < (p4est_locidx_t) leaf->mirrors->elem_count) {
        mirror = p4est_quadrant_array_index (leaf->mirrors, leaf->nm + 1);
        leaf->next_mirror_quadrant = mirror->p.piggy3.local_num;
        P4EST_ASSERT (leaf->next_mirror_quadrant > leaf->local_quad);
        P4EST_ASSERT (leaf->next_mirror_quadrant <
                      p4est->local_num_quadrants);
      }
      else {
        leaf->next_mirror_quadrant = -1;
      }
      leaf->is_mirror = 1;
    }
    else {
      leaf->is_mirror = 0;
    }
  }

  return leaf;
}