p4est 2.8.7.456-de8c6
p4est is a software library for parallel adaptive mesh refinement.
Loading...
Searching...
No Matches
p4est_connectivity.h
Go to the documentation of this file.
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
58#ifndef P4EST_CONNECTIVITY_H
59#define P4EST_CONNECTIVITY_H
60
61#ifdef P4_TO_P8
62#error "Including a p4est header with P4_TO_P8 defined"
63#endif
64
65#include <sc_io.h>
66#include <p4est_base.h>
67
68SC_EXTERN_C_BEGIN;
69
71#define P4EST_DIM 2
73#define P4EST_FACES (2 * P4EST_DIM)
75#define P4EST_CHILDREN 4
77#define P4EST_HALF (P4EST_CHILDREN / 2)
79#define P4EST_INSUL 9
80
82#define P4EST_ONLY_P8_LAND(x)
83
85#define P4EST_ONLY_P8_COMMA(x)
86
88#define P4EST_DIM_POW(a) ((a) * (a))
89
91#define P4EST_FTRANSFORM 9
92
94#define P4EST_STRING "p4est"
95
101#define P4EST_ONDISK_FORMAT 0x2000009
102
112typedef enum
113{
114 /* make sure to have different values 2D and 3D */
122
123#ifdef P4EST_BACKWARD_DEALII
124typedef p4est_connect_type_t p4est_balance_type_t;
125#endif
126
128typedef enum
129{
130 P4EST_CONN_ENCODE_NONE = SC_IO_ENCODE_NONE,
134
139int p4est_connect_type_int (p4est_connect_type_t btype);
140
145const char *p4est_connect_type_string (p4est_connect_type_t btype);
146
220
223{
226#ifdef P4EST_ENABLE_MPIWINSHARED
227 MPI_Win win_vertices;
228 MPI_Win win_tree_to_vertex;
229 MPI_Win win_tree_to_attr;
230 MPI_Win win_tree_to_tree;
231 MPI_Win win_tree_to_face;
232 MPI_Win win_tree_to_corner;
233 MPI_Win win_ctt_offset;
234 MPI_Win win_corner_to_tree;
235 MPI_Win win_corner_to_corner;
236#endif
237}
239
244size_t p4est_connectivity_memory_used (p4est_connectivity_t *
245 conn);
246
248typedef struct
249{
251 int8_t ncorner;
252}
254
256typedef struct
257{
259 sc_array_t corner_transforms;
261}
263
285
286/* *INDENT-OFF* */
287
294void p4est_neighbor_transform_coordinates
295 (const p4est_neighbor_transform_t * nt,
296 const p4est_qcoord_t self_coords[P4EST_DIM],
297 p4est_qcoord_t neigh_coords[P4EST_DIM]);
298
305void p4est_neighbor_transform_coordinates_reverse
306 (const p4est_neighbor_transform_t * nt,
307 const p4est_qcoord_t neigh_coords[P4EST_DIM],
308 p4est_qcoord_t self_coords[P4EST_DIM]);
309
319void p4est_connectivity_get_neighbor_transforms
321 p4est_topidx_t tree_id,
322 p4est_connect_type_t boundary_type,
323 int boundary_index,
324 sc_array_t *neighbor_transform_array);
325
326/* *INDENT-ON* */
327
347void p4est_connectivity_coordinates_canonicalize
349 p4est_topidx_t treeid, const p4est_qcoord_t coords[],
350 p4est_topidx_t *treeid_out, p4est_qcoord_t coords_out[]);
351
353extern const int p4est_volume_point;
354
356extern const int p4est_face_corners[4][2];
357
359extern const int p4est_face_points[4];
360
362extern const int p4est_face_dual[4];
363
365extern const int p4est_corner_faces[4][2];
366
368extern const int p4est_corner_points[4];
369
371extern const int p4est_corner_face_corners[4][4];
372
374extern const int p4est_child_corner_faces[4][4];
375
384int p4est_connectivity_face_neighbor_face_corner
385 (int fc, int f, int nf, int o);
386
395int p4est_connectivity_face_neighbor_corner
396 (int c, int f, int nf, int o);
397
406p4est_connectivity_t *p4est_connectivity_new (p4est_topidx_t num_vertices,
407 p4est_topidx_t num_trees,
408 p4est_topidx_t num_corners,
409 p4est_topidx_t num_ctt);
410
428p4est_connectivity_t *p4est_connectivity_new_copy (p4est_topidx_t
429 num_vertices,
430 p4est_topidx_t num_trees,
431 p4est_topidx_t num_corners,
432 const double *vertices,
433 const p4est_topidx_t * ttv,
434 const p4est_topidx_t * ttt,
435 const int8_t * ttf,
436 const p4est_topidx_t * ttc,
437 const p4est_topidx_t *
438 coff,
439 const p4est_topidx_t * ctt,
440 const int8_t * ctc);
441
449p4est_connectivity_t *p4est_connectivity_copy (p4est_connectivity_t *input,
450 int copy_attr);
451
469p4est_connectivity_t *p4est_connectivity_bcast (p4est_connectivity_t *
470 conn_in, int root,
471 sc_MPI_Comm comm);
472
475void p4est_connectivity_destroy (p4est_connectivity_t *
476 connectivity);
477
500p4est_connectivity_shared_t *p4est_connectivity_share
501 (p4est_connectivity_t * conn_in, int root, sc_MPI_Comm comm);
502
522p4est_connectivity_mission (p4est_connectivity_t *conn_in,
523 int split_type, sc_MPI_Comm world_comm);
524
531void p4est_connectivity_shared_destroy
533
540void p4est_connectivity_set_attr (p4est_connectivity_t * conn,
541 size_t bytes_per_tree);
542
546int p4est_connectivity_is_valid (p4est_connectivity_t *
547 connectivity);
548
552int p4est_connectivity_is_equal (p4est_connectivity_t * conn1,
554 conn2);
555
561int p4est_connectivity_sink (p4est_connectivity_t * conn,
562 sc_io_sink_t * sink);
563
569sc_array_t *p4est_connectivity_deflate (p4est_connectivity_t * conn,
571 code);
572
578int p4est_connectivity_save (const char *filename,
580 connectivity);
581
586p4est_connectivity_t *p4est_connectivity_source (sc_io_source_t * source);
587
594p4est_connectivity_t *p4est_connectivity_inflate (sc_array_t * buffer);
595
601p4est_connectivity_t *p4est_connectivity_load (const char *filename,
602 size_t *bytes);
603
607
611
616
624
629
636p4est_connectivity_t *p4est_connectivity_new_twotrees (int l_face,
637 int r_face,
638 int orientation);
639
643
647
651
655
666
673
701 int periodic_b);
702
732
737
744
758
763p4est_connectivity_t *p4est_connectivity_new_brick (int mi, int ni,
764 int periodic_a,
765 int periodic_b);
766
781p4est_connectivity_t *p4est_connectivity_new_byname (const char *name);
782
793p4est_connectivity_t *p4est_connectivity_refine (p4est_connectivity_t * conn,
794 int num_per_dim);
795
815void p4est_expand_face_transform (int iface, int nface,
816 int ftransform[]);
817
830p4est_topidx_t p4est_find_face_transform (p4est_connectivity_t *
831 connectivity,
832 p4est_topidx_t itree,
833 int iface, int ftransform[]);
834
841void p4est_find_corner_transform (p4est_connectivity_t *
842 connectivity,
843 p4est_topidx_t itree,
844 int icorner,
846
856void p4est_connectivity_complete (p4est_connectivity_t * conn);
857
863void p4est_connectivity_reduce (p4est_connectivity_t * conn);
864
879void p4est_connectivity_permute (p4est_connectivity_t * conn,
880 sc_array_t * perm,
881 int is_current_to_new);
882#ifdef P4EST_WITH_METIS
883
909void p4est_connectivity_reorder (sc_MPI_Comm comm, int k,
912
936sc_array_t *p4est_connectivity_reorder_newid (sc_MPI_Comm comm, int k,
938 conn,
940 ctype,
941 sc_array_t * newid);
942
943#endif /* P4EST_WITH_METIS */
944
960void p4est_connectivity_join_faces (p4est_connectivity_t *
961 conn,
962 p4est_topidx_t tree_left,
963 p4est_topidx_t tree_right,
964 int face_left,
965 int face_right,
966 int orientation);
967
978int p4est_connectivity_is_equivalent (p4est_connectivity_t *
979 conn1,
981 conn2);
982
985p4est_corner_array_index (sc_array_t *array, size_t it)
986{
987 P4EST_ASSERT (array->elem_size == sizeof (p4est_corner_transform_t));
988 P4EST_ASSERT (it < array->elem_count);
989
990 return
991 (p4est_corner_transform_t *) (array->array +
992 sizeof (p4est_corner_transform_t) * it);
993}
994
1075int p4est_connectivity_read_inp_stream (FILE * stream,
1077 num_vertices,
1079 num_trees,
1080 double *vertices,
1082 tree_to_vertex);
1083
1156p4est_connectivity_t *p4est_connectivity_read_inp (const char *filename);
1157
1158SC_EXTERN_C_END;
1159
1160#endif /* !P4EST_CONNECTIVITY_H */
General support types and functions.
int32_t p4est_qcoord_t
Typedef for quadrant coordinates.
Definition p4est_base.h:81
int32_t p4est_topidx_t
Typedef for counting topological entities (trees, tree vertices).
Definition p4est_base.h:93
p4est_connectivity_t * p4est_connectivity_new_drop(void)
Create a connectivity structure for a five-trees geometry with a hole.
struct p4est_connectivity_shared p4est_connectivity_shared_t
Management information for a connectivity shared by MPI3.
p4est_connectivity_t * p4est_connectivity_new_corner(void)
Create a connectivity structure for a three-tree mesh around a corner.
p4est_connectivity_t * p4est_connectivity_new_cubed(void)
Create a connectivity structure for the six sides of a unit cube.
p4est_connectivity_t * p4est_connectivity_new_disk(int periodic_a, int periodic_b)
Create a connectivity structure for a five-tree flat spherical disk.
#define P4EST_DIM
The spatial dimension.
Definition p4est_connectivity.h:71
p4est_connectivity_t * p4est_connectivity_new_unitsquare(void)
Create a connectivity structure for the unit square.
p4est_connectivity_t * p4est_connectivity_new_disk2d(void)
Create a connectivity structure that maps a 2d disk.
p4est_connectivity_t * p4est_connectivity_new_shell2d(void)
Create a connectivity structure that builds a 2d spherical shell.
p4est_connectivity_t * p4est_connectivity_new_rotwrap(void)
Create a connectivity structure for a periodic unit square.
const int p4est_face_points[4]
For each face number, its boundary point in [0, P4EST_INSUL).
p4est_connectivity_t * p4est_connectivity_new_circle(void)
Create a connectivity structure for an donut-like circle.
const int p4est_corner_faces[4][2]
Store the face numbers 0..3 for each tree corner.
const int p4est_face_corners[4][2]
Store the corner numbers 0..4 for each tree face.
const int p4est_corner_face_corners[4][4]
Store the face corner numbers for the faces touching a tree corner.
p4est_connectivity_t * p4est_connectivity_new_pillow(void)
Create a connectivity structure for two trees on top of each other.
p4est_connectivity_encode_t
Typedef for serialization method.
Definition p4est_connectivity.h:129
@ P4EST_CONN_ENCODE_LAST
Invalid entry to close the list.
Definition p4est_connectivity.h:131
p4est_connectivity_t * p4est_connectivity_new_icosahedron(void)
Create a connectivity for mapping the sphere using an icosahedron.
p4est_connectivity_t * p4est_connectivity_new_bowtie(void)
Create a connectivity structure that maps a 2d bowtie structure.
struct p4est_connectivity p4est_connectivity_t
This structure holds the 2D inter-tree connectivity information.
p4est_connectivity_t * p4est_connectivity_new_star(void)
Create a connectivity structure for a six-tree star.
const int p4est_volume_point
Store the boundary point of the volume in [0, P4EST_INSUL).
p4est_connectivity_t * p4est_connectivity_new_disk_nonperiodic(void)
Create a connectivity structure for a five-tree flat spherical disk.
const int p4est_corner_points[4]
For each corner number, its boundary point in [0, P4EST_INSUL).
p4est_connect_type_t
Characterize a type of adjacency.
Definition p4est_connectivity.h:113
@ P4EST_CONNECT_FACE
Balance across faces only.
Definition p4est_connectivity.h:116
@ P4EST_CONNECT_SELF
No balance whatsoever.
Definition p4est_connectivity.h:115
@ P4EST_CONNECT_FULL
= CORNER.
Definition p4est_connectivity.h:119
@ P4EST_CONNECT_ALMOST
= CORNER - 1.
Definition p4est_connectivity.h:117
@ P4EST_CONNECT_CORNER
Balance across faces and corners.
Definition p4est_connectivity.h:118
const int p4est_face_dual[4]
Store the face numbers in the face neighbor's system.
p4est_connectivity_t * p4est_connectivity_new_moebius(void)
Create a connectivity structure for a five-tree moebius band.
const int p4est_child_corner_faces[4][4]
Store the faces for each child and corner, can be -1.
p4est_connectivity_t * p4est_connectivity_new_periodic(void)
Create a connectivity structure for an all-periodic unit square.
Management information for a connectivity shared by MPI3.
Definition p4est_connectivity.h:223
p4est_connectivity_t * conn
The members of this connectivity are MPI3 shared windows.
Definition p4est_connectivity.h:225
This structure holds the 2D inter-tree connectivity information.
Definition p4est_connectivity.h:190
p4est_topidx_t num_vertices
the number of vertices that define the embedding of the forest (not the topology)
Definition p4est_connectivity.h:191
p4est_topidx_t num_trees
the number of trees
Definition p4est_connectivity.h:194
int8_t * tree_to_face
(4 * num_trees) face to face+orientation (see description)
Definition p4est_connectivity.h:208
p4est_topidx_t * ctt_offset
corner to offset in corner_to_tree and corner_to_corner
Definition p4est_connectivity.h:213
p4est_topidx_t num_corners
the number of corners that help define topology
Definition p4est_connectivity.h:195
int8_t * corner_to_corner
list of tree-corners that meet at a corner
Definition p4est_connectivity.h:216
p4est_topidx_t * tree_to_vertex
embed each tree into for e.g.
Definition p4est_connectivity.h:199
p4est_topidx_t * tree_to_tree
(4 * num_trees) neighbors across faces
Definition p4est_connectivity.h:206
char * tree_to_attr
not touched by p4est
Definition p4est_connectivity.h:204
p4est_topidx_t * tree_to_corner
(4 * num_trees) or NULL (see description)
Definition p4est_connectivity.h:211
p4est_topidx_t * corner_to_tree
list of trees that meet at a corner
Definition p4est_connectivity.h:215
double * vertices
an array of size (3 * num_vertices)
Definition p4est_connectivity.h:197
size_t tree_attr_bytes
bytes per tree in tree_to_attr
Definition p4est_connectivity.h:203
Information about the neighbors of a corner.
Definition p4est_connectivity.h:257
p4est_topidx_t icorner
The number of the originating corner.
Definition p4est_connectivity.h:258
sc_array_t corner_transforms
The array of neighbors of the originating corner.
Definition p4est_connectivity.h:259
Generic interface for transformations between a tree and any of its corner.
Definition p4est_connectivity.h:249
p4est_topidx_t ntree
The number of the tree.
Definition p4est_connectivity.h:250
int8_t ncorner
The number of the corner.
Definition p4est_connectivity.h:251
Generic interface for transformations between a tree and any of its neighbors.
Definition p4est_connectivity.h:266
int8_t index_self
index of interface from self's perspective
Definition p4est_connectivity.h:269
p4est_topidx_t neighbor
neighbor tree index
Definition p4est_connectivity.h:268
int8_t index_neighbor
index of interface from neighbor's perspective
Definition p4est_connectivity.h:271
p4est_connect_type_t neighbor_type
type of connection to neighbor
Definition p4est_connectivity.h:267