dune-fem 2.8.0
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
10#include <dune/common/hybridutilities.hh>
11
13
14namespace Dune
15{
16
17 namespace Fem
18 {
19
30 template< class LocalFunctionImpl >
31 class LocalFunctionAdapter;
32
33 template< class LocalFunctionImpl >
34 class LocalFunctionAdapterLocalFunction;
35
36
38 template< class LocalFunctionImpl >
40 {
41 typedef typename LocalFunctionImpl::FunctionSpaceType FunctionSpaceType;
42 typedef typename LocalFunctionImpl::GridPartType GridPartType;
43
44 // use storage as reference if no copy constructor
45 template< class T, bool >
47 {
48 typedef T& Type;
49 };
50 // otherwise use storage as copy
51 template< class T >
52 struct LocalFuncType< T, true >
53 {
54 typedef T Type;
55 };
56
57 // store the local function object by value if it can be copy constructed - otherwise store a reference
58 static constexpr bool localFunctionHasCopyConstructor = std::is_copy_constructible<LocalFunctionImpl>::value;
60
61 typedef typename FunctionSpaceType::RangeFieldType RangeFieldType;
62 typedef typename FunctionSpaceType::DomainFieldType DomainFieldType;
63 typedef typename FunctionSpaceType::RangeType RangeType;
64 typedef typename FunctionSpaceType::DomainType DomainType;
65 typedef typename FunctionSpaceType::JacobianRangeType JacobianRangeType;
66 typedef typename FunctionSpaceType::HessianRangeType HessianRangeType;
67
68 typedef typename GridPartType :: GridType GridType;
69 typedef typename GridPartType::template Codim< 0 >::EntityType EntityType;
71 typedef typename GridPartType::template Codim< 0 >::IteratorType IteratorType;
73 typedef typename GridPartType :: IndexSetType IndexSetType;
74
76
79 };
80
81
82
132 template< class LocalFunctionImpl >
134 : public Function< typename LocalFunctionImpl::FunctionSpaceType, LocalFunctionAdapter< LocalFunctionImpl > >,
135 public HasLocalFunction
136 {
139
140 friend class LocalFunctionAdapterLocalFunction< LocalFunctionImpl >;
141
142 public:
144
146 typedef LocalFunctionImpl LocalFunctionImplType;
147
150
153
156
159
161 typedef typename Traits::GridType GridType;
169 typedef typename Traits::RangeType RangeType;
174
177
178 protected:
180 {
181 virtual void initialize( LocalFunctionType* ) const = 0;
182
183 virtual ~ArgumentIF ()
184 {}
185 };
186
187 template <class ArgType>
189 {
190 const ArgType arg_;
191 const double time_;
192
193 ArgumentInitializer( const ArgType& arg, double time )
194 : arg_( arg ), time_( time )
195 {}
196
198 {}
199
200 virtual void initialize( LocalFunctionType* lf ) const
201 {
202 lf->initialize( arg_, time_ );
203 }
204 };
205
207
208 public:
211 LocalFunctionAdapter ( const std::string &name,
213 const GridPartType &gridPart,
215 : space_( gridPart, order ),
217 lfList_(),
219 name_( name ),
220 order_( order )
221 {}
222
224 LocalFunctionAdapter ( const std::string &name,
226 const GridPartType &gridPart,
228 : space_( gridPart, order ),
230 lfList_(),
232 name_( name ),
233 order_( order )
234 {}
235
237 LocalFunctionAdapter ( const std::string &name,
239 const GridPartType &gridPart,
241 : space_( gridPart, order ),
243 lfList_(),
245 name_( name ),
246 order_( order )
247 {}
248
251 template < class ...Args >
252 LocalFunctionAdapter ( const std::string &name,
253 const GridPartType &gridPart,
254 unsigned int order,
255 Args&... args)
256 : space_( gridPart, order ),
257 localFunctionImpl_( args... ),
258 lfList_(),
260 name_( name ),
261 order_( order )
262 {}
263
267 template < class ...Args >
268 LocalFunctionAdapter ( const std::string &name,
269 const GridPartType &gridPart,
270 const std::tuple< Args&... > &args,
273 std::make_index_sequence< std::tuple_size< std::tuple<Args&...> >::value >{} )
274 {}
275
277 : space_( other.space_ ),
279 lfList_(),
281 name_( other.name_ ),
282 order_( other.order_ )
283 {}
284
286 unsigned int order() const
287 {
288 return order_;
289 }
290
292 inline bool continuous () const
293 {
294 return space().continuous();
295 }
296
299 {
300 return localFunctionImpl_;
301 }
302
305 {
306 return localFunctionImpl_;
307 }
308
310 void evaluate(const DomainType& global, RangeType& result) const
311 {
312 DUNE_THROW( NotImplemented, "LocalFunctionAdapter::evaluate is not implemented." );
313 }
314
317 {
318 return LocalFunctionType( entity, *this );
319 }
320
322 const LocalFunctionType localFunction( const EntityType &entity ) const
323 {
324 return LocalFunctionType( entity, *this );
325 }
326
328 const std::string &name() const
329 {
330 return name_;
331 }
332
334 {
335 return space_;
336 }
337
338 const GridPartType &gridPart () const
339 {
340 return space().gridPart();
341 }
342
344 template <class DFType>
346 {
347 DUNE_THROW( NotImplemented, "LocalFunctionAdapter::operator += is not implemented." );
348 return *this;
349 }
350
355 template <class DFType>
357 {
358 DUNE_THROW( NotImplemented, "LocalFunctionAdapter::operator -= is not implemented." );
359 return *this;
360 }
361
369 {
370 DUNE_THROW( NotImplemented, "LocalFunctionAdapter::operator *= is not implemented." );
371 return *this;
372 }
373
381 {
382 DUNE_THROW( NotImplemented, "LocalFunctionAdapter::operator /= is not implemented." );
383 return *this;
384 }
385
387 template< class ArgumentType >
388 void initialize( const ArgumentType &arg, double time )
389 {
390 constexpr bool hasCopyConstructor = Traits::localFunctionHasCopyConstructor;
391 if( hasCopyConstructor)
392 {
393 argInitializer_ = std::make_unique< ArgumentInitializer< ArgumentType > >( arg, time );
394 for( auto& localFunctionPtr : lfList_ )
395 Hybrid::ifElse( hasCopyConstructor, [ & ]( auto&& ){ argInitializer_->initialize( localFunctionPtr ); } );
396 }
397 else
398 DUNE_THROW(NotImplemented,"LocalFunctionAdapter::initialize is not implemented");
399 }
400
403 {
405 {
406 if( argInitializer_ != nullptr )
407 argInitializer_->initialize( lf );
408 lfList_.insert( lf );
409 }
410 }
411
414 {
416 lfList_.erase( lf );
417 }
418
419 protected:
420 template <class ...Args, std::size_t ...index>
421 LocalFunctionAdapter ( const std::string &name,
422 const GridPartType &gridPart,
423 const std::tuple< Args&... > &args,
424 unsigned int order,
425 std::index_sequence< index... > )
426 : space_( gridPart, order ),
427 localFunctionImpl_( std::get< index >( args )... ),
428 lfList_(),
430 name_( name ),
431 order_( order )
432 {}
433
436 mutable std::set< LocalFunctionType * > lfList_;
437 std::unique_ptr< ArgumentIF > argInitializer_ ;
438 const std::string name_;
439 const unsigned int order_;
440 };
441
442
443
444 template< class LocalFunctionImpl >
446 {
448
449 public:
451 typedef LocalFunctionImpl LocalFunctionImplType;
452
455
457
465 typedef typename Traits::RangeType RangeType;
470
473
475
478 : adapter_( adapter ), localFunctionImpl_( adapter.localFunctionImpl_ )
479 {
480 // add local function to list
482 localFunctionImpl().init( entity );
483 }
484
487 : adapter_( adapter ), localFunctionImpl_( adapter.localFunctionImpl_ )
488 {
489 // add local function to list
491 }
492
496 {
497 // add local function to list
499 }
500
503 {
504 // remove local function from list
506 }
507
509 unsigned int order() const
510 {
511 return adapter_.order();
512 }
513
515 template< class PointType >
516 void evaluate ( const PointType &x, RangeType &ret ) const
517 {
518 localFunctionImpl().evaluate(x,ret);
519 }
520
522 template< class PointType >
523 void jacobian ( const PointType &x, JacobianRangeType &ret ) const
524 {
525 localFunctionImpl().jacobian( x, ret );
526 }
527
528 // hessian of local function
529 template< class PointType >
530 void hessian ( const PointType &x, HessianRangeType &ret ) const
531 {
532 localFunctionImpl().hessian( x, ret );
533 }
534
535 template< class QuadratureType, class ... Vectors >
536 void evaluateQuadrature( const QuadratureType &quad, Vectors& ... result ) const
537 {
538 static_assert( sizeof...( Vectors ) > 0, "evaluateQuadrature needs to be called with at least one vector." );
539 std::ignore = std::make_tuple(
540 ( evaluateQuadrature( quad, result ), 1 ) ... );
541 }
542
543 template< class QuadratureType, class ... Vectors >
544 void jacobianQuadrature( const QuadratureType &quad, Vectors& ... result ) const
545 {
546 static_assert( sizeof...( Vectors ) > 0, "evaluateQuadrature needs to be called with at least one vector." );
547 std::ignore = std::make_tuple(
548 ( evaluateQuadrature( quad, result ), 1 ) ... );
549 }
550
552 void init( const EntityType& entity )
553 {
554 localFunctionImpl().init( entity );
555 entity_ = &entity;
556 }
557
559 const EntityType& entity() const
560 {
561 assert( entity_ );
562 return *entity_;
563 }
564
565 template <class ArgumentType>
566 void initialize ( const ArgumentType& arg, double time )
567 {
568 localFunctionImpl().initialize( arg, time );
569 }
570
571 template< class QuadratureType, class VectorType >
572 auto evaluateQuadrature( const QuadratureType &quad, VectorType &result ) const
573 -> std::enable_if_t< std::is_same< std::decay_t< decltype(result[ 0 ] ) >, RangeType >::value >
574 {
575 const size_t quadNop = quad.nop();
576 for(size_t i = 0; i<quadNop; ++i)
577 evaluate( quad[ i ], result[ i ] );
578 }
579
580 template< class QuadratureType, class VectorType >
581 auto evaluateQuadrature( const QuadratureType &quad, VectorType &result ) const
582 -> std::enable_if_t< std::is_same< std::decay_t< decltype(result[ 0 ] ) >, JacobianRangeType >::value >
583 {
584 const size_t quadNop = quad.nop();
585 for(size_t i = 0; i<quadNop; ++i)
586 jacobian( quad[ i ], result[ i ] );
587 }
588
589 protected:
591 {
592 return localFunctionImpl_;
593 }
594
596 {
597 return localFunctionImpl_;
598 }
599
600 EntityType const* entity_ = nullptr;
603 };
604
605
606
628 template<class DiscreteFunctionSpaceImpl>
630 {
631 public:
632 typedef DiscreteFunctionSpaceImpl DiscreteFunctionSpaceType;
634
635 typedef typename DiscreteFunctionSpaceType::FunctionSpaceType FunctionSpaceType;
636 typedef typename DiscreteFunctionSpaceType::GridPartType GridPartType;
637 typedef typename DiscreteFunctionSpaceType::EntityType EntityType;
638
639 typedef typename FunctionSpaceType::DomainType DomainType;
640 typedef typename FunctionSpaceType::RangeType RangeType;
641 typedef typename DiscreteFunctionSpaceType::DomainFieldType DomainFieldType;
642 typedef typename DiscreteFunctionSpaceType::RangeFieldType RangeFieldType;
643
644 typedef typename FunctionSpaceType::JacobianRangeType JacobianRangeType;
645 typedef typename FunctionSpaceType::HessianRangeType HessianRangeType;
646
647 typedef std::function<RangeType(const DomainType&,double,const EntityType&)> AnalyticalFunctionType;
648 typedef std::function<JacobianRangeType(const DomainType&,double,const EntityType&)> AnalyticalJacobianType;
649 typedef std::function<HessianRangeType(const DomainType&,double,const EntityType&)> AnalyticalHessianType;
650
652 LocalAnalyticalFunctionBinder(const AnalyticalFunctionType& f=[](const auto& ,auto ,const auto& ){return RangeType(0.0);},
653 const AnalyticalJacobianType& j=[](const auto& ,auto ,const auto& ){return JacobianRangeType(0.0);},
654 const AnalyticalHessianType& h=[](const auto& ,auto ,const auto& ){return HessianRangeType(0.0);},
655 double t=0.0):
656 f_(f),j_(j),h_(h),t_(t)
657 {}
658
661 ThisType& operator=(const ThisType& )=default;
663
666 {
667 return f_;
668 }
669
672 {
673 return f_;
674 }
675
678 {
679 return j_;
680 }
681
684 {
685 return j_;
686 }
687
690 {
691 return h_;
692 }
693
696 {
697 return h_;
698 }
699
701 template<class PointType>
702 void evaluate(const PointType& x,RangeType& ret) const
703 {
704 ret=f_(entity().geometry().global(coordinate(x)),t_,entity());
705 }
706
708 template<class PointType>
709 void jacobian(const PointType& x,JacobianRangeType& ret) const
710 {
711 ret=j_(entity().geometry().global(coordinate(x)),t_,entity());
712 }
713
715 template<class PointType>
716 void hessian(const PointType& x,HessianRangeType& ret ) const
717 {
718 ret=h_(entity().geometry().global(coordinate(x)),t_,entity());
719 }
720
722 void init(const EntityType& entity)
723 {
724 entity_=&entity;
725 }
726
728 template<typename Arg>
729 void initialize(Arg&& ,double time)
730 {
731 t_=time;
732 }
733
735 const EntityType& entity() const
736 {
737 assert(entity_);
738 return *entity_;
739 }
740
742 double time() const
743 {
744 return t_;
745 }
746
747 private:
748 EntityType const* entity_;
752 double t_;
753 };
754
755 } // namespace Fem
756
757} // namespace Dune
758
760
761#endif // #ifndef DUNE_FEM_LOCALFUNCTIONADAPTER_HH
GridPartType::GridType GridType
Definition: localfunctionadapter.hh:68
LocalFunctionAdapterLocalFunction< LocalFunctionImpl > LocalFunctionType
Definition: localfunctionadapter.hh:78
ThisType DiscreteFunctionType
Definition: localfunctionadapter.hh:143
DiscreteFunctionType & operator/=(const RangeFieldType &scalar)
devide all DoFs by a scalar factor
Definition: localfunctionadapter.hh:380
DiscreteFunctionSpaceType::DomainFieldType DomainFieldType
Definition: localfunctionadapter.hh:641
~LocalFunctionAdapterLocalFunction()
destructor
Definition: localfunctionadapter.hh:502
LocalFunctionAdapter(const std::string &name, LocalFunctionImplType &localFunctionImpl, const GridPartType &gridPart, unsigned int order=DiscreteFunctionSpaceType::polynomialOrder)
Definition: localfunctionadapter.hh:211
FunctionSpaceType::DomainType DomainType
Definition: localfunctionadapter.hh:639
LocalAnalyticalFunctionBinder< DiscreteFunctionSpaceType > ThisType
Definition: localfunctionadapter.hh:633
DiscreteFunctionSpaceType::GridPartType GridPartType
Definition: localfunctionadapter.hh:636
static constexpr bool localFunctionHasCopyConstructor
Definition: localfunctionadapter.hh:58
void init(const EntityType &entity)
initialize entity
Definition: localfunctionadapter.hh:722
AnalyticalFunctionType & function()
get local function
Definition: localfunctionadapter.hh:665
Traits::LocalFunctionType LocalFunctionType
type of local function to export
Definition: localfunctionadapter.hh:176
Traits::RangeFieldType RangeFieldType
range type
Definition: localfunctionadapter.hh:461
void jacobian(const PointType &x, JacobianRangeType &ret) const
jacobian of local function
Definition: localfunctionadapter.hh:523
LocalFunctionImpl::FunctionSpaceType FunctionSpaceType
Definition: localfunctionadapter.hh:41
Traits::GridType GridType
type of grid
Definition: localfunctionadapter.hh:161
void jacobianQuadrature(const QuadratureType &quad, Vectors &... result) const
Definition: localfunctionadapter.hh:544
LocalFunctionType localFunction(const EntityType &entity)
Definition: localfunctionadapter.hh:316
void jacobian(const PointType &x, JacobianRangeType &ret) const
evaluate jacobian local function
Definition: localfunctionadapter.hh:709
Traits::RangeType RangeType
range type
Definition: localfunctionadapter.hh:465
void hessian(const PointType &x, HessianRangeType &ret) const
evaluate hessian local function
Definition: localfunctionadapter.hh:716
Traits::HessianRangeType HessianRangeType
hessian type
Definition: localfunctionadapter.hh:469
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:224
AnalyticalJacobianType & jacobian()
get jacobian local function
Definition: localfunctionadapter.hh:677
Traits::DomainFieldType DomainFieldType
domain type
Definition: localfunctionadapter.hh:163
std::unique_ptr< ArgumentIF > argInitializer_
Definition: localfunctionadapter.hh:437
DiscreteFunctionType & operator+=(const DFType &g)
Definition: localfunctionadapter.hh:345
LocalFunctionAdapterLocalFunction(const ThisType &other)
copy constructor
Definition: localfunctionadapter.hh:494
Traits::DiscreteFunctionSpaceType DiscreteFunctionSpaceType
type of discrete function space
Definition: localfunctionadapter.hh:158
FunctionSpaceType::RangeType RangeType
Definition: localfunctionadapter.hh:640
Traits::DomainType DomainType
domain type
Definition: localfunctionadapter.hh:463
LocalFunctionAdapter(const ThisType &other)
Definition: localfunctionadapter.hh:276
void init(const EntityType &entity)
init local function
Definition: localfunctionadapter.hh:552
LocalFuncStorageType localFunctionImpl_
Definition: localfunctionadapter.hh:435
LocalFunctionAdapterLocalFunction(const DiscreteFunctionType &adapter)
constructor
Definition: localfunctionadapter.hh:486
std::function< HessianRangeType(const DomainType &, double, const EntityType &)> AnalyticalHessianType
Definition: localfunctionadapter.hh:649
const ArgType arg_
Definition: localfunctionadapter.hh:190
FunctionSpaceType::JacobianRangeType JacobianRangeType
Definition: localfunctionadapter.hh:644
double time() const
get time
Definition: localfunctionadapter.hh:742
void registerLocalFunction(LocalFunctionType *lf) const
add LocalFunction to list of local functions
Definition: localfunctionadapter.hh:402
T & Type
Definition: localfunctionadapter.hh:48
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:572
Traits::EntityType EntityType
Definition: localfunctionadapter.hh:472
const std::string name_
Definition: localfunctionadapter.hh:438
LocalFunctionAdapter< LocalFunctionImpl > DiscreteFunctionType
Definition: localfunctionadapter.hh:77
LocalFuncType< LocalFunctionImpl, localFunctionHasCopyConstructor >::Type LocalFuncStorageType
Definition: localfunctionadapter.hh:59
DiscreteFunctionSpaceType::RangeFieldType RangeFieldType
Definition: localfunctionadapter.hh:642
LocalFunctionAdapter(const std::string &name, const GridPartType &gridPart, const std::tuple< Args &... > &args, unsigned int order, std::index_sequence< index... >)
Definition: localfunctionadapter.hh:421
const std::string & name() const
obtain the name of the discrete function
Definition: localfunctionadapter.hh:328
DiscreteFunctionType & operator-=(const DFType &g)
substract all degrees of freedom from given discrete function using the dof iterators
Definition: localfunctionadapter.hh:356
const EntityType & entity() const
get entity
Definition: localfunctionadapter.hh:559
ThisType & operator=(ThisType &&)=default
const double time_
Definition: localfunctionadapter.hh:191
Traits::DomainFieldType DomainFieldType
domain type
Definition: localfunctionadapter.hh:459
void evaluate(const PointType &x, RangeType &ret) const
evaluate local function
Definition: localfunctionadapter.hh:516
LocalFunctionImpl LocalFunctionImplType
type of local function implementation
Definition: localfunctionadapter.hh:451
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:237
LocalFunctionImpl LocalFunctionImplType
Evaluate class.
Definition: localfunctionadapter.hh:146
Traits::DomainType DomainType
domain type
Definition: localfunctionadapter.hh:167
void initialize(Arg &&, double time)
initialize time
Definition: localfunctionadapter.hh:729
FunctionSpaceType::DomainType DomainType
Definition: localfunctionadapter.hh:64
void initialize(const ArgumentType &arg, double time)
Definition: localfunctionadapter.hh:566
unsigned int order() const
return the order of the space
Definition: localfunctionadapter.hh:286
ArgumentInitializer(const ArgType &arg, double time)
Definition: localfunctionadapter.hh:193
void evaluate(const PointType &x, RangeType &ret) const
evaluate local function
Definition: localfunctionadapter.hh:702
virtual void initialize(LocalFunctionType *lf) const
Definition: localfunctionadapter.hh:200
LocalFunctionAdapterLocalFunction(const EntityType &entity, const DiscreteFunctionType &adapter)
constructor initializing local function
Definition: localfunctionadapter.hh:477
const DiscreteFunctionType & adapter_
Definition: localfunctionadapter.hh:601
GridPartType::template Codim< 0 >::EntityType EntityType
Definition: localfunctionadapter.hh:69
Traits::FunctionSpaceType FunctionSpaceType
Definition: localfunctionadapter.hh:456
FunctionSpaceType::JacobianRangeType JacobianRangeType
Definition: localfunctionadapter.hh:65
void hessian(const PointType &x, HessianRangeType &ret) const
Definition: localfunctionadapter.hh:530
FunctionSpaceType::HessianRangeType HessianRangeType
Definition: localfunctionadapter.hh:66
Traits::RangeType RangeType
range type
Definition: localfunctionadapter.hh:169
DiscreteFunctionSpaceAdapter< FunctionSpaceType, GridPartType > DiscreteFunctionSpaceType
Definition: localfunctionadapter.hh:75
LocalAnalyticalFunctionBinder(ThisType &&)=default
void evaluateQuadrature(const QuadratureType &quad, Vectors &... result) const
Definition: localfunctionadapter.hh:536
Traits::JacobianRangeType JacobianRangeType
jacobian type
Definition: localfunctionadapter.hh:467
LocalAnalyticalFunctionBinder(const ThisType &)=default
~ArgumentInitializer()
Definition: localfunctionadapter.hh:197
std::function< JacobianRangeType(const DomainType &, double, const EntityType &)> AnalyticalJacobianType
Definition: localfunctionadapter.hh:648
const LocalFuncStorageType & localFunctionImpl() const
Definition: localfunctionadapter.hh:590
unsigned int order() const
return order of the space
Definition: localfunctionadapter.hh:509
Traits::EntityType EntityType
type of codim 0 entity
Definition: localfunctionadapter.hh:173
LocalFunctionAdapter(const std::string &name, const GridPartType &gridPart, const std::tuple< Args &... > &args, unsigned int order=DiscreteFunctionSpaceType::polynomialOrder)
Definition: localfunctionadapter.hh:268
const DiscreteFunctionSpaceType & space() const
Definition: localfunctionadapter.hh:333
LocalFunctionAdapterTraits< LocalFunctionImplType > Traits
traits class
Definition: localfunctionadapter.hh:152
std::function< RangeType(const DomainType &, double, const EntityType &)> AnalyticalFunctionType
Definition: localfunctionadapter.hh:647
GridPartType::template Codim< 0 >::IteratorType IteratorType
type of iterator
Definition: localfunctionadapter.hh:71
AnalyticalHessianType & hessian()
get hessian local function
Definition: localfunctionadapter.hh:689
const EntityType & entity() const
get entity
Definition: localfunctionadapter.hh:735
FunctionSpaceType::RangeFieldType RangeFieldType
Definition: localfunctionadapter.hh:61
ThisType & operator=(const ThisType &)=default
void deleteLocalFunction(LocalFunctionType *lf) const
remove LocalFunction to list of local functions
Definition: localfunctionadapter.hh:413
Traits::LocalFuncStorageType LocalFuncStorageType
Definition: localfunctionadapter.hh:206
const AnalyticalJacobianType & jacobian() const
get jacobian local function
Definition: localfunctionadapter.hh:683
DiscreteFunctionSpaceType::FunctionSpaceType FunctionSpaceType
Definition: localfunctionadapter.hh:635
LocalFunctionAdapter(const std::string &name, const GridPartType &gridPart, unsigned int order, Args &... args)
Definition: localfunctionadapter.hh:252
LocalFuncStorageType & localFunctionImpl()
Definition: localfunctionadapter.hh:595
Traits::GridPartType GridPartType
type of grid part
Definition: localfunctionadapter.hh:155
LocalFunctionAdapterTraits< LocalFunctionImplType > Traits
type of the traits class
Definition: localfunctionadapter.hh:454
virtual ~ArgumentIF()
Definition: localfunctionadapter.hh:183
Traits::DiscreteFunctionType DiscreteFunctionType
Definition: localfunctionadapter.hh:471
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:652
const unsigned int order_
Definition: localfunctionadapter.hh:439
Traits::JacobianRangeType JacobianRangeType
jacobian type
Definition: localfunctionadapter.hh:171
GridPartType::IndexSetType IndexSetType
type of IndexSet
Definition: localfunctionadapter.hh:73
const LocalFunctionType localFunction(const EntityType &entity) const
Definition: localfunctionadapter.hh:322
const AnalyticalHessianType & hessian() const
get hessian local function
Definition: localfunctionadapter.hh:695
DiscreteFunctionSpaceImpl DiscreteFunctionSpaceType
Definition: localfunctionadapter.hh:632
bool continuous() const
return true, probably
Definition: localfunctionadapter.hh:292
FunctionSpaceType::HessianRangeType HessianRangeType
Definition: localfunctionadapter.hh:645
DiscreteFunctionType & operator*=(const RangeFieldType &scalar)
multiply all DoFs with a scalar factor
Definition: localfunctionadapter.hh:368
DiscreteFunctionSpaceType space_
Definition: localfunctionadapter.hh:434
const LocalFuncStorageType & localFunctionImpl() const
return local function implementation
Definition: localfunctionadapter.hh:298
FunctionSpaceType::DomainFieldType DomainFieldType
Definition: localfunctionadapter.hh:62
EntityType const * entity_
Definition: localfunctionadapter.hh:600
Traits::LocalFuncStorageType LocalFuncStorageType
Definition: localfunctionadapter.hh:474
const AnalyticalFunctionType & function() const
get local function
Definition: localfunctionadapter.hh:671
FunctionSpaceType::RangeType RangeType
Definition: localfunctionadapter.hh:63
virtual void initialize(LocalFunctionType *) const =0
DiscreteFunctionSpaceType::EntityType EntityType
Definition: localfunctionadapter.hh:637
BaseType::FunctionType FunctionType
type of function
Definition: localfunctionadapter.hh:149
std::set< LocalFunctionType * > lfList_
Definition: localfunctionadapter.hh:436
LocalFuncStorageType localFunctionImpl_
Definition: localfunctionadapter.hh:602
Traits::RangeFieldType RangeFieldType
range type
Definition: localfunctionadapter.hh:165
LocalFunctionImpl::GridPartType GridPartType
Definition: localfunctionadapter.hh:42
const GridPartType & gridPart() const
Definition: localfunctionadapter.hh:338
void evaluate(const DomainType &global, RangeType &result) const
evaluate function on local coordinate local
Definition: localfunctionadapter.hh:310
void initialize(const ArgumentType &arg, double time)
initialize local function with argument and time
Definition: localfunctionadapter.hh:388
LocalFuncStorageType & localFunctionImpl()
return local function implementation
Definition: localfunctionadapter.hh:304
STL namespace.
Definition: bindguard.hh:11
std::tuple_element< i, Tuple >::type & get(Dune::TypeIndexedTuple< Tuple, Types > &tuple)
Definition: typeindexedtuple.hh:122
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:136
Definition: localfunctionadapter.hh:446
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:581
traits of DiscreteFunctionAdapter
Definition: localfunctionadapter.hh:40
Definition: localfunctionadapter.hh:47
Definition: localfunctionadapter.hh:180
Definition: localfunctionadapter.hh:189
LocalAnalyticalFunctionBinder binds a C++ local analytical function (and also its Jacobian and Hessia...
Definition: localfunctionadapter.hh:630
bool continuous() const
returns true if the space contains only globally continuous functions
Definition: discretefunctionspace.hh:1052
const GridPartType & gridPart() const
get a reference to the associated grid partition
Definition: discretefunctionspace.hh:1034