2016-03-14 07:21:47 -05:00
|
|
|
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
|
|
|
// vi: set et ts=4 sw=4 sts=4:
|
|
|
|
/*
|
|
|
|
This file is part of the Open Porous Media project (OPM).
|
|
|
|
|
|
|
|
OPM is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
OPM is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
Consult the COPYING file in the top-level source directory of this
|
|
|
|
module for the precise wording of the license and the list of
|
|
|
|
copyright holders.
|
|
|
|
*/
|
2015-08-05 11:17:18 -05:00
|
|
|
#ifndef EWOMS_DUNE_COMPATIBILITY_HH
|
|
|
|
#define EWOMS_DUNE_COMPATIBILITY_HH
|
|
|
|
|
|
|
|
#if HAVE_DUNE_FEM
|
|
|
|
#include <dune/fem/gridpart/common/gridpart.hh>
|
|
|
|
#include <dune/fem/misc/compatibility.hh>
|
2015-08-06 06:11:51 -05:00
|
|
|
#include <dune/fem/io/streams/streams.hh>
|
2015-08-05 11:17:18 -05:00
|
|
|
|
|
|
|
namespace Dune
|
|
|
|
{
|
|
|
|
|
|
|
|
namespace cpgrid
|
|
|
|
{
|
|
|
|
template <int codim>
|
|
|
|
class Entity;
|
|
|
|
|
|
|
|
template <int codim>
|
|
|
|
class EntityPointer;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// specialization of dune-fem compatiblity functions for CpGrid, since CpGrid does not use the interface classes.
|
|
|
|
namespace Fem
|
|
|
|
{
|
|
|
|
|
2015-08-06 06:11:51 -05:00
|
|
|
////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// make_entity for CpGrid entities
|
|
|
|
//
|
|
|
|
////////////////////////////////////////////////////////////
|
2015-08-05 11:17:18 -05:00
|
|
|
template <int codim>
|
|
|
|
inline Dune::cpgrid::Entity< codim > make_entity ( const Dune::cpgrid::EntityPointer< codim >& entityPointer )
|
|
|
|
{
|
|
|
|
return *entityPointer;
|
|
|
|
}
|
|
|
|
|
|
|
|
template <int codim>
|
|
|
|
inline Dune::cpgrid::Entity<codim> make_entity ( Dune::cpgrid::Entity<codim> entity )
|
|
|
|
{
|
|
|
|
return std::move( entity );
|
|
|
|
}
|
|
|
|
|
2015-08-06 06:11:51 -05:00
|
|
|
////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// GridEntityAccess for CpGrid entities
|
|
|
|
//
|
|
|
|
////////////////////////////////////////////////////////////
|
2015-08-05 11:17:18 -05:00
|
|
|
template< int codim >
|
|
|
|
struct GridEntityAccess< Dune::cpgrid::Entity< codim > >
|
|
|
|
{
|
|
|
|
|
|
|
|
typedef Dune::cpgrid::Entity< codim > EntityType;
|
|
|
|
typedef EntityType GridEntityType;
|
|
|
|
|
2016-11-07 08:14:07 -06:00
|
|
|
static const GridEntityType& gridEntity ( const EntityType& entity )
|
2015-08-05 11:17:18 -05:00
|
|
|
{
|
|
|
|
return entity;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-08-06 06:11:51 -05:00
|
|
|
////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// operator << and operator >> for __float128
|
|
|
|
//
|
|
|
|
////////////////////////////////////////////////////////////
|
|
|
|
#if HAVE_QUAD
|
|
|
|
template< class Traits >
|
|
|
|
inline OutStreamInterface< Traits > &
|
2016-11-07 08:14:07 -06:00
|
|
|
operator<< ( OutStreamInterface< Traits >& out,
|
2015-08-06 06:11:51 -05:00
|
|
|
const __float128 value )
|
|
|
|
{
|
|
|
|
double val = double( value );
|
|
|
|
out.writeDouble( val );
|
|
|
|
return out;
|
|
|
|
}
|
|
|
|
|
|
|
|
template< class Traits >
|
|
|
|
inline InStreamInterface< Traits > &
|
2016-11-07 08:14:07 -06:00
|
|
|
operator>> ( InStreamInterface< Traits >& in,
|
2015-08-06 06:11:51 -05:00
|
|
|
__float128& value )
|
|
|
|
{
|
|
|
|
double val;
|
|
|
|
in.readDouble( val );
|
|
|
|
value = val;
|
|
|
|
return in;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2015-08-05 11:17:18 -05:00
|
|
|
} // namespace Fem
|
|
|
|
|
|
|
|
} // end namespace Dune
|
|
|
|
|
|
|
|
#endif // #if HAVE_DUNE_FEM
|
|
|
|
|
|
|
|
#endif // #ifndef EWOMS_DUNE_COMPATIBILITY_HH
|