Skip to content
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

Update code to use tag_t, coordinate_t, is_<geometry>_v #1033

Merged
merged 4 commits into from
Feb 8, 2024

Conversation

aprokop
Copy link
Contributor

@aprokop aprokop commented Feb 2, 2024

I know this patch is noisy. Still, I'd like to get it in.

  • Provide is_<geometry>_v helpers to avoid is_<geometry>::value_type
  • Provide coordinate_type_t<geometry> helpers to avoid coordinate_type<geometry>::type
  • Provide is_valid_geometry
  • Provide GeometryTraits for Ray

@aprokop aprokop changed the title Update code to use tag_t and coordinate_t Update code to use tag_t, coordinate_t, is_<geometry>_v Feb 5, 2024
@aprokop aprokop added the refactoring Code reorganization label Feb 8, 2024
@aprokop aprokop merged commit ea784f6 into arborx:master Feb 8, 2024
1 of 2 checks passed
@aprokop aprokop deleted the _t_stuff branch February 8, 2024 05:02
template <typename Geometry>
using coordinate_type_t = typename coordinate_type<Geometry>::type;

// clang-format off
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did you disable format?
One of the backslash in not aligned,

#define DEFINE_GEOMETRY(name, name_tag) \
struct name_tag{}; \
template <typename Geometry> \
struct is_##name : std::is_same<tag_t<Geometry>, name_tag>{}; \
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the point of defining the trait if you don't use it. You could define directly the helper variable template.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Technically, ArborX::GeometryTraits is a user visible namespace. Removing is_point and such is not backwards compatible.

Copy link
Contributor

Choose a reason for hiding this comment

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

It is still somewhat experimental and it is not documented. Also that is not a type that is intended to be specialized for user-defined geometry types.
I am not saying that we absolutely have to drop the trait type but that I think that there is nothing that prevent us to do so.

std::is_same<Tag, SphereTag>{} ||
std::is_same<Tag, TriangleTag>{} ||
std::is_same<Tag, KDOPTag>{},
static_assert(is_valid_geometry<Geometry>,
Copy link
Contributor

Choose a reason for hiding this comment

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

is_valid_geometry includes rays. Did you mean to add?
Now I see the message. So it is a yes.
Why so?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because Ray is a valid geometry. However, check_valid_geometry_traits and the tag are a bit weird. Tags are useful within ArborX, but less so for user defined geometries. So, the type check should really be only called for the geometries we control.

Copy link
Contributor

Choose a reason for hiding this comment

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

Was there a use case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring Code reorganization
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants