29 #ifndef T8_FOREST_GENERAL_H
30 #define T8_FOREST_GENERAL_H
88 const t8_locidx_t first_outgoing,
const int num_incoming,
373 t8_forest_set_load (
t8_forest_t forest,
const char *filename);
520 t8_element_t **pneighbor_leaves[],
int face,
int *dual_faces[],
int *num_neighbors,
522 int forest_is_balanced);
526 t8_element_t **pneighbor_leaves[],
int face,
int *dual_faces[],
int *num_neighbors,
784 const double *points,
int num_points,
int *is_inside,
const double tolerance);
This structure holds the connectivity data of the coarse mesh.
Definition: t8_cmesh_types.h:88
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:41
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:143
t8_eclass_t eclass
The element class of this tree.
Definition: t8_forest_types.h:145
t8_element_array_t elements
locally stored elements
Definition: t8_forest_types.h:144
int64_t t8_gloidx_t
A type for global indexing that holds really big numbers.
Definition: t8.h:100
int32_t t8_locidx_t
A type for processor-local indexing.
Definition: t8.h:89
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
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:167
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:1018
t8_forest_t t8_forest_new_uniform(t8_cmesh_t cmesh, t8_scheme_cxx_t *scheme, const int level, const int do_face_ghost, sc_MPI_Comm comm)
Build a uniformly refined forest on a coarse mesh.
Definition: t8_forest.c:1408
int t8_forest_no_overlap(t8_forest_t forest)
Check whether the forest has local overlapping elements.
Definition: t8_forest_cxx.cxx:261
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:1152
t8_eclass_t t8_forest_get_eclass(const t8_forest_t forest, const t8_locidx_t ltreeid)
Return the element class of a forest local tree.
Definition: t8_forest.c:1038
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:834
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:1120
void t8_forest_commit(t8_forest_t forest)
After allocating and adding properties to a forest, commit the changes.
Definition: t8_forest.c:416
t8_locidx_t t8_forest_get_num_ghost_trees(const t8_forest_t forest)
Return the number of ghost trees of a given forest.
Definition: t8_forest.c:770
void * t8_forest_get_user_data(const t8_forest_t forest)
Return the user data pointer associated with a forest.
Definition: t8_forest.c:289
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:998
sc_MPI_Comm t8_forest_get_mpicomm(const t8_forest_t forest)
Return the mpi communicator associated to a forest.
Definition: t8_forest.c:755
t8_gloidx_t t8_forest_get_global_num_elements(const t8_forest_t forest)
Return the number of global elements in the forest.
Definition: t8_forest.c:686
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:1089
t8_locidx_t t8_forest_get_tree_element_offset(const t8_forest_t forest, const 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:952
t8_locidx_t t8_forest_get_num_ghosts(const t8_forest_t forest)
Return the number of ghost elements of a forest.
Definition: t8_forest.c:694
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:193
void t8_forest_leaf_face_neighbors(t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *leaf, t8_element_t **pneighbor_leaves[], 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:1928
void t8_forest_element_points_inside(t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *element, const double *points, int num_points, int *is_inside, const double tolerance)
Query whether a batch of points lies inside an element.
Definition: t8_forest_cxx.cxx:1089
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:222
t8_gloidx_t t8_forest_get_num_global_trees(const t8_forest_t forest)
Return the number of global trees of a given forest.
Definition: t8_forest.c:796
const 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:941
t8_ghost_type_t
This type controls, which neighbors count as ghost elements.
Definition: t8_forest_general.h:42
@ T8_GHOST_VERTICES
Consider all vertex (codimension 3) and edge and face neighbors.
Definition: t8_forest_general.h:46
@ T8_GHOST_FACES
Consider all face (codimension 1) neighbors.
Definition: t8_forest_general.h:44
@ T8_GHOST_NONE
Do not create ghost layer.
Definition: t8_forest_general.h:43
@ T8_GHOST_EDGES
Consider all edge (codimension 2) and face neighbors.
Definition: t8_forest_general.h:45
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 committing.
Definition: t8_forest.c:251
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_general.h:53
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:881
void t8_forest_set_copy(t8_forest_t forest, const t8_forest_t from)
Set a forest as source for copying on committing.
Definition: t8_forest.c:143
t8_locidx_t t8_forest_get_local_num_elements(const t8_forest_t forest)
Return the number of process local elements in the forest.
Definition: t8_forest.c:678
void t8_forest_set_user_data(t8_forest_t forest, void *data)
Set the user data of a forest.
Definition: t8_forest.c:282
int t8_forest_get_maxlevel(const t8_forest_t forest)
Return the maximum allowed refinement level for any element in a forest.
Definition: t8_forest_cxx.cxx:201
void t8_forest_init(t8_forest_t *pforest)
Create a new forest with reference count one.
Definition: t8_forest.c:40
void t8_forest_ref(t8_forest_t forest)
Increase the reference counter of a forest.
Definition: t8_forest.c:1545
struct t8_forest * t8_forest_t
Opaque pointer to a forest implementation.
Definition: t8_forest_general.h:37
int t8_forest_is_initialized(t8_forest_t forest)
Check whether a forest is not NULL, initialized and not committed.
Definition: t8_forest.c:66
t8_element_array_t * t8_forest_tree_get_leaves(const t8_forest_t forest, const t8_locidx_t ltree_id)
Return the array of leaf elements of a local tree in a forest.
Definition: t8_forest.c:840
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:972
void t8_forest_unref(t8_forest_t *pforest)
Decrease the reference counter of a forest.
Definition: t8_forest.c:1552
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:117
t8_eclass_t t8_forest_get_tree_class(const t8_forest_t forest, const t8_locidx_t ltreeid)
Return the eclass of a tree in a forest.
Definition: t8_forest.c:981
void t8_forest_set_user_function(t8_forest_t forest, t8_generic_function_pointer function)
Set the user function pointer of a forest.
Definition: t8_forest.c:295
t8_locidx_t t8_forest_get_num_local_trees(const t8_forest_t forest)
Return the number of local trees of a given forest.
Definition: t8_forest.c:781
void t8_forest_set_level(t8_forest_t forest, int level)
Set the initial refinement level to be used when forest is committed.
Definition: t8_forest.c:131
t8_generic_function_pointer t8_forest_get_user_function(const t8_forest_t forest)
Return the user function pointer associated with a forest.
Definition: t8_forest.c:302
t8_tree_t t8_forest_get_tree(const t8_forest_t forest, const t8_locidx_t ltree_id)
Return a pointer to a tree in a forest.
Definition: t8_forest.c:826
int t8_forest_is_committed(t8_forest_t forest)
Check whether a forest is not NULL, initialized and committed.
Definition: t8_forest.c:72
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:94
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:960
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:729
t8_locidx_t t8_forest_get_local_or_ghost_id(const t8_forest_t forest, const t8_gloidx_t gtreeid)
Given a global tree id compute the forest local id of this tree.
Definition: t8_forest.c:1065
t8_gloidx_t t8_forest_get_first_local_tree_id(const t8_forest_t forest)
Return the global id of the first local tree of a forest.
Definition: t8_forest.c:762
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:1435
t8_locidx_t t8_forest_get_local_id(const t8_forest_t forest, const t8_gloidx_t gtreeid)
Given a global tree id compute the forest local id of this tree.
Definition: t8_forest.c:1045
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:244
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, const int refine, const int num_outgoing, const t8_locidx_t first_outgoing, const int num_incoming, const t8_locidx_t first_incoming)
Callback function prototype to replace one set of elements with another.
Definition: t8_forest_general.h:86
t8_cmesh_t t8_forest_get_cmesh(t8_forest_t forest)
Return a cmesh associated to a forest.
Definition: t8_forest.c:849
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:309
void t8_forest_ghost_print(t8_forest_t forest)
Print the ghost structure of a forest.
Definition: t8_forest_ghost.cxx:1802
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:1770
t8_scheme_cxx_t * t8_forest_get_scheme(const t8_forest_t forest)
Return the element scheme associated to a forest.
Definition: t8_forest.c:1009
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:1471
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:318
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_general.h:114
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:1514
t8_gloidx_t t8_forest_global_tree_id(const t8_forest_t forest, const t8_locidx_t ltreeid)
Return the global id of a local tree or a ghost tree.
Definition: t8_forest.c:804