Commit 5e247bf0 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

added integrate tests

parent 144b36ba
Pipeline #1347 passed with stage
in 20 minutes and 39 seconds
...@@ -61,7 +61,7 @@ namespace AMDiS ...@@ -61,7 +61,7 @@ namespace AMDiS
return 0.0; return 0.0;
#else #else
return Dune::Hybrid::ifElse(bool_<expr_has_order>, return Dune::Hybrid::ifElse(bool_<expr_has_order>,
[&](auto) { return Impl::integrateImpl(std::forward<decltype(gridFct)>(gridFct), gridView, makeQuad); }, [&](auto) { return Impl::integrateImpl(gridFct, gridView, makeQuad); },
[ ](auto) { return 0.0; }); [ ](auto) { return 0.0; });
#endif #endif
} }
......
...@@ -24,6 +24,10 @@ dune_add_test(SOURCES FiniteElementTypeTest.cpp ...@@ -24,6 +24,10 @@ dune_add_test(SOURCES FiniteElementTypeTest.cpp
dune_add_test(SOURCES FilesystemTest.cpp dune_add_test(SOURCES FilesystemTest.cpp
LINK_LIBRARIES amdis) LINK_LIBRARIES amdis)
dune_add_test(SOURCES IntegrateTest.cpp
LINK_LIBRARIES amdis
CMD_ARGS "${CMAKE_SOURCE_DIR}/examples/init/ellipt.dat.2d")
dune_add_test(SOURCES MarkerTest.cpp dune_add_test(SOURCES MarkerTest.cpp
LINK_LIBRARIES amdis LINK_LIBRARIES amdis
CMD_ARGS "${CMAKE_SOURCE_DIR}/examples/init/marker.dat.2d") CMD_ARGS "${CMAKE_SOURCE_DIR}/examples/init/marker.dat.2d")
......
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#include <iostream>
#include <dune/geometry/type.hh>
#include <amdis/AMDiS.hpp>
#include <amdis/ProblemStat.hpp>
#include <amdis/Operators.hpp>
#include <amdis/common/Literals.hpp>
#include <amdis/common/FieldMatVec.hpp>
#include <amdis/gridfunctions/Integrate.hpp>
#include "Tests.hpp"
using namespace AMDiS;
using ElliptParam = YaspGridBasis<2, 2>;
using ElliptProblem = ProblemStat<ElliptParam>;
int main(int argc, char** argv)
{
AMDiS::init(argc, argv);
ElliptProblem prob("ellipt");
prob.initialize(INIT_ALL);
auto u = prob.getSolution(0);
auto gv = u.basis().gridView();
u << 1.0;
auto i1 = integrate(1.0, gv);
auto i2 = integrate(u, gv);
auto i3 = integrate([](auto const& x) { return 1.0; }, gv, 0);
AMDIS_TEST(i1 == 1.0);
AMDIS_TEST(i2 == 1.0);
AMDIS_TEST(i3 == 1.0);
auto quad = Dune::QuadratureRules<double,2>::rule(Dune::GeometryTypes::quadrilateral, 0);
auto i4 = integrate([](auto const& x) { return 1.0; }, gv, quad);
AMDIS_TEST(i4 == 1.0);
AMDiS::finalize();
return 0;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment