Commit e9a18563 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

added static_assert in case of wrong ORDER parameter

parent ce73bdd6
...@@ -576,7 +576,7 @@ namespace Dune ...@@ -576,7 +576,7 @@ namespace Dune
protected: protected:
VertexGeometry (Construct, const ReferenceElement& refElement, const LocalFunction& localFunction, VertexGeometry (Construct, const ReferenceElement& refElement, const LocalFunction& localFunction,
const LocalGeometry& lg) const LocalGeometry& lg)
: Super(refElement, std::vector<GlobalCoordinate>{localFunction(lg.global(refElement.position(0,0)))}) : Super(refElement, std::vector<GlobalCoordinate>{localFunction(lg.global(refElement.position(0,0)))})
{} {}
......
...@@ -65,6 +65,7 @@ namespace Dune ...@@ -65,6 +65,7 @@ namespace Dune
using LocalFunction = std::decay_t<decltype(localFunction(std::declval<GF const&>()))>; using LocalFunction = std::decay_t<decltype(localFunction(std::declval<GF const&>()))>;
static const bool differentiableLocalFunction = DifferentiableLocalFunction<GF, LocalFunction>::value; static const bool differentiableLocalFunction = DifferentiableLocalFunction<GF, LocalFunction>::value;
static_assert((differentiableLocalFunction || order>0), "Either provide a differentiable GridFunction or set ORDER > 0");
using ctype = typename HostGrid::ctype; using ctype = typename HostGrid::ctype;
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include <dune/common/exceptions.hh> // We use exceptions #include <dune/common/exceptions.hh> // We use exceptions
#include <dune/alugrid/grid.hh> #include <dune/alugrid/grid.hh>
#include <dune/curvedsurfacegrid/curvedsurfacegrid.hh> #include <dune/curvedsurfacegrid/curvedsurfacegrid.hh>
#include <dune/curvedsurfacegrid/gridfunctions/analyticgridfunction.hh>
#include <dune/grid/io/file/gmshreader.hh> #include <dune/grid/io/file/gmshreader.hh>
#include <dune/grid/io/file/vtk/vtkwriter.hh> #include <dune/grid/io/file/vtk/vtkwriter.hh>
#include <dune/grid/io/file/vtk/subsamplingvtkwriter.hh> #include <dune/grid/io/file/vtk/subsamplingvtkwriter.hh>
...@@ -46,12 +45,10 @@ int main(int argc, char** argv) ...@@ -46,12 +45,10 @@ int main(int argc, char** argv)
//case1: projection to actual sphere //case1: projection to actual sphere
{ {
SphereCoordFunction sphereCF(/*center=*/{0.0, 0.0, 0.0}, /*radius=*/1.0); SphereCoordFunction sphereCF(/*center=*/{0.0, 0.0, 0.0}, /*radius=*/1.0);
auto sphereGridFct = analyticGridFunction<HostGridType>(sphereCF); CurvedSurfaceGrid grid(*hostGrid, sphereCF, std::integral_constant<int, ip_order>{});
using GridType = CurvedSurfaceGrid<decltype(sphereGridFct), ip_order>;
GridType grid(*hostGrid, sphereGridFct);
using GridView = GridType::LeafGridView; auto gridView = grid.leafGridView();
GridView gridView = grid.leafGridView(); using GridView = decltype(gridView);
VTKWriter<GridView> vtkWriter(gridView); VTKWriter<GridView> vtkWriter(gridView);
vtkWriter.write("sphere1_real_elements"); vtkWriter.write("sphere1_real_elements");
SubsamplingVTKWriter<GridView> ssvtkWriter(gridView, refinementIntervals(ip_order)); SubsamplingVTKWriter<GridView> ssvtkWriter(gridView, refinementIntervals(ip_order));
...@@ -61,12 +58,10 @@ int main(int argc, char** argv) ...@@ -61,12 +58,10 @@ int main(int argc, char** argv)
//case2: projection to a surface-mesh of a sphere //case2: projection to a surface-mesh of a sphere
{ {
SurfaceDistanceCoordFunction<> surfdistCF("example/sphere_fine.vtu"); SurfaceDistanceCoordFunction<> surfdistCF("example/sphere_fine.vtu");
auto surfaceDistGridFct = analyticGridFunction<HostGridType>(surfdistCF); CurvedSurfaceGrid grid(*hostGrid, std::ref(surfdistCF), std::integral_constant<int, ip_order>{});
using GridType = CurvedSurfaceGrid<decltype(surfaceDistGridFct), ip_order>;
GridType grid(*hostGrid, surfaceDistGridFct); auto gridView = grid.leafGridView();
using GridView = decltype(gridView);
using GridView = GridType::LeafGridView;
GridView gridView = grid.leafGridView();
VTKWriter<GridView> vtkWriter(gridView); VTKWriter<GridView> vtkWriter(gridView);
vtkWriter.write("sphere2_real_elements"); vtkWriter.write("sphere2_real_elements");
SubsamplingVTKWriter<GridView> ssvtkWriter(gridView, refinementIntervals(ip_order)); SubsamplingVTKWriter<GridView> ssvtkWriter(gridView, refinementIntervals(ip_order));
......
Supports Markdown
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