Skip to content
Snippets Groups Projects

Add generalized derivative and local-to-global adapter to handle the global derivatives uniformly

Merged Praetorius, Simon requested to merge feature/gridfunctions_localtoglobal_adaptor into master
4 unresolved threads
Files
25
+ 58
0
#pragma once
#include <dune/functions/common/defaultderivativetraits.hh>
namespace Dune
{
template <class K, int n>
class FieldVector;
template <class K, int n, int m>
class FieldMatrix;
}
namespace AMDiS
{
namespace tag
{
struct gradient {};
struct divergence {};
struct partial { std::size_t comp = 0; };
// register possible types for derivative traits
struct derivative_type : gradient, divergence, partial {};
}
template <class Sig, class Type>
struct DerivativeTraits;
template <class R, class D>
struct DerivativeTraits<R(D), tag::gradient>
: public Dune::Functions::DefaultDerivativeTraits<R(D)>
{};
template <class R, class D>
struct DerivativeTraits<R(D), tag::partial>
{
using Range = R;
};
template <class K, class D>
struct DerivativeTraits<K(D), tag::divergence>
{
// error
};
template <class K, int n, class D>
struct DerivativeTraits<Dune::FieldVector<K,n>(D), tag::divergence>
{
using Range = K;
};
template <class K, int n, int m, class D>
struct DerivativeTraits<Dune::FieldMatrix<K,n,m>(D), tag::divergence>
{
using Range = Dune::FieldVector<K,m>;
};
} // end namespace AMDiS
\ No newline at end of file
Loading