diff --git a/ewoms/aux/compatibility.hh b/ewoms/aux/compatibility.hh new file mode 100644 index 000000000..63821aac9 --- /dev/null +++ b/ewoms/aux/compatibility.hh @@ -0,0 +1,56 @@ +#ifndef EWOMS_DUNE_COMPATIBILITY_HH +#define EWOMS_DUNE_COMPATIBILITY_HH + +#if HAVE_DUNE_FEM +#include +#include + +namespace Dune +{ + + namespace cpgrid + { + template + class Entity; + + template + class EntityPointer; + + } + + // specialization of dune-fem compatiblity functions for CpGrid, since CpGrid does not use the interface classes. + namespace Fem + { + + template + inline Dune::cpgrid::Entity< codim > make_entity ( const Dune::cpgrid::EntityPointer< codim >& entityPointer ) + { + return *entityPointer; + } + + template + inline Dune::cpgrid::Entity make_entity ( Dune::cpgrid::Entity entity ) + { + return std::move( entity ); + } + + template< int codim > + struct GridEntityAccess< Dune::cpgrid::Entity< codim > > + { + + typedef Dune::cpgrid::Entity< codim > EntityType; + typedef EntityType GridEntityType; + + static const GridEntityType &gridEntity ( const EntityType &entity ) + { + return entity; + } + }; + + } // namespace Fem + +} // end namespace Dune + +#endif // #if HAVE_DUNE_FEM + +#endif // #ifndef EWOMS_DUNE_COMPATIBILITY_HH