p4est  1.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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.
6  Copyright (C) 2010 The University of Texas System
7  Written by Carsten Burstedde, Lucas C. Wilcox, and Tobin Isaac
9  p4est is free software; you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation; either version 2 of the License, or
12  (at your option) any later version.
14  p4est is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  GNU General Public License for more details.
19  You should have received a copy of the GNU General Public License
20  along with p4est; if not, write to the Free Software Foundation, Inc.,
21  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 */
24 /********************************************************************
26  * *
27  * These interfaces are intended for those who like finer control. *
28  * The API offers extended versions of some basic p4est functions. *
29  * The API may change without notice. *
30  ********************************************************************/
39 #ifndef P8EST_EXTENDED_H
40 #define P8EST_EXTENDED_H
42 #include <p8est.h>
43 #include <p8est_mesh.h>
44 #include <p8est_iterate.h>
48 /* Data pertaining to selecting, inspecting, and profiling algorithms.
49  * A pointer to this structure is hooked into the p8est main structure.
50  *
51  * TODO: Describe the purpose of various switches, counters, and timings.
52  *
53  * The balance_ranges and balance_notify* times are collected
54  * whenever an inspect structure is present in p8est.
55  */
57 {
68  size_t balance_A_count_in;
69  size_t balance_A_count_out;
70  size_t balance_comm_sent;
71  size_t balance_comm_nzpeers;
72  size_t balance_B_count_in;
73  size_t balance_B_count_out;
74  size_t balance_zero_sends[2], balance_zero_receives[2];
75  double balance_A;
76  double balance_comm;
77  double balance_B;
78  double balance_ranges;
79  double balance_notify;
82  int use_B;
83 };
104 typedef void (*p8est_replace_t) (p8est_t * p8est,
105  p4est_topidx_t which_tree,
106  int num_outgoing,
107  p8est_quadrant_t * outgoing[],
108  int num_incoming,
109  p8est_quadrant_t * incoming[]);
124 p8est_t *p8est_new_ext (sc_MPI_Comm mpicomm,
125  p8est_connectivity_t * connectivity,
126  p4est_locidx_t min_quadrants,
127  int min_level, int fill_uniform,
128  size_t data_size, p8est_init_t init_fn,
129  void *user_pointer);
144  p8est_ghost_t * ghost,
145  int compute_tree_index,
146  int compute_level_lists,
147  p8est_connect_type_t btype);
170 void p8est_refine_ext (p8est_t * p8est,
171  int refine_recursive, int maxlevel,
173  p8est_init_t init_fn,
174  p8est_replace_t replace_fn);
194 void p8est_coarsen_ext (p8est_t * p8est, int coarsen_recursive,
195  int callback_orphans,
196  p8est_coarsen_t coarsen_fn,
197  p8est_init_t init_fn,
198  p8est_replace_t replace_fn);
211 void p8est_balance_ext (p8est_t * p8est,
212  p8est_connect_type_t btype,
213  p8est_init_t init_fn,
214  p8est_replace_t replace_fn);
216 void p8est_balance_subtree_ext (p8est_t * p8est,
217  p8est_connect_type_t btype,
218  p4est_topidx_t which_tree,
219  p8est_init_t init_fn,
220  p8est_replace_t replace_fn);
235  int partition_for_coarsening,
236  p8est_weight_t weight_fn);
243 void p8est_iterate_ext (p8est_t * p8est,
244  p8est_ghost_t * ghost_layer,
245  void *user_data,
246  p8est_iter_volume_t iter_volume,
247  p8est_iter_face_t iter_face,
248  p8est_iter_edge_t iter_edge,
249  p8est_iter_corner_t iter_corner,
250  int remote);
269 void p8est_save_ext (const char *filename, p8est_t * p8est,
270  int save_data, int save_partition);
293 p8est_t *p8est_load_ext (const char *filename, sc_MPI_Comm mpicomm,
294  size_t data_size, int load_data,
295  int autopartition, int broadcasthead,
296  void *user_pointer,
297  p8est_connectivity_t ** connectivity);
302 p8est_t *p8est_source_ext (sc_io_source_t * src,
303  sc_MPI_Comm mpicomm, size_t data_size,
304  int load_data, int autopartition,
305  int broadcasthead, void *user_pointer,
306  p8est_connectivity_t ** connectivity);
310 #endif /* !P8EST_EXTENDED_H */
void(* p8est_iter_volume_t)(p8est_iter_volume_info_t *info, void *user_data)
The prototype for a function that p8est_iterate() will execute at every quadrant local to the current...
Definition: p8est_iterate.h:62
void p8est_refine_ext(p8est_t *p8est, int refine_recursive, int maxlevel, p8est_refine_t refine_fn, p8est_init_t init_fn, p8est_replace_t replace_fn)
Refine a forest with a bounded refinement level and a replace option.
p8est_t * p8est_new_ext(sc_MPI_Comm mpicomm, p8est_connectivity_t *connectivity, p4est_locidx_t min_quadrants, int min_level, int fill_uniform, size_t data_size, p8est_init_t init_fn, void *user_pointer)
Create a new forest.
This structure contains complete mesh information on the forest.
Definition: p8est_mesh.h:89
Iteration over mesh topology via callbacks.
p8est_t * p8est_source_ext(sc_io_source_t *src, sc_MPI_Comm mpicomm, size_t data_size, int load_data, int autopartition, int broadcasthead, void *user_pointer, p8est_connectivity_t **connectivity)
The same as p8est_load_ext, but reading the connectivity/p8est from an open sc_io_source_t stream...
void(* p8est_iter_face_t)(p8est_iter_face_info_t *info, void *user_data)
The prototype for a function that p8est_iterate() will execute wherever two quadrants share a face: t...
Definition: p8est_iterate.h:136
Characterize a type of adjacency.
Definition: p8est_connectivity.h:79
quadrants that neighbor the local domain
Definition: p8est_ghost.h:39
void(* p8est_iter_corner_t)(p8est_iter_corner_info_t *info, void *user_data)
The prototype for a function that p8est_iterate will execute wherever the corner is a corner for all ...
Definition: p8est_iterate.h:273
Data pertaining to selecting, inspecting, and profiling algorithms.
Definition: p8est_extended.h:56
void p8est_iterate_ext(p8est_t *p8est, p8est_ghost_t *ghost_layer, void *user_data, p8est_iter_volume_t iter_volume, p8est_iter_face_t iter_face, p8est_iter_edge_t iter_edge, p8est_iter_corner_t iter_corner, int remote)
p8est_iterate_ext adds the option remote: if this is false, then it is the same as p8est_iterate; if ...
The top-level 3D p8est interface.
p8est_mesh_t * p8est_mesh_new_ext(p8est_t *p4est, p8est_ghost_t *ghost, int compute_tree_index, int compute_level_lists, p8est_connect_type_t btype)
Create a new mesh.
int use_balance_ranges
Use sc_ranges to determine the asymmetric communication pattern.
Definition: p8est_extended.h:60
void(* p8est_iter_edge_t)(p8est_iter_edge_info_t *info, void *user_data)
The prototype for a function that p8est_iterate will execute wherever the edge is an edge of all quad...
Definition: p8est_iterate.h:217
void p8est_save_ext(const char *filename, p8est_t *p8est, int save_data, int save_partition)
Save the complete connectivity/p8est data to disk.
static int refine_fn(p4est_t *p4est, p4est_topidx_t which_tree, p4est_quadrant_t *quadrant)
Callback function to decide on refinement.
Definition: p4est_step1.c:59
int64_t p4est_gloidx_t
Typedef for globally unique indexing of quadrants.
Definition: p4est_base.h:84
forest topology in a conventional mesh format
void p8est_coarsen_ext(p8est_t *p8est, int coarsen_recursive, int callback_orphans, p8est_coarsen_t coarsen_fn, p8est_init_t init_fn, p8est_replace_t replace_fn)
Coarsen a forest.
This structure holds the 3D inter-tree connectivity information.
Definition: p8est_connectivity.h:158
The 3D quadrant (i.e.
Definition: p8est.h:61
int(* p8est_refine_t)(p8est_t *p8est, p4est_topidx_t which_tree, p8est_quadrant_t *quadrant)
Callback function prototype to decide for refinement.
Definition: p8est.h:190
void p8est_balance_ext(p8est_t *p8est, p8est_connect_type_t btype, p8est_init_t init_fn, p8est_replace_t replace_fn)
2:1 balance the size differences of neighboring elements in a forest.
The p8est forest datatype.
Definition: p8est.h:125
int use_balance_verify
Verify sc_ranges and/or sc_notify as applicable.
Definition: p8est_extended.h:65
void(* p8est_init_t)(p8est_t *p8est, p4est_topidx_t which_tree, p8est_quadrant_t *quadrant)
Callback function prototype to initialize the quadrant's user data.
Definition: p8est.h:180
int(* p8est_weight_t)(p8est_t *p8est, p4est_topidx_t which_tree, p8est_quadrant_t *quadrant)
Callback function prototype to calculate weights for partitioning.
Definition: p8est.h:210
double balance_notify
time spent in sc_notify
Definition: p8est_extended.h:79
p4est_gloidx_t p8est_partition_ext(p8est_t *p8est, int partition_for_coarsening, p8est_weight_t weight_fn)
Repartition the forest.
int balance_max_ranges
If positive and smaller than p8est_num ranges, overrides it.
Definition: p8est_extended.h:67
p8est_t * p8est_load_ext(const char *filename, sc_MPI_Comm mpicomm, size_t data_size, int load_data, int autopartition, int broadcasthead, void *user_pointer, p8est_connectivity_t **connectivity)
Load the complete connectivity/p4est structure from disk.
int32_t p4est_topidx_t
Typedef for counting topological entities (trees, tree vertices).
Definition: p4est_base.h:63
int32_t p4est_locidx_t
Typedef for processor-local indexing of quadrants and nodes.
Definition: p4est_base.h:74
int use_balance_ranges_notify
If true, call both sc_ranges and sc_notify and verify consistency.
Definition: p8est_extended.h:63
int(* p8est_coarsen_t)(p8est_t *p8est, p4est_topidx_t which_tree, p8est_quadrant_t *quadrants[])
Callback function prototype to decide for coarsening.
Definition: p8est.h:200
void(* p8est_replace_t)(p8est_t *p8est, p4est_topidx_t which_tree, int num_outgoing, p8est_quadrant_t *outgoing[], int num_incoming, p8est_quadrant_t *incoming[])
Callback function prototype to replace one set of quadrants with another.
Definition: p8est_extended.h:104
double balance_ranges
time spent in sc_ranges
Definition: p8est_extended.h:78
double balance_notify_allgather
time spent in sc_notify_allgather
Definition: p8est_extended.h:81