p4est 2.8.6
p4est is a software library for parallel adaptive mesh refinement.
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
115/*@unused@*/
116static inline int
117p6est_lnodes_decode (p6est_lnodes_code_t face_code, int hanging_face[6],
118 int hanging_edge[12])
119{
120 P4EST_ASSERT (face_code >= 0);
121
122 if (face_code) {
123 /* we pack the p4est_lnodes_code_t at the bottom, followed by a bit
124 * indicating whether this layer is a first or second sibling, followed by
125 * four bits indicating which of the four side faces are layerwise
126 * nonconforming, followed by four bits indicating which of the four side
127 * edges are layerwise nonconforming */
128 p4est_lnodes_code_t fc4 = face_code & 0x000f;
129 int16_t h = (face_code & 0x0010) >> 4;
130 int16_t work = face_code >> 5;
131 int hf;
132 int f, e, w;
133
134 memset (hanging_face, -1, 6 * sizeof (int));
135 memset (hanging_edge, -1, 12 * sizeof (int));
136
137 /* the first two faces are the top and bottom faces, which we know are not
138 * hanging */
139 p4est_lnodes_decode (fc4, hanging_face + 2);
140 for (f = 0; f < 4; f++) {
141 hf = hanging_face[f + 2];
142 w = work & 0x0001;
143 if (hf >= 0) {
144 hanging_edge[p8est_face_edges[f + 2][2]] = 2 + hf;
145 hanging_edge[p8est_face_edges[f + 2][3]] = 2 + hf;
146 hanging_edge[p8est_face_edges[f + 2][1 ^ hf]] = 4;
147 if (w) {
148 hanging_edge[p8est_face_edges[f + 2][3 ^ h]] = 4;
149 hanging_edge[p8est_face_edges[f + 2][1 ^ hf]] = 4;
150 hanging_edge[p8est_face_edges[f + 2][hf]] = 2 + h;
151 hanging_face[f + 2] = (hf << 1) | h;
152 }
153 else {
154 hanging_face[f + 2] = 4 + hf;
155 }
156 }
157 else if (w) {
158 hanging_edge[p8est_face_edges[f + 2][3 ^ h]] = 4;
159 hanging_edge[p8est_face_edges[f + 2][0]] =
160 SC_MAX (hanging_edge[p8est_face_edges[f + 2][0]], 2 + h);
161 hanging_edge[p8est_face_edges[f + 2][1]] =
162 SC_MAX (hanging_edge[p8est_face_edges[f + 2][1]], 2 + h);
163 hanging_face[f + 2] = 6 + h;
164 }
165 work >>= 1;
166 }
167 for (e = 0; e < 4; e++) {
168 if (work & 0x0001) {
169 if (hanging_edge[e] < 0) {
170 hanging_edge[e] = h;
171 }
172#ifdef P4EST_ENABLE_DEBUG
173 else {
174 P4EST_ASSERT (hanging_edge[e] == 2 + h || hanging_edge[e] == 4);
175 }
176#endif
177 }
178 work >>= 1;
179 }
180 return 1;
181 }
182 else {
183 return 0;
184 }
185}
186
187p6est_lnodes_t *p6est_lnodes_new (p6est_t * p6est,
188 p6est_ghost_t * ghost_layer,
189 int degree);
190
191static inline void
192p6est_lnodes_destroy (p6est_lnodes_t * lnodes)
193{
194 p8est_lnodes_destroy (lnodes);
195}
196
197/*@unused@*/
198static inline p6est_lnodes_buffer_t *
199p6est_lnodes_share_owned_begin (sc_array_t * node_data,
200 p6est_lnodes_t * lnodes)
201{
202 return p8est_lnodes_share_owned_begin (node_data, lnodes);
203}
204
205/*@unused@*/
206static inline void
207p6est_lnodes_share_owned_end (p6est_lnodes_buffer_t * buffer)
208{
209 p8est_lnodes_share_owned_end (buffer);
210}
211
212/*@unused@*/
213static inline void
214p6est_lnodes_share_owned (sc_array_t * node_data, p6est_lnodes_t * lnodes)
215{
216 p8est_lnodes_share_owned (node_data, lnodes);
217}
218
219/*@unused@*/
220static inline p6est_lnodes_buffer_t *
221p6est_lnodes_share_all_begin (sc_array_t * node_data, p6est_lnodes_t * lnodes)
222{
223 return p8est_lnodes_share_all_begin (node_data, lnodes);
224}
225
226/*@unused@*/
227static inline void
228p6est_lnodes_share_all_end (p6est_lnodes_buffer_t * buffer)
229{
230 p8est_lnodes_share_all_end (buffer);
231}
232
233/*@unused@*/
234static inline p6est_lnodes_buffer_t *
235p6est_lnodes_share_all (sc_array_t * node_data, p6est_lnodes_t * lnodes)
236{
237 return p8est_lnodes_share_all (node_data, lnodes);
238}
239
240/*@unused@*/
241static inline void
242p6est_lnodes_buffer_destroy (p6est_lnodes_buffer_t * buffer)
243{
244 p8est_lnodes_buffer_destroy (buffer);
245}
246
247/*@unused@*/
248static inline p6est_lnodes_rank_t *
249p6est_lnodes_rank_array_index_int (sc_array_t * array, int it)
250{
251 return p8est_lnodes_rank_array_index_int (array, it);
252}
253
254/*@unused@*/
255static inline p6est_lnodes_rank_t *
256p6est_lnodes_rank_array_index (sc_array_t * array, size_t it)
257{
258 return p8est_lnodes_rank_array_index (array, it);
259}
260
261/*@unused@*/
262static inline p4est_gloidx_t
263p6est_lnodes_global_index (p6est_lnodes_t * lnodes, p4est_locidx_t lidx)
264{
265 return p8est_lnodes_global_index (lnodes, lidx);
266}
267
277p4est_gloidx_t *p6est_lnodes_get_column_labels (p6est_t * p6est,
278 p8est_lnodes_t * lnodes);
279
280SC_EXTERN_C_END;
281
282#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
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.
columns of layers that neighbor the local domain
Definition: p6est_ghost.h:42
The p6est forest datatype.
Definition: p6est.h:165
p8est_lnodes_buffer_t handles the communication of data associated with nodes.
Definition: p8est_lnodes.h:318
The structure stored in the sharers array.
Definition: p8est_lnodes.h:140
Store a parallel numbering of Lobatto points of a given degree > 0.
Definition: p8est_lnodes.h:112