Commit 36bc6c97 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

Merge branch 'feature/gradient_test' into 'master'

Test more grids in gradient test

See merge request !262
parents ab0ccc2a ab13dac3
......@@ -20,7 +20,7 @@ init()
{
if (!bool(hasConnectedIntersections_)) {
hasConnectedIntersections_ = true;
const auto& gridView = basis_.gridView().grid().levelGridView(0);
const auto& gridView = basis_.gridView();
for (auto const& element : elements(gridView)) {
for (const auto& intersection : intersections(gridView, element)) {
if (!boundarySubset_(intersection))
......
......@@ -2,10 +2,12 @@
#include "ProblemInstat.hpp"
#include <dune/grid/yaspgrid.hh>
namespace AMDiS
{
// explicit template instatiation
template class ProblemInstat<YaspGridBasis<2,1>>;
template class ProblemInstat<YaspGridBasis<2,2>>;
template class ProblemInstat<LagrangeBasis<Dune::YaspGrid<2>,1>>;
template class ProblemInstat<LagrangeBasis<Dune::YaspGrid<2>,1,1>>;
} // end namespace AMDiS
......@@ -6,6 +6,8 @@
#include <amdis/ProblemStat.hpp>
#include <amdis/common/TypeTraits.hpp>
#include <dune/grid/yaspgrid.hh>
namespace AMDiS
{
// forward declarations
......@@ -101,8 +103,8 @@ namespace AMDiS
// mark template as explicitly instantiated in cpp file
extern template class ProblemInstat<YaspGridBasis<2,1>>;
extern template class ProblemInstat<YaspGridBasis<2,2>>;
extern template class ProblemInstat<LagrangeBasis<Dune::YaspGrid<2>,1>>;
extern template class ProblemInstat<LagrangeBasis<Dune::YaspGrid<2>,1,1>>;
} // end namespace AMDiS
......
......@@ -2,10 +2,12 @@
#include "ProblemStat.hpp"
#include <dune/grid/yaspgrid.hh>
namespace AMDiS
{
// explicit template instatiation
template class ProblemStat<YaspGridBasis<2,1>>;
template class ProblemStat<YaspGridBasis<2,2>>;
template class ProblemStat<LagrangeBasis<Dune::YaspGrid<2>,1>>;
template class ProblemStat<LagrangeBasis<Dune::YaspGrid<2>,1,1>>;
} // end namespace AMDiS
......@@ -591,8 +591,8 @@ namespace AMDiS
// mark templates as explicitly instantiated in cpp file
extern template class ProblemStat<YaspGridBasis<2,1>>;
extern template class ProblemStat<YaspGridBasis<2,2>>;
extern template class ProblemStat<LagrangeBasis<Dune::YaspGrid<2>,1>>;
extern template class ProblemStat<LagrangeBasis<Dune::YaspGrid<2>,1,1>>;
} // end namespace AMDiS
......
#include <config.h>
#include <dune/grid/yaspgrid.hh>
#include <dune/common/filledarray.hh>
#include <dune/grid/test/gridcheck.hh>
#include <amdis/AdaptiveGrid.hpp>
#if HAVE_DUNE_UGGRID
#include <dune/grid/uggrid.hh>
#else
#include <dune/grid/yaspgrid.hh>
#endif
#include "Tests.hpp"
using namespace AMDiS;
// test IdentityGrid for given dimension
template <int dim>
void testDim()
template <class HostGrid>
void testGrid(HostGrid& grid)
{
using HostGrid = Dune::YaspGrid<dim>;
std::array<int,dim> n;
std::fill(n.begin(), n.end(), 1 << (5 - dim));
Dune::FieldVector<double,dim> extension(1.0);
HostGrid grid(extension,n);
grid.globalRefine(1);
AdaptiveGrid<HostGrid> adaptiveGrid(grid);
......@@ -32,8 +31,49 @@ int main(int argc, char** argv)
{
Environment env(argc, argv);
testDim<2>();
testDim<3>();
#if HAVE_DUNE_UGGRID
std::cout << std::endl << "UGGrid<2,Simplex>..." << std::endl;
{
using HostGrid = Dune::UGGrid<2>;
auto hostGridPtr = Dune::StructuredGridFactory<HostGrid>::createSimplexGrid({0.0,0.0}, {1.0,1.0}, {8u,8u});
testGrid(*hostGridPtr);
}
std::cout << std::endl << "UGGrid<2,Cube>..." << std::endl;
{
using HostGrid = Dune::UGGrid<2>;
auto hostGridPtr = Dune::StructuredGridFactory<HostGrid>::createCubeGrid({0.0,0.0}, {1.0,1.0}, {8u,8u});
testGrid(*hostGridPtr);
}
std::cout << std::endl << "UGGrid<3,Simplex>..." << std::endl;
{
using HostGrid = Dune::UGGrid<3>;
auto hostGridPtr = Dune::StructuredGridFactory<HostGrid>::createSimplexGrid({0.0,0.0,0.0}, {1.0,1.0,1.0}, {4u,4u,4u});
testGrid(*hostGridPtr);
}
std::cout << std::endl << "UGGrid<3,Cube>..." << std::endl;
{
using HostGrid = Dune::UGGrid<3>;
auto hostGridPtr = Dune::StructuredGridFactory<HostGrid>::createCubeGrid({0.0,0.0,0.0}, {1.0,1.0,1.0}, {4u,4u,4u});
testGrid(*hostGridPtr);
}
#else
std::cout << "YaspGrid<2>..." << std::endl;
{
using HostGrid = Dune::YaspGrid<2>;
HostGrid hostGrid({1.0,1.0}, {8,8});
testGrid(hostGrid);
}
std::cout << "YaspGrid<3>..." << std::endl;
{
using HostGrid = Dune::YaspGrid<3>;
HostGrid hostGrid({1.0,1.0,1.0}, {4,4,4});
testGrid(hostGrid);
}
#endif
return report_errors();
}
# set(DUNE_MAX_TEST_CORES 4)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CMAKE_COMMAND} -E time")
# additional compiler option for CMAKE_BUILD_TYPE=RelWithDebInfo only for gcc
set(NoVarTrackingAssignments $<$<AND:$<CONFIG:RelWithDebInfo>,$<CXX_COMPILER_ID:GNU>>:-fno-var-tracking-assignments>)
......
......@@ -6,7 +6,7 @@ int main(int argc, char** argv)
{
Environment env(argc, argv);
#ifdef HAVE_DUNE_UGGRID
#if HAVE_DUNE_UGGRID
using Grid = Dune::UGGrid<2>;
#else
using Grid = Dune::YaspGrid<2>;
......
......@@ -6,7 +6,7 @@ int main(int argc, char** argv)
{
Environment env(argc, argv);
#ifdef HAVE_DUNE_UGGRID
#if HAVE_DUNE_UGGRID
using Grid = Dune::UGGrid<3>;
#else
using Grid = Dune::YaspGrid<3>;
......
......@@ -15,7 +15,7 @@
using namespace AMDiS;
using ElliptParam = YaspGridBasis<2, 2, 2>;
using ElliptParam = LagrangeBasis<Dune::YaspGrid<2>,1,1>;
using ElliptProblem = ProblemStat<ElliptParam>;
template <class T,
......
......@@ -9,10 +9,11 @@
#include <amdis/ProblemStat.hpp>
#include <amdis/common/FieldMatVec.hpp>
#include <dune/grid/yaspgrid.hh>
using namespace AMDiS;
using ElliptParam = YaspGridBasis<2, 2>;
using ElliptParam = LagrangeBasis<Dune::YaspGrid<2>,1>;
using ElliptProblem = ProblemStat<ElliptParam>;
int main(int argc, char** argv)
......
......@@ -11,17 +11,23 @@
#include <amdis/Integrate.hpp>
#include <amdis/gridfunctions/DiscreteFunction.hpp>
#if HAVE_DUNE_UGGRID
#include <dune/grid/uggrid.hh>
#else
#include <dune/grid/yaspgrid.hh>
#endif
#include <dune/grid/utility/structuredgridfactory.hh>
#include "Tests.hpp"
using namespace AMDiS;
template <std::size_t p>
void test()
template <std::size_t p, class HostGrid>
void test(HostGrid& hostGrid)
{
using HostGrid = Dune::YaspGrid<2>;
std::cout << "[p = " << p << "]" << std::endl;
using Basis1 = LagrangeBasis<HostGrid,p,p>;
HostGrid hostGrid({1.0, 1.0}, {16,16});
AdaptiveGrid<HostGrid> grid(hostGrid);
auto const& gridView = grid.leafGridView();
......@@ -91,9 +97,42 @@ int main(int argc, char** argv)
{
Environment env(argc, argv);
test<1u>();
test<2u>();
test<3u>();
#if HAVE_DUNE_UGGRID
std::cout << std::endl << "UGGrid<Simplex>..." << std::endl;
{
using HostGrid = Dune::UGGrid<2>;
auto numElements = Dune::filledArray<2,unsigned int>(16);
auto hostGridPtr = Dune::StructuredGridFactory<HostGrid>::createSimplexGrid({0.0,0.0}, {1.0,1.0}, numElements);
test<1u>(*hostGridPtr);
test<2u>(*hostGridPtr);
test<3u>(*hostGridPtr);
test<4u>(*hostGridPtr);
}
std::cout << std::endl << "UGGrid<Cube>..." << std::endl;
{
using HostGrid = Dune::UGGrid<2>;
auto numElements = Dune::filledArray<2,unsigned int>(16);
auto hostGridPtr = Dune::StructuredGridFactory<HostGrid>::createCubeGrid({0.0,0.0}, {1.0,1.0}, numElements);
test<1u>(*hostGridPtr);
test<2u>(*hostGridPtr);
test<3u>(*hostGridPtr);
test<4u>(*hostGridPtr);
}
#else
std::cout << "YaspGrid..." << std::endl;
{
using HostGrid = Dune::YaspGrid<2>;
HostGrid hostGrid({1.0, 1.0}, {16,16});
test<1u>(hostGrid);
test<2u>(hostGrid);
test<3u>(hostGrid);
test<4u>(hostGrid);
}
#endif
return report_errors();
}
......@@ -11,9 +11,11 @@
#include "Tests.hpp"
#include <dune/grid/yaspgrid.hh>
using namespace AMDiS;
using ElliptParam = YaspGridBasis<2, 2>;
using ElliptParam = LagrangeBasis<Dune::YaspGrid<2>, 1>;
using ElliptProblem = ProblemStat<ElliptParam>;
int main(int argc, char** argv)
......
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