-
Notifications
You must be signed in to change notification settings - Fork 9
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
Version 3 - Failsafe Polyhedral Gravity Modeling & Polyhedron Class #36
Conversation
Modified the MeshChecking functionality to include an orientation check for both outward and inward facing normals. Also included a method to determine the majority vertex ordering of a polyhedron and which vertices violate this ordering. The new checks are implemented in the test suite and reflected in the main application.
Changes: - add orientation from GravityEvaluable - add density from GravityEvaluable - add mesh checking from MeshChecking - propagate changes inside C++ library/ executable Rational: All these methods/ functions were previously requiring to hand over a polyhedron. As instance methods, the argument is implicit (this) and we group mesh related utility into "the mesh container" and de-couple it from the gravity model.
add new pytests for the Polyhedron class
- aarch64 not working due to failure in x86 pipeline, dedicated aarch64 not available in GitHub runners at the moment - arm64 working with Apple Clang compiler instead of gnu
Never mind you already did update it :) Was on the wrong branch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious, github ate my "Submit review" click yesterday it seems. Some minor comments / suggestions.
Nice work!
One open question for me is whether we checked performance is on the same scale as before? I don't see particular cause for worry, just to doublecheck?
Co-authored-by: Pablo Gómez <[email protected]>
Co-authored-by: Pablo Gómez <[email protected]>
Co-authored-by: Pablo Gómez <[email protected]>
Co-authored-by: Pablo Gómez <[email protected]>
Co-authored-by: Pablo Gómez <[email protected]>
Co-authored-by: Pablo Gómez <[email protected]>
Hmm, dark magic going on. That happened to me recently with a comment.
Thanks!
@gomezzz Thank you very much for the review 😀 I included a performance comparison in the comments above (with an explanation). We're faster or equal than version For quick reference, here again: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💪
Changelog
PyPi Release Release Candidate 3.0rc3
Published on PyPi as Pre-Release 3.0rc3 and installable via explicit versioning:
Resolves Issues
The changes introduced with this PR make it impossible to create an invalid
Polyhedron
(if not explicitly requested). Hence, the gravity model guarantees correct results according to Tsoulis' formulation.We are also NOT dependent anymore on
INWARDS
orOUTWARDS
pointing normals. Both cases can be handled.The changes are quite extensive - especially due to changes to the initial architectural concept being necessary. Below, you'll find a list of interesting files for the review.
Rational of the Changes
The problem with #34 is that it requires adding at least two options: one to
disable/ enable checking
and one to hand over theplane unit normal orientation
(now only referred to asorientation
). Hence, extending theevaluate
method would lead to a method with six parameters.Further, the
orientation
is actually correlated to meshvertices
andfaces
.There is no good way to integrate this in the current method without:
The new Way with a fully fleshed Polyhedron
The PR fundamentally reworks the input handling and separates gravity evaluation & mesh handling by promoting the
Polyhedron
to an actual class with behavior rather than just a data container.This also paves the way for (native on the C++ side) heterogeneous density evaluation in the future.
New design approach:
One first creates a
Polyhedron
from apolyhedral_source
(file input list or vertices/ faces).It is NOT possible to create an invalid polyhedron leading to wrong results in the gravity evaluation (as long as
integrity_check != PolyhedronIntegrity.DISABLE
).This is also the magic of the new implementation:
AUTOMATIC
(default): Informs the user aboutorientation
is different than specified or degenerated faces appear (first-time user)VERIFY
: LikeAUTOMATIC
and raises an exception, but without the info-message to stdoutHEAL
: No exception; the mesh is repaired automatically to make the normal orientation consistent (still raises if degenerated faces appear)DISABLE
: All checks disabled, no runtime cost (experienced user), allows the construction of invalid polyhedrons--> Details in
docs
, see in rendered rstExample
Create a
Polyhedron
:The
evaluate
method only takes an object of kindPolyhedron
(so no wrong input possible/ separation of concerns):Or with caching, the
GravityEvaluable
:Major Changes and Features
For review interesting:
src/polyhedralGravityPython/PolyhedralGravityPython.cpp
src/polyhedralGravity/model/Polyhedron.h/cpp
test/model/PolyhedronTest.cpp
test/model/PolyhedronBigTest.cpp
test/python/test_polyhedron.py
test/python/test_gravity_model.py
The rest are nearly only movements or changes required due to the refactored interface.
C++ Library
enum
NormalOrientation
, which makes the Mesh Orientation more expressiveMeshChecking
namespace intoPolyhedron
getPlaneUnitNormalOrientation()
which returnsdensity
fromGravityEvaluable
intoPolyhedron
PolyhedronIntegrity
to select mesh checking modes onPolyhedron
construction.Polyhedron
class regarding mesh checkingPython Interface
Polyhedron
__getitem__
convenience access to resolved faces with vertex coordinates)check_normal_orientation()
for debugging what's wrong with the polyhedron (only viable if constructed withPolyhedronIntegrity.DISABLE
as otherwise a wrong polyhedron is not constructible)NormalOrientation
PolyhedronIntegrity
Polyhedron
from now)GravityEvaluable
evaluate
utility
submoduleread
replaced by accesible properties of apolyhedron
polyhedron.vertices
andpolyhedron.faces
check_mesh
replaced byPolyhedron
's automatic capabilities + its debug method (just in case)Polyhedron
class regarding mesh checkingOther
2.1
jupyter notebook
andscripts
setup.py
.clang-format
setup.py
)