Commit 3d7f4341 authored by Praetorius, Simon's avatar Praetorius, Simon Committed by Stenger, Florian
Browse files

initial version of curvedsurfacegrid based on curvedgeometry

parent 3123de92
...@@ -7,5 +7,5 @@ Module: dune-curvedsurfacegrid ...@@ -7,5 +7,5 @@ Module: dune-curvedsurfacegrid
Version: 0.1.0 Version: 0.1.0
Maintainer: florian.stenger@tu-dresden.de Maintainer: florian.stenger@tu-dresden.de
#depending on #depending on
Depends: dune-common dune-geometry dune-grid dune-localfunctions dune-curvilineargeometry Depends: dune-common dune-geometry dune-grid dune-localfunctions dune-curvedgeometry
Suggests: dune-alugrid dune-foamgrid Suggests: dune-alugrid dune-foamgrid
...@@ -5,6 +5,9 @@ ...@@ -5,6 +5,9 @@
#include <array> #include <array>
#include <dune/localfunctions/lagrange/equidistantpoints.hh>
#include <dune/localfunctions/lagrange/lagrangelfecache.hh>
namespace Dune namespace Dune
{ {
...@@ -220,26 +223,37 @@ namespace Dune ...@@ -220,26 +223,37 @@ namespace Dune
typedef typename HostGrid::template Codim< codimension >::Entity HostEntity; typedef typename HostGrid::template Codim< codimension >::Entity HostEntity;
using LocalFECache = LagrangeLocalFiniteElementCache<ctype, ctype, mydimension, Grid::order>;
using LocalFiniteElement = typename LocalFECache::FiniteElementType;
public: public:
CoordProvider ( const HostEntity &hostEntity, CoordProvider ( const HostEntity &hostEntity,
const CoordFunction &coordFunction ) const CoordFunction &coordFunction )
: coordFunction_(coordFunction), : coordFunction_(coordFunction),
hostEntity_(hostEntity) hostEntity_(hostEntity),
localFECache_(),
localFE_(localFECache_.get(hostEntity.type()))
{} {}
void calculate ( std::vector< Coordinate > &vertices ) const void calculate ( std::vector< Coordinate > &vertices ) const
{ {
const std::size_t numCorners = hostEntity_.geometry().corners(); vertices.resize(localFE_.size());
std::array<Coordinate, (1 << mydim)> corners;
for( std::size_t i = 0; i < numCorners; ++i ) auto f = [this,geo = hostEntity_.geometry()](auto const& local) -> Coordinate {
corners[i] = hostEntity_.geometry().corner(i); Coordinate res;
InterpolatoryVerticesGenerator<Coordinate, mydim, Grid::order>::generate(corners, vertices); this->coordFunction_.evaluate(geo.global(local), res);
for(auto &v : vertices) coordFunction_.evaluate(v, v); return res;
};
localFE_.localInterpolation().interpolate(f, vertices);
} }
private: private:
const CoordFunction &coordFunction_; const CoordFunction &coordFunction_;
const HostEntity &hostEntity_; const HostEntity &hostEntity_;
LocalFECache localFECache_;
LocalFiniteElement const& localFE_;
}; };
//CoordProvider (fake) //CoordProvider (fake)
...@@ -273,6 +287,7 @@ namespace Dune ...@@ -273,6 +287,7 @@ namespace Dune
void calculate ( std::vector< Coordinate > &vertices ) const void calculate ( std::vector< Coordinate > &vertices ) const
{ {
throw "not implemented";
const GeometryType type = hostElement_.geometry().type(); const GeometryType type = hostElement_.geometry().type();
auto refElement = referenceElement< ctype, dimension >( type ); auto refElement = referenceElement< ctype, dimension >( type );
const std::size_t numCorners = refElement.size( subEntity_, codimension, dimension ); const std::size_t numCorners = refElement.size( subEntity_, codimension, dimension );
...@@ -328,6 +343,7 @@ namespace Dune ...@@ -328,6 +343,7 @@ namespace Dune
void calculate ( std::vector< Coordinate > &vertices ) const void calculate ( std::vector< Coordinate > &vertices ) const
{ {
throw "not implemented";
const std::size_t numCorners = hostLocalGeometry_.corners(); const std::size_t numCorners = hostLocalGeometry_.corners();
std::array<Coordinate, (1 << mydimension)> corners; std::array<Coordinate, (1 << mydimension)> corners;
// $flo: coordFunction is applied here which is in contrast to GeomentryGrid's behaviour! // $flo: coordFunction is applied here which is in contrast to GeomentryGrid's behaviour!
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#include <dune/common/typetraits.hh> #include <dune/common/typetraits.hh>
#include <dune/curvilineargeometry/curvilineargeometry.hh> #include <dune/curvedgeometry/curvedgeometry.hh>
#include <dune/geometry/referenceelements.hh> #include <dune/geometry/referenceelements.hh>
#include <dune/geometry/type.hh> #include <dune/geometry/type.hh>
...@@ -92,7 +92,7 @@ namespace Dune ...@@ -92,7 +92,7 @@ namespace Dune
static const int codimension = dimension - mydimension; static const int codimension = dimension - mydimension;
protected: protected:
typedef CachedCurvilinearGeometry<ctype, mydimension, coorddimension> BasicMapping; typedef CurvedGeometry<mydimension, coorddimension, Grid> BasicMapping;
struct Mapping struct Mapping
: public BasicMapping : public BasicMapping
...@@ -101,7 +101,7 @@ namespace Dune ...@@ -101,7 +101,7 @@ namespace Dune
template< class CoordVector > template< class CoordVector >
Mapping ( const GeometryType &type, const CoordVector &coords ) Mapping ( const GeometryType &type, const CoordVector &coords )
: BasicMapping( type, coords, Grid::order ), : BasicMapping( type, coords ),
refCount_( 0 ) refCount_( 0 )
{} {}
...@@ -181,24 +181,21 @@ namespace Dune ...@@ -181,24 +181,21 @@ namespace Dune
bool affine () const { return mapping_->affine(); } bool affine () const { return mapping_->affine(); }
GeometryType type () const { return mapping_->type(); } GeometryType type () const { return mapping_->type(); }
std::vector<GlobalCoordinate> interpolatoryVertices() const { return mapping_->vertexSet(); } std::vector<GlobalCoordinate> interpolatoryVertices() const { return mapping_->vertices(); }
int corners () const { return mapping_->nCorner(); } int corners () const { return mapping_->corners(); }
GlobalCoordinate corner ( const int i ) const { return mapping_->corner( i ); } GlobalCoordinate corner ( const int i ) const { return mapping_->corner( i ); }
GlobalCoordinate center () const { return mapping_->center(); } GlobalCoordinate center () const { return mapping_->center(); }
GlobalCoordinate global ( const LocalCoordinate &local ) const { return mapping_->global( local ); } GlobalCoordinate global ( const LocalCoordinate &local ) const { return mapping_->global( local ); }
LocalCoordinate local ( const GlobalCoordinate &global ) const LocalCoordinate local ( const GlobalCoordinate &global ) const
{ {
LocalCoordinate l; return mapping_->local(global);
DUNE_UNUSED bool b = mapping_->local( global, l );
assert(b);
return l;
} }
GlobalCoordinate normal ( const LocalCoordinate &local ) const { return mapping_->normal( local ); } GlobalCoordinate normal ( const LocalCoordinate &local ) const { return mapping_->normal( local ); }
ctype integrationElement ( const LocalCoordinate &local ) const { return mapping_->integrationElement( local ); } ctype integrationElement ( const LocalCoordinate &local ) const { return mapping_->integrationElement( local ); }
ctype volume () const { return mapping_->volume(std::numeric_limits<ctype>::epsilon()); } ctype volume () const { return mapping_->volume(); }
JacobianTransposed jacobianTransposed ( const LocalCoordinate &local ) const { return mapping_->jacobianTransposed( local ); } JacobianTransposed jacobianTransposed ( const LocalCoordinate &local ) const { return mapping_->jacobianTransposed( local ); }
JacobianInverseTransposed jacobianInverseTransposed ( const LocalCoordinate &local ) const { return mapping_->jacobianInverseTransposed( local ); } JacobianInverseTransposed jacobianInverseTransposed ( const LocalCoordinate &local ) const { return mapping_->jacobianInverseTransposed( local ); }
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#define STR(s) STR_HELPER(s) #define STR(s) STR_HELPER(s)
#define STR_HELPER(s) #s #define STR_HELPER(s) #s
const int order = 3; const int order = 2;
const int quad_order = order+5; const int quad_order = order+5;
const int num_levels = 5; const int num_levels = 5;
......
...@@ -37,10 +37,10 @@ int main(int argc, char** argv) ...@@ -37,10 +37,10 @@ int main(int argc, char** argv)
//load host-grid (ALUGrid) //load host-grid (ALUGrid)
using HostGridType = Dune::ALUGrid<2, 3, simplex, conforming>; using HostGridType = Dune::ALUGrid<2, 3, simplex, conforming>;
GridFactory<HostGridType> gridFactory; GridFactory<HostGridType> gridFactory;
GmshReader<HostGridType>::read(gridFactory, "dune-curvedsurfacegrid/example/sphere_coarse.msh"); GmshReader<HostGridType>::read(gridFactory, "example/sphere_coarse.msh");
std::shared_ptr<HostGridType> hostGrid(gridFactory.createGrid()); std::shared_ptr<HostGridType> hostGrid(gridFactory.createGrid());
const int ip_order = 5; //interpolatory order for curved elements const int ip_order = 3; //interpolatory order for curved elements
//case1: projection to actual sphere //case1: projection to actual sphere
{ {
......
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