Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proposal of new feature:
TetraMeshData
TL;DR: Reading files in the created tree structure will greatly enhance the speed of the process with this PR.
Description
I would propose a new feature, the
TetraMeshData
class, modeled after the existingMeshData
definition.(I have already suggested #407 but would like to split the function.)
It was implemented with the following objectives:
.rsm
, which has constructed a K-D tree structure.Additionally, this class will be used when loading mesh files formatted as
.vtk
or.obj
, which contain tetrahedral (3-D unstructured) mesh data in the future.Examples of the use:
TetraMeshData
.rsm
.rsm
fileSpeed test
I attempted to compare the instancing of
Discrete3DMesh
withTetraMeshData
loaded from a file.As a mesh file, I used the
stanford_bunny.mesh
file located indemos/resources/
.Discrete3DMesh
TetraMeshData
TetraMeshData
from fileI attained a loading speed for tetra mesh that is approximately 9 times faster than generating
TetraMeshData
using vertices and tetrahedral index arrays.This difference is expected to widen as the vertex data size increases.
The test script that I used is in the collapsed section below.
Test script
Class structure
The structure of the
TetraMeshData
I implemented is as follows.Details of unit test
I also implemented a unit test for
TestMeshData
in raysect/primitive/mesh/tests/test_tetra_mesh.py.Below is a table showing the correspondence between the methods of the
TestTetraMeshData
class in unit tests and the methods tested in theTestMeshData
class.TestTetraMeshData
TetraMeshData
test_initialization()
__init__()
test_invalid_tetrahedron_indices()
__init__()
test_vertex_method()
vertex()
test_invalid_vertex_index()
vertex()
test_barycenter()
barycenter()
test_compute_volume()
volume()
,volume_total()
test_is_contained()
is_contained()
test_bounding_box()
bounding_box()
test_pickle_state ()
__getstate__()
,__setstate__()
,save()
,load()
I would appreciate it if you would review it and make any suggestions and comments.