Improvement: Remove strong types from t8_3D_vec and t8_3D_point#2139
Improvement: Remove strong types from t8_3D_vec and t8_3D_point#2139lenaploetzke wants to merge 9 commits intomainfrom
Conversation
Codecov Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
| */ | ||
| 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>; |
There was a problem hiding this comment.
This is a bit inconsistent. We have a using for vectors, but not for points and sometimes we have using and sometimes typedef.
There was a problem hiding this comment.
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
src/t8_types/t8_vec.hxx
Outdated
| template <std::size_t TDim, typename TType = double> | ||
| using t8_vec_view = std::span<TType, TDim>; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Ah, i got it now, thank you!
src/t8_types/t8_vec.hxx
Outdated
| /** Type alias for a 2D point. | ||
| */ | ||
| using t8_2D_vec = t8_vec<2>; | ||
| typedef std::array<double, 2> t8_2D_point; |
There was a problem hiding this comment.
What you you think, do we still need the differentiation between vectors and points or is a general dimensional type sufficient?
There was a problem hiding this comment.
We could keep the vector name, since a vector is not only a vector in a geometric sense, but also a one-dimensional tensor.
There was a problem hiding this comment.
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...
src/t8_types/t8_vec.hxx
Outdated
| template <typename T> | ||
| concept T8ContainerdoubleType = requires (T t) { |
There was a problem hiding this comment.
| template <typename T> | |
| concept T8ContainerdoubleType = requires (T t) { | |
| template <typename TType> | |
| concept T8ContainerDoubleType = requires (TType type) { |
There was a problem hiding this comment.
Renamed to T8ContainerType and deleted the other one
Describe your changes here:
Closes #2130
Very open for suggestions
All these boxes must be checked by the AUTHOR before requesting review:
Documentation:,Bugfix:,Feature:,Improvement:orOther:.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
Tests
If the Pull request introduces code that is not covered by the github action (for example coupling with a new library):
Scripts and Wiki
script/find_all_source_files.scpto check the indentation of these files.License
doc/(or already has one).