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

Implemented eval and evaluate for DiscreteFunctionDefault so that they fail with a proper assert

[[Imported from SVN: r2710]]
parent 2cd23e35
Branches
Tags
No related merge requests found
......@@ -12,6 +12,24 @@ namespace Dune
//************************************************************
// Default Implementations
//************************************************************
template <class DiscreteFunctionTraits>
void DiscreteFunctionDefault<DiscreteFunctionTraits>::clear() {
DofIteratorType endit = this->dend();
for (DofIteratorType it = this->dbegin(); it != endit; ++it) {
*it = 0.0;
}
}
template <class DiscreteFunctionTraits>
void DiscreteFunctionDefault<DiscreteFunctionTraits>::
addScaled(const DiscreteFunctionType& g, const RangeFieldType& c) {
DofIteratorType endit = this->dend();
ConstDofIteratorType oit = g.dbegin();
for (DofIteratorType it = this->dbegin(); it != endit; ++it, ++oit) {
*it += *oit*c;
}
}
// scalarProductDofs
template <class DiscreteFunctionTraits>
inline typename DiscreteFunctionTraits::DiscreteFunctionSpaceType::RangeFieldType
......
......@@ -91,11 +91,6 @@ namespace Dune {
return asImp().name();
}
//! Continuous data
bool continuous() const {
return asImp().continuous();
}
//! the implementation of an iterator to iterate efficient
//! over all dofs of a discrete function
DofIteratorType dbegin ()
......@@ -210,6 +205,17 @@ namespace Dune {
DiscreteFunctionDefault (const DiscreteFunctionSpaceType & f ) :
DiscreteFunctionInterfaceType ( f ) {}
//! Continuous data
bool continuous() const {
return this->functionSpace_.continuous();
}
//! Set all elements to zero
void clear();
//! daxpy operation
void addScaled(const DiscreteFunctionType& g, const RangeFieldType& c);
//! Evaluate a scalar product of the dofs of two DiscreteFunctions
//! on the top level of the underlying grid
RangeFieldType scalarProductDofs(const DiscreteFunctionType& g) const;
......@@ -235,6 +241,20 @@ namespace Dune {
DiscreteFunctionType&
add(const DiscreteFunctionType &g , RangeFieldType scalar );
//! evaluate Function (which just dies because there is no meaningful implementation)
void eval(const DomainType & arg, RangeType & dest) const {
// Die a horrible death! Never call that one...
assert(false);
}
//! evaluate function and derivatives (just dies)
template <int derivation>
void evaluate ( const FieldVector<deriType, derivation> &diffVariable,
const DomainType& arg, RangeType & dest) const {
// Die a horrible death! Never call that one...
assert(false);
}
private:
// Barton-Nackman trick
DiscreteFunctionType &asImp()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment