dune-fem 2.12-git
Loading...
Searching...
No Matches
localfunctionadapter.hh
Go to the documentation of this file.
1#ifndef DUNE_FEM_LOCALFUNCTIONADAPTER_HH
2#define DUNE_FEM_LOCALFUNCTIONADAPTER_HH
3
4#include <functional>
5#include <memory>
6#include <set>
7#include <tuple>
8#include <type_traits>
9
11
14
15namespace Dune
16{
17
18 namespace Fem
19 {
20
31 template< class LocalFunctionImpl >
32 class LocalFunctionAdapter;
33
34 template< class LocalFunctionImpl >
35 class LocalFunctionAdapterLocalFunction;
36
37
39 template< class LocalFunctionImpl >
41 {
42 typedef typename LocalFunctionImpl::FunctionSpaceType FunctionSpaceType;
43 typedef typename LocalFunctionImpl::GridPartType GridPartType;
44
45 // use storage as reference if no copy constructor
46 template< class T, bool >
48 {
49 typedef T& Type;
50 };
51 // otherwise use storage as copy
52 template< class T >
53 struct LocalFuncType< T, true >
54 {
55 typedef T Type;
56 };
57
58 // store the local function object by value if it can be copy constructed - otherwise store a reference
61
62 typedef typename FunctionSpaceType::RangeFieldType RangeFieldType;
63 typedef typename FunctionSpaceType::DomainFieldType DomainFieldType;
64 typedef typename FunctionSpaceType::RangeType RangeType;
65 typedef typename FunctionSpaceType::DomainType DomainType;
66 typedef typename FunctionSpaceType::JacobianRangeType JacobianRangeType;
67 typedef typename FunctionSpaceType::HessianRangeType HessianRangeType;
68
69 typedef typename GridPartType :: GridType GridType;
70 typedef typename GridPartType::template Codim< 0 >::EntityType EntityType;
72 typedef typename GridPartType::template Codim< 0 >::IteratorType IteratorType;
74 typedef typename GridPartType :: IndexSetType IndexSetType;
75
77
80 };
81
82
83
133 template< class LocalFunctionImpl >
135 : public Function< typename LocalFunctionImpl::FunctionSpaceType, LocalFunctionAdapter< LocalFunctionImpl > >,
136 public HasLocalFunction
137 {
140
141 friend class LocalFunctionAdapterLocalFunction< LocalFunctionImpl >;
142
143 public:
145
147 typedef LocalFunctionImpl LocalFunctionImplType;
148
151
154
157
160
162 typedef typename Traits::GridType GridType;
170 typedef typename Traits::RangeType RangeType;
175
178
179 protected:
181 {
182 virtual void initialize( LocalFunctionType* ) const = 0;
183
184 virtual ~ArgumentIF ()
185 {}
186 };
187
188 template <class ArgType>
190 {
191 const ArgType arg_;
192 const double time_;
193
194 ArgumentInitializer( const ArgType& arg, double time )
195 : arg_( arg ), time_( time )
196 {}
197
200
201 virtual void initialize( LocalFunctionType* lf ) const
202 {
203 lf->initialize( arg_, time_ );
204 }
205 };
206
208
209 public:
223
236
249
252 template < class ...Args >
254 const GridPartType &gridPart,
255 unsigned int order,
256 Args&... args)
257 : space_( gridPart, order ),
258 localFunctionImpl_( args... ),
259 lfList_(),
261 name_( name ),
262 order_( order )
263 {}
264
268 template < class ...Args >
270 const GridPartType &gridPart,
271 const std::tuple< Args&... > &args,
274 std::make_index_sequence< std::tuple_size< std::tuple<Args&...> >::value >{} )
275 {}
276
278 : space_( other.space_ ),
280 lfList_(),
282 name_( other.name_ ),
283 order_( other.order_ )
284 {}
285
287 unsigned int order() const
288 {
289 return order_;
290 }
291
293 inline bool continuous () const
294 {
295 return space().continuous();
296 }
297
300 {
301 return localFunctionImpl_;
302 }
303
309
311 void evaluate(const DomainType& global, RangeType& result) const
312 {
313 DUNE_THROW( NotImplemented, "LocalFunctionAdapter::evaluate is not implemented." );
314 }
315
318 {
319 return LocalFunctionType( entity, *this );
320 }
321
323 const LocalFunctionType localFunction( const EntityType &entity ) const
324 {
325 return LocalFunctionType( entity, *this );
326 }
327
329 const std::string &name() const
330 {
331 return name_;
332 }
333
335 {
336 return space_;
337 }
338
339 const GridPartType &gridPart () const
340 {
341 return space().gridPart();
342 }
343
345 template <class DFType>
347 {
348 DUNE_THROW( NotImplemented, "LocalFunctionAdapter::operator += is not implemented." );
349 return *this;
350 }
351
356 template <class DFType>
358 {
359 DUNE_THROW( NotImplemented, "LocalFunctionAdapter::operator -= is not implemented." );
360 return *this;
361 }
362
370 {
371 DUNE_THROW( NotImplemented, "LocalFunctionAdapter::operator *= is not implemented." );
372 return *this;
373 }
374
382 {
383 DUNE_THROW( NotImplemented, "LocalFunctionAdapter::operator /= is not implemented." );
384 return *this;
385 }
386
388 template< class ArgumentType >
389 void initialize( const ArgumentType &arg, double time )
390 {
391 constexpr bool hasCopyConstructor = Traits::localFunctionHasCopyConstructor;
392 if( hasCopyConstructor)
393 {
395 for( auto& localFunctionPtr : lfList_ )
396 Hybrid::ifElse( hasCopyConstructor, [ & ]( auto&& ){ argInitializer_->initialize( localFunctionPtr ); } );
397 }
398 else
399 DUNE_THROW(NotImplemented,"LocalFunctionAdapter::initialize is not implemented");
400 }
401
404 {
406 {
407 if( argInitializer_ != nullptr )
408 argInitializer_->initialize( lf );
409 lfList_.insert( lf );
410 }
411 }
412
415 {
417 lfList_.erase( lf );
418 }
419
420 protected:
421 template <class ...Args, std::size_t ...index>
423 const GridPartType &gridPart,
424 const std::tuple< Args&... > &args,
425 unsigned int order,
427 : space_( gridPart, order ),
428 localFunctionImpl_( std::get< index >( args )... ),
429 lfList_(),
431 name_( name ),
432 order_( order )
433 {}
434
440 const unsigned int order_;
441 };
442
443
444
445 template< class LocalFunctionImpl >
447 {
449
450 public:
452 typedef LocalFunctionImpl LocalFunctionImplType;
453
456
458
466 typedef typename Traits::RangeType RangeType;
471
474 typedef typename EntityType::Geometry Geometry;
475
477
480 : adapter_( adapter ), localFunctionImpl_( adapter.localFunctionImpl_ )
481 {
482 // add local function to list
484 localFunctionImpl().init( entity );
485 }
486
489 : adapter_( adapter ), localFunctionImpl_( adapter.localFunctionImpl_ )
490 {
491 // add local function to list
493 }
494
498 {
499 // add local function to list
501 }
502
505 {
506 // remove local function from list
508 }
509
511 unsigned int order() const
512 {
513 return adapter_.order();
514 }
515
517 template< class PointType >
518 void evaluate ( const PointType &x, RangeType &ret ) const
519 {
520 localFunctionImpl().evaluate(x,ret);
521 }
522
524 template< class PointType >
525 void jacobian ( const PointType &x, JacobianRangeType &ret ) const
526 {
527 localFunctionImpl().jacobian( x, ret );
528 }
529
530 // hessian of local function
531 template< class PointType >
532 void hessian ( const PointType &x, HessianRangeType &ret ) const
533 {
534 localFunctionImpl().hessian( x, ret );
535 }
536
537 template< class QuadratureType, class ... Vectors >
538 void evaluateQuadrature( const QuadratureType &quad, Vectors& ... result ) const
539 {
540 static_assert( sizeof...( Vectors ) > 0, "evaluateQuadrature needs to be called with at least one vector." );
541 std::ignore = std::make_tuple(
542 ( evaluateQuadrature( quad, result ), 1 ) ... );
543 }
544
545 template< class QuadratureType, class ... Vectors >
546 void jacobianQuadrature( const QuadratureType &quad, Vectors& ... result ) const
547 {
548 static_assert( sizeof...( Vectors ) > 0, "evaluateQuadrature needs to be called with at least one vector." );
549 std::ignore = std::make_tuple(
550 ( evaluateQuadrature( quad, result ), 1 ) ... );
551 }
552
554 void init( const EntityType& entity )
555 {
556 localFunctionImpl().init( entity );
557 }
558
560 const EntityType& entity() const
561 {
562 return localFunctionImpl().entity();
563 }
564
566 const Geometry& geometry() const
567 {
568 return localFunctionImpl().geometry();
569 }
570
571 template <class ArgumentType>
572 void initialize ( const ArgumentType& arg, double time )
573 {
574 localFunctionImpl().initialize( arg, time );
575 }
576
577 template< class QuadratureType, class VectorType >
578 auto evaluateQuadrature( const QuadratureType &quad, VectorType &result ) const
579 -> std::enable_if_t< std::is_same< std::decay_t< decltype(result[ 0 ] ) >, RangeType >::value >
580 {
581 const size_t quadNop = quad.nop();
582 for(size_t i = 0; i<quadNop; ++i)
583 evaluate( quad[ i ], result[ i ] );
584 }
585
586 template< class QuadratureType, class VectorType >
587 auto evaluateQuadrature( const QuadratureType &quad, VectorType &result ) const
588 -> std::enable_if_t< std::is_same< std::decay_t< decltype(result[ 0 ] ) >, JacobianRangeType >::value >
589 {
590 const size_t quadNop = quad.nop();
591 for(size_t i = 0; i<quadNop; ++i)
592 jacobian( quad[ i ], result[ i ] );
593 }
594
595 protected:
597 {
598 return localFunctionImpl_;
599 }
600
605
606 //EntityType const* entity_ = nullptr;
609 };
610
611
612
634 template<class DiscreteFunctionSpaceImpl>
636 : public EntityGeometryStorage< typename DiscreteFunctionSpaceImpl::EntityType >
637 {
639 public:
640 typedef DiscreteFunctionSpaceImpl DiscreteFunctionSpaceType;
642
643 typedef typename DiscreteFunctionSpaceType::FunctionSpaceType FunctionSpaceType;
644 typedef typename DiscreteFunctionSpaceType::GridPartType GridPartType;
645 typedef typename DiscreteFunctionSpaceType::EntityType EntityType;
646
647 typedef typename FunctionSpaceType::DomainType DomainType;
648 typedef typename FunctionSpaceType::RangeType RangeType;
649 typedef typename DiscreteFunctionSpaceType::DomainFieldType DomainFieldType;
650 typedef typename DiscreteFunctionSpaceType::RangeFieldType RangeFieldType;
651
652 typedef typename FunctionSpaceType::JacobianRangeType JacobianRangeType;
653 typedef typename FunctionSpaceType::HessianRangeType HessianRangeType;
654
658
660 LocalAnalyticalFunctionBinder(const AnalyticalFunctionType& f=[](const auto& ,auto ,const auto& ){return RangeType(0.0);},
661 const AnalyticalJacobianType& j=[](const auto& ,auto ,const auto& ){return JacobianRangeType(0.0);},
662 const AnalyticalHessianType& h=[](const auto& ,auto ,const auto& ){return HessianRangeType(0.0);},
663 double t=0.0)
664 : BaseType(), f_(f),j_(j),h_(h),t_(t)
665 {}
666
669 ThisType& operator=(const ThisType& )=default;
671
672 using BaseType :: entity;
673 using BaseType :: geometry;
674 using BaseType :: bind;
675 using BaseType :: unbind;
676
679 {
680 return f_;
681 }
682
685 {
686 return f_;
687 }
688
691 {
692 return j_;
693 }
694
697 {
698 return j_;
699 }
700
703 {
704 return h_;
705 }
706
709 {
710 return h_;
711 }
712
714 template<class PointType>
715 void evaluate(const PointType& x,RangeType& ret) const
716 {
717 ret=f_(geometry().global(coordinate(x)),t_,entity());
718 }
719
721 template<class PointType>
722 void jacobian(const PointType& x,JacobianRangeType& ret) const
723 {
724 ret=j_(geometry().global(coordinate(x)),t_,entity());
725 }
726
728 template<class PointType>
729 void hessian(const PointType& x,HessianRangeType& ret ) const
730 {
731 ret=h_(geometry().global(coordinate(x)),t_,entity());
732 }
733
735 void init(const EntityType& entity)
736 {
737 bind( entity );
738 }
739
741 template<typename Arg>
742 void initialize(Arg&& ,double time)
743 {
744 t_=time;
745 }
746
748 double time() const
749 {
750 return t_;
751 }
752
753 private:
757 double t_;
758 };
759
760 } // namespace Fem
761
762} // namespace Dune
763
765
766#endif // #ifndef DUNE_FEM_LOCALFUNCTIONADAPTER_HH
decltype(auto) ifElse(const Condition &condition, IfFunc &&ifFunc, ElseFunc &&elseFunc)
std::ptrdiff_t index() const
#define DUNE_THROW(E,...)
const GlobalIndex & global() const
constexpr auto get(std::integer_sequence< T, II... >, std::integral_constant< std::size_t, pos >={})
GridPartType::GridType GridType
Definition localfunctionadapter.hh:69
LocalFunctionAdapterLocalFunction< LocalFunctionImpl > LocalFunctionType
Definition localfunctionadapter.hh:79
ThisType DiscreteFunctionType
Definition localfunctionadapter.hh:144
DiscreteFunctionType & operator/=(const RangeFieldType &scalar)
devide all DoFs by a scalar factor
Definition localfunctionadapter.hh:381
DiscreteFunctionSpaceType::DomainFieldType DomainFieldType
Definition localfunctionadapter.hh:649
~LocalFunctionAdapterLocalFunction()
destructor
Definition localfunctionadapter.hh:504
LocalFunctionAdapter(const std::string &name, LocalFunctionImplType &localFunctionImpl, const GridPartType &gridPart, unsigned int order=DiscreteFunctionSpaceType::polynomialOrder)
Definition localfunctionadapter.hh:212
FunctionSpaceType::DomainType DomainType
Definition localfunctionadapter.hh:647
LocalAnalyticalFunctionBinder< DiscreteFunctionSpaceType > ThisType
Definition localfunctionadapter.hh:641
DiscreteFunctionSpaceType::GridPartType GridPartType
Definition localfunctionadapter.hh:644
static constexpr bool localFunctionHasCopyConstructor
Definition localfunctionadapter.hh:59
void init(const EntityType &entity)
initialize entity
Definition localfunctionadapter.hh:735
AnalyticalFunctionType & function()
get local function
Definition localfunctionadapter.hh:678
Traits::LocalFunctionType LocalFunctionType
type of local function to export
Definition localfunctionadapter.hh:177
Traits::RangeFieldType RangeFieldType
range type
Definition localfunctionadapter.hh:462
void jacobian(const PointType &x, JacobianRangeType &ret) const
jacobian of local function
Definition localfunctionadapter.hh:525
LocalFunctionImpl::FunctionSpaceType FunctionSpaceType
Definition localfunctionadapter.hh:42
Traits::GridType GridType
type of grid
Definition localfunctionadapter.hh:162
void jacobianQuadrature(const QuadratureType &quad, Vectors &... result) const
Definition localfunctionadapter.hh:546
LocalFunctionType localFunction(const EntityType &entity)
Definition localfunctionadapter.hh:317
void jacobian(const PointType &x, JacobianRangeType &ret) const
evaluate jacobian local function
Definition localfunctionadapter.hh:722
Traits::RangeType RangeType
range type
Definition localfunctionadapter.hh:466
void hessian(const PointType &x, HessianRangeType &ret) const
evaluate hessian local function
Definition localfunctionadapter.hh:729
Traits::HessianRangeType HessianRangeType
hessian type
Definition localfunctionadapter.hh:470
LocalFunctionAdapter(const std::string &name, const LocalFunctionImplType &localFunctionImpl, const GridPartType &gridPart, unsigned int order=DiscreteFunctionSpaceType::polynomialOrder)
constructor taking a const reference instance of the local function class
Definition localfunctionadapter.hh:225
AnalyticalJacobianType & jacobian()
get jacobian local function
Definition localfunctionadapter.hh:690
Traits::DomainFieldType DomainFieldType
domain type
Definition localfunctionadapter.hh:164
std::unique_ptr< ArgumentIF > argInitializer_
Definition localfunctionadapter.hh:438
DiscreteFunctionType & operator+=(const DFType &g)
Definition localfunctionadapter.hh:346
LocalFunctionAdapterLocalFunction(const ThisType &other)
copy constructor
Definition localfunctionadapter.hh:496
Traits::DiscreteFunctionSpaceType DiscreteFunctionSpaceType
type of discrete function space
Definition localfunctionadapter.hh:159
FunctionSpaceType::RangeType RangeType
Definition localfunctionadapter.hh:648
Traits::DomainType DomainType
domain type
Definition localfunctionadapter.hh:464
LocalFunctionAdapter(const ThisType &other)
Definition localfunctionadapter.hh:277
void init(const EntityType &entity)
init local function
Definition localfunctionadapter.hh:554
LocalFuncStorageType localFunctionImpl_
Definition localfunctionadapter.hh:436
LocalFunctionAdapterLocalFunction(const DiscreteFunctionType &adapter)
constructor
Definition localfunctionadapter.hh:488
std::function< HessianRangeType(const DomainType &, double, const EntityType &)> AnalyticalHessianType
Definition localfunctionadapter.hh:657
const ArgType arg_
Definition localfunctionadapter.hh:191
FunctionSpaceType::JacobianRangeType JacobianRangeType
Definition localfunctionadapter.hh:652
double time() const
get time
Definition localfunctionadapter.hh:748
void registerLocalFunction(LocalFunctionType *lf) const
add LocalFunction to list of local functions
Definition localfunctionadapter.hh:403
T & Type
Definition localfunctionadapter.hh:49
auto evaluateQuadrature(const QuadratureType &quad, VectorType &result) const -> std::enable_if_t< std::is_same< std::decay_t< decltype(result[0]) >, RangeType >::value >
Definition localfunctionadapter.hh:578
Traits::EntityType EntityType
Definition localfunctionadapter.hh:473
const std::string name_
Definition localfunctionadapter.hh:439
LocalFunctionAdapter< LocalFunctionImpl > DiscreteFunctionType
Definition localfunctionadapter.hh:78
LocalFuncType< LocalFunctionImpl, localFunctionHasCopyConstructor >::Type LocalFuncStorageType
Definition localfunctionadapter.hh:60
DiscreteFunctionSpaceType::RangeFieldType RangeFieldType
Definition localfunctionadapter.hh:650
LocalFunctionAdapter(const std::string &name, const GridPartType &gridPart, const std::tuple< Args &... > &args, unsigned int order, std::index_sequence< index... >)
Definition localfunctionadapter.hh:422
const std::string & name() const
obtain the name of the discrete function
Definition localfunctionadapter.hh:329
DiscreteFunctionType & operator-=(const DFType &g)
substract all degrees of freedom from given discrete function using the dof iterators
Definition localfunctionadapter.hh:357
const EntityType & entity() const
get entity
Definition localfunctionadapter.hh:560
ThisType & operator=(ThisType &&)=default
const double time_
Definition localfunctionadapter.hh:192
Traits::DomainFieldType DomainFieldType
domain type
Definition localfunctionadapter.hh:460
void evaluate(const PointType &x, RangeType &ret) const
evaluate local function
Definition localfunctionadapter.hh:518
LocalFunctionImpl LocalFunctionImplType
type of local function implementation
Definition localfunctionadapter.hh:452
LocalFunctionAdapter(const std::string &name, LocalFunctionImplType &&localFunctionImpl, const GridPartType &gridPart, unsigned int order=DiscreteFunctionSpaceType::polynomialOrder)
constructor taking a r-value reference instance of the local function class
Definition localfunctionadapter.hh:238
LocalFunctionImpl LocalFunctionImplType
Evaluate class.
Definition localfunctionadapter.hh:147
Traits::DomainType DomainType
domain type
Definition localfunctionadapter.hh:168
void initialize(Arg &&, double time)
initialize time
Definition localfunctionadapter.hh:742
FunctionSpaceType::DomainType DomainType
Definition localfunctionadapter.hh:65
void initialize(const ArgumentType &arg, double time)
Definition localfunctionadapter.hh:572
unsigned int order() const
return the order of the space
Definition localfunctionadapter.hh:287
ArgumentInitializer(const ArgType &arg, double time)
Definition localfunctionadapter.hh:194
void evaluate(const PointType &x, RangeType &ret) const
evaluate local function
Definition localfunctionadapter.hh:715
virtual void initialize(LocalFunctionType *lf) const
Definition localfunctionadapter.hh:201
LocalFunctionAdapterLocalFunction(const EntityType &entity, const DiscreteFunctionType &adapter)
constructor initializing local function
Definition localfunctionadapter.hh:479
const DiscreteFunctionType & adapter_
Definition localfunctionadapter.hh:607
GridPartType::template Codim< 0 >::EntityType EntityType
Definition localfunctionadapter.hh:70
Traits::FunctionSpaceType FunctionSpaceType
Definition localfunctionadapter.hh:457
FunctionSpaceType::JacobianRangeType JacobianRangeType
Definition localfunctionadapter.hh:66
void hessian(const PointType &x, HessianRangeType &ret) const
Definition localfunctionadapter.hh:532
EntityType::Geometry Geometry
Definition localfunctionadapter.hh:474
FunctionSpaceType::HessianRangeType HessianRangeType
Definition localfunctionadapter.hh:67
Traits::RangeType RangeType
range type
Definition localfunctionadapter.hh:170
DiscreteFunctionSpaceAdapter< FunctionSpaceType, GridPartType > DiscreteFunctionSpaceType
Definition localfunctionadapter.hh:76
LocalAnalyticalFunctionBinder(ThisType &&)=default
void evaluateQuadrature(const QuadratureType &quad, Vectors &... result) const
Definition localfunctionadapter.hh:538
Traits::JacobianRangeType JacobianRangeType
jacobian type
Definition localfunctionadapter.hh:468
LocalAnalyticalFunctionBinder(const ThisType &)=default
~ArgumentInitializer()
Definition localfunctionadapter.hh:198
std::function< JacobianRangeType(const DomainType &, double, const EntityType &)> AnalyticalJacobianType
Definition localfunctionadapter.hh:656
const LocalFuncStorageType & localFunctionImpl() const
Definition localfunctionadapter.hh:596
unsigned int order() const
return order of the space
Definition localfunctionadapter.hh:511
Traits::EntityType EntityType
type of codim 0 entity
Definition localfunctionadapter.hh:174
LocalFunctionAdapter(const std::string &name, const GridPartType &gridPart, const std::tuple< Args &... > &args, unsigned int order=DiscreteFunctionSpaceType::polynomialOrder)
Definition localfunctionadapter.hh:269
const DiscreteFunctionSpaceType & space() const
Definition localfunctionadapter.hh:334
LocalFunctionAdapterTraits< LocalFunctionImplType > Traits
traits class
Definition localfunctionadapter.hh:153
std::function< RangeType(const DomainType &, double, const EntityType &)> AnalyticalFunctionType
Definition localfunctionadapter.hh:655
GridPartType::template Codim< 0 >::IteratorType IteratorType
type of iterator
Definition localfunctionadapter.hh:72
AnalyticalHessianType & hessian()
get hessian local function
Definition localfunctionadapter.hh:702
FunctionSpaceType::RangeFieldType RangeFieldType
Definition localfunctionadapter.hh:62
ThisType & operator=(const ThisType &)=default
void deleteLocalFunction(LocalFunctionType *lf) const
remove LocalFunction to list of local functions
Definition localfunctionadapter.hh:414
Traits::LocalFuncStorageType LocalFuncStorageType
Definition localfunctionadapter.hh:207
const AnalyticalJacobianType & jacobian() const
get jacobian local function
Definition localfunctionadapter.hh:696
DiscreteFunctionSpaceType::FunctionSpaceType FunctionSpaceType
Definition localfunctionadapter.hh:643
LocalFunctionAdapter(const std::string &name, const GridPartType &gridPart, unsigned int order, Args &... args)
Definition localfunctionadapter.hh:253
LocalFuncStorageType & localFunctionImpl()
Definition localfunctionadapter.hh:601
Traits::GridPartType GridPartType
type of grid part
Definition localfunctionadapter.hh:156
LocalFunctionAdapterTraits< LocalFunctionImplType > Traits
type of the traits class
Definition localfunctionadapter.hh:455
virtual ~ArgumentIF()
Definition localfunctionadapter.hh:184
const Geometry & geometry() const
get entity
Definition localfunctionadapter.hh:566
Traits::DiscreteFunctionType DiscreteFunctionType
Definition localfunctionadapter.hh:472
LocalAnalyticalFunctionBinder(const AnalyticalFunctionType &f=[](const auto &, auto, const auto &){return RangeType(0.0);}, const AnalyticalJacobianType &j=[](const auto &, auto, const auto &){return JacobianRangeType(0.0);}, const AnalyticalHessianType &h=[](const auto &, auto, const auto &){return HessianRangeType(0.0);}, double t=0.0)
constructor
Definition localfunctionadapter.hh:660
const unsigned int order_
Definition localfunctionadapter.hh:440
Traits::JacobianRangeType JacobianRangeType
jacobian type
Definition localfunctionadapter.hh:172
GridPartType::IndexSetType IndexSetType
type of IndexSet
Definition localfunctionadapter.hh:74
const LocalFunctionType localFunction(const EntityType &entity) const
Definition localfunctionadapter.hh:323
const AnalyticalHessianType & hessian() const
get hessian local function
Definition localfunctionadapter.hh:708
DiscreteFunctionSpaceImpl DiscreteFunctionSpaceType
Definition localfunctionadapter.hh:640
bool continuous() const
return true, probably
Definition localfunctionadapter.hh:293
FunctionSpaceType::HessianRangeType HessianRangeType
Definition localfunctionadapter.hh:653
DiscreteFunctionType & operator*=(const RangeFieldType &scalar)
multiply all DoFs with a scalar factor
Definition localfunctionadapter.hh:369
DiscreteFunctionSpaceType space_
Definition localfunctionadapter.hh:435
const LocalFuncStorageType & localFunctionImpl() const
return local function implementation
Definition localfunctionadapter.hh:299
FunctionSpaceType::DomainFieldType DomainFieldType
Definition localfunctionadapter.hh:63
Traits::LocalFuncStorageType LocalFuncStorageType
Definition localfunctionadapter.hh:476
const AnalyticalFunctionType & function() const
get local function
Definition localfunctionadapter.hh:684
FunctionSpaceType::RangeType RangeType
Definition localfunctionadapter.hh:64
virtual void initialize(LocalFunctionType *) const =0
DiscreteFunctionSpaceType::EntityType EntityType
Definition localfunctionadapter.hh:645
BaseType::FunctionType FunctionType
type of function
Definition localfunctionadapter.hh:150
std::set< LocalFunctionType * > lfList_
Definition localfunctionadapter.hh:437
LocalFuncStorageType localFunctionImpl_
Definition localfunctionadapter.hh:608
Traits::RangeFieldType RangeFieldType
range type
Definition localfunctionadapter.hh:166
LocalFunctionImpl::GridPartType GridPartType
Definition localfunctionadapter.hh:43
const GridPartType & gridPart() const
Definition localfunctionadapter.hh:339
void evaluate(const DomainType &global, RangeType &result) const
evaluate function on local coordinate local
Definition localfunctionadapter.hh:311
void initialize(const ArgumentType &arg, double time)
initialize local function with argument and time
Definition localfunctionadapter.hh:389
LocalFuncStorageType & localFunctionImpl()
return local function implementation
Definition localfunctionadapter.hh:305
STL namespace.
static const Point & coordinate(const Point &x)
Definition coordinate.hh:14
base class for determing whether a function has local functions or not
Definition common/discretefunction.hh:57
Abstract class representing a function.
Definition common/function.hh:50
FunctionImp FunctionType
type of the implementation (Barton-Nackman)
Definition common/function.hh:59
LocalFunctionAdapter wrapped a class with a local evaluate method into a grid function.
Definition localfunctionadapter.hh:137
Definition localfunctionadapter.hh:447
auto evaluateQuadrature(const QuadratureType &quad, VectorType &result) const -> std::enable_if_t< std::is_same< std::decay_t< decltype(result[0]) >, JacobianRangeType >::value >
Definition localfunctionadapter.hh:587
traits of DiscreteFunctionAdapter
Definition localfunctionadapter.hh:41
Definition localfunctionadapter.hh:48
Definition localfunctionadapter.hh:181
Definition localfunctionadapter.hh:190
LocalAnalyticalFunctionBinder binds a C++ local analytical function (and also its Jacobian and Hessia...
Definition localfunctionadapter.hh:637
bool continuous() const
returns true if the space contains only globally continuous functions
Definition discretefunctionspace.hh:1093
const GridPartType & gridPart() const
get a reference to the associated grid partition
Definition discretefunctionspace.hh:1075
implementation of entity and geometry storage for basis function set and local functions
Definition entitygeometry.hh:35
const Entity & entity() const
return entity
Definition entitygeometry.hh:101
const Geometry & geometry() const
return geometry
Definition entitygeometry.hh:111
void unbind()
release entity and geometry object
Definition entitygeometry.hh:164
void bind(const EntityType &entity)
set new entity object and geometry if enabled
Definition entitygeometry.hh:135
T forward(T... args)
T make_tuple(T... args)