Skip to content

Commit

Permalink
AttributeDescription: adding comment to enable aggregate initializati…
Browse files Browse the repository at this point in the history
…on and cleaning up how unit test uses it for other ocmpilers
  • Loading branch information
mtao committed Nov 22, 2024
1 parent 22a0240 commit 1c4baaf
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ namespace wmtk::components::multimesh::utils {
// the minimal information to uniquely extract an attribute handle
struct AttributeDescription
{
// Avoiding defining any constructors to enable aggregate construction
//AttributeDescription() = default;
//AttributeDescription(const AttributeDescription&) = default;
//AttributeDescription(AttributeDescription&&) = default;
//AttributeDescription& operator=(const AttributeDescription&) = default;
//AttributeDescription& operator=(AttributeDescription&&) = default;
//~AttributeDescription() = default;

std::string path;
uint8_t dimension; // internally the primitive type
attribute::AttributeType type;
Expand Down
31 changes: 16 additions & 15 deletions components/multimesh/tests/named_multimesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,12 @@ TEST_CASE("named_multimesh_parse_attributes", "[components][multimesh]")

using AT = wmtk::attribute::AttributeType;


using AD = wmtk::components::multimesh::utils::AttributeDescription;
{ // double check that path extraction is working
std::vector<wmtk::components::multimesh::utils::AttributeDescription> double_ads;
double_ads.emplace_back("double_test", 0, AT::Double);
double_ads.emplace_back("/double_test", 0, AT::Double);
double_ads.emplace_back("roo/double_test", 0, AT::Double);
std::vector<AD> double_ads;
double_ads.emplace_back(AD{"double_test", 0, AT::Double});
double_ads.emplace_back(AD{"/double_test", 0, AT::Double});
double_ads.emplace_back(AD{"roo/double_test", 0, AT::Double});


for (const auto& ad : double_ads) {
Expand All @@ -179,15 +179,15 @@ TEST_CASE("named_multimesh_parse_attributes", "[components][multimesh]")
CHECK(
rational_test_handle == wmtk::components::multimesh::utils::get_attribute(
named_mm,
{"rational_test", 0, AT::Rational}));
AD{"rational_test", 0, AT::Rational}));
CHECK(
int_test_handle == wmtk::components::multimesh::utils::get_attribute(
named_mm,
{"int_test", 0, AT::Int64}));
AD{"int_test", 0, AT::Int64}));
CHECK(
char_test_handle == wmtk::components::multimesh::utils::get_attribute(
named_mm,
{"char_test", 0, AT::Char}));
AD{"char_test", 0, AT::Char}));
}
{ // check that other simplex types work
auto edge_handle =
Expand All @@ -197,17 +197,18 @@ TEST_CASE("named_multimesh_parse_attributes", "[components][multimesh]")
CHECK(
edge_handle == wmtk::components::multimesh::utils::get_attribute(
named_mm,
{"double_test", 1, AT::Double}));
AD{"double_test", 1, AT::Double}));
CHECK(
tri_handle == wmtk::components::multimesh::utils::get_attribute(
named_mm,
{"double_test", 2, AT::Double}));
AD{"double_test", 2, AT::Double}));
// TODO: lazy about testing tet
}
}


{
using AD = wmtk::components::multimesh::utils::AttributeDescription;
auto m = make_mesh();
auto children = make_child(*m, {0});
REQUIRE(children.size() == 1);
Expand All @@ -231,23 +232,23 @@ TEST_CASE("named_multimesh_parse_attributes", "[components][multimesh]")
CHECK(
attr_handle == wmtk::components::multimesh::utils::get_attribute(
named_mm,
{"double_test", 0, AT::Double}));
AD{"double_test", 0, AT::Double}));
CHECK(
attr_handle == wmtk::components::multimesh::utils::get_attribute(
named_mm,
{"/double_test", 0, AT::Double}));
AD{"/double_test", 0, AT::Double}));
CHECK(
attr_handle == wmtk::components::multimesh::utils::get_attribute(
named_mm,
{"roo/double_test", 0, AT::Double}));
AD{"roo/double_test", 0, AT::Double}));
CHECK(
child_attr_handle == wmtk::components::multimesh::utils::get_attribute(
named_mm,
{"roo.child/double_test", 0, AT::Double}));
AD{"roo.child/double_test", 0, AT::Double}));
CHECK(
child_attr_handle == wmtk::components::multimesh::utils::get_attribute(
named_mm,
{".child/double_test", 0, AT::Double}));
AD{".child/double_test", 0, AT::Double}));
}
}

Expand Down

0 comments on commit 1c4baaf

Please sign in to comment.