Skip to content

Improvement: Remove strong types from t8_3D_vec and t8_3D_point#2139

Open
lenaploetzke wants to merge 9 commits intomainfrom
2130-remove-strong-types-from-t8_3d_vec-and-t8_3d_point
Open

Improvement: Remove strong types from t8_3D_vec and t8_3D_point#2139
lenaploetzke wants to merge 9 commits intomainfrom
2130-remove-strong-types-from-t8_3d_vec-and-t8_3d_point

Conversation

@lenaploetzke
Copy link
Collaborator

@lenaploetzke lenaploetzke commented Feb 2, 2026

Describe your changes here:
Closes #2130
Very open for suggestions

All these boxes must be checked by the AUTHOR before requesting review:

  • The PR is small enough to be reviewed easily. If not, consider splitting up the changes in multiple PRs.
  • The title starts with one of the following prefixes: Documentation:, Bugfix:, Feature:, Improvement: or Other:.
  • If the PR is related to an issue, make sure to link it.
  • The author made sure that, as a reviewer, he/she would check all boxes below.

All these boxes must be checked by the REVIEWERS before merging the pull request:

As a reviewer please read through all the code lines and make sure that the code is fully understood, bug free, well-documented and well-structured.

General

  • The reviewer executed the new code features at least once and checked the results manually.
  • The code follows the t8code coding guidelines.
  • New source/header files are properly added to the CMake files.
  • The code is well documented. In particular, all function declarations, structs/classes and their members have a proper doxygen documentation. Make sure to add a file documentation for each file!
  • All new algorithms and data structures are sufficiently optimal in terms of memory and runtime (If this should be merged, but there is still potential for optimization, create a new issue).

Tests

  • The code is covered in an existing or new test case using Google Test.
  • The code coverage of the project (reported in the CI) should not decrease. If coverage is decreased, make sure that this is reasonable and acceptable.
  • Valgrind doesn't find any bugs in the new code. This script can be used to check for errors; see also this wiki article.

If the Pull request introduces code that is not covered by the github action (for example coupling with a new library):

  • Should this use case be added to the github action?
  • If not, does the specific use case compile and all tests pass (check manually).

Scripts and Wiki

  • If a new directory with source files is added, it must be covered by the script/find_all_source_files.scp to check the indentation of these files.
  • If this PR introduces a new feature, it must be covered in an example or tutorial and a Wiki article.

License

  • The author added a BSD statement to doc/ (or already has one).

@lenaploetzke lenaploetzke linked an issue Feb 2, 2026 that may be closed by this pull request
@codecov
Copy link

codecov bot commented Feb 2, 2026

Codecov Report

❌ Patch coverage is 51.28205% with 19 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.89%. Comparing base (9f94c4e) to head (0e1c80b).

Files with missing lines Patch % Lines
src/t8_types/t8_vec.cxx 51.51% 16 Missing ⚠️
src/t8_types/t8_vec.hxx 40.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2139      +/-   ##
==========================================
- Coverage   77.95%   77.89%   -0.06%     
==========================================
  Files         113      112       -1     
  Lines       19089    19021      -68     
==========================================
- Hits        14881    14817      -64     
+ Misses       4208     4204       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

*/
template <std::size_t TDim, typename TType = double>
using t8_vec_view = T8Type<std::span<TType, TDim>, t8_vec_tag<TDim>, EqualityComparable, Swapable, RandomAccessible>;
using t8_vec = std::array<TType, TDim>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit inconsistent. We have a using for vectors, but not for points and sometimes we have using and sometimes typedef.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The inconsistency between using and typedef is because i cannot use templates with typedefs. But i will change everything to using as this is preferred for modern cpp

Comment on lines 68 to 69
template <std::size_t TDim, typename TType = double>
using t8_vec_view = std::span<TType, TDim>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was only for the C interface, since we needed a non owning strong type. But now, we can just use a normal std::span and do not need a wrapper.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, i got it now, thank you!

/** Type alias for a 2D point.
*/
using t8_2D_vec = t8_vec<2>;
typedef std::array<double, 2> t8_2D_point;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What you you think, do we still need the differentiation between vectors and points or is a general dimensional type sufficient?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could keep the vector name, since a vector is not only a vector in a geometric sense, but also a one-dimensional tensor.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No i also think that one dimensional object is enough. And yes i agree that we can just name it t8_vec and not t8_dimensional. I just defined both because we have so many usages of t8_3D_point in t8code...

Comment on lines 114 to 115
template <typename T>
concept T8ContainerdoubleType = requires (T t) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
template <typename T>
concept T8ContainerdoubleType = requires (T t) {
template <typename TType>
concept T8ContainerDoubleType = requires (TType type) {

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed to T8ContainerType and deleted the other one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove strong types from t8_3D_vec and t8_3D_point

2 participants