#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "Eigen/LU" #include #include "gtest/gtest.h" using namespace mm; // NOLINT(*) using namespace std; // NOLINT(*) TEST(End2end, PoissonExplicit) { HDF hdf("test.h5", HDF::DESTROY); hdf.close(); BoxShape box(0.0, 1.0); double step = 0.1; DomainDiscretization domain = box.discretizeWithStep(step); domain.findSupport(FindClosest(9)); hdf.atomic().writeDomain("domain", domain); WLS, NoWeight, ScaleToFarthest> wls(Monomials::tensorBasis(2), {}); auto storage = domain.computeShapes(wls); auto op = storage.explicitOperators(); ScalarFieldd s = ScalarFieldd::Ones(domain.size()); ScalarFieldd s2 = ScalarFieldd::Zero(domain.size()); s[domain.boundary()] = 0.0; double T = 0.1; double dt = 1e-5; int steps = iceil(T/dt); auto interior = domain.interior(); for (int t = 0; t < steps; ++t) { for (int i : interior) { s2[i] = s[i] + dt * op.lap(s, i); } s = s2; } hdf.reopen(); hdf.writeDoubleArray("sol", s); hdf.close(); }