Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
1fdb864
Startet implementation of an adaption-class to simplify the addition …
Davknapp Dec 10, 2025
5c65516
Started Implementation of the manipulation-functions
Davknapp Dec 12, 2025
60e93a1
fix compiler errors
Davknapp Dec 15, 2025
2a3b85b
Merge remote-tracking branch 'origin/main' into adapt_class
Davknapp Dec 15, 2025
99c16c2
fix macro changes
Davknapp Dec 15, 2025
a787822
fix last macro change
Davknapp Dec 15, 2025
b96d5cd
fix empty space
Davknapp Dec 15, 2025
0519026
Merge branch 'main' into adapt_class
Davknapp Jan 30, 2026
51ad26c
Merge remote-tracking branch 'origin/main' into adapt_class
Davknapp Feb 3, 2026
a299e52
change to concepts
Davknapp Feb 4, 2026
ab8aa1f
move adapt implementation
Davknapp Feb 4, 2026
c51c9a7
remove empty file
Davknapp Feb 4, 2026
955dff6
start a test for batched implementation
Davknapp Feb 4, 2026
3ba4356
Remove adapt.cxx from CMake, the file does not exist anymore
Davknapp Feb 4, 2026
be5513a
Document the concepts and the class
Davknapp Feb 4, 2026
69ddd3c
profiling
Davknapp Feb 4, 2026
d6b2d62
encapsulate versions of adapt in macro to minimize integration size
Davknapp Feb 4, 2026
d2d013f
compilable version
Davknapp Feb 4, 2026
13ad04a
renamte t8_forest_adapt_namespace -> t8_adapt
Davknapp Feb 4, 2026
49c504d
adapt_action -> action
Davknapp Feb 4, 2026
f2262cd
Improve names in concepts
Davknapp Feb 4, 2026
6db0e98
fix documentation
Davknapp Feb 4, 2026
3cd21d4
fix documentation
Davknapp Feb 4, 2026
5f03128
document dummy callback
Davknapp Feb 4, 2026
28919b6
callback_type has to be defined at the beginning
Davknapp Feb 4, 2026
47810a2
Activate experimental features from CMake
Davknapp Feb 5, 2026
b9fc683
Debugging
Davknapp Feb 5, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ option( T8CODE_ENABLE_NETCDF "Enable t8code's features which rely on netCDF" OFF
option( T8CODE_USE_SYSTEM_SC "Use system-installed sc library" OFF )
option( T8CODE_USE_SYSTEM_P4EST "Use system-installed p4est library" OFF )

option ( T8CODE_ACTIVATE_EXPERIMENTAL_ADAPT "Activate experimental adaptation implementation (may be unstable)" OFF )
mark_as_advanced( FORCE T8CODE_ACTIVATE_EXPERIMENTAL_ADAPT)

option( T8CODE_BUILD_DOCUMENTATION "Build t8code's documentation" OFF )
cmake_dependent_option( T8CODE_BUILD_DOCUMENTATION_SPHINX "Build t8code's documentation using sphinx" OFF "T8CODE_BUILD_DOCUMENTATION" OFF )

Expand Down
6 changes: 6 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ if( CMAKE_BUILD_TYPE STREQUAL "Debug" )
target_compile_definitions( T8 PUBLIC T8_ENABLE_DEBUG=1 )
endif()

if (T8CODE_ACTIVATE_EXPERIMENTAL_ADAPT)
target_compile_definitions( T8 PUBLIC T8CODE_EXPERIMENTAL_ADAPT=1 )
else()
target_compile_definitions( T8 PUBLIC T8CODE_EXPERIMENTAL_ADAPT=0 )
endif()

if( T8CODE_EXPORT_COMPILE_COMMANDS )
set_target_properties( T8 PROPERTIES EXPORT_COMPILE_COMMANDS ON )
endif( T8CODE_EXPORT_COMPILE_COMMANDS )
Expand Down
1 change: 1 addition & 0 deletions src/t8_forest/t8_forest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -3569,6 +3569,7 @@ t8_forest_get_tree_leaf_element_count (t8_tree_t tree)

T8_ASSERT (tree != NULL);
element_count = t8_element_array_get_count (&tree->leaf_elements);
t8_debugf ("[D] Tree has %li leaf elements.\n", (long) element_count);
/* check for type conversion errors */
T8_ASSERT ((size_t) element_count == t8_element_array_get_count (&tree->leaf_elements));
return element_count;
Expand Down
45 changes: 45 additions & 0 deletions src/t8_forest/t8_forest_adapt.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,13 @@
#include <t8_forest/t8_forest_general.h>
#include <t8_schemes/t8_scheme.hxx>
#include <t8_data/t8_containers.h>
#include <t8_forest/t8_forest_adapt/t8_forest_adapt.hxx>

/* We want to export the whole implementation to be callable from "C" */
T8_EXTERN_C_BEGIN ();

#if !T8CODE_EXPERIMENTAL_ADAPT

#if T8_ENABLE_DEBUG
/** Return zero if the first \a num_elements in \a elements are not a (sub)family.
* \param [in] scheme The element scheme for current local tree
Expand Down Expand Up @@ -378,6 +381,7 @@ t8_forest_adapt_refine_recursive (t8_forest_t forest, t8_locidx_t ltreeid, t8_ec
}

/* TODO: optimize this when we own forest_from */

void
t8_forest_adapt (t8_forest_t forest)
{
Expand Down Expand Up @@ -688,5 +692,46 @@ t8_forest_adapt (t8_forest_t forest)
t8_global_productionf ("End adapt %f %f\n", sc_MPI_Wtime (), forest->profile->adapt_runtime);
}
}
#else

/**
* Dummy callback function for element adaptation.
* This function always returns the KEEP action.
*
* \param [in] forest The forest
* \param [in] ltreeid The local tree id
* \param [in] element The element to adapt
* \param [in] scheme The scheme for this element
* \param [in] tree_class The eclass of tree the element is part of.
* \return The KEEP action.
*/
t8_adapt::action
dummy_callback ([[maybe_unused]] const t8_forest_t forest, [[maybe_unused]] const t8_locidx_t ltreeid,
[[maybe_unused]] const t8_element_t *element, [[maybe_unused]] const t8_scheme *scheme,
[[maybe_unused]] const t8_eclass_t tree_class)
{
return t8_adapt::action::REFINE;
}

void
t8_forest_adapt (t8_forest_t forest)
{
T8_ASSERT (forest != NULL);
T8_ASSERT (forest->set_from != NULL);
T8_ASSERT (forest->set_adapt_recursive != -1);
t8_forest_t forest_from = forest->set_from;
using namespace t8_adapt;
/**TODO: currently only using a dummy callback to check compilation.
* For proper usage we need to change the layout of the adapt function pointer
* in t8_forest_t.
*/
adaptor<adapt_collector, family_checker, manipulator> standard_adaptor (forest, forest_from, dummy_callback,
forest->profile != NULL);
standard_adaptor.adapt ();
/*TODO: Update incomplete trees logic. */
forest->incomplete_trees = 0;
t8_debugf ("t8_forest_adapt: Adaptation completed using dummy callback.\n");
}
#endif /* T8_FOREST_ADAPT_LEGACY */

T8_EXTERN_C_END ();
Loading