-
Notifications
You must be signed in to change notification settings - Fork 17
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
Component extract_subset
#426
base: main
Are you sure you want to change the base?
Changes from 1 commit
3aa11fb
3921e20
1be4189
dcf2723
5504abb
476bb22
472a219
06e9114
3203b4c
b6c5f36
de1533e
db6d98c
d299091
886909a
b4b4d7f
da5b811
9faab15
407b2b5
183fabc
1fc1002
24c5142
c24e525
152cb95
7f7fa10
efc311e
b0fd76a
b39e35f
1a1a7b5
7a30eb7
822c722
5d55b33
65ca4eb
09ac3a4
1471fed
7a946dd
3f2744e
2d8d2f6
55f22c6
34d00a4
2603077
2da433c
a23f82f
777cd32
bcfd83e
cb53ea9
fdd4b5b
73cfe5e
c08131c
961cc25
ad34515
1d757f1
d3f23a4
5d89c64
931b10c
3afccbe
2c56235
29327cd
ed177b2
be76d8b
f8ecc61
be2b55a
6cb1ed2
92445ac
e656a30
4a8c362
106aca6
bdcdfc1
0b8e485
6cfce0b
3b5353c
63e9562
5a7757b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,8 +1,25 @@ | ||||||
#include <wmtk_components/extract_subset/internal/extract_subset_2d.hpp> | ||||||
#include <wmtk_components/extract_subset/extract_subset.hpp> | ||||||
#include <catch2/catch_test_macros.hpp> | ||||||
#include "../tools/TriMesh_examples.hpp" | ||||||
#include "wmtk/attribute/Attribute.hpp" | ||||||
#include "wmtk/Primitive.hpp" | ||||||
#include "wmtk/attribute/AttributeHandle.hpp" | ||||||
#include "wmtk/Mesh.hpp" | ||||||
|
||||||
|
||||||
TEST_CASE("manual test case", "[components][extract_subset][2D]") | ||||||
TEST_CASE("3 neighbors test case", "[components][extract_subset][2D]") | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. write test case names with underscores: "3_neighbors_test_case" |
||||||
{ | ||||||
wmtk::TriMesh tm; | ||||||
tm = wmtk::tests::three_neighbors(); // start with 4 tri | ||||||
Eigen::Vector<long, 10> V; // init the data vector with any static length, then resize | ||||||
V.resize(tm.capacity( wmtk::PrimitiveType::Face), 1); | ||||||
V.row(0) << 1; | ||||||
V.row(1) << 0; // ont tri is not tagged | ||||||
V.row(2) << 1; | ||||||
V.row(3) << 1; | ||||||
auto tag_handle = wmtk::mesh_utils::set_matrix_attribute(V, "tag", wmtk::PrimitiveType::Face, tm); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That way of setting values should be only used if you want to assign a value to each vertex at once. It is mostly for the case that you load data from a file. In general, you should follow this example:
wildmeshing-toolkit/src/wmtk/Mesh.hpp Line 97 in 764ca0e
You might want to use that to default everything to something signaling invalidness like -1 .
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. According to the commit history f1b7140, this functionality is update on Oct 5. So in our current branch there is no such interface right now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did a merge just now. |
||||||
|
||||||
// NOTE: I don't know why the following line gives me a linking error of undefined reference... | ||||||
// wmtk::TriMesh new_tm = wmtk::components::extract_subset(tm, tag_handle, 2); | ||||||
wmtk::TriMesh new_tm = wmtk::components::internal::extract_subset_2d(tm, tag_handle); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I see it correctly, you didn't set |
||||||
} |
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.
Add a
default
case that containsthrow "not implemented";
or something similar.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.
Btw if you throw a string literal it causes weird outputs. Make sure to throw a runtime error