Skip to content

Improvement: Remove strong types from t8_3D_vec and t8_3D_point#2139

Open
lenaploetzke wants to merge 3 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 3 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 50.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.92%. Comparing base (44f449b) to head (f5e6e7b).
⚠️ Report is 17 commits behind head on main.

Files with missing lines Patch % Lines
src/t8_types/t8_vec.hxx 50.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2139      +/-   ##
==========================================
+ Coverage   77.56%   77.92%   +0.35%     
==========================================
  Files         113      113              
  Lines       19025    19055      +30     
==========================================
+ Hits        14757    14848      +91     
+ Misses       4268     4207      -61     

☔ 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.

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.

/** 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.

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) {

Comment on lines +125 to +135
/** Concept for container types with any value type.
*/
template <typename T>
concept T8ContainerType = requires (T t) {
{
std::begin (t)
} -> std::input_iterator;
{
std::end (t)
} -> std::input_iterator;
};
Copy link
Member

Choose a reason for hiding this comment

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

I understand why this is implemented, but since we are in a vector class with floating variables, it is okay if every function expects a floating point type.


/**
* \brief Test if two 3D Dimensionaltors are equal with respect to a given precision
* \brief Test if two 3D containers are equal with respect to a given precision
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
* \brief Test if two 3D containers are equal with respect to a given precision
* \brief Test if two vectors are equal with respect to a given precision

this does work with all dimensions and I think vector is better, but that's debatable

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