4#ifndef DUNE_LOCALFUNCTIONS_WHITNEY_EDGES0_5_BASIS_HH
5#define DUNE_LOCALFUNCTIONS_WHITNEY_EDGES0_5_BASIS_HH
13#include <dune/localfunctions/common/localtoglobaladaptors.hh>
14#include <dune/localfunctions/lagrange/lagrangesimplex.hh>
15#include <dune/localfunctions/whitney/edges0.5/common.hh>
33 template<
class Geometry,
class RF>
35 private EdgeS0_5Common<Geometry::mydimension, typename Geometry::ctype>
46 typedef RF RangeField;
47 static const std::size_t dimRange = dimDomainLocal;
54 typedef Dune::Impl::LagrangeSimplexLocalBasis<
typename Traits::DomainField,
55 typename Traits::RangeField,
56 Traits::dimDomainLocal,
61 static const P1LocalBasis& p1LocalBasis;
62 static const std::size_t dim = Traits::dimDomainLocal;
69 std::vector<typename P1Basis::Traits::Jacobian> p1j;
71 std::vector<typename Traits::DomainField> edgel;
81 template<
typename VertexOrder>
89 P1Basis(p1LocalBasis, geo).evaluateJacobian(xl, p1j);
92 for(std::size_t i = 0; i < s; ++i) {
93 edgel[i] = (geo.
corner(refelem.subEntity(i,dim-1,0,dim))-
94 geo.
corner(refelem.subEntity(i,dim-1,1,dim))
96 const typename VertexOrder::iterator& edgeVertexOrder =
97 vertexOrder.begin(dim-1, i);
98 if(edgeVertexOrder[0] > edgeVertexOrder[1])
104 std::size_t
size ()
const {
return s; }
108 std::vector<typename Traits::Range>& out)
const
114 std::vector<typename P1LocalBasis::Traits::RangeType> p1v;
115 p1LocalBasis.evaluateFunction(xl, p1v);
117 for(std::size_t i = 0; i < s; i++) {
118 const std::size_t i0 = refelem.subEntity(i,dim-1,0,dim);
119 const std::size_t i1 = refelem.subEntity(i,dim-1,1,dim);
120 out[i].axpy( p1v[i0], p1j[i1][0]);
121 out[i].axpy(-p1v[i1], p1j[i0][0]);
128 std::vector<typename Traits::Jacobian>& out)
const
132 for(std::size_t i = 0; i < s; i++) {
133 const std::size_t i0 = refelem.subEntity(i,dim-1,0,dim);
134 const std::size_t i1 = refelem.subEntity(i,dim-1,1,dim);
135 for(std::size_t j = 0; j < dim; j++)
136 for(std::size_t k = 0; k < dim; k++)
137 out[i][j][k] = edgel[i] *
138 (p1j[i0][0][k]*p1j[i1][0][j]-p1j[i1][0][k]*p1j[i0][0][j]);
145 std::vector<typename Traits::Range>& out)
const
148 if (totalOrder == 0) {
150 }
else if (totalOrder==1) {
151 auto const k = std::distance(
order.begin(), std::find(
order.begin(),
order.end(), 1));
154 for (std::size_t i = 0; i < s; i++)
156 const std::size_t i0 = refelem.subEntity(i,dim-1,0,dim);
157 const std::size_t i1 = refelem.subEntity(i,dim-1,1,dim);
158 for(std::size_t j = 0; j < dim; j++)
159 out[i][j] = edgel[i] *
160 (p1j[i0][0][k]*p1j[i1][0][j] - p1j[i1][0][k]*p1j[i0][0][j]);
168 std::size_t
order ()
const {
return 1; }
171 template<
class Geometry,
class RF>
172 const typename EdgeS0_5Basis<Geometry, RF>::P1LocalBasis&
173 EdgeS0_5Basis<Geometry, RF>::p1LocalBasis = P1LocalBasis();
Basis for order 0.5 (lowest order) edge elements on simplices.
Definition: basis.hh:36
EdgeS0_5Basis(const Geometry &geo, const VertexOrder &vertexOrder)
Construct an EdgeS0_5Basis.
Definition: basis.hh:82
void evaluateJacobian(const typename Traits::DomainLocal &, std::vector< typename Traits::Jacobian > &out) const
Evaluate all Jacobians.
Definition: basis.hh:127
void evaluateFunction(const typename Traits::DomainLocal &xl, std::vector< typename Traits::Range > &out) const
Evaluate all shape functions.
Definition: basis.hh:107
std::size_t size() const
number of shape functions
Definition: basis.hh:104
void partial(const std::array< unsigned int, dim > &order, const typename Traits::DomainLocal &in, std::vector< typename Traits::Range > &out) const
Evaluate partial derivatives of all shape functions.
Definition: basis.hh:143
std::size_t order() const
Polynomial order of the shape functions.
Definition: basis.hh:168
A dense n x m matrix.
Definition: fmatrix.hh:69
vector space out of a tensor product of fields.
Definition: fvector.hh:96
Wrapper class for geometries.
Definition: geometry.hh:67
@ coorddimension
Definition: geometry.hh:92
GlobalCoordinate corner(int i) const
Obtain a corner of the geometry.
Definition: geometry.hh:156
GridImp::ctype ctype
define type used for coordinates in grid module
Definition: geometry.hh:95
@ mydimension
Definition: geometry.hh:90
Default exception for dummy implementations.
Definition: exceptions.hh:261
Convert a simple scalar local basis into a global basis.
Definition: localtoglobaladaptors.hh:63
Implements a matrix constructed from a given type representing a field and compile-time given number ...
Implements a vector constructed from a given type representing a field and a compile-time given size.
#define DUNE_THROW(E, m)
Definition: exceptions.hh:216
T accumulate(Range &&range, T value, F &&f)
Accumulate values.
Definition: hybridutilities.hh:290
Dune namespace.
Definition: alignedallocator.hh:14
export type traits for function signature
Definition: basis.hh:39
Common base class for edge elements.
Definition: common.hh:17
RefElem refelem
The reference element for this edge element.
Definition: common.hh:24
std::size_t s
The number of base functions.
Definition: common.hh:32