#include "gtest/gtest.h"
TEST(DomainEngines, GridFill2d) {
auto sh = BoxShape<Vec2d>(-1, 1) - BallShape<Vec2d>(0, 0.5);
DomainDiscretization<Vec2d> domain(sh);
domain.fill(GridFill<Vec2d>(-1, 1), 0.5);
auto pos = domain.positions();
Range<Vec2d> expected;
std::vector<double> cs = {-1, -0.5, 0, 0.5, 1};
for (double x : cs) {
for (double y : cs) {
if (x == 0 && y == 0) continue;
expected.emplace_back(x, y);
}
}
EXPECT_EQ(expected, pos);
}
TEST(DomainEngines, GridFill3d) {
auto sh = BoxShape<Vec3d>(-1, 1) - BallShape<Vec3d>(0, 0.5);
DomainDiscretization<Vec3d> domain(sh);
domain.addInternalNode({0, 0, 1}, 2);
domain.fill(GridFill<Vec3d>(-1, 1), 0.5);
auto pos = domain.positions();
Range<Vec3d> expected;
std::vector<double> cs = {-1, -0.5, 0, 0.5, 1};
for (double x : cs) {
for (double y : cs) {
for (double z : cs) {
if (x == 0 && y == 0 && z == 0) continue;
expected.emplace_back(x, y, z);
}
}
}
EXPECT_EQ(expected, pos);
}
}