p4est 2.8.5.190-3fcf-dirty
p4est is a software library for parallel adaptive mesh refinement.
|
forest topology in a conventional mesh format More...
#include <p4est_ghost.h>
Go to the source code of this file.
Data Structures | |
struct | p4est_mesh_t |
This structure contains complete mesh information on a 2:1 balanced forest. More... | |
struct | p4est_mesh_face_neighbor_t |
This structure can be used as the status of a face neighbor iterator. More... | |
Functions | |
size_t | p4est_mesh_memory_used (p4est_mesh_t *mesh) |
Calculate the memory usage of the mesh structure. More... | |
p4est_mesh_t * | p4est_mesh_new (p4est_t *p4est, p4est_ghost_t *ghost, p4est_connect_type_t btype) |
Create a p4est_mesh structure. More... | |
void | p4est_mesh_destroy (p4est_mesh_t *mesh) |
Destroy a p4est_mesh structure. More... | |
p4est_quadrant_t * | p4est_mesh_get_quadrant (p4est_t *p4est, p4est_mesh_t *mesh, p4est_locidx_t qid) |
Access a process-local quadrant inside a forest. More... | |
p4est_locidx_t | p4est_mesh_get_neighbors (p4est_t *p4est, p4est_ghost_t *ghost, p4est_mesh_t *mesh, p4est_locidx_t curr_quad_id, p4est_locidx_t direction, sc_array_t *neighboring_quads, sc_array_t *neighboring_encs, sc_array_t *neighboring_qids) |
Lookup neighboring quads of quadrant in a specific direction. More... | |
p4est_quadrant_t * | p4est_mesh_quadrant_cumulative (p4est_t *p4est, p4est_mesh_t *mesh, p4est_locidx_t cumulative_id, p4est_topidx_t *which_tree, p4est_locidx_t *quadrant_id) |
Find a quadrant based on its cumulative number in the local forest. More... | |
void | p4est_mesh_face_neighbor_init2 (p4est_mesh_face_neighbor_t *mfn, p4est_t *p4est, p4est_ghost_t *ghost, p4est_mesh_t *mesh, p4est_topidx_t which_tree, p4est_locidx_t quadrant_id) |
Initialize a mesh neighbor iterator by quadrant index. More... | |
void | p4est_mesh_face_neighbor_init (p4est_mesh_face_neighbor_t *mfn, p4est_t *p4est, p4est_ghost_t *ghost, p4est_mesh_t *mesh, p4est_topidx_t which_tree, p4est_quadrant_t *quadrant) |
Initialize a mesh neighbor iterator by quadrant pointer. More... | |
p4est_quadrant_t * | p4est_mesh_face_neighbor_next (p4est_mesh_face_neighbor_t *mfn, p4est_topidx_t *ntree, p4est_locidx_t *nquad, int *nface, int *nrank) |
Move the iterator forward to loop around neighbors of the quadrant. More... | |
void * | p4est_mesh_face_neighbor_data (p4est_mesh_face_neighbor_t *mfn, void *ghost_data) |
Get the user data for the current face neighbor. More... | |
forest topology in a conventional mesh format
void p4est_mesh_destroy | ( | p4est_mesh_t * | mesh | ) |
Destroy a p4est_mesh structure.
[in] | mesh | Mesh structure previously created by p4est_mesh_new. |
void * p4est_mesh_face_neighbor_data | ( | p4est_mesh_face_neighbor_t * | mfn, |
void * | ghost_data | ||
) |
Get the user data for the current face neighbor.
[in] | mfn | Internal status of the iterator. |
[in] | ghost_data | Data for the ghost quadrants that has been synchronized with p4est_ghost_exchange_data. |
void p4est_mesh_face_neighbor_init | ( | p4est_mesh_face_neighbor_t * | mfn, |
p4est_t * | p4est, | ||
p4est_ghost_t * | ghost, | ||
p4est_mesh_t * | mesh, | ||
p4est_topidx_t | which_tree, | ||
p4est_quadrant_t * | quadrant | ||
) |
Initialize a mesh neighbor iterator by quadrant pointer.
[out] | mfn | A p4est_mesh_face_neighbor_t to be initialized. |
[in] | which_tree | Tree of quadrant whose neighbors are looped over. |
[in] | quadrant | Pointer to quadrant contained in which_tree. |
void p4est_mesh_face_neighbor_init2 | ( | p4est_mesh_face_neighbor_t * | mfn, |
p4est_t * | p4est, | ||
p4est_ghost_t * | ghost, | ||
p4est_mesh_t * | mesh, | ||
p4est_topidx_t | which_tree, | ||
p4est_locidx_t | quadrant_id | ||
) |
Initialize a mesh neighbor iterator by quadrant index.
[out] | mfn | A p4est_mesh_face_neighbor_t to be initialized. |
[in] | which_tree | Tree of quadrant whose neighbors are looped over. |
[in] | quadrant_id | Index relative to which_tree of quadrant. |
p4est_quadrant_t * p4est_mesh_face_neighbor_next | ( | p4est_mesh_face_neighbor_t * | mfn, |
p4est_topidx_t * | ntree, | ||
p4est_locidx_t * | nquad, | ||
int * | nface, | ||
int * | nrank | ||
) |
Move the iterator forward to loop around neighbors of the quadrant.
[in,out] | mfn | Internal status of the iterator. |
[out] | ntree | If not NULL, the tree number of the neighbor. |
[out] | nquad | If not NULL, the quadrant number within tree. For ghosts instead the number in ghost layer. |
[out] | nface | If not NULL, neighbor's face as in p4est_mesh_t. |
[out] | nrank | If not NULL, the owner process of the neighbor. |
p4est_locidx_t p4est_mesh_get_neighbors | ( | p4est_t * | p4est, |
p4est_ghost_t * | ghost, | ||
p4est_mesh_t * | mesh, | ||
p4est_locidx_t | curr_quad_id, | ||
p4est_locidx_t | direction, | ||
sc_array_t * | neighboring_quads, | ||
sc_array_t * | neighboring_encs, | ||
sc_array_t * | neighboring_qids | ||
) |
Lookup neighboring quads of quadrant in a specific direction.
[in] | p4est | Forest to be worked with. |
[in] | ghost | Ghost layer. |
[in] | mesh | Mesh structure. |
[in] | curr_quad_id | Process-local id of current quad. |
[in] | direction | Direction i in which to look for adjacent quadrants is encoded as follows: 0 .. 3 neighbor(-s) across face i, 4 .. 7 neighbor(-s) across corner i-4. TODO: Allow any combination of empty output arrays. |
[out] | neighboring_quads | Array containing neighboring quad(-s). Needs to be empty on input, size of p4est_quadrant_t *. May be NULL, then neighboring_qids must not be NULL. |
[out] | neighboring_qids | Array containing quadrant ids for neighboring quadrants. May be NULL, then no neighboring qids are collected. If non-NULL the array needs to be empty and will contain int. CAUTION: Note, that the encodings differ from the encodings saved in the mesh. TODO: Encodings are the same as in p4est_mesh for all quadrants. TODO: Ghosts can be encoded by returning the quad_to_quad convention in qid. For ghost quadrants, we add -300 to the values in p4est_mesh. This means that values below -100 belong to ghosts, values above to locals. Positive values are for local quadrants, negative values indicate ghost quadrants. Faces: 1 .. 8 => same size neighbor (r * 4 + nf) + 1; nf = 0 .. 3 face index; r = 0 .. 1 relative orientation 9 .. 24 => double size neighbor 9 + h * 8 + r * 4 + nf; h = 0 .. 1 number of the subface; r, nf as above 25 .. 32 => half-size neighbors 25 + r * 4 + nf; r, nf as above Corners: 1 .. 4 => size not encoded for corners nc + 1; nc = 0 .. 3 corner index |
[out] | neighboring_encs | Array containing encodings for neighboring quads. Needs to be empty, contains int. |
p4est_quadrant_t * p4est_mesh_get_quadrant | ( | p4est_t * | p4est, |
p4est_mesh_t * | mesh, | ||
p4est_locidx_t | qid | ||
) |
Access a process-local quadrant inside a forest.
Needs a mesh with populated quad_to_tree array. This is a special case of p4est_mesh_quadrant_cumulative.
[in] | p4est | The forest. |
[in] | mesh | The mesh. |
[in] | qid | Process-local id of the quadrant (cumulative over trees). |
size_t p4est_mesh_memory_used | ( | p4est_mesh_t * | mesh | ) |
Calculate the memory usage of the mesh structure.
[in] | mesh | Mesh structure. |
p4est_mesh_t * p4est_mesh_new | ( | p4est_t * | p4est, |
p4est_ghost_t * | ghost, | ||
p4est_connect_type_t | btype | ||
) |
Create a p4est_mesh structure.
This function does not populate the quad_to_tree and quad_level fields. To populate them, use p4est_mesh_new_ext.
[in] | p4est | A forest that is fully 2:1 balanced. |
[in] | ghost | The ghost layer created from the provided p4est. |
[in] | btype | Determines the highest codimension of neighbors. |
p4est_quadrant_t * p4est_mesh_quadrant_cumulative | ( | p4est_t * | p4est, |
p4est_mesh_t * | mesh, | ||
p4est_locidx_t | cumulative_id, | ||
p4est_topidx_t * | which_tree, | ||
p4est_locidx_t * | quadrant_id | ||
) |
Find a quadrant based on its cumulative number in the local forest.
If the quad_to_tree field of the mesh structure exists, this is O(1). Otherwise, we perform a binary search over the processor-local trees.
[in] | p4est | Forest to be worked with. |
[in] | mesh | A mesh derived from the forest. |
[in] | cumulative_id | Cumulative index over all trees of quadrant. Must refer to a local (non-ghost) quadrant. |
[in,out] | which_tree | If not NULL, the input value can be -1 or an initial guess for the quadrant's tree and output is the tree of returned quadrant. |
[out] | quadrant_id | If not NULL, the number of quadrant in tree. |