|
p4est 2.8.7.456-de8c6
p4est is a software library for parallel adaptive mesh refinement.
|
Generate Lobatto node numbers for any degree. More...
#include <p8est_ghost.h>

Go to the source code of this file.
Data Structures | |
| struct | p8est_lnodes |
| Store a parallel numbering of Lobatto points of a given degree > 0. More... | |
| struct | p8est_lnodes_rank |
| The structure stored in the sharers array. More... | |
| struct | p8est_lnodes_buffer |
| p8est_lnodes_buffer_t handles the communication of data associated with nodes. More... | |
Typedefs | |
| typedef int16_t | p8est_lnodes_code_t |
| The face code encodes the configuration of a hanging quadrant. | |
| typedef struct p8est_lnodes | p8est_lnodes_t |
| Store a parallel numbering of Lobatto points of a given degree > 0. | |
| typedef struct p8est_lnodes_rank | p8est_lnodes_rank_t |
| The structure stored in the sharers array. | |
| typedef struct p8est_lnodes_buffer | p8est_lnodes_buffer_t |
| p8est_lnodes_buffer_t handles the communication of data associated with nodes. | |
Functions | |
| int | p8est_lnodes_decode (p8est_lnodes_code_t face_code, int hanging_face[6], int hanging_edge[12]) |
| Decode the face_code into hanging face information. | |
| void | p8est_lnodes_derive_child_codes (int pc, p8est_lnodes_code_t pfc, p8est_lnodes_code_t fcs[8]) |
| Given a quadrant and its face code, derive children's face codes. | |
| p8est_lnodes_t * | p8est_lnodes_new (p8est_t *p8est, p8est_ghost_t *ghost_layer, int degree) |
| Create a tensor-product Lobatto node structure for a given degree. | |
| size_t | p8est_lnodes_memory_used (p8est_lnodes_t *lnodes) |
| Calculate the memory allocated in a p8est_lnodes structure. | |
| void | p8est_lnodes_destroy (p8est_lnodes_t *lnodes) |
| Free all memory in a previously constructed lnodes structure. | |
| void | p8est_partition_lnodes (p8est_t *p8est, p8est_ghost_t *ghost, int degree, int partition_for_coarsening) |
| Partition using weights based on the number of nodes assigned to each element in lnodes. | |
| void | p8est_partition_lnodes_detailed (p8est_t *p4est, p8est_ghost_t *ghost, int nodes_per_volume, int nodes_per_face, int nodes_per_edge, int nodes_per_corner, int partition_for_coarsening) |
| Partition using weights that are broken down by where they reside: in volumes, on faces, on edges, or on corners. | |
| void | p8est_ghost_support_lnodes (p8est_t *p8est, p8est_lnodes_t *lnodes, p8est_ghost_t *ghost) |
| Expand the ghost layer to include the support of all nodes supported on the local partition. | |
| void | p8est_ghost_expand_by_lnodes (p8est_t *p8est, p8est_lnodes_t *lnodes, p8est_ghost_t *ghost) |
| Expand the ghost layer as in p8est_ghost_expand(), but use node support to define adjacency instead of geometric adjacency. | |
| p8est_lnodes_buffer_t * | p8est_lnodes_share_owned_begin (sc_array_t *node_data, p8est_lnodes_t *lnodes) |
| p8est_lnodes_share_owned_begin | |
| void | p8est_lnodes_share_owned_end (p8est_lnodes_buffer_t *buffer) |
| p8est_lnodes_shared_owned_end | |
| void | p8est_lnodes_share_owned (sc_array_t *node_data, p8est_lnodes_t *lnodes) |
| Equivalent to calling p8est_lnodes_share_owned_end directly after p8est_lnodes_share_owned_begin. | |
| p8est_lnodes_buffer_t * | p8est_lnodes_share_all_begin (sc_array_t *node_data, p8est_lnodes_t *lnodes) |
| p8est_lnodes_share_all_begin | |
| void | p8est_lnodes_share_all_end (p8est_lnodes_buffer_t *buffer) |
| p8est_lnodes_shared_all_end | |
| p8est_lnodes_buffer_t * | p8est_lnodes_share_all (sc_array_t *node_data, p8est_lnodes_t *lnodes) |
| Equivalent to calling p8est_lnodes_share_all_end directly after p8est_lnodes_share_all_begin. | |
| void | p8est_lnodes_buffer_destroy (p8est_lnodes_buffer_t *buffer) |
| Destroy the buffer filled with node data during a call to p8est_lnodes_share_all_end or p8est_lnodes_share_all. | |
| p8est_lnodes_rank_t * | p8est_lnodes_rank_array_index_int (sc_array_t *array, int it) |
| Return a pointer to a lnodes_rank array element indexed by a int. | |
| p8est_lnodes_rank_t * | p8est_lnodes_rank_array_index (sc_array_t *array, size_t it) |
| Return a pointer to a lnodes_rank array element indexed by a size_t. | |
| p4est_gloidx_t | p8est_lnodes_global_index (p8est_lnodes_t *lnodes, p4est_locidx_t lidx) |
| Compute the global number of a local node number. | |
Variables | |
| const int | p8est_lnodes_corner_hanging [8] |
| For each corner, the direction of the hanging face/edge. | |
Generate Lobatto node numbers for any degree.
| typedef struct p8est_lnodes_buffer p8est_lnodes_buffer_t |
p8est_lnodes_buffer_t handles the communication of data associated with nodes.
send_buffers is an array of arrays: one buffer for each process to which the current process sends node-data. It should not be altered between a shared_*_begin and a shared_*_end call.
recv_buffers is an array of arrays that is used in lnodes_share_all_*. recv_buffers[j] corresponds with lnodes->sharers[j]: it is the same length as lnodes->sharers[j]->shared_nodes. At the completion of lnodes_share_all or lnodes_share_all_end, recv_buffers[j] contains the node-data from the process lnodes->sharers[j]->rank (unless j is the current rank, in which case recv_buffers[j] is empty).
| typedef struct p8est_lnodes_rank p8est_lnodes_rank_t |
The structure stored in the sharers array.
shared_nodes is a sorted array of p4est_locidx_t that indexes into local nodes. The shared_nodes array has a contiguous (or empty) section of nodes owned by the current rank. shared_mine_offset and shared_mine_count identify this section by indexing the shared_nodes array, not the local nodes array. owned_offset and owned_count define the section of local nodes that is owned by the listed rank (the section may be empty). For the current process these coincide with those in p8est_lnodes_t.
| typedef struct p8est_lnodes p8est_lnodes_t |
Store a parallel numbering of Lobatto points of a given degree > 0.
Each element has degree+1 nodes per edge and vnodes = (degree+1)^3 nodes per volume. element_nodes is of dimension vnodes * num_local_elements and lists the nodes of each element in lexicographic yx-order (x varies fastest); element_nodes indexes into the set of local nodes, laid out as follows:
local nodes = [<-----owned_count----->|<-----nonlocal_nodes----->]
= [<----------------num_local_nodes----------------->]
nonlocal_nodes contains the globally unique numbers for independent nodes that are owned by other processes; for local nodes, the globally unique numbers are given by i + global_offset, where i is the local number. Hanging nodes are always local and don't have a global number. They index the geometrically corresponding independent nodes of a neighbor.
Whether nodes are hanging or not is decided based on the element faces and edges. This information is encoded in face_code with one int16_t per element. If no faces or edges are hanging, the value is zero, otherwise the face_code is interpreted by p8est_lnodes_decode.
Independent nodes can be shared by multiple MPI ranks. The owner rank of a node is the one from the lowest numbered element on the lowest numbered octree touching the node.
What is meant by touching? A quadrant is said to touch all faces/edges/corners that are incident on it, and by extension all nodes that are contained in those faces/edges/corners.
X +-----------+
x |\ \
x | \ \
. x | \ \
x X | +-----------+
+-----+ . . | | |
|\ \ X o + | |
| +-----+ o . \ | p |
+ | q | o \ | |
\| | o \| |
+-----+ O +-----------+
In this example degree = 3. There are 4 nodes that live on the face between q and p, two on each edge and one at each corner of that face. The face is incident on q, so q owns the nodes marked '.' on the face (provided q is from a lower tree or has a lower index than p). The bottom and front edges are incident on q, so q owns its nodes marked 'o' as well. The front lower corner is incident on q, so q owns its node 'O' as well. The other edges and corners are not incident on q, so q cannot own their nodes, marked 'x' and 'X'.
global_owned_count contains the number of independent nodes owned by each process.
The sharers array contains items of type p8est_lnodes_rank_t that hold the ranks that own or share independent local nodes. If there are no shared nodes on this processor, it is empty. Otherwise, it is sorted by rank and the current process is included.
degree < 0 indicates that the lnodes data structure is being used to number the quadrant boundary object (faces, edge and corners) rather than the $C^0$ Lobatto nodes:
if degree == -1, then one node is assigned per face, and no nodes are assigned per volume, per edge, or per corner: this numbering can be used for low-order Raviart-Thomas elements. In this case, vnodes == 6, and the nodes are listed in face-order.
if degree == -2, then one node is assigned per face and per edge and no nodes are assigned per volume or per corner. In this case, vnodes == 18, and the nodes are listed in face-order, followed by edge-order.
if degree == -3, then one node is assigned per face, per edge and per corner and no nodes are assigned per volume. In this case, vnodes == 26, and the nodes are listed in face-order, followed by edge-order, followed by corner-order.
| void p8est_ghost_expand_by_lnodes | ( | p8est_t * | p8est, |
| p8est_lnodes_t * | lnodes, | ||
| p8est_ghost_t * | ghost | ||
| ) |
Expand the ghost layer as in p8est_ghost_expand(), but use node support to define adjacency instead of geometric adjacency.
| [in] | p8est | The forest from which the ghost layer was generated. |
| [in] | lnodes | The nodes to support. |
| [in,out] | ghost | The ghost layer to be expanded. |
| void p8est_ghost_support_lnodes | ( | p8est_t * | p8est, |
| p8est_lnodes_t * | lnodes, | ||
| p8est_ghost_t * | ghost | ||
| ) |
Expand the ghost layer to include the support of all nodes supported on the local partition.
| [in] | p8est | The forest from which the ghost layer was generated. |
| [in] | lnodes | The nodes to support. |
| [in,out] | ghost | The ghost layer to be expanded. |
|
inline |
Decode the face_code into hanging face information.
This is mostly for demonstration purposes. Applications probably will integrate it into their own loop over the face for performance reasons.
| [in] | face_code | as in the p8est_lnodes_t structure. |
| [out] | hanging_face | If there are hanging faces or edges, = -1 if the face is not hanging, = the corner of the full face that it touches: e.g. if face = i and hanging_face[i] = j, then the interpolation operator corresponding to corner j should be used for that face. note: not touched if there are no hanging faces or edges. |
| [out] | hanging_edge | If there are hanging faces or edges, = -1 if the edge is not hanging, = 0 if the edge is the first half of a full edge, but neither of the two faces touching the edge is hanging, = 1 if the edge is the second half of a full edge, but neither of the two faces touching the edge is hanging, = 2 if the edge is the first half of a full edge and is on the boundary of a full face, = 3 if the edge is the second half of a full edge and is on the boundary of a full face, = 4 if the edge is in the middle of a full face. See the diagram below for clarification. note: not touched if there are no hanging faces or edges. |
The following picture illustrates the situation on a hanging face.
o...............o o...............o +---2---+.......o o.......+---3---+ : : : : | | : : | | : : : : 3 2 4 : : 4 3 3 : : : : | | : : | | +---4---+ : : +---4---+ +---4---+ : : +---4---+ | | : : | | : : : : 2 0 4 : : 4 1 2 : : : : | | : : | | : : : : +---2---+.......o o.......+---3---+ o...............o o...............o
The following picture illustrates the situation on a hanging edge.
o +-------+
: |\ \
: 1 \ \
: | +-------+
+-------+ + | |
|\ \ :\ | |
0 \ \ : \| |
| +-------+ : +-------+
+ | | o
\ | |
\| |
+-------+
| void p8est_lnodes_derive_child_codes | ( | int | pc, |
| p8est_lnodes_code_t | pfc, | ||
| p8est_lnodes_code_t | fcs[8] | ||
| ) |
Given a quadrant and its face code, derive children's face codes.
| [in] | pc | The child id of the parent quadrant. |
| [in] | pfc | Valid parent face code, including 0 for non-hanging. |
| [out] | fcs | Array of 8 face codes of the children. |
| void p8est_lnodes_destroy | ( | p8est_lnodes_t * | lnodes | ) |
Free all memory in a previously constructed lnodes structure.
| [in] | lnodes | This pointer will be deep freed. Do no longer use once this function returns. |
| size_t p8est_lnodes_memory_used | ( | p8est_lnodes_t * | lnodes | ) |
Calculate the memory allocated in a p8est_lnodes structure.
| [in] | lnodes | Valid lnodes structure. |
| p8est_lnodes_t * p8est_lnodes_new | ( | p8est_t * | p8est, |
| p8est_ghost_t * | ghost_layer, | ||
| int | degree | ||
| ) |
Create a tensor-product Lobatto node structure for a given degree.
| [in] | p8est | Valid forest. |
| [in] | ghost_layer | Valid full ghost layer, i. e. constructed by p8est_ghost_new with the same forest and argument P8EST_CONNECT_FULL. |
| [in] | degree | Degree >= 1 leads to N = degree + 1 nodes in every direction. Degrees -1, -2, and -3 are legal for special constructions; see p8est_lnodes. |
| p8est_lnodes_buffer_t * p8est_lnodes_share_all | ( | sc_array_t * | node_data, |
| p8est_lnodes_t * | lnodes | ||
| ) |
Equivalent to calling p8est_lnodes_share_all_end directly after p8est_lnodes_share_all_begin.
Use if there is no local work that can be done to mask the communication cost.
| p8est_lnodes_buffer_t * p8est_lnodes_share_all_begin | ( | sc_array_t * | node_data, |
| p8est_lnodes_t * | lnodes | ||
| ) |
p8est_lnodes_share_all_begin
node_data is a user_defined array of arbitrary type, where each entry is associated with the lnodes local nodes entry of matching index. For every process that shares an entry with the current one, the value in the node_data array of that process is written into a buffer->recv_buffers entry as described above. The user can then perform some arbitrary work that requires the data from all processes that share a node (such as reduce, max, min, etc.). When the work concludes, the buffer should be destroyed with p8est_lnodes_buffer_destroy.
Values of node_data are not guaranteed to be send, and buffer->recv_buffer entries are not guaranteed to be received until the buffer created by p8est_lnodes_share_all_begin is passed to p8est_lnodes_share_all_end.
| void p8est_lnodes_share_all_end | ( | p8est_lnodes_buffer_t * | buffer | ) |
p8est_lnodes_shared_all_end
Complete sharing of the node data between all relevant processes as initiated in p8est_lnodes_share_all_begin.
| void p8est_lnodes_share_owned | ( | sc_array_t * | node_data, |
| p8est_lnodes_t * | lnodes | ||
| ) |
Equivalent to calling p8est_lnodes_share_owned_end directly after p8est_lnodes_share_owned_begin.
Use if there is no local work that can be done to mask the communication cost.
| p8est_lnodes_buffer_t * p8est_lnodes_share_owned_begin | ( | sc_array_t * | node_data, |
| p8est_lnodes_t * | lnodes | ||
| ) |
p8est_lnodes_share_owned_begin
node_data is a user-defined array of arbitrary type, where each entry is associated with the lnodes local nodes entry of matching index. For every local nodes entry that is owned by a process other than the current one, the value in the node_data array of the owning process is written directly into the node_data array of the current process. Values of node_data are not guaranteed to be sent or received until the buffer created by p8est_lnodes_share_owned_begin is passed to p8est_lnodes_share_owned_end.
To be memory neutral, the buffer created by p8est_lnodes_share_owned_begin must be destroying with p8est_lnodes_buffer_destroy (it is not destroyed by p8est_lnodes_share_owned_end).
| void p8est_lnodes_share_owned_end | ( | p8est_lnodes_buffer_t * | buffer | ) |
p8est_lnodes_shared_owned_end
Complete sharing of the owbed node data between processes as initiated in p8est_lnodes_share_owned_begin.
| void p8est_partition_lnodes | ( | p8est_t * | p8est, |
| p8est_ghost_t * | ghost, | ||
| int | degree, | ||
| int | partition_for_coarsening | ||
| ) |
Partition using weights based on the number of nodes assigned to each element in lnodes.
| [in,out] | p8est | the forest to be repartitioned |
| [in] | ghost | the ghost layer |
| [in] | degree | the degree that would be passed to p8est_lnodes_new() |
| [in] | partition_for_coarsening | whether the partition should allow coarsening (i.e. group siblings who might merge) |
|
extern |
For each corner, the direction of the hanging face/edge.
The corner index is with respect to a zero child quadrant. Corners that may hang on a face store its normal direction. Corners that may hang on an edge store the edge direction + 3. Corners that may never hang store the value -1.