Skip to content

Commit

Permalink
Merge branch 'main' into user_data-interface
Browse files Browse the repository at this point in the history
  • Loading branch information
Davknapp authored Jan 30, 2025
2 parents a866281 + 0007ac8 commit 17a29fb
Show file tree
Hide file tree
Showing 39 changed files with 3,433 additions and 307 deletions.
6 changes: 3 additions & 3 deletions benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ function( add_t8_benchmark )
install( TARGETS ${ADD_T8_BENCHMARK_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin )
endfunction()

add_t8_benchmark( NAME t8_time_partition SOURCES time_partition.cxx )
add_t8_benchmark( NAME t8_time_forest_partition SOURCES time_forest_partition.cxx )
add_t8_benchmark( NAME t8_time_partition SOURCES t8_time_partition.cxx )
add_t8_benchmark( NAME t8_time_forest_partition SOURCES t8_time_forest_partition.cxx )
add_t8_benchmark( NAME t8_time_prism_adapt SOURCES t8_time_prism_adapt.cxx )
add_t8_benchmark( NAME t8_time_fractal SOURCES t8_time_fractal.cxx )
add_t8_benchmark( NAME t8_time_set_join_by_vertices SOURCES t8_time_set_join_by_vertices.cxx )
add_t8_benchmark( NAME t8_time_new_refine SOURCES time_new_refine.c )
add_t8_benchmark( NAME t8_time_new_refine SOURCES t8_time_new_refine.c )
File renamed without changes.
File renamed without changes.
File renamed without changes.
136 changes: 0 additions & 136 deletions benchmarks/time_refine_type03.c

This file was deleted.

1 change: 1 addition & 0 deletions doc/author_brandt.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
I place my contributions to t8code under the FreeBSD license. Hannes Brandt ([email protected])
4 changes: 3 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ target_sources( T8 PRIVATE
t8_forest/t8_forest_ghost.cxx
t8_forest/t8_forest_iterate.cxx
t8_forest/t8_forest_balance.cxx
t8_forest/t8_forest_netcdf.cxx
t8_forest/t8_forest_netcdf.cxx
t8_forest/t8_forest_search/t8_forest_search.cxx
t8_geometry/t8_geometry.cxx
t8_geometry/t8_geometry_helpers.c
t8_geometry/t8_geometry_base.cxx
Expand Down Expand Up @@ -156,6 +157,7 @@ target_sources( T8 PRIVATE
t8_schemes/t8_default/t8_default_tri/t8_dtri_connectivity.c
t8_schemes/t8_default/t8_default_vertex/t8_default_vertex.cxx
t8_schemes/t8_default/t8_default_vertex/t8_dvertex_bits.c
t8_schemes/t8_standalone/t8_standalone.cxx
t8_vtk/t8_vtk_polydata.cxx
t8_vtk/t8_vtk_unstructured.cxx
t8_vtk/t8_vtk_parallel.cxx
Expand Down
5 changes: 4 additions & 1 deletion src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ libt8_installed_headers_forest = \
src/t8_forest/t8_forest_profiling.h \
src/t8_forest/t8_forest_io.h \
src/t8_forest/t8_forest_adapt.h \
src/t8_forest/t8_forest_iterate.h src/t8_forest/t8_forest_partition.h
src/t8_forest/t8_forest_iterate.h \
src/t8_forest/t8_forest_partition.h \
src/t8_forest/t8_forest_search/t8_forest_search.hxx
libt8_installed_headers_geometry = \
src/t8_geometry/t8_geometry.h \
src/t8_geometry/t8_geometry_handler.hxx \
Expand Down Expand Up @@ -140,6 +142,7 @@ libt8_compiled_sources = \
src/t8_forest/t8_forest_partition.cxx src/t8_forest/t8_forest.cxx \
src/t8_forest/t8_forest_private.c \
src/t8_forest/t8_forest_ghost.cxx src/t8_forest/t8_forest_iterate.cxx \
src/t8_forest/t8_forest_search/t8_forest_search.cxx \
src/t8_version.c \
src/t8_vtk.c src/t8_forest/t8_forest_balance.cxx \
src/t8_forest/t8_forest_netcdf.cxx \
Expand Down
1 change: 0 additions & 1 deletion src/t8_forest/t8_forest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -3685,7 +3685,6 @@ t8_eclass_t
t8_forest_get_tree_class (const t8_forest_t forest, const t8_locidx_t ltreeid)
{
t8_locidx_t num_local_trees = t8_forest_get_num_local_trees (forest);

T8_ASSERT (0 <= ltreeid && ltreeid < num_local_trees + t8_forest_get_num_ghost_trees (forest));
if (ltreeid < num_local_trees) {
/* The id belongs to a local tree */
Expand Down
7 changes: 7 additions & 0 deletions src/t8_forest/t8_forest_iterate.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -536,4 +536,11 @@ t8_forest_iterate_replace (t8_forest_t forest_new, t8_forest_t forest_old, t8_fo
t8_global_productionf ("Done t8_forest_iterate_replace\n");
}

void
t8_forest_search_partition (const t8_forest_t forest, t8_forest_partition_search_fn search_fn,
t8_forest_partition_query_fn query_fn, sc_array_t *queries)
{
SC_ABORT ("not implemented yet");
}

T8_EXTERN_C_END ();
61 changes: 61 additions & 0 deletions src/t8_forest/t8_forest_iterate.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,48 @@ typedef void (*t8_forest_query_fn) (t8_forest_t forest, const t8_locidx_t ltreei
const int is_leaf, const t8_element_array_t *leaf_elements,
const t8_locidx_t tree_leaf_index, sc_array_t *queries, sc_array_t *query_indices,
int *query_matches, const size_t num_active_queries);
/**
* A call-back function used by \ref t8_forest_search_partition describing a search-criterion. Is called on an element
* and the search criterion should be checked on that element. Return true if the search criterion is met, false
* otherwise.
*
* \param[in] forest the forest
* \param[in] ltreeid the local tree id of the current tree in the cmesh. Since the cmesh has to be
* replicated, it coincides with the global tree id.
* \param[in] element the element for which the search criterion is checked
* \param[in] pfirst the first processor that owns part of \a element. Guaranteed to be non-empty.
* \param[in] plast the last processor that owns part of \a element. Guaranteed to be non-empty.
* \returns non-zero if the search criterion is met, zero otherwise.
*/
typedef int (*t8_forest_partition_search_fn) (const t8_forest_t forest, const t8_locidx_t ltreeid,
const t8_element_t *element, const int pfirst, const int plast);

/**
* A call-back function used by \ref t8_forest_search_partition for queries. Is called on an element and all queries are
* checked on that element. All positive queries are passed further down to the children of the element. The results of
* the check are stored in \a query_matches.
*
* \param[in] forest the forest
* \param[in] ltreeid the local tree id of the current tree in the cmesh. Since the cmesh has to be
* replicated, it coincides with the global tree id.
* \param[in] element the element for which the query is executed
* \param[in] pfirst the first processor that owns part of \a element. Guaranteed to be non-empty.
* \param[in] plast the last processor that owns part of \a element. Guaranteed to be non-empty.
* if this is equal to \a pfirst, then the recursion will stop for
* \a element's branch after this function returns.
* \param[in] queries an array of queries that are checked by the function
* \param[in] query_indices an array of size_t entries, where each entry is an index of a query in \a queries.
* \param[in, out] query_matches an array of length \a num_active_queries.
* If the element is not a leaf must be set to true or false at the i-th index for
* each query, specifying whether the element 'matches' the query of the i-th query
* index or not. When the element is a leaf we can return before all entries are set.
* \param[in] num_active_queries The number of currently active queries (equals the number of entries of
* \a query_matches and entries of \a query_indices).
*/
typedef void (*t8_forest_partition_query_fn) (const t8_forest_t forest, const t8_locidx_t ltreeid,
const t8_element_t *element, const int pfirst, const int plast,
void *queries, sc_array_t *query_indices, int *query_matches,
const size_t num_active_queries);

T8_EXTERN_C_BEGIN ();

Expand Down Expand Up @@ -134,6 +176,25 @@ t8_forest_search (t8_forest_t forest, t8_forest_search_fn search_fn, t8_forest_q
void
t8_forest_iterate_replace (t8_forest_t forest_new, t8_forest_t forest_old, t8_forest_replace_t replace_fn);

/**
* Perform a top-down search of the global partition, executing a callback on
* each intermediate element. The search will enter each tree at least once.
* The recursion will only go down branches that are split between multiple processors.
* This is not a collective function. It does not communicate.
* The function expects the coarse mesh to be replicated.
* If the callback returns false for an element, its descendants
* are not further searched.
* To pass user data to \b search_fn function use \ref t8_forest_set_user_data
*
* \param[in] forest the forest to be searched
* \param[in] search_fn a search callback function called on elements
* \param[in] query_fn a query callback function called for all active queries of an element
* \param[in,out] queries an array of queries that are checked by the function
*/
void
t8_forest_search_partition (const t8_forest_t forest, t8_forest_partition_search_fn search_fn,
t8_forest_partition_query_fn query_fn, sc_array_t *queries);

T8_EXTERN_C_END ();

#endif /* !T8_FOREST_ITERATE_H */
Loading

0 comments on commit 17a29fb

Please sign in to comment.