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

Added Halfedge primitive type and refactored primitive type indexing #460

Merged
merged 5 commits into from
Oct 22, 2023

Conversation

rjc8237
Copy link
Collaborator

@rjc8237 rjc8237 commented Oct 16, 2023

No description provided.

@rjc8237
Copy link
Collaborator Author

rjc8237 commented Oct 16, 2023

I added a HalfEdge attribute. The most potentially problematic changes are code snippets where a correspondence between dimension and a PrimitiveType is assumed, and especially where iteration over dimensions are used. In particular, the attribute manager in Mesh used dimension+1 as the number of attributes and flags to initialize. I made the function get_dimension_primitive_counts to explicitly get the number of primitives for point, edge, surface, and volumetric meshes.

: Mesh(dimension, dimension, get_primitive_type_from_id(dimension))
{}

Mesh::Mesh(const long& dimension, const long& max_primitive_type_id, PrimitiveType hash_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.

I made the type of the hash explicit as well instead of inferring from dimension.

m_flag_handles.emplace_back(
register_attribute<char>("flags", static_cast<PrimitiveType>(j), 1));
register_attribute<char>("flags", get_primitive_type_from_id(j), 1));
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I made a function to explicitly convert from IDs to primitive types. We could just use static_cast and initializers in the enumerator list (as was done before), but I think this more explicit conversion function is safer.

Copy link
Collaborator

@mtao mtao left a comment

Choose a reason for hiding this comment

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

just add one include and try to remove as many derprecations as you can

{
switch (t) {
case PrimitiveType::Vertex: return 0;
case PrimitiveType::Edge: return 1;
case PrimitiveType::Face: return 2;
case PrimitiveType::Tetrahedron: return 3;
case PrimitiveType::HalfEdge: {
throw std::runtime_error("halfedge is not a simplex");
Copy link
Collaborator

Choose a reason for hiding this comment

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

make sure we include stdexcept

@codecov
Copy link

codecov bot commented Oct 21, 2023

Codecov Report

Merging #460 (903aeca) into main (0020fdb) will increase coverage by 2.63%.
Report is 99 commits behind head on main.
The diff coverage is 87.92%.

@@            Coverage Diff             @@
##             main     #460      +/-   ##
==========================================
+ Coverage   82.02%   84.66%   +2.63%     
==========================================
  Files         156      162       +6     
  Lines        4184     4557     +373     
==========================================
+ Hits         3432     3858     +426     
+ Misses        752      699      -53     
Flag Coverage Δ
wildmeshing 84.66% <87.92%> (+2.63%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
src/wmtk/Mesh.hpp 94.44% <ø> (ø)
src/wmtk/MultiMeshManager.hpp 100.00% <ø> (ø)
src/wmtk/TetMeshOperationExecutor.cpp 93.88% <100.00%> (ø)
src/wmtk/TriMesh.cpp 93.04% <100.00%> (ø)
src/wmtk/TriMeshOperationExecutor.cpp 96.59% <ø> (+0.07%) ⬆️
src/wmtk/attribute/AttributeManager.hpp 90.90% <100.00%> (ø)
src/wmtk/attribute/ConstAccessor.hpp 50.00% <ø> (ø)
src/wmtk/attribute/MutableAccessor.hpp 100.00% <ø> (ø)
src/wmtk/simplex/Simplex.hpp 90.90% <ø> (ø)
...rc/wmtk/utils/edgemesh_topology_initialization.cpp 100.00% <100.00%> (ø)
... and 6 more

... and 19 files with indirect coverage changes

@mtao mtao merged commit 0661dc5 into wildmeshing:main Oct 22, 2023
9 checks passed
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.

2 participants