-
Notifications
You must be signed in to change notification settings - Fork 91
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
Enhance the fracture generation feature of mesh_doctor
#2793
Conversation
checking duplicated nodes for fractures and matrix.
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.
Note that this is a complete rewriting of the algorithm; therefore it's not particularly relevant to compare the two files during the code review process.
collocated_nodes: numpy.ndarray = vtk_to_numpy(fracture_mesh.GetPointData().GetArray("collocated_nodes")) | ||
if len(collocated_nodes.shape) == 1: | ||
collocated_nodes: numpy.ndarray = collocated_nodes.reshape((collocated_nodes.shape[0], 1)) | ||
return tuple(map(lambda bucket: tuple(sorted(filter(lambda i: i != -1, bucket))), collocated_nodes)) |
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.
This is completely fine (and maybe a bit faster?), but I find list comprehension+slicing to be much more readable/pythonic than lambdas+maps+filters:
tuple([tuple(sorted(bucket[bucket != -1])) for bucket in collected_nodes])
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.
You are right, it's far better!
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.
Looks good to me
- Complete rewriting of the fracture generation algorithm. There should be not limitation anymore, and it supports `VTK_POLYHEDRON` thanks to @IsaacJu-debug 's investigations. - Efforts were paid to validate the code using `mypy` and type hints. Not perfect yet, but still a good improvement.
VTK_POLYHEDRON
thanks to @IsaacJu-debug 's investigations.mypy
and type hints. Not perfect yet, but still a good improvement.