diff --git a/common/function.hh b/common/function.hh index 8f58b1611b19be8d71acbdccdc73a1521d1d54ed..ece09c18b778ce3e226b764b8fd30a751ce8f7f1 100644 --- a/common/function.hh +++ b/common/function.hh @@ -44,20 +44,34 @@ namespace Dune { //! Constructor Function (const FunctionSpaceType & f) : functionSpace_ (f) {} ; + //! application operator + virtual void operator()(const Domain & arg, Range & dest) const { + eval(arg,dest); + } + //! evaluate Function - void eval (const Domain & , Range &) const ; + void eval(const Domain & arg, Range & dest) const { + asImp().eval(arg, dest); + } //! evaluate function and derivatives template <int derivation> - - //! ??? void evaluate ( const FieldVector<deriType, derivation> &diffVariable, - const Domain & , Range &) const {}; + const Domain& arg, Range & dest) const { + asImp().evaluate(diffVariable, arg, dest); + } //! Get access to the related function space const FunctionSpaceType& getFunctionSpace() const { return functionSpace_; } protected: + //! Barton-Nackman trick + FunctionImp& asImp() { + return static_cast<FunctionImp&>(*this); + } + const FunctionImp& asImp() const { + return static_cast<const FunctionImp&>(*this); + } //! The related function space const FunctionSpaceType & functionSpace_; diff --git a/common/genericiterator.hh b/common/genericiterator.hh index 7d2966cde16cb4359a4913bc0d9fbfc866a08e26..edd843c6baf6fed252d55849c70ff946b7bfba9b 100644 --- a/common/genericiterator.hh +++ b/common/genericiterator.hh @@ -7,8 +7,7 @@ #include <dune/common/iteratorfacades.hh> #include <cassert> -namespace Dune -{ +namespace Dune { /*! \defgroup GenericIterator GenericIterator \ingroup IteratorFacades @@ -87,7 +86,8 @@ namespace Dune * */ template<class C, class T> - class GenericIterator : public Dune::RandomAccessIteratorFacade<GenericIterator<C,T>,T, T&, int> + class GenericIterator : + public Dune::RandomAccessIteratorFacade<GenericIterator<C,T>,T, T&, int> { friend class GenericIterator<typename Dune::RemoveConst<C>::Type, typename Dune::RemoveConst<T>::Type >; friend class GenericIterator<const typename Dune::RemoveConst<C>::Type, const typename Dune::RemoveConst<T>::Type >; @@ -161,6 +161,6 @@ namespace Dune /** @} */ -} +} // end namespace Dune #endif diff --git a/common/interfaces.hh b/common/interfaces.hh new file mode 100644 index 0000000000000000000000000000000000000000..e0e835d62931599e680a227eb6a341b614f4d885 --- /dev/null +++ b/common/interfaces.hh @@ -0,0 +1,15 @@ +// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- +// vi: set et ts=4 sw=2 sts=2: +#ifndef DUNE_INTERFACES_HH +#define DUNE_INTERFACES_HH + +namespace Dune { + + //! An interface class for cloneable objects + struct Cloneable { + virtual Cloneable* clone() const = 0; + }; + +} // end namespace Dune + +#endif