p4est  1.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
p4est_extended.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  Written by Carsten Burstedde, Lucas C. Wilcox, and Tobin Isaac
8 
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.
13 
14  p4est is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
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 */
23 
24 /********************************************************************
25  * IMPORTANT NOTE *
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  ********************************************************************/
31 
39 #ifndef P4EST_EXTENDED_H
40 #define P4EST_EXTENDED_H
41 
42 #include <p4est.h>
43 #include <p4est_mesh.h>
44 #include <p4est_iterate.h>
45 
46 SC_EXTERN_C_BEGIN;
47 
55 /* TODO: Describe the purpose of various switches, counters, and timings. */
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 };
84 
104 typedef void (*p4est_replace_t) (p4est_t * p4est,
105  p4est_topidx_t which_tree,
106  int num_outgoing,
107  p4est_quadrant_t * outgoing[],
108  int num_incoming,
109  p4est_quadrant_t * incoming[]);
110 
124 p4est_t *p4est_new_ext (sc_MPI_Comm mpicomm,
125  p4est_connectivity_t * connectivity,
126  p4est_locidx_t min_quadrants,
127  int min_level, int fill_uniform,
128  size_t data_size, p4est_init_t init_fn,
129  void *user_pointer);
130 
144  p4est_ghost_t * ghost,
145  int compute_tree_index,
146  int compute_level_lists,
147  p4est_connect_type_t btype);
148 
170 void p4est_refine_ext (p4est_t * p4est,
171  int refine_recursive, int maxlevel,
173  p4est_init_t init_fn,
174  p4est_replace_t replace_fn);
175 
194 void p4est_coarsen_ext (p4est_t * p4est, int coarsen_recursive,
195  int callback_orphans,
196  p4est_coarsen_t coarsen_fn,
197  p4est_init_t init_fn,
198  p4est_replace_t replace_fn);
199 
211 void p4est_balance_ext (p4est_t * p4est,
212  p4est_connect_type_t btype,
213  p4est_init_t init_fn,
214  p4est_replace_t replace_fn);
215 
216 void p4est_balance_subtree_ext (p4est_t * p4est,
217  p4est_connect_type_t btype,
218  p4est_topidx_t which_tree,
219  p4est_init_t init_fn,
220  p4est_replace_t replace_fn);
221 
235  int partition_for_coarsening,
236  p4est_weight_t weight_fn);
237 
242 void p4est_iterate_ext (p4est_t * p4est,
243  p4est_ghost_t * ghost_layer,
244  void *user_data,
245  p4est_iter_volume_t iter_volume,
246  p4est_iter_face_t iter_face,
247  p4est_iter_corner_t iter_corner,
248  int remote);
249 
267 void p4est_save_ext (const char *filename, p4est_t * p4est,
268  int save_data, int save_partition);
269 
291 p4est_t *p4est_load_ext (const char *filename, sc_MPI_Comm mpicomm,
292  size_t data_size, int load_data,
293  int autopartition, int broadcasthead,
294  void *user_pointer,
295  p4est_connectivity_t ** connectivity);
296 
300 p4est_t *p4est_source_ext (sc_io_source_t * src,
301  sc_MPI_Comm mpicomm, size_t data_size,
302  int load_data, int autopartition,
303  int broadcasthead, void *user_pointer,
304  p4est_connectivity_t ** connectivity);
305 
306 SC_EXTERN_C_END;
307 
308 #endif /* !P4EST_EXTENDED_H */
Iteration over mesh topology via callbacks.
quadrants that neighbor the local domain
Definition: p4est_ghost.h:39
int use_balance_verify
Verify sc_ranges and/or sc_notify as applicable.
Definition: p4est_extended.h:65
p4est_t * p4est_new_ext(sc_MPI_Comm mpicomm, p4est_connectivity_t *connectivity, p4est_locidx_t min_quadrants, int min_level, int fill_uniform, size_t data_size, p4est_init_t init_fn, void *user_pointer)
Create a new forest.
Definition: p4est.c:181
p4est_gloidx_t p4est_partition_ext(p4est_t *p4est, int partition_for_coarsening, p4est_weight_t weight_fn)
Repartition the forest.
Definition: p4est.c:2374
int use_balance_ranges
Use sc_ranges to determine the asymmetric communication pattern.
Definition: p4est_extended.h:60
p4est_mesh_t * p4est_mesh_new_ext(p4est_t *p4est, p4est_ghost_t *ghost, int compute_tree_index, int compute_level_lists, p4est_connect_type_t btype)
Create a new mesh.
Definition: p4est_mesh.c:527
void p4est_refine_ext(p4est_t *p4est, int refine_recursive, int maxlevel, p4est_refine_t refine_fn, p4est_init_t init_fn, p4est_replace_t replace_fn)
Refine a forest with a bounded refinement level and a replace option.
Definition: p4est.c:651
void(* p4est_iter_corner_t)(p4est_iter_corner_info_t *info, void *user_data)
The prototype for a function that p4est_iterate will execute wherever quadrants meet at a conformal c...
Definition: p4est_iterate.h:194
void p4est_iterate_ext(p4est_t *p4est, p4est_ghost_t *ghost_layer, void *user_data, p4est_iter_volume_t iter_volume, p4est_iter_face_t iter_face, p4est_iter_corner_t iter_corner, int remote)
p4est_iterate_ext adds the option remote: if this is false, then it is the same as p4est_iterate; if ...
Definition: p4est_iterate.c:3133
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
Data pertaining to selecting, inspecting, and profiling algorithms.
Definition: p4est_extended.h:56
void(* p4est_iter_volume_t)(p4est_iter_volume_info_t *info, void *user_data)
The prototype for a function that p4est_iterate will execute at every quadrant local to the current p...
Definition: p4est_iterate.h:62
int64_t p4est_gloidx_t
Typedef for globally unique indexing of quadrants.
Definition: p4est_base.h:84
The p4est forest datatype.
Definition: p4est.h:129
The top-level 2D p4est interface.
void p4est_coarsen_ext(p4est_t *p4est, int coarsen_recursive, int callback_orphans, p4est_coarsen_t coarsen_fn, p4est_init_t init_fn, p4est_replace_t replace_fn)
Coarsen a forest.
Definition: p4est.c:897
This structure holds the 2D inter-tree connectivity information.
Definition: p4est_connectivity.h:139
void p4est_save_ext(const char *filename, p4est_t *p4est, int save_data, int save_partition)
Save the complete connectivity/p4est data to disk.
Definition: p4est.c:3189
void p4est_balance_ext(p4est_t *p4est, p4est_connect_type_t btype, p4est_init_t init_fn, p4est_replace_t replace_fn)
2:1 balance the size differences of neighboring elements in a forest.
Definition: p4est.c:1197
forest topology in a conventional mesh format
int use_balance_ranges_notify
If true, call both sc_ranges and sc_notify and verify consistency.
Definition: p4est_extended.h:63
int(* p4est_coarsen_t)(p4est_t *p4est, p4est_topidx_t which_tree, p4est_quadrant_t *quadrants[])
Callback function prototype to decide for coarsening.
Definition: p4est.h:204
p4est_t * p4est_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, p4est_connectivity_t **connectivity)
The same as p4est_load_ext, but reading the connectivity/p4est from an open sc_io_source_t stream...
Definition: p4est.c:3459
double balance_notify_allgather
time spent in sc_notify_allgather
Definition: p4est_extended.h:81
p4est_connect_type_t
Characterize a type of adjacency.
Definition: p4est_connectivity.h:77
void(* p4est_init_t)(p4est_t *p4est, p4est_topidx_t which_tree, p4est_quadrant_t *quadrant)
Callback function prototype to initialize the quadrant's user data.
Definition: p4est.h:184
int32_t p4est_topidx_t
Typedef for counting topological entities (trees, tree vertices).
Definition: p4est_base.h:63
double balance_ranges
time spent in sc_ranges
Definition: p4est_extended.h:78
int32_t p4est_locidx_t
Typedef for processor-local indexing of quadrants and nodes.
Definition: p4est_base.h:74
void(* p4est_iter_face_t)(p4est_iter_face_info_t *info, void *user_data)
The prototype for a function that p4est_iterate will execute wherever two quadrants share a face: the...
Definition: p4est_iterate.h:138
p4est_t * p4est_load_ext(const char *filename, sc_MPI_Comm mpicomm, size_t data_size, int load_data, int autopartition, int broadcasthead, void *user_pointer, p4est_connectivity_t **connectivity)
Load the complete connectivity/p4est structure from disk.
Definition: p4est.c:3428
void(* p4est_replace_t)(p4est_t *p4est, p4est_topidx_t which_tree, int num_outgoing, p4est_quadrant_t *outgoing[], int num_incoming, p4est_quadrant_t *incoming[])
Callback function prototype to replace one set of quadrants with another.
Definition: p4est_extended.h:104
double balance_notify
time spent in sc_notify
Definition: p4est_extended.h:79
int balance_max_ranges
If positive and smaller than p4est_num ranges, overrides it.
Definition: p4est_extended.h:67
int(* p4est_refine_t)(p4est_t *p4est, p4est_topidx_t which_tree, p4est_quadrant_t *quadrant)
Callback function prototype to decide for refinement.
Definition: p4est.h:194
The 2D quadrant datatype.
Definition: p4est.h:65
This structure contains complete mesh information on the forest.
Definition: p4est_mesh.h:88
int(* p4est_weight_t)(p4est_t *p4est, p4est_topidx_t which_tree, p4est_quadrant_t *quadrant)
Callback function prototype to calculate weights for partitioning.
Definition: p4est.h:214