feat: add eigen vector type

This commit is contained in:
parker
2025-07-02 12:43:20 +01:00
parent 6463fe2a7f
commit f1d825d513
8 changed files with 66 additions and 3 deletions

View File

@@ -54,6 +54,18 @@ TEST_CASE("attrHandleFloat")
REQUIRE(myHandle.getValue(1)==6.9f);
}
TEST_CASE("attrHandleVector3")
{
using namespace enzo;
std::shared_ptr<ga::Attribute> myAttrib = std::make_shared<ga::Attribute>("test", ga::AttrType::vectorT);
ga::AttributeHandleVector3 myHandle(myAttrib);
myHandle.addValue(bt::Vector3(5,10,15));
myHandle.addValue(bt::Vector3(1,2,3));
REQUIRE(myHandle.getValue(0)==bt::Vector3(5,10,15));
REQUIRE(myHandle.getValue(1)==bt::Vector3(1,2,3));
}
TEST_CASE("Attribute Type")
{
using namespace enzo;
@@ -64,3 +76,27 @@ TEST_CASE("Attribute Type")
REQUIRE(ga::AttributeType::vectorT == ga::AttributeType::vectorT);
}
TEST_CASE("Vector3")
{
using namespace enzo;
bt::Vector3 u(1,2,3);
bt::Vector3 v(1,2,3);
REQUIRE(u == v);
REQUIRE(u*2 == bt::Vector3(2,4,6));
REQUIRE(2*u == bt::Vector3(2,4,6));
REQUIRE(u.x() == 1);
REQUIRE(u.y() == 2);
REQUIRE(u.z() == 3);
}
TEST_CASE("Vector4")
{
using namespace enzo;
bt::Vector4 u(1,2,3,4);
REQUIRE(u.x() == 1);
REQUIRE(u.y() == 2);
REQUIRE(u.z() == 3);
REQUIRE(u.w() == 4);
}