Commit 8394ba2d authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

updated curvedgeometry implementation

parent 5e1a7e87
......@@ -3,12 +3,12 @@
#ifndef DUNE_CRVSRF_ENTITY_HH
#define DUNE_CRVSRF_ENTITY_HH
#include <dune/common/std/optional.hh>
#include <dune/geometry/referenceelements.hh>
#include <dune/grid/common/grid.hh>
#include <dune/curvedsurfacegrid/capabilities.hh>
#include <dune/curvedsurfacegrid/coordprovider.hh>
namespace Dune
{
......@@ -126,8 +126,6 @@ namespace Dune
private:
typedef typename HostGrid::template Codim< codimension >::Geometry HostGeometry;
typedef crvsrf::CoordProvider< mydimension, Grid, fake > CoordProvider;
public:
/** \name Construction, Initialization and Destruction
* \{ */
......@@ -252,10 +250,12 @@ namespace Dune
{
if( !geo_ )
{
CoordProvider coords( hostEntity(), grid().coordFunction() );
geo_ = GeometryImpl( grid(), type(), coords );
auto ff = [f=grid().coordFunction(),geo=hostEntity().geometry()](const typename Geometry::LocalCoordinate& local) {
return f(geo.global(local));
};
geo_ = GeometryImpl( type(), ff );
}
return Geometry( geo_ );
return Geometry( geo_.value() );
}
unsigned int subEntities ( unsigned int cc ) const
......@@ -345,7 +345,7 @@ namespace Dune
private:
HostEntity hostEntity_;
const Grid *grid_;
mutable GeometryImpl geo_;
mutable Std::optional<GeometryImpl> geo_;
};
......@@ -415,8 +415,6 @@ namespace Dune
private:
typedef typename HostGrid::template Codim< 0 >::Geometry HostGeometry;
typedef crvsrf::CoordProvider< mydimension, Grid, fake > CoordProvider;
public:
/** \name Construction, Initialization and Destruction
* \{ */
......@@ -569,10 +567,14 @@ namespace Dune
{
if( !geo_ )
{
CoordProvider coords( hostElement(), subEntity_, grid().coordFunction() );
geo_ = GeometryImpl( grid(), type(), coords );
auto refElement = referenceElement<ctype, dimension>( hostElement().type() );
auto subGeo = refElement.geometry<codimension>(subEntity_);
auto ff = [f=grid().coordFunction(),geo=hostElement().geometry(),&subGeo](const typename Geometry::LocalCoordinate& local) {
return f(geo.global(subGeo.global(local)));
};
geo_ = GeometryImpl( type(), ff );
}
return Geometry( geo_ );
return Geometry( geo_.value() );
}
unsigned int subEntities ( unsigned int cc ) const
......@@ -681,7 +683,7 @@ namespace Dune
HostElement hostElement_;
unsigned int subEntity_;
const Grid *grid_;
mutable GeometryImpl geo_;
mutable Std::optional<GeometryImpl> geo_;
};
......
......@@ -92,7 +92,7 @@ namespace Dune
static const int codimension = dimension - mydimension;
protected:
typedef CurvedGeometry<ctype, mydimension, coorddimension, Grid::order> BasicMapping;
typedef LagrangeCurvedGeometry<ctype, mydimension, coorddimension, Grid::order> BasicMapping;
struct Mapping
: public BasicMapping
......
......@@ -81,7 +81,7 @@ namespace Dune
friend class crvsrf::HierarchicIterator< const Grid >;
template< int, class, bool > friend class crvsrf::EntityBase;
template< int, int, class > friend class crvsrf::Geometry;
//template< int, int, class > friend class crvsrf::Geometry;
template< class, class, class > friend class crvsrf::GridView;
template< class, class > friend class crvsrf::Intersection;
template< class, class > friend class crvsrf::IntersectionIterator;
......
......@@ -7,7 +7,7 @@
#include <dune/curvedsurfacegrid/capabilities.hh>
#include <dune/curvedsurfacegrid/entity.hh>
#include <dune/curvedsurfacegrid/entityseed.hh>
#include <dune/curvedsurfacegrid/geometry.hh>
//#include <dune/curvedsurfacegrid/geometry.hh>
#include <dune/curvedsurfacegrid/gridview.hh>
#include <dune/curvedsurfacegrid/intersection.hh>
#include <dune/curvedsurfacegrid/intersectioniterator.hh>
......@@ -15,6 +15,8 @@
#include <dune/curvedsurfacegrid/idset.hh>
#include <dune/curvedsurfacegrid/indexsets.hh>
#include <dune/curvedgeometry/curvedgeometry.hh>
namespace Dune
{
......@@ -74,8 +76,11 @@ namespace Dune
template< int codim >
struct Codim
{
typedef Dune::crvsrf::Geometry< dimension-codim, dimensionworld, const Grid > GeometryImpl;
typedef Dune::Geometry< dimension-codim, dimensionworld, const Grid, Dune::crvsrf::Geometry > Geometry;
template <int mydim, int cdim, class GridImpl>
using GeometryImplTemplate = Dune::LagrangeCurvedGeometry<ctype,mydim,cdim,order>;
typedef GeometryImplTemplate< dimension-codim, dimensionworld, const Grid > GeometryImpl;
typedef Dune::Geometry< dimension-codim, dimensionworld, const Grid, GeometryImplTemplate > Geometry;
typedef typename HostGrid::template Codim< codim >::LocalGeometry LocalGeometry;
typedef crvsrf::Entity< codim, dimension, const Grid > EntityImpl;
......
......@@ -4,7 +4,7 @@
#define DUNE_CRVSRF_INTERSECTION_HH
#include <dune/curvedsurfacegrid/declaration.hh>
#include <dune/curvedsurfacegrid/coordprovider.hh>
#include <dune/common/std//optional.hh>
namespace Dune
{
......@@ -36,8 +36,6 @@ namespace Dune
typedef typename Traits::template Codim< 0 >::Geometry ElementGeometry;
private:
typedef crvsrf::IntersectionCoordProvider< Grid > ICoordProvider;
typedef typename Traits::template Codim< 0 >::EntityImpl EntityImpl;
typedef typename Traits::template Codim< 1 >::GeometryImpl GeometryImpl;
......@@ -102,10 +100,12 @@ namespace Dune
{
if( !geo_ )
{
ICoordProvider coords( insideGeo_, geometryInInside(), grid().coordFunction() );
geo_ = GeometryImpl( grid(), type(), coords );
auto ff = [f=grid().coordFunction(),geo=hostIntersection().geometry()](const typename Geometry::LocalCoordinate& local) {
return f(geo.global(local));
};
geo_ = GeometryImpl( type(), ff );
}
return Geometry( geo_ );
return Geometry( geo_.value() );
}
GeometryType type () const { return hostIntersection().type(); }
......@@ -179,7 +179,7 @@ namespace Dune
private:
HostIntersection hostIntersection_;
ElementGeometryImpl insideGeo_;
mutable GeometryImpl geo_;
mutable Std::optional<GeometryImpl> geo_;
};
} // namespace crvsrf
......
......@@ -16,7 +16,7 @@
#define STR(s) STR_HELPER(s)
#define STR_HELPER(s) #s
const int order = 2;
const int order = 4;
const int quad_order = order+5;
const int num_levels = 5;
......
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