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 
14 namespace 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 >
46  struct LocalFuncType
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;
59  typedef typename LocalFuncType< LocalFunctionImpl, localFunctionHasCopyConstructor >::Type LocalFuncStorageType;
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;
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 
78  typedef LocalFunctionAdapterLocalFunction< LocalFunctionImpl > LocalFunctionType;
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 
155  typedef typename Traits::GridPartType GridPartType;
156 
159 
161  typedef typename Traits::GridType GridType;
163  typedef typename Traits::DomainFieldType DomainFieldType ;
165  typedef typename Traits::RangeFieldType RangeFieldType ;
167  typedef typename Traits::DomainType DomainType;
169  typedef typename Traits::RangeType RangeType;
171  typedef typename Traits::JacobianRangeType JacobianRangeType;
173  typedef typename Traits::EntityType EntityType;
174 
176  typedef typename Traits::LocalFunctionType LocalFunctionType;
177 
178  protected:
179  struct ArgumentIF
180  {
181  virtual void initialize( LocalFunctionType* ) const = 0;
182 
183  virtual ~ArgumentIF ()
184  {}
185  };
186 
187  template <class ArgType>
188  struct ArgumentInitializer : public ArgumentIF
189  {
190  const ArgType arg_;
191  const double time_;
192 
193  ArgumentInitializer( const ArgType& arg, double time )
194  : arg_( arg ), time_( time )
195  {}
196 
197  ~ArgumentInitializer ()
198  {}
199 
200  virtual void initialize( LocalFunctionType* lf ) const
201  {
202  lf->initialize( arg_, time_ );
203  }
204  };
205 
206  typedef typename Traits::LocalFuncStorageType LocalFuncStorageType;
207 
208  public:
211  LocalFunctionAdapter ( const std::string &name,
213  const GridPartType &gridPart,
214  unsigned int order = DiscreteFunctionSpaceType::polynomialOrder )
215  : space_( gridPart, order ),
216  localFunctionImpl_( localFunctionImpl ),
217  lfList_(),
218  argInitializer_(),
219  name_( name ),
220  order_( order )
221  {}
222 
224  LocalFunctionAdapter ( const std::string &name,
226  const GridPartType &gridPart,
227  unsigned int order = DiscreteFunctionSpaceType::polynomialOrder )
228  : space_( gridPart, order ),
229  localFunctionImpl_( localFunctionImpl ),
230  lfList_(),
231  argInitializer_(),
232  name_( name ),
233  order_( order )
234  {}
235 
237  LocalFunctionAdapter ( const std::string &name,
239  const GridPartType &gridPart,
240  unsigned int order = DiscreteFunctionSpaceType::polynomialOrder )
241  : space_( gridPart, order ),
242  localFunctionImpl_( localFunctionImpl ),
243  lfList_(),
244  argInitializer_(),
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_(),
259  argInitializer_(),
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,
271  unsigned int order = DiscreteFunctionSpaceType::polynomialOrder )
272  : LocalFunctionAdapter( name, gridPart, args, order,
273  std::make_index_sequence< std::tuple_size< std::tuple<Args&...> >::value >{} )
274  {}
275 
276  LocalFunctionAdapter( const ThisType &other )
277  : space_( other.space_ ),
278  localFunctionImpl_( other.localFunctionImpl_ ),
279  lfList_(),
280  argInitializer_(),
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 
298  const LocalFuncStorageType& localFunctionImpl() const
299  {
300  return localFunctionImpl_;
301  }
302 
304  LocalFuncStorageType& localFunctionImpl()
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 
333  const DiscreteFunctionSpaceType &space () const
334  {
335  return space_;
336  }
337 
338  const GridPartType &gridPart () const
339  {
340  return space().gridPart();
341  }
342 
344  template <class DFType>
345  DiscreteFunctionType &operator+= ( const DFType &g )
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  {
404  if( Traits::localFunctionHasCopyConstructor )
405  {
406  if( argInitializer_ != nullptr )
407  argInitializer_->initialize( lf );
408  lfList_.insert( lf );
409  }
410  }
411 
414  {
415  if( Traits::localFunctionHasCopyConstructor )
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_(),
429  argInitializer_(),
430  name_( name ),
431  order_( order )
432  {}
433 
434  DiscreteFunctionSpaceType space_;
435  LocalFuncStorageType localFunctionImpl_;
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 >
445  class LocalFunctionAdapterLocalFunction
446  {
447  typedef LocalFunctionAdapterLocalFunction< LocalFunctionImpl > ThisType;
448 
449  public:
451  typedef LocalFunctionImpl LocalFunctionImplType;
452 
455 
456  typedef typename Traits::FunctionSpaceType FunctionSpaceType;
457 
459  typedef typename Traits::DomainFieldType DomainFieldType;
461  typedef typename Traits::RangeFieldType RangeFieldType;
463  typedef typename Traits::DomainType DomainType;
465  typedef typename Traits::RangeType RangeType;
467  typedef typename Traits::JacobianRangeType JacobianRangeType;
469  typedef typename Traits::HessianRangeType HessianRangeType;
470 
472  typedef typename Traits::EntityType EntityType;
473 
474  typedef typename Traits::LocalFuncStorageType LocalFuncStorageType;
475 
477  LocalFunctionAdapterLocalFunction ( const EntityType &entity, const DiscreteFunctionType &adapter )
478  : adapter_( adapter ), localFunctionImpl_( adapter.localFunctionImpl_ )
479  {
480  // add local function to list
481  adapter_.registerLocalFunction( this );
482  localFunctionImpl().init( entity );
483  }
484 
487  : adapter_( adapter ), localFunctionImpl_( adapter.localFunctionImpl_ )
488  {
489  // add local function to list
490  adapter_.registerLocalFunction( this );
491  }
492 
494  LocalFunctionAdapterLocalFunction ( const ThisType &other )
495  : adapter_( other.adapter_ ), localFunctionImpl_( other.localFunctionImpl_ )
496  {
497  // add local function to list
498  adapter_.registerLocalFunction( this );
499  }
500 
503  {
504  // remove local function from list
505  adapter_.deleteLocalFunction( this );
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:
590  const LocalFuncStorageType& localFunctionImpl() const
591  {
592  return localFunctionImpl_;
593  }
594 
595  LocalFuncStorageType& localFunctionImpl()
596  {
597  return localFunctionImpl_;
598  }
599 
600  EntityType const* entity_ = nullptr;
601  const DiscreteFunctionType &adapter_;
602  LocalFuncStorageType localFunctionImpl_;
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 
659  LocalAnalyticalFunctionBinder(const ThisType& )=default;
660  LocalAnalyticalFunctionBinder(ThisType&& )=default;
661  ThisType& operator=(const ThisType& )=default;
662  ThisType& operator=(ThisType&& )=default;
663 
665  AnalyticalFunctionType& function()
666  {
667  return f_;
668  }
669 
671  const AnalyticalFunctionType& function() const
672  {
673  return f_;
674  }
675 
677  AnalyticalJacobianType& jacobian()
678  {
679  return j_;
680  }
681 
683  const AnalyticalJacobianType& jacobian() const
684  {
685  return j_;
686  }
687 
689  AnalyticalHessianType& hessian()
690  {
691  return h_;
692  }
693 
695  const AnalyticalHessianType& hessian() const
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_;
749  AnalyticalFunctionType f_;
750  AnalyticalJacobianType j_;
751  AnalyticalHessianType h_;
752  double t_;
753  };
754 
755  } // namespace Fem
756 
757 } // namespace Dune
758 
760 
761 #endif // #ifndef DUNE_FEM_LOCALFUNCTIONADAPTER_HH
const GridPartType & gridPart() const
get a reference to the associated grid partition
Definition: discretefunctionspace.hh:1075
bool continuous() const
returns true if the space contains only globally continuous functions
Definition: discretefunctionspace.hh:1093
Traits ::FunctionSpaceType FunctionSpaceType
type of function space
Definition: discretefunctionspace.hh:194
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:630
LocalFunctionAdapter wrapped a class with a local evaluate method into a grid function.
Definition: localfunctionadapter.hh:136
forward declaration
Definition: discretefunction.hh:51
Default exception for dummy implementations.
Definition: exceptions.hh:263
~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
GridPartType ::IndexSetType IndexSetType
type of IndexSet
Definition: localfunctionadapter.hh:73
void init(const EntityType &entity)
initialize entity
Definition: localfunctionadapter.hh:722
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
Traits::GridType GridType
type of grid
Definition: localfunctionadapter.hh:161
LocalFunctionType localFunction(const EntityType &entity)
obtain a local function for an entity (read-write)
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
const EntityType & entity() const
get entity
Definition: localfunctionadapter.hh:735
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
Traits::DomainFieldType DomainFieldType
domain type
Definition: localfunctionadapter.hh:163
DiscreteFunctionType & operator/=(const RangeFieldType &scalar)
devide all DoFs by a scalar factor
Definition: localfunctionadapter.hh:380
LocalFunctionAdapterLocalFunction(const ThisType &other)
copy constructor
Definition: localfunctionadapter.hh:494
Traits::DiscreteFunctionSpaceType DiscreteFunctionSpaceType
type of discrete function space
Definition: localfunctionadapter.hh:158
const LocalFuncStorageType & localFunctionImpl() const
return local function implementation
Definition: localfunctionadapter.hh:298
Traits::DomainType DomainType
domain type
Definition: localfunctionadapter.hh:463
void init(const EntityType &entity)
init local function
Definition: localfunctionadapter.hh:552
const EntityType & entity() const
get entity
Definition: localfunctionadapter.hh:559
LocalFunctionAdapterLocalFunction(const DiscreteFunctionType &adapter)
constructor
Definition: localfunctionadapter.hh:486
const AnalyticalHessianType & hessian() const
get hessian local function
Definition: localfunctionadapter.hh:695
DiscreteFunctionType & operator+=(const DFType &g)
Definition: localfunctionadapter.hh:345
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
GridPartType::template Codim< 0 >::IteratorType IteratorType
type of iterator
Definition: localfunctionadapter.hh:71
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
unsigned int order() const
return the order of the space
Definition: localfunctionadapter.hh:286
void evaluate(const PointType &x, RangeType &ret) const
evaluate local function
Definition: localfunctionadapter.hh:702
LocalFunctionAdapterLocalFunction(const EntityType &entity, const DiscreteFunctionType &adapter)
constructor initializing local function
Definition: localfunctionadapter.hh:477
const std::string & name() const
obtain the name of the discrete function
Definition: localfunctionadapter.hh:328
Traits::RangeType RangeType
range type
Definition: localfunctionadapter.hh:169
AnalyticalHessianType & hessian()
get hessian local function
Definition: localfunctionadapter.hh:689
Traits::JacobianRangeType JacobianRangeType
jacobian type
Definition: localfunctionadapter.hh:467
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
LocalFunctionAdapterTraits< LocalFunctionImplType > Traits
traits class
Definition: localfunctionadapter.hh:152
DiscreteFunctionType & operator-=(const DFType &g)
substract all degrees of freedom from given discrete function using the dof iterators
Definition: localfunctionadapter.hh:356
void deleteLocalFunction(LocalFunctionType *lf) const
remove LocalFunction to list of local functions
Definition: localfunctionadapter.hh:413
LocalFunctionAdapter(const std::string &name, const GridPartType &gridPart, unsigned int order, Args &... args)
Definition: localfunctionadapter.hh:252
Traits::GridPartType GridPartType
type of grid part
Definition: localfunctionadapter.hh:155
LocalFunctionAdapterTraits< LocalFunctionImplType > Traits
type of the traits class
Definition: localfunctionadapter.hh:454
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
Traits::JacobianRangeType JacobianRangeType
jacobian type
Definition: localfunctionadapter.hh:171
LocalFuncStorageType & localFunctionImpl()
return local function implementation
Definition: localfunctionadapter.hh:304
const LocalFunctionType localFunction(const EntityType &entity) const
obtain a local function for an entity (read-write)
Definition: localfunctionadapter.hh:322
bool continuous() const
return true, probably
Definition: localfunctionadapter.hh:292
AnalyticalJacobianType & jacobian()
get jacobian local function
Definition: localfunctionadapter.hh:677
DiscreteFunctionType & operator*=(const RangeFieldType &scalar)
multiply all DoFs with a scalar factor
Definition: localfunctionadapter.hh:368
BaseType::FunctionType FunctionType
type of function
Definition: localfunctionadapter.hh:149
Traits::RangeFieldType RangeFieldType
range type
Definition: localfunctionadapter.hh:165
const AnalyticalJacobianType & jacobian() const
get jacobian local function
Definition: localfunctionadapter.hh:683
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
#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
Static tag representing a codimension.
Definition: dimension.hh:24
traits of DiscreteFunctionAdapter
Definition: localfunctionadapter.hh:40
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.80.0 (May 16, 22:29, 2024)