Commit 8d20c4e7 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

repaired the GridOf type trait

parent 76aa364d
Pipeline #3854 passed with stage
in 8 minutes and 51 seconds
......@@ -91,7 +91,7 @@ public:
private:
T a_, b_, c_;
ImplicitSurfaceProjection<Phi> implicit_;
SimpleImplicitSurfaceProjection<Phi> implicit_;
};
/// \brief construct a grid function representing a sphere parametrization
......
......@@ -155,7 +155,7 @@ auto implicitSurfaceGridFunction (const F& phi, int maxIter = 10)
/// \brief Construct a grid function representing a projection to an implicit surface by
/// additionally giving the projection implementation as template
template <class Grid, template <class> Projection, class F>
template <class Grid, template <class> class Projection, class F>
auto implicitSurfaceGridFunction (const F& phi, int maxIter = 10)
{
return analyticGridFunction<Grid>(Projection<F>{phi, maxIter});
......
......@@ -3,25 +3,32 @@
#include <type_traits>
#include <dune/common/typeutilities.hh>
#include <dune/curvedsurfacegrid/concepts.hh>
#include <dune/curvedsurfacegrid/gridfunctions/analyticgridfunction.hh>
namespace Dune {
namespace Impl {
template <class ES, class = void>
struct GridOf;
template <class ES>
struct GridOf<ES, std::void_t<typename ES::GridView>>
struct GridOf
{
using type = typename ES::GridView::Grid;
};
private:
template <class ES, class Grid = typename ES::Grid>
static auto typeImpl(ES const&, PriorityTag<3>) -> Grid;
template <class ES>
struct GridOf<ES, std::void_t<typename ES::Grid>>
{
using type = typename ES::Grid;
template <class ES, class Grid = typename ES::GridView::Grid>
static auto typeImpl(ES const&, PriorityTag<2>) -> Grid;
template <class ES>
static auto typeImpl(ES const& es, PriorityTag<1>) -> decltype(es.grid());
template <class ES>
static auto typeImpl(ES const& es, PriorityTag<0>) -> decltype(es.gridView().grid());
public:
template <class GF>
static auto type(GF const& gf)
-> decltype(typeImpl(gf.entitySet(), PriorityTag<4>{}));
};
} // end namespace Impl
......@@ -29,7 +36,7 @@ struct GridOf<ES, std::void_t<typename ES::Grid>>
/// \brief Type-Traits to extract the grid-type from a GridFunction `GF`
template <class GF>
using GridOf_t = typename Impl::GridOf<std::decay_t<decltype(std::declval<GF>().entitySet())>>::type;
using GridOf_t = decltype( Impl::GridOf::type(std::declval<GF>()) );
/// \brief Conditionally define the GridFunction type.
......
......@@ -5,7 +5,8 @@ foreach (geometry RANGE 1 3)
GEOMETRY_TYPE=${geometry}
DUNE_GRID_PATH=\"${PROJECT_SOURCE_DIR}/doc/grids/\"
CMAKE_GUARD
dune-foamgrid_FOUND)
dune-foamgrid_FOUND
dune-localfunctions_FOUND)
endforeach (geometry)
dune_add_test(SOURCES discretegridviewfunction.cc
......@@ -13,5 +14,5 @@ dune_add_test(SOURCES discretegridviewfunction.cc
DUNE_GRID_PATH=\"${PROJECT_SOURCE_DIR}/doc/grids/\"
USE_FLOAT128=0
CMAKE_GUARD
dune-functions_FOUND
dune-foamgrid_FOUND)
dune-foamgrid_FOUND
dune-functions_FOUND)
......@@ -4,18 +4,26 @@
#include <iostream>
#if !HAVE_DUNE_FOAMGRID
#error "Need dune-foamgrid for the definition of the convergence test"
#endif
#if !HAVE_DUNE_LOCALFUNCTIONS
#error "Need dune-localfunctions for the definition of the convergence test"
#endif
#include <dune/common/parallel/mpihelper.hh> // An initializer of MPI
#include <dune/common/test/testsuite.hh>
#include <dune/curvedsurfacegrid/curvedsurfacegrid.hh>
#include <dune/curvedsurfacegrid/geometries/ellipsoid.hh>
#include <dune/curvedsurfacegrid/geometries/sphere.hh>
#include <dune/curvedsurfacegrid/geometries/torus.hh>
#include <dune/foamgrid/foamgrid.hh>
#include <dune/geometry/quadraturerules.hh>
#include <dune/grid/io/file/gmshreader.hh>
#include <dune/localfunctions/lagrange/pk.hh>
#if WRITE_FILES
#include <dune/vtk/vtkwriter.hh>
#include <dune/vtk/datacollectors/lagrangedatacollector.hh>
#endif
// 1 .. Sphere
// 2 .. Ellipsoid
......@@ -24,14 +32,19 @@
#define GEOMETRY_TYPE 1
#endif
#if GEOMETRY_TYPE == 1
#include <dune/curvedsurfacegrid/geometries/sphere.hh>
#elif GEOMETRY_TYPE == 2
#include <dune/curvedsurfacegrid/geometries/ellipsoid.hh>
#elif GEOMETRY_TYPE == 3
#include <dune/curvedsurfacegrid/geometries/torus.hh>
#else
#error "Unknown GEOMETRY_TYPE. Must bei either 1, 2, or 3"
#endif
const int order = 3;
const int quad_order = order+6;
#if GEOMETRY_TYPE < 3
const int num_levels = 4;
#else
const int num_levels = 4;
#endif
// Test Hausdorf-distance
template <class Grid>
......
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