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

refactor!: rework cmap2 index & attribute system #36

Merged
merged 31 commits into from
Apr 16, 2024
Merged

Conversation

imrn99
Copy link
Collaborator

@imrn99 imrn99 commented Apr 12, 2024

Description

Full rework of the CMap2 structure & interfaces. Changes mainly concern how attributes (currently vertices) are handled, as well as the cell index computation logic. For a detailed breakdown of the system, refer to:

Scope

  • Code: honeycomb-core for content, the rest is just updates dictated by core changes

Type of change

  • Refactor

Other

  • Breaking change

Necessary follow-up

  • Needs documentation
  • Needs testing

Mentions

...

Copy link
Member

@cedricchevalier19 cedricchevalier19 left a comment

Choose a reason for hiding this comment

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

Ok with the main changes.

@@ -25,6 +25,7 @@ use num::ToPrimitive;
///
/// todo
///
#[cfg_attr(feature = "utils", derive(Clone))]
Copy link
Member

Choose a reason for hiding this comment

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

Why the condition?

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 same condition is put on the CMap2 structure; the reasoning for CMap2 is that it's not a good idea to give a "free" Clone implementation to the user on such a structure. As for the storage, I didn't need the implementation for anything else than the case where it is required by the map itself.

honeycomb-benches/benches/core/cmap2/editing.rs Outdated Show resolved Hide resolved
honeycomb-core/src/cells/attribute_collections.rs Outdated Show resolved Hide resolved
honeycomb-core/src/cells/attribute_collections.rs Outdated Show resolved Hide resolved
honeycomb-core/src/twomap.rs Outdated Show resolved Hide resolved
Comment on lines +387 to 390
Orbit2::new(self, OrbitPolicy::Vertex, dart_id)
.min()
.unwrap() as VertexIdentifier
}
Copy link
Member

Choose a reason for hiding this comment

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

Why unwrap?

Copy link
Collaborator Author

@imrn99 imrn99 Apr 16, 2024

Choose a reason for hiding this comment

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

Essentially, an orbit is always non-empty, therefore the min() method will always yield a result. The fact that the orbit is always non-empty is because of its definition: it will always include the dart passed as an argument since it is the starting point of the internal BFS. Because of that, all darts (even the null dart!) yield a non-empty orbit (given that the policy is valid).

Comment on lines 403 to 404
Orbit2::new(self, OrbitPolicy::Edge, dart_id).min().unwrap() as EdgeIdentifier
}
Copy link
Member

Choose a reason for hiding this comment

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

Why as and not into()?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Because the identifier types are aliases (not structs) and the aliases point to the same primitives, clippy detect it as a useless type conversion & throws a warning. This might actually be an inconsistent behavior of the linter; I'll look into it.

honeycomb-core/src/twomap.rs Show resolved Hide resolved
honeycomb-core/src/twomap.rs Outdated Show resolved Hide resolved
Comment on lines 14 to 15
map: std::marker::PhantomData<&'a CMap2<T>>,
pub identifiers: Vec<VertexIdentifier>,
Copy link
Member

Choose a reason for hiding this comment

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

map is not a good name.

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 it to lifetime_indicator in decb9ac

@codecov-commenter
Copy link

codecov-commenter commented Apr 16, 2024

Codecov Report

Attention: Patch coverage is 50.42857% with 347 lines in your changes are missing coverage. Please review.

❗ No coverage uploaded for pull request base (master@96f55a1). Click here to learn what that means.

Files Patch % Lines
honeycomb-core/src/twomap.rs 25.82% 247 Missing ⚠️
honeycomb-render/src/handle.rs 0.00% 42 Missing ⚠️
honeycomb-core/src/cells/attribute_collections.rs 17.77% 37 Missing ⚠️
honeycomb-core/src/cells/orbits.rs 40.00% 21 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             master      #36   +/-   ##
=========================================
  Coverage          ?   44.45%           
=========================================
  Files             ?       15           
  Lines             ?     2166           
  Branches          ?        0           
=========================================
  Hits              ?      963           
  Misses            ?     1203           
  Partials          ?        0           

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

@imrn99 imrn99 merged commit a6d2f1b into master Apr 16, 2024
15 checks passed
@imrn99 imrn99 deleted the rework-cmap2 branch April 16, 2024 08:48
imrn99 added a commit that referenced this pull request Apr 16, 2024
imrn99 added a commit that referenced this pull request Apr 16, 2024
* chore: add content of PR #33, #34 to changelog

* chore: add content of pr #36 to changelog
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.

3 participants