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

488 refactor energy #506

Merged
merged 13 commits into from
Nov 14, 2023
Merged

488 refactor energy #506

merged 13 commits into from
Nov 14, 2023

Conversation

yunfanzhou
Copy link
Collaborator

issue 488 refactor energy

@yunfanzhou yunfanzhou linked an issue Nov 9, 2023 that may be closed by this pull request
7 tasks
Copy link

codecov bot commented Nov 9, 2023

Codecov Report

Attention: 132 lines in your changes are missing coverage. Please review.

Comparison is base (435ae49) 83.35% compared to head (6e582ae) 85.27%.
Report is 88 commits behind head on main.

Files Patch % Lines
src/wmtk/io/MshReader.cpp 81.52% 17 Missing ⚠️
src/wmtk/simplex/cofaces_single_dimension.cpp 30.43% 16 Missing ⚠️
src/wmtk/function/TriangleAutodiffFunction.cpp 65.71% 12 Missing ⚠️
src/wmtk/io/HDF5Reader.cpp 77.77% 12 Missing ⚠️
components/wmtk_components/output/output.cpp 0.00% 10 Missing ⚠️
src/wmtk/function/AMIPS.cpp 58.82% 7 Missing ⚠️
...mtk/multimesh/utils/find_local_switch_sequence.cpp 0.00% 7 Missing ⚠️
src/wmtk/simplex/top_dimension_cofaces.cpp 33.33% 6 Missing ⚠️
...onents/isotropic_remeshing/isotropic_remeshing.cpp 0.00% 5 Missing ⚠️
components/wmtk_components/mesh_info/mesh_info.cpp 0.00% 5 Missing ⚠️
... and 15 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #506      +/-   ##
==========================================
+ Coverage   83.35%   85.27%   +1.92%     
==========================================
  Files         215      207       -8     
  Lines        5954     6032      +78     
==========================================
+ Hits         4963     5144     +181     
+ Misses        991      888     -103     
Flag Coverage Δ
wildmeshing 85.27% <69.15%> (+1.92%) ⬆️

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

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

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.

fix the simplex stuff and try to add some more unit tests, but other than that looks good. i'l'l leave this at approve, but please try to improve the code coverage.

src/wmtk/function/AutodiffFunction.hpp Outdated Show resolved Hide resolved
src/wmtk/function/AutodiffFunction.hpp Outdated Show resolved Hide resolved
src/wmtk/simplex/cofaces_single_dimension.hpp Show resolved Hide resolved
src/wmtk/simplex/cofaces_single_dimension.cpp Show resolved Hide resolved
@mtao
Copy link
Collaborator

mtao commented Nov 13, 2023

Undo last changes to the simplex folder. This undoes an internal API practice

@yunfanzhou yunfanzhou self-assigned this Nov 13, 2023
Copy link
Contributor

@daniel-zint daniel-zint left a comment

Choose a reason for hiding this comment

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

Main concerns: documentation and coverage. The code itself looks good to me but especially with the simplex stuff, we should really make sure that it is 100% covered because everyone is going to use that.

src/wmtk/function/AMIPS.hpp Show resolved Hide resolved
src/wmtk/function/AMIPS.cpp Outdated Show resolved Hide resolved
throw std::runtime_error("AMIPS only supports 2D and 3D meshes");
}
if (embedded_dimension() == 2) {
DSVec2 coordinate0_2d = coordinate0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is that conversion safe? It seems to me like something that at least throws a warning and should be guarded properly by asserts). Actually, it might be the best if all the coordinates use a templated type.

~AMIPS();

protected:
DScalar eval(DSVec& coordinate0, DSVec& coordinate1, DSVec& coordinate2) const override;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think all the parameters should be const.

And where are DSVec and DScalar defined? I couldn't find it in autodiff.h.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

DSVec and DScalar are defined in my AutodiffFunction.

src/wmtk/function/AutodiffFunction.cpp Show resolved Hide resolved
src/wmtk/function/utils/autodiff.h Outdated Show resolved Hide resolved

std::vector<Tuple> cofaces_single_dimension_tuples(
SimplexCollection cofaces_single_dimension(
Copy link
Contributor

Choose a reason for hiding this comment

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

This one definitely needs documentation.

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'm going to leave everything that's related to cofaces_single_dimension unchanged for now, since Michael is going to possibly rewrite a lot about this function in #514

@@ -17,4 +18,10 @@ std::vector<Tuple> cofaces_single_dimension_tuples(
const Mesh& mesh,
const Simplex& my_simplex,
PrimitiveType cofaces_type);

std::vector<Simplex> cofaces_single_dimension_simplices(
Copy link
Contributor

Choose a reason for hiding this comment

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

Getting the vector of simplices from the simplex collection is very simple. I don't think this needs its own function.

std::vector<Tuple> cofaces_single_dimension_tuples(
const TriMesh& mesh,
const Simplex& my_simplex,
std::vector<Simplex> cofaces_single_dimension_simplices(
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a function that is going to be used by everyone. It should have 100% coverage.

Copy link
Contributor

@daniel-zint daniel-zint left a comment

Choose a reason for hiding this comment

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

lgtm

@yunfanzhou yunfanzhou merged commit ae84aa8 into main Nov 14, 2023
@yunfanzhou yunfanzhou deleted the 488-refactor-energy branch November 14, 2023 19:58
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.

refactor energy
3 participants