32 #include <sc_statistics.h>
128 const int num_elements,
320 int set_for_coarsening);
375 const char *filename);
515 int forest_is_balanced);
531 sc_array_t *element_data);
547 void t8_forest_compute_profile (
t8_forest_t forest);
549 const sc_statinfo_t *t8_forest_profile_get_adapt_stats (
t8_forest_t forest);
551 const sc_statinfo_t *t8_forest_profile_get_ghost_stats (
t8_forest_t forest);
553 const sc_statinfo_t *t8_forest_profile_get_partition_stats (
t8_forest_t
556 const sc_statinfo_t *t8_forest_profile_get_commit_stats (
t8_forest_t forest);
558 const sc_statinfo_t *t8_forest_profile_get_balance_stats (
t8_forest_t forest);
560 const sc_statinfo_t *t8_forest_profile_get_balance_rounds_stats (
t8_forest_t
606 int *balance_rounds);
844 *neigh_scheme,
int face,
885 const char *fileprefix,
889 int write_element_id,
912 const char *fileprefix);
930 double *coordinates);
946 double *coordinates);
1006 double centroid[3]);
1045 const double point[3],
1046 const double tolerance);
1063 int level,
int do_face_ghost,
1080 int recursive,
int do_face_ghost,
This structure holds the connectivity data of the coarse mesh.
Definition: t8_cmesh_types.h:83
This structure holds the data of a local tree including the information about face neighbors.
Definition: t8_cmesh_types.h:189
This struct holds virtual functions for a particular element class.
Definition: t8_element_cxx.hxx:47
The t8_element_array_t is an array to store t8_element_t * of a given eclass_scheme implementation.
Definition: t8_containers.h:42
This structure is private to the implementation.
Definition: t8_forest_types.h:69
The scheme holds implementations for one or more element classes.
Definition: t8_element.h:51
The t8 tree datatype.
Definition: t8_forest_types.h:139
t8_eclass_t eclass
The element class of this tree.
Definition: t8_forest_types.h:141
t8_element_array_t elements
locally stored elements
Definition: t8_forest_types.h:140
int64_t t8_gloidx_t
A type for global indexing that holds really big numbers.
Definition: t8.h:105
int32_t t8_locidx_t
A type for processor-local indexing.
Definition: t8.h:94
We define the coarse mesh of trees in this file.
We define the t8_element_array that stores elements of a given eclass scheme.
enum t8_eclass t8_eclass_t
This enumeration contains all possible element classes.
This file defines basic operations on an element in a refinement tree.
struct t8_element t8_element_t
Opaque structure for a generic element, only used as pointer.
Definition: t8_element.h:42
double t8_forest_element_face_area(t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *element, int face)
Compute the area of an element's face if a geometry for this tree is registered in the forest's cmesh...
Definition: t8_forest_cxx.cxx:568
void t8_forest_set_partition(t8_forest_t forest, const t8_forest_t set_from, int set_for_coarsening)
Set a source forest to be partitioned during commit.
Definition: t8_forest.c:188
t8_eclass_scheme_c * t8_forest_get_eclass_scheme(t8_forest_t forest, t8_eclass_t eclass)
Return the eclass scheme of a given element class associated to a forest.
Definition: t8_forest.c:1096
t8_eclass_t t8_forest_get_tree_class(t8_forest_t forest, t8_locidx_t ltreeid)
Return the eclass of a tree in a forest.
Definition: t8_forest.c:1055
t8_locidx_t t8_forest_get_num_local_trees(t8_forest_t forest)
Return the number of local trees of a given forest.
Definition: t8_forest.c:833
double t8_forest_element_volume(t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *element)
Compute the volume of an element if a geometry for this tree is registered in the forest's cmesh.
Definition: t8_forest_cxx.cxx:365
int t8_forest_element_point_inside(t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *element, const double point[3], const double tolerance)
Query whether a given point lies inside an element or not.
Definition: t8_forest_cxx.cxx:1035
double t8_forest_element_diam(t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *element)
Compute the diameter of an element if a geometry for this tree is registered in the forest's cmesh.
Definition: t8_forest_cxx.cxx:227
t8_ctree_t t8_forest_get_coarse_tree(t8_forest_t forest, t8_locidx_t ltreeid)
Given the local id of a tree in a forest, return the coarse tree of the cmesh that corresponds to thi...
Definition: t8_forest.c:1216
t8_locidx_t t8_forest_get_tree_element_offset(t8_forest_t forest, t8_locidx_t ltreeid)
Return the element offset of a local tree, that is the number of elements in all trees with smaller l...
Definition: t8_forest.c:1023
t8_forest_t t8_forest_new_uniform(t8_cmesh_t cmesh, t8_scheme_cxx_t *scheme, int level, int do_face_ghost, sc_MPI_Comm comm)
Build a uniformly refined forest on a coarse mesh.
Definition: t8_forest.c:1532
double * t8_forest_get_tree_vertices(t8_forest_t forest, t8_locidx_t ltreeid)
Return a pointer to the vertex coordinates of a tree.
Definition: t8_forest.c:890
double t8_forest_profile_get_adapt_time(t8_forest_t forest)
Get the runtime of the last call to t8_forest_adapt.
Definition: t8_forest.c:1354
t8_locidx_t t8_forest_cmesh_ltreeid_to_ltreeid(t8_forest_t forest, t8_locidx_t lctreeid)
Given the local id of a tree in the coarse mesh of a forest, compute the tree's local id in the fores...
Definition: t8_forest.c:1180
t8_gloidx_t t8_forest_get_global_num_elements(t8_forest_t forest)
Return the number of global elements in the forest.
Definition: t8_forest.c:735
void t8_forest_commit(t8_forest_t forest)
After allocating and adding properties to a forest, commit the changes.
Definition: t8_forest.c:454
void t8_forest_set_profiling(t8_forest_t forest, int set_profiling)
Enable or disable profiling for a forest.
Definition: t8_forest.c:1222
void t8_forest_element_face_centroid(t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *element, int face, double centroid[3])
Compute the vertex coordinates of the centroid of an element's face if a geometry for this tree is re...
Definition: t8_forest_cxx.cxx:660
t8_gloidx_t t8_forest_get_first_local_element_id(t8_forest_t forest)
Compute the global index of the first local element of a forest.
Definition: t8_forest.c:1075
double t8_forest_profile_get_ghost_time(t8_forest_t forest, t8_locidx_t *ghosts_sent)
Get the runtime of the last call to t8_forest_create_ghosts.
Definition: t8_forest.c:1386
double t8_forest_profile_get_ghostexchange_waittime(t8_forest_t forest)
Get the waittime of the last call to t8_forest_ghost_exchange_data.
Definition: t8_forest.c:1399
void t8_forest_element_centroid(t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *element, double *coordinates)
Compute the coordinates of the centroid of an element if a geometry for this tree is registered in th...
Definition: t8_forest_cxx.cxx:267
int t8_forest_get_maxlevel(t8_forest_t forest)
Return the maximum allowed refinement level for any element in a forest.
Definition: t8_forest_cxx.cxx:77
t8_locidx_t t8_forest_ltreeid_to_cmesh_ltreeid(t8_forest_t forest, t8_locidx_t ltreeid)
Given the local id of a tree in a forest, compute the tree's local id in the associated cmesh.
Definition: t8_forest.c:1146
t8_element_array_t * t8_forest_tree_get_leafs(t8_forest_t forest, t8_locidx_t ltree_id)
Return the array of leaf elements of a local tree in a forest.
Definition: t8_forest.c:898
void t8_forest_set_balance(t8_forest_t forest, const t8_forest_t set_from, int no_repartition)
Set a source forest to be balanced during commit.
Definition: t8_forest.c:215
void t8_forest_set_user_function(t8_forest_t forest, t8_generic_function_pointer functrion)
Set the user function pointer of a forest.
Definition: t8_forest.c:322
void t8_forest_set_ghost_ext(t8_forest_t forest, int do_ghost, t8_ghost_type_t ghost_type, int ghost_version)
Like t8_forest_set_ghost but with the additional options to change the ghost algorithm.
Definition: t8_forest.c:245
double t8_forest_profile_get_balance_time(t8_forest_t forest, int *balance_rounds)
Get the runtime of the last call to t8_forest_balance.
Definition: t8_forest.c:1375
t8_ghost_type_t
This type controls, which neighbors count as ghost elements.
Definition: t8_forest.h:46
@ T8_GHOST_VERTICES
Consider all vertex (codimension 3) and edge and face neighbors.
Definition: t8_forest.h:50
@ T8_GHOST_FACES
Consider all face (codimension 1) neighbors.
Definition: t8_forest.h:48
@ T8_GHOST_NONE
Do not create ghost layer.
Definition: t8_forest.h:47
@ T8_GHOST_EDGES
Consider all edge (codimension 2) and face neighbors.
Definition: t8_forest.h:49
t8_gloidx_t t8_forest_global_tree_id(t8_forest_t forest, t8_locidx_t ltreeid)
Return the global id of a local tree or a ghost tree.
Definition: t8_forest.c:857
void t8_forest_set_adapt(t8_forest_t forest, const t8_forest_t set_from, t8_forest_adapt_t adapt_fn, int recursive)
Set a source forest with an adapt function to be adapted on commiting.
Definition: t8_forest.c:277
void(* t8_generic_function_pointer)(void)
This typedef is needed as a helper construct to properly be able to define a function that returns a ...
Definition: t8_forest.h:57
t8_element_t * t8_forest_get_element(t8_forest_t forest, t8_locidx_t lelement_id, t8_locidx_t *ltreeid)
Return an element of the forest.
Definition: t8_forest.c:941
void t8_forest_set_copy(t8_forest_t forest, const t8_forest_t from)
Set a forest as source for copying on commiting.
Definition: t8_forest.c:162
t8_locidx_t t8_forest_get_num_ghost_trees(t8_forest_t forest)
Return the number of ghost trees of a given forest.
Definition: t8_forest.c:822
void t8_forest_set_user_data(t8_forest_t forest, void *data)
Set the user data of a forest.
Definition: t8_forest.c:309
t8_locidx_t t8_forest_get_local_id(t8_forest_t forest, t8_gloidx_t gtreeid)
Given a global tree id compute the forest local id of this tree.
Definition: t8_forest.c:1124
void t8_forest_init(t8_forest_t *pforest)
Create a new forest with reference count one.
Definition: t8_forest.c:38
void t8_forest_ref(t8_forest_t forest)
Increase the reference counter of a forest.
Definition: t8_forest.c:1661
struct t8_forest * t8_forest_t
Opaque pointer to a forest implementation.
Definition: t8_forest.h:39
int t8_forest_is_initialized(t8_forest_t forest)
Check whether a forest is not NULL, initialized and not committed.
Definition: t8_forest.c:63
double t8_forest_profile_get_partition_time(t8_forest_t forest, int *procs_sent)
Get the runtime of the last call to t8_forest_partition.
Definition: t8_forest.c:1364
t8_locidx_t t8_forest_get_tree_num_elements(t8_forest_t forest, t8_locidx_t ltreeid)
Return the number of elements of a tree.
Definition: t8_forest.c:1044
void t8_forest_unref(t8_forest_t *pforest)
Decrease the reference counter of a forest.
Definition: t8_forest.c:1668
void t8_forest_set_scheme(t8_forest_t forest, t8_scheme_cxx_t *scheme)
Set the element scheme associated to a forest.
Definition: t8_forest.c:136
t8_scheme_cxx_t * t8_forest_get_scheme(t8_forest_t forest)
Return the element scheme associated to a forest.
Definition: t8_forest.c:1087
void t8_forest_set_level(t8_forest_t forest, int level)
Set the initial refinement level to be used when forest is commited.
Definition: t8_forest.c:150
t8_generic_function_pointer t8_forest_get_user_function(t8_forest_t forest)
Return the user function pointer associated with a forest.
Definition: t8_forest.c:331
int t8_forest_is_committed(t8_forest_t forest)
Check whether a forest is not NULL, initialized and committed.
Definition: t8_forest.c:81
void t8_forest_element_coordinate(t8_forest_t forest, t8_locidx_t ltree_id, const t8_element_t *element, int corner_number, double *coordinates)
Compute the coordinates of a given vertex of an element if a geometry for this tree is registered in ...
Definition: t8_forest_cxx.cxx:199
void t8_forest_set_cmesh(t8_forest_t forest, t8_cmesh_t cmesh, sc_MPI_Comm comm)
Set the cmesh associated to a forest.
Definition: t8_forest.c:113
t8_locidx_t t8_forest_get_tree_element_count(t8_tree_t tree)
Return the number of elements of a tree.
Definition: t8_forest.c:1031
void t8_forest_element_face_normal(t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *element, int face, double normal[3])
Compute the normal vector of an element's face if a geometry for this tree is registered in the fores...
Definition: t8_forest_cxx.cxx:788
t8_element_t * t8_forest_get_element_in_tree(t8_forest_t forest, t8_locidx_t ltreeid, t8_locidx_t leid_in_tree)
Return an element of a local tree in a forest.
Definition: t8_forest.c:1010
void t8_forest_partition_cmesh(t8_forest_t forest, sc_MPI_Comm comm, int set_profiling)
Change the cmesh associated to a forest to a partitioned cmesh that is partitioned according to the t...
Definition: t8_forest.c:780
t8_tree_t t8_forest_get_tree(t8_forest_t forest, t8_locidx_t ltree_id)
Return a pointer to a tree in a forest.
Definition: t8_forest.c:881
t8_forest_t t8_forest_new_adapt(t8_forest_t forest_from, t8_forest_adapt_t adapt_fn, int recursive, int do_face_ghost, void *user_data)
Build a adapted forest from another forest.
Definition: t8_forest.c:1560
t8_gloidx_t t8_forest_get_first_local_tree_id(t8_forest_t forest)
Return the global id of the first local tree of a forest.
Definition: t8_forest.c:814
int t8_forest_write_vtk_ext(t8_forest_t forest, const char *fileprefix, int write_treeid, int write_mpirank, int write_level, int write_element_id, int write_ghosts, int write_curved, int do_not_use_API, int num_data, t8_vtk_data_field_t *data)
Write the forest in a parallel vtu format.
Definition: t8_forest.c:1444
t8_gloidx_t t8_forest_get_num_global_trees(t8_forest_t forest)
Return the number of global trees of a given forest.
Definition: t8_forest.c:849
int t8_forest_write_vtk(t8_forest_t forest, const char *fileprefix)
Write the forest in a parallel vtu format.
Definition: t8_forest.c:1525
t8_locidx_t t8_forest_get_num_ghosts(t8_forest_t forest)
Return the number of ghost elements of a forest.
Definition: t8_forest.c:743
void t8_forest_set_ghost(t8_forest_t forest, int do_ghost, t8_ghost_type_t ghost_type)
Enable or disable the creation of a layer of ghost elements.
Definition: t8_forest.c:269
t8_locidx_t t8_forest_get_local_num_elements(t8_forest_t forest)
Return the number of process local elements in the forest.
Definition: t8_forest.c:727
t8_cmesh_t t8_forest_get_cmesh(t8_forest_t forest)
Return a cmesh associated to a forest.
Definition: t8_forest.c:908
void t8_forest_comm_global_num_elements(t8_forest_t forest)
Compute the global number of elements in a forest as the sum of the local element counts.
Definition: t8_forest.c:338
void t8_forest_print_profile(t8_forest_t forest)
Print the collected statistics from a forest profile.
Definition: t8_forest.c:1284
void * t8_forest_get_user_data(t8_forest_t forest)
Return the user data pointer associated with a forest.
Definition: t8_forest.c:316
void(* t8_forest_replace_t)(t8_forest_t forest_old, t8_forest_t forest_new, t8_locidx_t which_tree, t8_eclass_scheme_c *ts, int refine, int num_outgoing, t8_locidx_t first_outgoing, int num_incoming, t8_locidx_t first_incoming)
Callback function prototype to replace one set of elements with another.
Definition: t8_forest.h:90
void t8_forest_ghost_print(t8_forest_t forest)
Print the ghost structure of a forest.
Definition: t8_forest_ghost.cxx:1976
void t8_forest_ghost_exchange_data(t8_forest_t forest, sc_array_t *element_data)
Exchange ghost information of user defined element data.
Definition: t8_forest_ghost.cxx:1943
t8_eclass_t t8_forest_element_neighbor_eclass(t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *elem, int face)
Return the eclass of the tree in which a face neighbor of a given element lies.
Definition: t8_forest_cxx.cxx:1539
t8_eclass_t t8_forest_get_eclass(t8_forest_t forest, t8_locidx_t ltreeid)
Return the element class of a forest local tree.
Definition: t8_forest.c:1117
int t8_forest_is_equal(t8_forest_t forest_a, t8_forest_t forest_b)
Check whether two committed forests have the same local elements.
Definition: t8_forest_cxx.cxx:140
int(* t8_forest_adapt_t)(t8_forest_t forest, t8_forest_t forest_from, t8_locidx_t which_tree, t8_locidx_t lelement_id, t8_eclass_scheme_c *ts, const int is_family, const int num_elements, t8_element_t *elements[])
Callback function prototype to decide for refining and coarsening.
Definition: t8_forest.h:122
t8_gloidx_t t8_forest_element_face_neighbor(t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *elem, t8_element_t *neigh, t8_eclass_scheme_c *neigh_scheme, int face, int *neigh_face)
Construct the face neighbor of an element, possibly across tree boundaries.
Definition: t8_forest_cxx.cxx:1589
void t8_forest_leaf_face_neighbors(t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *leaf, t8_element_t **pneighbor_leafs[], int face, int *dual_faces[], int *num_neighbors, t8_locidx_t **pelement_indices, t8_eclass_scheme_c **pneigh_scheme, int forest_is_balanced)
Compute the leaf face neighbors of a forest.
Definition: t8_forest_cxx.cxx:1796
sc_MPI_Comm t8_forest_get_mpicomm(t8_forest_t forest)
Return the mpi communicator associated to a forest.
Definition: t8_forest.c:807