Skip to content
Snippets Groups Projects
Commit fa8d3dc2 authored by Adrian Burri's avatar Adrian Burri
Browse files

File for (java-like) interfaces.\nAdded Cloneable interface

[[Imported from SVN: r1639]]
parent 34afe99c
No related branches found
No related tags found
No related merge requests found
......@@ -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_;
......
......@@ -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
// -*- 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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment