-
Notifications
You must be signed in to change notification settings - Fork 62
Feature: Very first version of the unstructured mesh interface #1829
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
lenaploetzke
merged 114 commits into
main
from
1655-define-structure-of-the-unstructured-mesh-class
Nov 26, 2025
Merged
Changes from all commits
Commits
Show all changes
114 commits
Select commit
Hold shift + click to select a range
9619869
add files
lenaploetzke 8b3fa7e
iterator
lenaploetzke ccc4dad
indent ...
lenaploetzke 4264e15
some progress
lenaploetzke 27ee532
added test
lenaploetzke 758e9e3
Merge branch 'main' into 1655-define-structure-of-the-unstructured-me…
lenaploetzke 9f6ded1
define end and begin
lenaploetzke 9f3a411
first test working
lenaploetzke f5c7efa
make unstructured mesh element a template parameter
lenaploetzke 83bac71
Added documentation
lenaploetzke 2e8c994
add cache for level
lenaploetzke 38fb9a4
missing docu
lenaploetzke 9b89bc3
changes before restructuring
lenaploetzke e4886e5
Apply suggestions from code review
lenaploetzke ac439be
review comments
lenaploetzke 7eed40a
Merge branch 'main' into 1655-define-structure-of-the-unstructured-me…
lenaploetzke 0cd5d28
new concept
lenaploetzke cdda8a2
remove wrong access to vector
lenaploetzke b514275
minimal working structure
lenaploetzke 8d8e4de
calculate in element
lenaploetzke 3f3960d
rlly use cache
lenaploetzke 3351e35
begin cleanup
lenaploetzke 381a852
begin documenting
lenaploetzke d9291b4
Merge branch 'main' into 1655-define-structure-of-the-unstructured-me…
lenaploetzke 4fb3807
second competence
lenaploetzke ad9fcc1
add test with two competences
lenaploetzke e8fc7bc
added documentation
lenaploetzke af4a010
own file for element
lenaploetzke 3de92ec
add brackets
lenaploetzke 0c60828
use helper function
lenaploetzke af052d7
renaming
lenaploetzke 4128c9b
Use array instead of pointer and optional for cache
lenaploetzke a654195
add coordinates function
lenaploetzke 0d4c0b2
add push back
lenaploetzke ffbc948
rename test file, delete cache level, add vertex coord cache
lenaploetzke aadcc32
add _serial
lenaploetzke 3d60de8
Apply suggestions from code review
lenaploetzke 054dd77
Suggestions README
lenaploetzke 140be0c
add CRTP to description
lenaploetzke 189a976
add getter for element and tree class
lenaploetzke 1dd40f5
Merge branch 'main' into 1655-define-structure-of-the-unstructured-me…
lenaploetzke 3ad6d6a
add getter for element and tree class
lenaploetzke 78b2f50
add cxx file to cmake
lenaploetzke 65283ad
avoid duplication for vertex coordinates
lenaploetzke 5c99b9d
avoid duplication for centroid
lenaploetzke 1a81fc8
handle empty forests
lenaploetzke 7594d4c
delete cxx file
lenaploetzke d2f005e
clean up includes
lenaploetzke 6ea4849
Merge branch 'improve-codecov-for-templated-code' into 1655-define-st…
lenaploetzke af5aef7
Merge branch 'main' into 1655-define-structure-of-the-unstructured-me…
lenaploetzke f6ad307
Apply suggestions from code review
lenaploetzke 891db2e
code review
lenaploetzke 8f0e9a3
Apply suggestions from code review
lenaploetzke 83638ee
code review
lenaploetzke c22fbd9
Apply suggestions from code review
lenaploetzke 7a128c4
add missing consts
lenaploetzke 131a295
flat vector and delete iterator
lenaploetzke b207f1f
use t8_3d_vec instead of array
lenaploetzke b9642e5
implement [] operator
lenaploetzke bcb8c38
rm const from operator
lenaploetzke 41a9782
Merge pull request #1892 from DLR-AMR/unstructured-use-flat-vector-fo…
lenaploetzke cebf72b
added test with custom competence
lenaploetzke 1a17965
correct access specifier in competence and easier use of members.
lenaploetzke 4b4acb7
faster unstructured mesh test
lenaploetzke c7c6464
added missing !
lenaploetzke a1f62c6
Apply suggestions from code review
lenaploetzke 552cc29
first ideas
lenaploetzke ad5c5eb
Merge branch '1655-define-structure-of-the-unstructured-mesh-class' o…
lenaploetzke 5cef37a
undo things for another branch, dont know what happened here
lenaploetzke f18eba9
indent
lenaploetzke 05d9698
documentation for cache function variables
lenaploetzke 2051314
add constant iterator
lenaploetzke 0cd9d49
add mutable keyword
lenaploetzke 4e293dc
Apply suggestions from code review
lenaploetzke 24fdfc2
cmakefiles
lenaploetzke 4dfa67d
added cxx file
lenaploetzke 9f6ace0
code review
lenaploetzke 945b6cd
Merge branch '1655-define-structure-of-the-unstructured-mesh-class' i…
lenaploetzke ce8c142
change location of add_subdir
lenaploetzke a69417e
typoin cmake test
lenaploetzke 13360ae
add has_..._cache functions
lenaploetzke 0d538bf
review
lenaploetzke c906f7b
Merge pull request #1895 from DLR-AMR/interface-custom-competence-test
lenaploetzke eeb3e12
Merge branch '1655-define-structure-of-the-unstructured-mesh-class' i…
lenaploetzke 99c5133
new location of interface
lenaploetzke 113be94
move tests to api
lenaploetzke 35ea103
add mesh interface to api test
lenaploetzke 4063c6e
add option to codecov and valgrind
lenaploetzke a466b6d
parallel instead of serial test
lenaploetzke 2d80444
rename files
lenaploetzke 8de5b00
rename classes etc
lenaploetzke 030bfc5
rename to mesh_handle and use namespaces
lenaploetzke 70bb807
indent comments
lenaploetzke 2327a2a
review
lenaploetzke c4265f8
Merge pull request #1914 from DLR-AMR/interface-as-cmake-library
lenaploetzke fcfe285
Merge branch '1655-define-structure-of-the-unstructured-mesh-class' i…
lenaploetzke 81bdee1
add handle to doxygen and resolve doxygen errors
lenaploetzke 139e0f4
formatting
lenaploetzke 29e7aef
Merge pull request #1923 from DLR-AMR/rename-unstructured-mesh-interface
lenaploetzke d2bee70
Merge branch 'main' into 1655-define-structure-of-the-unstructured-me…
lenaploetzke 1f13cf7
Apply suggestions from code review
lenaploetzke d5952b2
Merge branch 'main' into 1655-define-structure-of-the-unstructured-me…
lenaploetzke 34297c5
code review
lenaploetzke 5147546
adapt cmake according to review
lenaploetzke 7a6e040
delete unnecessary include and make public inheritance explicit
lenaploetzke 2d786dc
Apply suggestions from code review
lenaploetzke 954f9a7
review
lenaploetzke 5f38e06
access operator and iterator const
lenaploetzke 7b7d424
last forgotten interface
lenaploetzke bc913ab
moved file locations
lenaploetzke 8ec1bb7
adapt cmake
lenaploetzke 74a34f4
Merge branch 'main' into 1655-define-structure-of-the-unstructured-me…
sandro-elsweijer 90401ed
Update include path for t8_cmesh header
sandro-elsweijer 7f65c1a
Update include path for t8_cmesh header
sandro-elsweijer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| # This file is part of t8code. | ||
| # t8code is a C library to manage a collection (a forest) of multiple | ||
| # connected adaptive space-trees of general element types in parallel. | ||
| # | ||
| # Copyright (C) 2025 the developers | ||
| # | ||
| # t8code is free software; you can redistribute it and/or modify | ||
| # it under the terms of the GNU General Public License as published by | ||
| # the Free Software Foundation; either version 2 of the License, or | ||
| # (at your option) any later version. | ||
| # | ||
| # t8code is distributed in the hope that it will be useful, | ||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| # GNU General Public License for more details. | ||
| # | ||
| # You should have received a copy of the GNU General Public License | ||
| # along with t8code; if not, write to the Free Software Foundation, Inc., | ||
| # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
|
|
||
| # Define own library for mesh handle. | ||
| if ( T8CODE_BUILD_AS_SHARED_LIBRARY ) | ||
| add_library( T8_MESH_HANDLE SHARED ) | ||
| set_target_properties( T8_MESH_HANDLE PROPERTIES POSITION_INDEPENDENT_CODE ON ) | ||
| else() | ||
| add_library( T8_MESH_HANDLE STATIC ) | ||
| endif() | ||
|
|
||
| add_library( T8CODE::T8_MESH_HANDLE ALIAS T8_MESH_HANDLE ) | ||
| set_target_properties(T8_MESH_HANDLE PROPERTIES OUTPUT_NAME mesh_handle) | ||
|
|
||
| target_include_directories( T8_MESH_HANDLE PUBLIC | ||
| $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/..> | ||
| $<INSTALL_INTERFACE:${CMAKE_INSTALL_PREFIX}/include/mesh_handle> | ||
| ) | ||
|
|
||
| target_sources(T8_MESH_HANDLE PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/mesh.cxx) | ||
| install( DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | ||
| DESTINATION include/ | ||
| FILES_MATCHING PATTERN "*.hxx" | ||
| ) | ||
|
|
||
| target_link_libraries(T8_MESH_HANDLE PUBLIC T8) | ||
|
|
||
| install( TARGETS T8_MESH_HANDLE | ||
| EXPORT ${PROJECT_NAME}-targets | ||
| ARCHIVE DESTINATION lib | ||
| LIBRARY DESTINATION lib | ||
| RUNTIME DESTINATION bin | ||
| ) | ||
|
|
||
| if( T8CODE_EXPORT_COMPILE_COMMANDS ) | ||
| set_target_properties( T8_MESH_HANDLE PROPERTIES EXPORT_COMPILE_COMMANDS ON ) | ||
| endif( T8CODE_EXPORT_COMPILE_COMMANDS ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # mesh_handle # | ||
| **REMARK: Please note that this feature is still work-in-progress, so a lot of functionality is still missing, but will be added step by step.** | ||
|
|
||
| In this folder, we define a mesh handle. | ||
| Some application codes are designed for unstructured or uniform meshes and cannot use t8code's tree-based structures directly. For this purpose, an iterable mesh data structure is created as an intermediate level. This frees the users from having to work with the forest-of-trees based concept and increases the usability. Please note that it is not guaranteed that the mesh is conformal and does not contain hanging nodes. | ||
|
|
||
| If you want to use the handle, note that is has its own library. Turn the option `T8CODE_BUILD_MESH_HANDLE` to `ON` and link against the target `T8_MESH_HANDLE` in addition to the usual t8code target please. | ||
|
|
||
| The [mesh.hxx](mesh.hxx) defines the mesh class of the handle. | ||
| The [element.hxx](element.hxx) defines the elements used in the mesh class. | ||
| The [competences.hxx](competences.hxx) defines additional competences/functionality of an element to access additional data. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| /* | ||
| This file is part of t8code. | ||
| t8code is a C library to manage a collection (a forest) of multiple | ||
| connected adaptive space-trees of general element classes in parallel. | ||
|
|
||
| Copyright (C) 2025 the developers | ||
|
|
||
| t8code is free software; you can redistribute it and/or modify | ||
| it under the terms of the GNU General Public License as published by | ||
| the Free Software Foundation; either version 2 of the License, or | ||
| (at your option) any later version. | ||
|
|
||
| t8code is distributed in the hope that it will be useful, | ||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| GNU General Public License for more details. | ||
|
|
||
| You should have received a copy of the GNU General Public License | ||
| along with t8code; if not, write to the Free Software Foundation, Inc., | ||
| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
| */ | ||
|
|
||
| /** \file competences.hxx | ||
| * Definition of the additional competences/functionalities that can be used for the mesh class. | ||
| * Especially, competences to cache functionalities of elements instead of calculating them each time a function | ||
| * is called are provided. | ||
| * | ||
| * All competences have the same inheritance pattern: | ||
| * We use the CRTP pattern as we may need to access members of the derived class \ref t8_mesh_handle::element. | ||
| * The t8_crtp_operator is used for convenience/clear code (avoid to type a static cast explicitly each time | ||
| * we need functionality of TUnderlying). | ||
| * Especially for the competences to cache functionality, the access of members is not necessary, | ||
| * such that it is not obvious why we use the crtp. For competences that extend the functionality of the element, | ||
| * this is required. | ||
| * We use it for all competences for consistency and compatibility with the \ref t8_mesh_handle::element class. | ||
| */ | ||
|
|
||
| #ifndef T8_COMPETENCES_HXX | ||
| #define T8_COMPETENCES_HXX | ||
|
|
||
| #include <t8.h> | ||
| #include <t8_types/t8_operators.hxx> | ||
| #include <t8_types/t8_vec.hxx> | ||
| #include <t8_eclass.h> | ||
| #include <array> | ||
| #include <vector> | ||
| #include <optional> | ||
|
|
||
| namespace t8_mesh_handle | ||
| { | ||
|
|
||
| /** | ||
| * Competence to cache the vertex coordinates of an element at the first function call. | ||
| * \tparam TUnderlying Use the \ref element with specified competences as template parameter. | ||
| */ | ||
| template <typename TUnderlying> | ||
| struct cache_vertex_coordinates: public t8_crtp_operator<TUnderlying, cache_vertex_coordinates> | ||
| { | ||
| public: | ||
| /** | ||
| * Function that checks if the cache for the vertex coordinates has been filled. | ||
| * \return true if the cache for the vertex coordinates has been filled, false otherwise. | ||
| */ | ||
| bool | ||
| vertex_cache_filled () const | ||
| { | ||
| return !m_vertex_coordinates.empty (); | ||
| } | ||
|
|
||
| protected: | ||
| mutable std::vector<t8_3D_point> | ||
| m_vertex_coordinates; /**< Cache for the vector of vertex coordinate arrays. Empty vector if not filled. */ | ||
| }; | ||
|
|
||
| /** | ||
| * Competence to cache the centroid of an element at the first function call. | ||
| * \tparam TUnderlying Use the \ref element with specified competences as template parameter. | ||
| */ | ||
| template <typename TUnderlying> | ||
| struct cache_centroid: public t8_crtp_operator<TUnderlying, cache_centroid> | ||
| { | ||
| public: | ||
| /** | ||
| * Function that checks if the cache for the centroid has been filled. | ||
| * \return true if the cache for the centroid has been filled, false otherwise. | ||
| */ | ||
| bool | ||
| centroid_cache_filled () const | ||
| { | ||
| return m_centroid.has_value (); | ||
| } | ||
|
|
||
| protected: | ||
| mutable std::optional<t8_3D_point> | ||
| m_centroid; /**< Cache for the coordinates of the centroid. Use optional to allow no value if cache is not filled. */ | ||
| }; | ||
|
|
||
| } // namespace t8_mesh_handle | ||
| #endif /* !T8_COMPETENCES_HXX */ | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.