mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-11-28 03:53:49 -06:00
67c978fe75
i.e., using clang 3.8 to compile the test suite with the following flags: ``` -Weverything -Wno-documentation -Wno-documentation-unknown-command -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-undef -Wno-padded -Wno-global-constructors -Wno-exit-time-destructors -Wno-weak-vtables -Wno-float-equal ``` should not produce any warnings anymore. In my opinion the only flag which would produce beneficial warnings is -Wdocumentation. This has not been fixed in this patch because writing documentation is left for another day (or, more likely, year). note that this patch consists of a heavy dose of the OPM_UNUSED macro and plenty of static_casts (to fix signedness issues). Fixing the singedness issues were quite a nightmare and the fact that the Dune API is quite inconsistent in that regard was not exactly helpful. :/ Finally this patch includes quite a few formatting changes (e.g., all occurences of 'T &t' should be changed to `T& t`) and some fixes for minor issues which I've found during the excercise. I've made sure that all unit tests the test suite still pass successfully and I've made sure that flow_ebos still works for Norne and that it did not regress w.r.t. performance. (Note that this patch does not fix compiler warnings triggered `ebos` and `flow_ebos` but only those caused by the basic infrastructure or the unit tests.) v2: fix the warnings that occur if the dune-localfunctions module is not available. thanks to [at]atgeirr for testing. v3: fix dune 2.3 build issue
118 lines
3.3 KiB
C++
118 lines
3.3 KiB
C++
// -*- 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.
|
|
*/
|
|
#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>
|
|
#include <dune/fem/io/streams/streams.hh>
|
|
|
|
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
|
|
{
|
|
|
|
////////////////////////////////////////////////////////////
|
|
//
|
|
// make_entity for CpGrid entities
|
|
//
|
|
////////////////////////////////////////////////////////////
|
|
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 );
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////
|
|
//
|
|
// GridEntityAccess for CpGrid entities
|
|
//
|
|
////////////////////////////////////////////////////////////
|
|
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;
|
|
}
|
|
};
|
|
|
|
////////////////////////////////////////////////////////////
|
|
//
|
|
// operator << and operator >> for __float128
|
|
//
|
|
////////////////////////////////////////////////////////////
|
|
#if HAVE_QUAD
|
|
template< class Traits >
|
|
inline OutStreamInterface< Traits > &
|
|
operator<< ( OutStreamInterface< Traits >& out,
|
|
const __float128 value )
|
|
{
|
|
double val = double( value );
|
|
out.writeDouble( val );
|
|
return out;
|
|
}
|
|
|
|
template< class Traits >
|
|
inline InStreamInterface< Traits > &
|
|
operator>> ( InStreamInterface< Traits >& in,
|
|
__float128& value )
|
|
{
|
|
double val;
|
|
in.readDouble( val );
|
|
value = val;
|
|
return in;
|
|
}
|
|
#endif
|
|
|
|
} // namespace Fem
|
|
|
|
} // end namespace Dune
|
|
|
|
#endif // #if HAVE_DUNE_FEM
|
|
|
|
#endif // #ifndef EWOMS_DUNE_COMPATIBILITY_HH
|