DUNE-FEM (unstable)

localfunctionadapter.hh
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
12#include <dune/fem/function/common/discretefunction.hh>
13#include <dune/fem/storage/entitygeometry.hh>
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 >
47 struct LocalFuncType
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
59 static constexpr bool localFunctionHasCopyConstructor = std::is_copy_constructible<LocalFunctionImpl>::value;
60 typedef typename LocalFuncType< LocalFunctionImpl, localFunctionHasCopyConstructor >::Type LocalFuncStorageType;
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;
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
79 typedef LocalFunctionAdapterLocalFunction< LocalFunctionImpl > LocalFunctionType;
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
156 typedef typename Traits::GridPartType GridPartType;
157
160
162 typedef typename Traits::GridType GridType;
164 typedef typename Traits::DomainFieldType DomainFieldType ;
166 typedef typename Traits::RangeFieldType RangeFieldType ;
168 typedef typename Traits::DomainType DomainType;
170 typedef typename Traits::RangeType RangeType;
172 typedef typename Traits::JacobianRangeType JacobianRangeType;
174 typedef typename Traits::EntityType EntityType;
175
177 typedef typename Traits::LocalFunctionType LocalFunctionType;
178
179 protected:
180 struct ArgumentIF
181 {
182 virtual void initialize( LocalFunctionType* ) const = 0;
183
184 virtual ~ArgumentIF ()
185 {}
186 };
187
188 template <class ArgType>
189 struct ArgumentInitializer : public ArgumentIF
190 {
191 const ArgType arg_;
192 const double time_;
193
194 ArgumentInitializer( const ArgType& arg, double time )
195 : arg_( arg ), time_( time )
196 {}
197
198 ~ArgumentInitializer ()
199 {}
200
201 virtual void initialize( LocalFunctionType* lf ) const
202 {
203 lf->initialize( arg_, time_ );
204 }
205 };
206
207 typedef typename Traits::LocalFuncStorageType LocalFuncStorageType;
208
209 public:
212 LocalFunctionAdapter ( const std::string &name,
214 const GridPartType &gridPart,
215 unsigned int order = DiscreteFunctionSpaceType::polynomialOrder )
216 : space_( gridPart, order ),
217 localFunctionImpl_( localFunctionImpl ),
218 lfList_(),
219 argInitializer_(),
220 name_( name ),
221 order_( order )
222 {}
223
225 LocalFunctionAdapter ( const std::string &name,
227 const GridPartType &gridPart,
228 unsigned int order = DiscreteFunctionSpaceType::polynomialOrder )
229 : space_( gridPart, order ),
230 localFunctionImpl_( localFunctionImpl ),
231 lfList_(),
232 argInitializer_(),
233 name_( name ),
234 order_( order )
235 {}
236
238 LocalFunctionAdapter ( const std::string &name,
240 const GridPartType &gridPart,
241 unsigned int order = DiscreteFunctionSpaceType::polynomialOrder )
242 : space_( gridPart, order ),
243 localFunctionImpl_( localFunctionImpl ),
244 lfList_(),
245 argInitializer_(),
246 name_( name ),
247 order_( order )
248 {}
249
252 template < class ...Args >
253 LocalFunctionAdapter ( const std::string &name,
254 const GridPartType &gridPart,
255 unsigned int order,
256 Args&... args)
257 : space_( gridPart, order ),
258 localFunctionImpl_( args... ),
259 lfList_(),
260 argInitializer_(),
261 name_( name ),
262 order_( order )
263 {}
264
268 template < class ...Args >
269 LocalFunctionAdapter ( const std::string &name,
270 const GridPartType &gridPart,
271 const std::tuple< Args&... > &args,
272 unsigned int order = DiscreteFunctionSpaceType::polynomialOrder )
273 : LocalFunctionAdapter( name, gridPart, args, order,
274 std::make_index_sequence< std::tuple_size< std::tuple<Args&...> >::value >{} )
275 {}
276
277 LocalFunctionAdapter( const ThisType &other )
278 : space_( other.space_ ),
279 localFunctionImpl_( other.localFunctionImpl_ ),
280 lfList_(),
281 argInitializer_(),
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
299 const LocalFuncStorageType& localFunctionImpl() const
300 {
301 return localFunctionImpl_;
302 }
303
305 LocalFuncStorageType& localFunctionImpl()
306 {
307 return localFunctionImpl_;
308 }
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
334 const DiscreteFunctionSpaceType &space () const
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 {
394 argInitializer_ = std::make_unique< ArgumentInitializer< ArgumentType > >( arg, time );
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 {
405 if( Traits::localFunctionHasCopyConstructor )
406 {
407 if( argInitializer_ != nullptr )
408 argInitializer_->initialize( lf );
409 lfList_.insert( lf );
410 }
411 }
412
415 {
416 if( Traits::localFunctionHasCopyConstructor )
417 lfList_.erase( lf );
418 }
419
420 protected:
421 template <class ...Args, std::size_t ...index>
422 LocalFunctionAdapter ( const std::string &name,
423 const GridPartType &gridPart,
424 const std::tuple< Args&... > &args,
425 unsigned int order,
426 std::index_sequence< index... > )
427 : space_( gridPart, order ),
428 localFunctionImpl_( std::get< index >( args )... ),
429 lfList_(),
430 argInitializer_(),
431 name_( name ),
432 order_( order )
433 {}
434
435 DiscreteFunctionSpaceType space_;
436 LocalFuncStorageType localFunctionImpl_;
437 mutable std::set< LocalFunctionType * > lfList_;
438 std::unique_ptr< ArgumentIF > argInitializer_ ;
439 const std::string name_;
440 const unsigned int order_;
441 };
442
443
444
445 template< class LocalFunctionImpl >
446 class LocalFunctionAdapterLocalFunction
447 {
448 typedef LocalFunctionAdapterLocalFunction< LocalFunctionImpl > ThisType;
449
450 public:
452 typedef LocalFunctionImpl LocalFunctionImplType;
453
456
457 typedef typename Traits::FunctionSpaceType FunctionSpaceType;
458
460 typedef typename Traits::DomainFieldType DomainFieldType;
462 typedef typename Traits::RangeFieldType RangeFieldType;
464 typedef typename Traits::DomainType DomainType;
466 typedef typename Traits::RangeType RangeType;
468 typedef typename Traits::JacobianRangeType JacobianRangeType;
470 typedef typename Traits::HessianRangeType HessianRangeType;
471
473 typedef typename Traits::EntityType EntityType;
474 typedef typename EntityType::Geometry Geometry;
475
476 typedef typename Traits::LocalFuncStorageType LocalFuncStorageType;
477
479 LocalFunctionAdapterLocalFunction ( const EntityType &entity, const DiscreteFunctionType &adapter )
480 : adapter_( adapter ), localFunctionImpl_( adapter.localFunctionImpl_ )
481 {
482 // add local function to list
483 adapter_.registerLocalFunction( this );
484 localFunctionImpl().init( entity );
485 }
486
489 : adapter_( adapter ), localFunctionImpl_( adapter.localFunctionImpl_ )
490 {
491 // add local function to list
492 adapter_.registerLocalFunction( this );
493 }
494
496 LocalFunctionAdapterLocalFunction ( const ThisType &other )
497 : adapter_( other.adapter_ ), localFunctionImpl_( other.localFunctionImpl_ )
498 {
499 // add local function to list
500 adapter_.registerLocalFunction( this );
501 }
502
505 {
506 // remove local function from list
507 adapter_.deleteLocalFunction( this );
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:
596 const LocalFuncStorageType& localFunctionImpl() const
597 {
598 return localFunctionImpl_;
599 }
600
601 LocalFuncStorageType& localFunctionImpl()
602 {
603 return localFunctionImpl_;
604 }
605
606 //EntityType const* entity_ = nullptr;
607 const DiscreteFunctionType &adapter_;
608 LocalFuncStorageType localFunctionImpl_;
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
655 typedef std::function<RangeType(const DomainType&,double,const EntityType&)> AnalyticalFunctionType;
656 typedef std::function<JacobianRangeType(const DomainType&,double,const EntityType&)> AnalyticalJacobianType;
657 typedef std::function<HessianRangeType(const DomainType&,double,const EntityType&)> AnalyticalHessianType;
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
667 LocalAnalyticalFunctionBinder(const ThisType& )=default;
668 LocalAnalyticalFunctionBinder(ThisType&& )=default;
669 ThisType& operator=(const ThisType& )=default;
670 ThisType& operator=(ThisType&& )=default;
671
672 using BaseType :: entity;
673 using BaseType :: geometry;
674 using BaseType :: bind;
675 using BaseType :: unbind;
676
678 AnalyticalFunctionType& function()
679 {
680 return f_;
681 }
682
684 const AnalyticalFunctionType& function() const
685 {
686 return f_;
687 }
688
690 AnalyticalJacobianType& jacobian()
691 {
692 return j_;
693 }
694
696 const AnalyticalJacobianType& jacobian() const
697 {
698 return j_;
699 }
700
702 AnalyticalHessianType& hessian()
703 {
704 return h_;
705 }
706
708 const AnalyticalHessianType& hessian() const
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:
754 AnalyticalFunctionType f_;
755 AnalyticalJacobianType j_;
756 AnalyticalHessianType h_;
757 double t_;
758 };
759
760 } // namespace Fem
761
762} // namespace Dune
763
765
766#endif // #ifndef DUNE_FEM_LOCALFUNCTIONADAPTER_HH
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
Traits::FunctionSpaceType FunctionSpaceType
type of function space
Definition: discretefunctionspace.hh:194
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
Definition: explicitfieldvector.hh:75
FunctionSpaceTraits::DomainFieldType DomainFieldType
Intrinsic type used for values in the domain field (usually a double)
Definition: functionspaceinterface.hh:60
FunctionSpaceTraits::RangeType RangeType
Type of range vector (using type of range field) has a Dune::FieldVector type interface.
Definition: functionspaceinterface.hh:71
FunctionSpaceTraits::LinearMappingType JacobianRangeType
Intrinsic type used for the jacobian values has a Dune::FieldMatrix type interface.
Definition: functionspaceinterface.hh:75
FunctionSpaceTraits::DomainType DomainType
Type of domain vector (using type of domain field) has a Dune::FieldVector type interface.
Definition: functionspaceinterface.hh:67
FunctionSpaceTraits::RangeFieldType RangeFieldType
Intrinsic type used for values in the range field (usually a double)
Definition: functionspaceinterface.hh:63
Abstract class representing a function.
Definition: function.hh:50
FunctionImp FunctionType
type of the implementation (Barton-Nackman)
Definition: function.hh:59
base class for determing whether a function has local functions or not
Definition: discretefunction.hh:57
LocalAnalyticalFunctionBinder binds a C++ local analytical function (and also its Jacobian and Hessia...
Definition: localfunctionadapter.hh:637
LocalFunctionAdapter wrapped a class with a local evaluate method into a grid function.
Definition: localfunctionadapter.hh:137
forward declaration
Definition: discretefunction.hh:51
Default exception for dummy implementations.
Definition: exceptions.hh:263
DiscreteFunctionType & operator/=(const RangeFieldType &scalar)
devide all DoFs by a scalar factor
Definition: localfunctionadapter.hh:381
~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
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
Traits::GridType GridType
type of grid
Definition: localfunctionadapter.hh:162
LocalFunctionType localFunction(const EntityType &entity)
obtain a local function for an entity (read-write)
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
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
Traits::DomainType DomainType
domain type
Definition: localfunctionadapter.hh:464
void init(const EntityType &entity)
init local function
Definition: localfunctionadapter.hh:554
LocalFunctionAdapterLocalFunction(const DiscreteFunctionType &adapter)
constructor
Definition: localfunctionadapter.hh:488
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
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
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
unsigned int order() const
return the order of the space
Definition: localfunctionadapter.hh:287
void evaluate(const PointType &x, RangeType &ret) const
evaluate local function
Definition: localfunctionadapter.hh:715
LocalFunctionAdapterLocalFunction(const EntityType &entity, const DiscreteFunctionType &adapter)
constructor initializing local function
Definition: localfunctionadapter.hh:479
Traits::RangeType RangeType
range type
Definition: localfunctionadapter.hh:170
Traits::JacobianRangeType JacobianRangeType
jacobian type
Definition: localfunctionadapter.hh:468
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
LocalFunctionAdapterTraits< LocalFunctionImplType > Traits
traits class
Definition: localfunctionadapter.hh:153
GridPartType::template Codim< 0 >::IteratorType IteratorType
type of iterator
Definition: localfunctionadapter.hh:72
AnalyticalHessianType & hessian()
get hessian local function
Definition: localfunctionadapter.hh:702
void deleteLocalFunction(LocalFunctionType *lf) const
remove LocalFunction to list of local functions
Definition: localfunctionadapter.hh:414
const AnalyticalJacobianType & jacobian() const
get jacobian local function
Definition: localfunctionadapter.hh:696
LocalFunctionAdapter(const std::string &name, const GridPartType &gridPart, unsigned int order, Args &... args)
Definition: localfunctionadapter.hh:253
Traits::GridPartType GridPartType
type of grid part
Definition: localfunctionadapter.hh:156
LocalFunctionAdapterTraits< LocalFunctionImplType > Traits
type of the traits class
Definition: localfunctionadapter.hh:455
const Geometry & geometry() const
get entity
Definition: localfunctionadapter.hh:566
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
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
obtain a local function for an entity (read-write)
Definition: localfunctionadapter.hh:323
const AnalyticalHessianType & hessian() const
get hessian local function
Definition: localfunctionadapter.hh:708
bool continuous() const
return true, probably
Definition: localfunctionadapter.hh:293
DiscreteFunctionType & operator*=(const RangeFieldType &scalar)
multiply all DoFs with a scalar factor
Definition: localfunctionadapter.hh:369
const LocalFuncStorageType & localFunctionImpl() const
return local function implementation
Definition: localfunctionadapter.hh:299
const AnalyticalFunctionType & function() const
get local function
Definition: localfunctionadapter.hh:684
BaseType::FunctionType FunctionType
type of function
Definition: localfunctionadapter.hh:150
Traits::RangeFieldType RangeFieldType
range type
Definition: localfunctionadapter.hh:166
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
#define DUNE_THROW(E, m)
Definition: exceptions.hh:218
decltype(auto) ifElse(const Condition &condition, IfFunc &&ifFunc, ElseFunc &&elseFunc)
A conditional expression.
Definition: hybridutilities.hh:344
Dune namespace.
Definition: alignedallocator.hh:13
constexpr auto get(std::integer_sequence< T, II... >, std::integral_constant< std::size_t, pos >={})
Return the entry at position pos of the given sequence.
Definition: integersequence.hh:22
STL namespace.
Static tag representing a codimension.
Definition: dimension.hh:24
traits of DiscreteFunctionAdapter
Definition: localfunctionadapter.hh:41
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 21, 23:30, 2024)