p4est 2.8.7.456-de8c6
p4est is a software library for parallel adaptive mesh refinement.
Loading...
Searching...
No Matches
p6est_lnodes.h
1/*
2 This file is part of p4est.
3 p4est is a C library to manage a collection (a forest) of multiple
4 connected adaptive quadtrees or octrees in parallel.
5
6 Copyright (C) 2010 The University of Texas System
7 Additional copyright (C) 2011 individual authors
8 Written by Carsten Burstedde, Lucas C. Wilcox, and Tobin Isaac
9
10 p4est is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
14
15 p4est is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with p4est; if not, write to the Free Software Foundation, Inc.,
22 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23*/
24
25#ifndef P6EST_LNODES_H
26#define P6EST_LNODES_H
27
28#include <p6est_ghost.h>
29#include <p4est_lnodes.h>
30#include <p8est_lnodes.h>
31
32SC_EXTERN_C_BEGIN;
33
34/* A p6est_lnodes_t is exactly the same as a p8est_lnodes_t, with the only
35 * difference being that the face_codes are interpreted differently to account
36 * for the types of hanging faces that occur in a p6est. Please see the
37 * documentation for p8est_lnodes */
38
39/* The only other difference is in the numbering of nodes, edges, and faces.
40 *
41 * Columns of nodes are numbered contiguously: this still generates a
42 * partition-unique numbering.
43 *
44 * Although we call a p2est_quadrant_t coordinate layer->z, the orientation of
45 * a layer from lnodes perspective is that the vertical axis is the X axis of
46 * the 3D element, the x axis of the columns is the Y axis of the 3D element,
47 * and the y axis of the columns is the Z axis of the 3D element
48 */
49
51typedef p8est_lnodes_code_t p6est_lnodes_code_t;
54
115inline int
116p6est_lnodes_decode (p6est_lnodes_code_t face_code, int hanging_face[6],
117 int hanging_edge[12])
118{
119 P4EST_ASSERT (face_code >= 0);
120
121 if (face_code) {
122 /* we pack the p4est_lnodes_code_t at the bottom, followed by a bit
123 * indicating whether this layer is a first or second sibling, followed by
124 * four bits indicating which of the four side faces are layerwise
125 * nonconforming, followed by four bits indicating which of the four side
126 * edges are layerwise nonconforming */
127 p4est_lnodes_code_t fc4 = face_code & 0x000f;
128 int16_t h = (face_code & 0x0010) >> 4;
129 int16_t work = face_code >> 5;
130 int hf;
131 int f, e, w;
132
133 memset (hanging_face, -1, 6 * sizeof (int));
134 memset (hanging_edge, -1, 12 * sizeof (int));
135
136 /* the first two faces are the top and bottom faces, which we know are not
137 * hanging */
138 p4est_lnodes_decode (fc4, hanging_face + 2);
139 for (f = 0; f < 4; f++) {
140 hf = hanging_face[f + 2];
141 w = work & 0x0001;
142 if (hf >= 0) {
143 hanging_edge[p8est_face_edges[f + 2][2]] = 2 + hf;
144 hanging_edge[p8est_face_edges[f + 2][3]] = 2 + hf;
145 hanging_edge[p8est_face_edges[f + 2][1 ^ hf]] = 4;
146 if (w) {
147 hanging_edge[p8est_face_edges[f + 2][3 ^ h]] = 4;
148 hanging_edge[p8est_face_edges[f + 2][1 ^ hf]] = 4;
149 hanging_edge[p8est_face_edges[f + 2][hf]] = 2 + h;
150 hanging_face[f + 2] = (hf << 1) | h;
151 }
152 else {
153 hanging_face[f + 2] = 4 + hf;
154 }
155 }
156 else if (w) {
157 hanging_edge[p8est_face_edges[f + 2][3 ^ h]] = 4;
158 hanging_edge[p8est_face_edges[f + 2][0]] =
159 SC_MAX (hanging_edge[p8est_face_edges[f + 2][0]], 2 + h);
160 hanging_edge[p8est_face_edges[f + 2][1]] =
161 SC_MAX (hanging_edge[p8est_face_edges[f + 2][1]], 2 + h);
162 hanging_face[f + 2] = 6 + h;
163 }
164 work >>= 1;
165 }
166 for (e = 0; e < 4; e++) {
167 if (work & 0x0001) {
168 if (hanging_edge[e] < 0) {
169 hanging_edge[e] = h;
170 }
171#ifdef P4EST_ENABLE_DEBUG
172 else {
173 P4EST_ASSERT (hanging_edge[e] == 2 + h || hanging_edge[e] == 4);
174 }
175#endif
176 }
177 work >>= 1;
178 }
179 return 1;
180 }
181 else {
182 return 0;
183 }
184}
185
186p6est_lnodes_t *p6est_lnodes_new (p6est_t * p6est,
187 p6est_ghost_t * ghost_layer,
188 int degree);
189
194inline void
195p6est_lnodes_destroy (p6est_lnodes_t * lnodes)
196{
197 p8est_lnodes_destroy (lnodes);
198}
199
217p6est_lnodes_share_owned_begin (sc_array_t * node_data,
218 p6est_lnodes_t * lnodes)
219{
220 return p8est_lnodes_share_owned_begin (node_data, lnodes);
221}
222
227inline void
228p6est_lnodes_share_owned_end (p6est_lnodes_buffer_t * buffer)
229{
231}
232
237inline void
238p6est_lnodes_share_owned (sc_array_t * node_data, p6est_lnodes_t * lnodes)
239{
240 p8est_lnodes_share_owned (node_data, lnodes);
241}
242
260p6est_lnodes_share_all_begin (sc_array_t * node_data, p6est_lnodes_t * lnodes)
261{
262 return p8est_lnodes_share_all_begin (node_data, lnodes);
263}
264
269inline void
270p6est_lnodes_share_all_end (p6est_lnodes_buffer_t * buffer)
271{
273}
274
283p6est_lnodes_share_all (sc_array_t * node_data, p6est_lnodes_t * lnodes)
284{
285 return p8est_lnodes_share_all (node_data, lnodes);
286}
287
290inline void
291p6est_lnodes_buffer_destroy (p6est_lnodes_buffer_t * buffer)
292{
294}
295
297inline p6est_lnodes_rank_t *
298p6est_lnodes_rank_array_index_int (sc_array_t * array, int it)
299{
300 return p8est_lnodes_rank_array_index_int (array, it);
301}
302
304inline p6est_lnodes_rank_t *
305p6est_lnodes_rank_array_index (sc_array_t * array, size_t it)
306{
307 return p8est_lnodes_rank_array_index (array, it);
308}
309
311inline p4est_gloidx_t
312p6est_lnodes_global_index (p6est_lnodes_t * lnodes, p4est_locidx_t lidx)
313{
314 return p8est_lnodes_global_index (lnodes, lidx);
315}
316
326p4est_gloidx_t *p6est_lnodes_get_column_labels (p6est_t * p6est,
327 p8est_lnodes_t * lnodes);
328
329SC_EXTERN_C_END;
330
331#endif /* !P6EST_LNODES */
int32_t p4est_locidx_t
Typedef for processor-local indexing of quadrants and nodes.
Definition p4est_base.h:106
int64_t p4est_gloidx_t
Typedef for globally unique indexing of quadrants.
Definition p4est_base.h:118
Generate Lobatto node numbers for any degree.
int8_t p4est_lnodes_code_t
The face code encodes the configuration of a hanging quadrant.
Definition p4est_lnodes.h:44
passing columns of layers and data to neighboring processes
const int p8est_face_edges[6][4]
Store the edge numbers 0..12 for each tree face.
Generate Lobatto node numbers for any degree.
int16_t p8est_lnodes_code_t
The face code encodes the configuration of a hanging quadrant.
Definition p8est_lnodes.h:46
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.
void p8est_lnodes_destroy(p8est_lnodes_t *lnodes)
Free all memory in a previously constructed lnodes structure.
void p8est_lnodes_share_all_end(p8est_lnodes_buffer_t *buffer)
p8est_lnodes_shared_all_end
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.
Definition p8est_lnodes.h:457
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_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_...
void p8est_lnodes_share_owned_end(p8est_lnodes_buffer_t *buffer)
p8est_lnodes_shared_owned_end
p8est_lnodes_buffer_t * p8est_lnodes_share_all_begin(sc_array_t *node_data, p8est_lnodes_t *lnodes)
p8est_lnodes_share_all_begin
p4est_gloidx_t p8est_lnodes_global_index(p8est_lnodes_t *lnodes, p4est_locidx_t lidx)
Compute the global number of a local node number.
Definition p8est_lnodes.h:480
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.
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.
Definition p8est_lnodes.h:469
columns of layers that neighbor the local domain
Definition p6est_ghost.h:42
The p6est forest datatype.
Definition p6est.h:167
p8est_lnodes_buffer_t handles the communication of data associated with nodes.
Definition p8est_lnodes.h:373
The structure stored in the sharers array.
Definition p8est_lnodes.h:161
Store a parallel numbering of Lobatto points of a given degree > 0.
Definition p8est_lnodes.h:127