Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
fdc5f9e
implement ghost class as child of element
lenaploetzke Oct 29, 2025
3fa3ada
implement ghost class as child of element
lenaploetzke Oct 29, 2025
1f405a8
adapt all tests
lenaploetzke Oct 30, 2025
04ed7a1
make constructors of elements private
lenaploetzke Oct 30, 2025
6c2f9ee
abstract class for elements
lenaploetzke Oct 30, 2025
719f831
adapt remaining tests
lenaploetzke Oct 31, 2025
db7bcf6
documentation
lenaploetzke Oct 31, 2025
3ed16f4
documentation
lenaploetzke Nov 3, 2025
f27d7ef
add cache for neighbors
lenaploetzke Nov 4, 2025
885b28b
implement cache test
lenaploetzke Nov 5, 2025
e8701d8
Merge branch 'add-interface-tests-cache-compare-with-forest' into han…
lenaploetzke Nov 26, 2025
ed5c947
add check for comitted forest to mesh
lenaploetzke Nov 26, 2025
d97a209
clean up includes
lenaploetzke Nov 26, 2025
d6dee07
Merge branch 'main' into handle-neighbor-and-ghost
lenaploetzke Dec 17, 2025
436dd62
Merge branch 'add-interface-tests-cache-compare-with-forest' into han…
lenaploetzke Dec 17, 2025
d789736
fix doxygen
lenaploetzke Dec 17, 2025
64c2772
reduce to single element class
lenaploetzke Jan 5, 2026
2d4a1e4
rm num_neighs argument
lenaploetzke Jan 5, 2026
bb8828e
cleanup
lenaploetzke Jan 6, 2026
9e79d6d
Cache element from forest
lenaploetzke Jan 6, 2026
659a4ac
make dual_faces parameter optional
lenaploetzke Jan 6, 2026
88cfa56
return ptr to elements instead of indices in get_face_neigh
lenaploetzke Jan 6, 2026
65d0203
add check that we actually have ghosts and test smth
lenaploetzke Jan 6, 2026
a0d7fdc
Apply suggestions from code review
lenaploetzke Jan 8, 2026
4127dd0
review
lenaploetzke Jan 8, 2026
dc77ae3
Merge branch 'main' into handle-neighbor-and-ghost
lenaploetzke Jan 8, 2026
13b23b6
better doku and renaming
lenaploetzke Jan 8, 2026
6aedab7
small copy paste error
lenaploetzke Jan 9, 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
5 changes: 3 additions & 2 deletions mesh_handle/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Some application codes are designed for unstructured or uniform meshes and canno

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 folder's most important files are:
The [mesh.hxx](mesh.hxx) defines the mesh class of the handle. This is the central file of the mesh handle.
The [element.hxx](element.hxx) defines the elements (mesh or ghost elements) of the mesh handle.
The [competences.hxx](competences.hxx) defines additional competences/functionality of an element to access additional data.
49 changes: 46 additions & 3 deletions mesh_handle/competences.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ along with t8code; if not, write to the Free Software Foundation, Inc.,
* 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.
* We use the CRTP pattern as we may need to access members of the derived classes like
* \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,
Expand All @@ -41,8 +42,6 @@ along with t8code; if not, write to the Free Software Foundation, Inc.,
#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>

Expand Down Expand Up @@ -95,5 +94,49 @@ struct cache_centroid: public t8_crtp_operator<TUnderlying, cache_centroid>
m_centroid; /**< Cache for the coordinates of the centroid. Use optional to allow no value if cache is not filled. */
};

/**
* Competence to cache the neighbors of an element at a specific face at the first function call.
* \tparam TUnderlying Use the \ref element with specified competences as template parameter.
*/
template <typename TUnderlying>
struct cache_neighbors: t8_crtp_operator<TUnderlying, cache_neighbors>
{
public:
/**
* Function that checks if the neighbor cache for a face has been filled.
* \param [in] face The face for which the cache should be checked.
* \return true if the cache has been filled, false otherwise.
*/
bool
neighbor_cache_filled (int face) const
{
return m_num_neighbors[face].has_value ();
}

/**
* Function that checks if the neighbor cache for any face has been filled.
* \return true if the cache has been filled, false otherwise.
*/
bool
neighbor_cache_filled_any () const
{
for (int iface = 0; iface < this->underlying ().get_num_faces (); ++iface) {
if (neighbor_cache_filled (iface)) {
return true;
}
}
return false;
}

protected:
mutable std::vector<std::vector<const TUnderlying *>>
m_neighbors; /**< Neighboring elements at each face. The length of the vectors is stored in \ref m_num_neighbors. */
mutable std::vector<std::optional<int>>
m_num_neighbors; /**< Vector with the numbers of neighbor elements at each face.
num_neighbors is stored to indicate that the cache is filled if a face does not have any neighbor. */
mutable std::vector<std::vector<int>>
m_dual_faces; /**< Face id's of the neighboring elements' faces for each face. */
};

} // namespace t8_mesh_handle
#endif /* !T8_COMPETENCES_HXX */
Loading