Medusa  1.1
Coordinate Free Mehless Method implementation
test/end2end/poisson_explicit.cpp
#include "Eigen/LU"
#include "gtest/gtest.h"
using namespace mm; // NOLINT(*)
using namespace std; // NOLINT(*)
TEST(End2end, PoissonExplicit) {
HDF hdf("test.h5", HDF::DESTROY);
hdf.close();
BoxShape<Vec2d> box(0.0, 1.0);
double step = 0.1;
hdf.atomic().writeDomain("domain", domain);
auto storage = domain.computeShapes<sh::lap>(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();
}
mm
Root namespace for the whole library.
Definition: Gaussian.hpp:14
mm::DomainDiscretization
Class representing domain discretization along with an associated shape.
Definition: DomainDiscretization_fwd.hpp:46
mm::DomainDiscretization::interior
indexes_t interior() const
Returns indexes of all internal nodes.
Definition: DomainDiscretization_fwd.hpp:184
mm::sh::lap
static const shape_flags lap
Indicates to calculate laplace shapes.
Definition: shape_flags.hpp:24
mm::HDF::close
void close() const
Closes all open objects. Alias of closeFile().
Definition: HDF_fwd.hpp:164
mm::HDF::reopen
void reopen(Mode mode=APPEND)
Reopens current file and group.
Definition: HDF_fwd.hpp:152
JacobiSVDWrapper.hpp
RaggedShapeStorage.hpp
numutils.hpp
BoxShape_fwd.hpp
mm::NoWeight
Class representing no weight function, i.e. a constant 1.
Definition: WeightFunction_fwd.hpp:25
ScaleFunction.hpp
mm::ScalarField
Represents a discretization of a scalar field, a finite collection of scalars.
Definition: ScalarField_fwd.hpp:27
mm::HDF
Simplified HDF5 I/O utilities.
Definition: HDF_fwd.hpp:75
HDF.hpp
mm::ScaleToFarthest
Scale function that scales to the farthest neighbor.
Definition: ScaleFunction.hpp:43
FindClosest.hpp
ExplicitOperators.hpp
mm::DomainDiscretization::size
int size() const
Returns N, the number of nodes in this discretization.
Definition: DomainDiscretization_fwd.hpp:189
mm::iceil
int iceil(T x)
Ceils a floating point to an integer.
Definition: numutils.hpp:27
mm::FindClosest
Class representing the engine for finding supports consisting of closest nodes.
Definition: FindClosest_fwd.hpp:23
mm::Monomials
A class representing Monomial basis.
Definition: Monomials_fwd.hpp:38
mm::DomainDiscretization::findSupport
void findSupport(callable_t &callable, Args &&... args)
Enables more readable calls to support engines.
Definition: DomainDiscretization_fwd.hpp:455
mm::BoxShape
Class for working with box shaped domains.
Definition: BoxShape_fwd.hpp:28
mm::BoxShape::discretizeWithStep
DomainDiscretization< vec_t > discretizeWithStep(scalar_t step, int internal_type, int boundary_type) const override
Returns a discretization of this shape with approximately uniform distance step between nodes.
Definition: BoxShape.hpp:312
WeightFunction_fwd.hpp
mm::DomainDiscretization::boundary
indexes_t boundary() const
Returns indexes of all boundary nodes.
Definition: DomainDiscretization_fwd.hpp:182
DomainDiscretization_fwd.hpp
Monomials_fwd.hpp
mm::DomainDiscretization::computeShapes
RaggedShapeStorage< vec_t, typename sh::operator_tuple< mask, vec_t::dim >::type > computeShapes(approx_t approx, const indexes_t &indexes={}) const
Compute shapes, specified with shape flags, for this domain with given approximation for given indexe...
mm::WLS
A class for generating approximations using Weighted Least Squares over local neighborhoods.
Definition: WLS_fwd.hpp:49
computeShapes.hpp
mm::HDF::DESTROY
@ DESTROY
Removes old contents, if any exist.
Definition: HDF_fwd.hpp:86
WLS_fwd.hpp
mm::HDF::writeDoubleArray
void writeDoubleArray(const std::string &dataset_name, const array_t &value, bool overwrite=false) const
Write given value as a 1D array of doubles.
Definition: HDF.hpp:246
ScalarField.hpp
mm::HDF::writeDomain
void writeDomain(const std::string &name, const domain_t &domain, bool overwrite=false)
Writes given domain discretization to file.
Definition: HDF.hpp:332
UniformShapeStorage.hpp
mm::HDF::atomic
HDF atomic() const
Allows for "atomic" read and write operations to HDF5 files.
Definition: HDF.cpp:250