2
0
mirror of https://github.com/boostorg/odeint.git synced 2026-01-19 04:22:12 +00:00

Various warning fixes

This commit is contained in:
Matt Borland
2023-12-18 11:16:19 +01:00
parent 3dd53fea79
commit 291acb4ca0
24 changed files with 72 additions and 76 deletions

View File

@@ -46,7 +46,7 @@ typedef double value_type;
struct lorenz
{
template< class State , class Deriv , class Value >
void operator()( const State &_x , Deriv &_dxdt , const Value &dt ) const
void operator()( const State &_x , Deriv &_dxdt , const Value &/*dt*/ ) const
{
const value_type sigma = 10.0;
const value_type R = 28.0;

View File

@@ -34,7 +34,7 @@ typedef double value_type;
struct lorenz
{
template< class State , class Deriv , class Value >
void operator()( const State &_x , Deriv &_dxdt , const Value &dt ) const
void operator()( const State &_x , Deriv &_dxdt , const Value &/*dt*/ ) const
{
const value_type sigma = 10.0;
const value_type R = 28.0;

View File

@@ -40,7 +40,7 @@ typedef double value_type;
struct lorenz
{
template< class State , class Deriv , class Value >
void operator()( const State &_x , Deriv &_dxdt , const Value &dt ) const
void operator()( const State &_x , Deriv &_dxdt , const Value &/*dt*/ ) const
{
const value_type sigma = 10.0;
const value_type R = 28.0;

View File

@@ -48,7 +48,7 @@ const double b = 8.0 / 3.0;
struct lorenz
{
template< class State , class Deriv >
void operator()( const State &x , Deriv &dxdt , double t ) const
void operator()( const State &x , Deriv &dxdt , double /*t*/ ) const
{
dxdt[0] = sigma * ( x[1] - x[0] );
dxdt[1] = R * x[0] - x[1] - x[0] * x[2];
@@ -59,7 +59,7 @@ struct lorenz
struct const_system
{
template< class State , class Deriv >
void operator()( const State &x , Deriv &dxdt , double t ) const
void operator()( const State &/*x*/ , Deriv &dxdt , double /*t*/ ) const
{
dxdt[0] = 1.0;
dxdt[1] = 1.0;
@@ -70,7 +70,7 @@ struct const_system
struct sin_system
{
template< class State , class Deriv >
void operator()( const State &x , Deriv &dxdt , double t ) const
void operator()( const State &x , Deriv &dxdt , double /*t*/ ) const
{
dxdt[0] = sin( x[0] );
dxdt[1] = cos( x[1] );

View File

@@ -16,7 +16,7 @@ using namespace boost::numeric::odeint;
struct const_sys
{
template< class State , class Deriv , class Value >
void operator()( const State &x , Deriv &dxdt , const Value &dt ) const
void operator()( const State &/*x*/ , Deriv &dxdt , const Value &/*dt*/ ) const
{
dxdt[0] = 1;
}

View File

@@ -21,7 +21,7 @@
#include <complex>
#include <boost/test/unit_test.hpp>
#include <boost/test/floating_point_comparison.hpp>
#include <boost/test/tools/floating_point_comparison.hpp>
#include <boost/units/systems/si/length.hpp>
#include <boost/units/systems/si/time.hpp>

View File

@@ -31,7 +31,7 @@
struct constant_system_functor_standard
{
template< class State , class Deriv , class Time >
void operator()( const State &x , Deriv &dxdt , const Time t ) const
void operator()( const State &/*x*/ , Deriv &dxdt , const Time /*t*/ ) const
{
dxdt[0] = 1.0;
}
@@ -40,7 +40,7 @@ struct constant_system_functor_standard
struct constant_system_functor_vector_space
{
template< class State , class Deriv , class Time >
void operator()( const State &x , Deriv &dxdt , const Time t ) const
void operator()( const State &/*x*/ , Deriv &dxdt , const Time /*t*/ ) const
{
dxdt = 1.0;
}
@@ -49,7 +49,7 @@ struct constant_system_functor_vector_space
struct constant_system_functor_fusion
{
template< class State , class Deriv , class Time >
void operator()( const State &x , Deriv &dxdt , const Time t ) const
void operator()( const State &x , Deriv &dxdt , const Time /*t*/ ) const
{
boost::fusion::at_c< 0 >( dxdt ) = boost::fusion::at_c< 0 >( x ) / Time( 1.0 );
}
@@ -58,7 +58,7 @@ struct constant_system_functor_fusion
struct lorenz
{
template< typename State , typename Deriv , typename Time >
void operator()( const State& x , Deriv& dxdt , const Time& t ) const
void operator()( const State& x , Deriv& dxdt , const Time& /*t*/ ) const
{
const Time sigma = 10.0;
const Time R = 28.0;
@@ -70,19 +70,19 @@ struct lorenz
};
template< class State , class Deriv , class Time >
void constant_system_standard( const State &x , Deriv &dxdt , const Time t )
void constant_system_standard( const State &/*x*/ , Deriv &dxdt , const Time /*t*/ )
{
dxdt[0] = 1.0;
}
template< class State , class Deriv , class Time >
void constant_system_vector_space( const State &x , Deriv &dxdt , const Time t )
void constant_system_vector_space( const State &/*x*/ , Deriv &dxdt , const Time /*t*/ )
{
dxdt = 1.0;
}
template< class State , class Deriv , class Time >
void constant_system_fusion( const State &x , Deriv &dxdt , const Time t )
void constant_system_fusion( const State &x , Deriv &dxdt , const Time /*t*/ )
{
boost::fusion::at_c< 0 >( dxdt ) = boost::fusion::at_c< 0 >( x ) / Time( 1.0 );
}
@@ -96,7 +96,7 @@ void constant_system_fusion( const State &x , Deriv &dxdt , const Time t )
struct constant_mom_func
{
template< class StateIn , class StateOut >
void operator()( const StateIn &q , StateOut &dp ) const
void operator()( const StateIn &/*q*/ , StateOut &dp ) const
{
dp[0] = 1.0;
}
@@ -116,7 +116,7 @@ struct default_coor_func
struct constant_mom_func_vector_space_1d
{
template< class T >
void operator()( const T &q , T &dp ) const
void operator()( const T &/*q*/ , T &dp ) const
{
dp = 1.0;
}
@@ -140,7 +140,7 @@ struct default_coor_func_vector_space_1d
struct empty_system
{
template <class State >
void operator()( const State &x , State &dxdt , double t ) const
void operator()( const State &/*x*/ , State &/*dxdt*/ , double /*t*/ ) const
{
}
};

View File

@@ -68,7 +68,7 @@ typedef my_vec state_type;
/* use functors, because functions don't work with msvc 10, I guess this is a bug */
struct sys
{
void operator()( const state_type &x , state_type &dxdt , const value_type t ) const
void operator()( const state_type &x , state_type &dxdt , const value_type ) const
{
std::cout << "sys start " << dxdt.size() << std::endl;
dxdt[0] = x[0] + 2 * x[1];

View File

@@ -42,7 +42,7 @@ namespace fusion = boost::fusion;
typedef double value_type;
typedef boost::array< value_type , 2 > state_type;
void sys( const state_type &x , state_type &dxdt , const value_type &t )
void sys( const state_type &x , state_type &dxdt , const value_type &/*t*/ )
{
dxdt[ 0 ] = x[ 0 ] + 2 * x[ 1 ];
dxdt[ 1 ] = x[ 1 ];
@@ -81,9 +81,6 @@ BOOST_AUTO_TEST_CASE( test_generic_error_stepper )
rk54_ck_type rk54_ck = rk54_ck_;
typedef error_rk_generic_type::state_type state_type;
typedef error_rk_generic_type::value_type stepper_value_type;
typedef error_rk_generic_type::deriv_type deriv_type;
typedef error_rk_generic_type::time_type time_type;
state_type x = {{ 0.0 , 1.0 }};
state_type y = x;

View File

@@ -41,7 +41,7 @@ namespace fusion = boost::fusion;
typedef double value_type;
typedef boost::array< value_type , 2 > state_type;
void sys( const state_type &x , state_type &dxdt , const value_type &t )
void sys( const state_type &x , state_type &dxdt , const value_type &/*t*/ )
{
dxdt[ 0 ] = x[ 0 ] + 2 * x[ 1 ];
dxdt[ 1 ] = x[ 1 ];
@@ -77,9 +77,6 @@ BOOST_AUTO_TEST_CASE( test_generic_stepper )
rk4_type rk4 = rk4_;
typedef rk_generic_type::state_type state_type;
typedef rk_generic_type::value_type stepper_value_type;
typedef rk_generic_type::deriv_type deriv_type;
typedef rk_generic_type::time_type time_type;
state_type x = {{ 0.0 , 1.0 }};
state_type y = x;

View File

@@ -44,7 +44,7 @@ typedef boost::numeric::ublas::matrix< value_type > matrix_type;
/* use functors, because functions don't work with msvc 10, I guess this is a bug */
struct sys
{
void operator()( const state_type &x , state_type &dxdt , const value_type t ) const
void operator()( const state_type &x , state_type &dxdt , const value_type /*t*/ ) const
{
dxdt( 0 ) = x( 0 ) + 2 * x( 1 );
dxdt( 1 ) = x( 1 );
@@ -53,7 +53,7 @@ struct sys
struct jacobi
{
void operator()( const state_type &x , matrix_type &jacobi , const value_type t ) const
void operator()( const state_type &/*x*/ , matrix_type &jacobi , const value_type /*t*/ ) const
{
jacobi( 0 , 0 ) = 1;
jacobi( 0 , 1 ) = 2;

View File

@@ -69,7 +69,7 @@ namespace mpl = boost::mpl;
typedef double value_type;
typedef std::vector< value_type > state_type;
void lorenz( const state_type &x , state_type &dxdt , const value_type t )
void lorenz( const state_type &x , state_type &dxdt , const value_type /*t*/ )
{
//const value_type sigma( 10.0 );
const value_type R( 28.0 );

View File

@@ -59,7 +59,7 @@ typedef boost::numeric::ublas::matrix< value_type > matrix_type;
struct sys
{
void operator()( const state_type &x , state_type &dxdt , const value_type &t ) const
void operator()( const state_type &x , state_type &dxdt , const value_type &/*t*/ ) const
{
dxdt( 0 ) = x( 0 ) + 2 * x( 1 );
dxdt( 1 ) = x( 1 );
@@ -68,7 +68,7 @@ struct sys
struct jacobi
{
void operator()( const state_type &x , matrix_type &jacobi , const value_type &t , state_type &dfdt ) const
void operator()( const state_type &/*x*/ , matrix_type &jacobi , const value_type &/*t*/ , state_type &dfdt ) const
{
jacobi( 0 , 0 ) = 1;
jacobi( 0 , 1 ) = 2;
@@ -86,7 +86,7 @@ struct push_back_time
push_back_time( std::vector< double > &times )
: m_times( times ) { }
void operator()( const state_type &x , double t )
void operator()( const state_type &/*x*/ , double t )
{
m_times.push_back( t );
}

View File

@@ -67,7 +67,7 @@ struct push_back_time
push_back_time( std::vector< double > &times )
: m_times( times ) { }
void operator()( const state_type &x , double t )
void operator()( const state_type &/*x*/ , double t )
{
m_times.push_back( t );
}

View File

@@ -20,6 +20,18 @@
#pragma warning(disable:4996)
#endif
// Need this PR to be merged to actually fix the issue: https://github.com/boostorg/ublas/pull/153
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-copy-with-user-provided-copy"
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-copy-with-user-provided-copy"
#elif defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable : 5267)
#endif
#define BOOST_TEST_MODULE odeint_is_resizeable
#include <vector>
@@ -97,7 +109,6 @@ BOOST_AUTO_TEST_CASE( test_fusion_quantity_sequence )
namespace si = boost::units::si;
typedef double value_type;
typedef units::quantity< si::time , value_type > time_type;
typedef units::quantity< si::length , value_type > length_type;
typedef units::quantity< si::velocity , value_type > velocity_type;
typedef boost::fusion::vector< length_type , velocity_type > state_type;
@@ -113,4 +124,12 @@ BOOST_AUTO_TEST_CASE( test_my_seq1 )
BOOST_AUTO_TEST_CASE( test_my_seq2 )
{
BOOST_CHECK( is_resizeable< my_seq2< double > >::value );
}
}
#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#elif defined(_MSC_VER)
#pragma warning(pop)
#endif

View File

@@ -23,7 +23,7 @@
#include <boost/array.hpp>
#include <boost/test/unit_test.hpp>
#include <boost/test/floating_point_comparison.hpp>
#include <boost/test/tools/floating_point_comparison.hpp>
#include <boost/units/systems/si/length.hpp>
#include <boost/units/systems/si/time.hpp>

View File

@@ -88,7 +88,6 @@ BOOST_AUTO_TEST_CASE( test_fusion_quantity_sequence )
namespace si = boost::units::si;
typedef double value_type;
typedef units::quantity< si::time , value_type > time_type;
typedef units::quantity< si::length , value_type > length_type;
typedef units::quantity< si::velocity , value_type > velocity_type;
typedef boost::fusion::vector< length_type , velocity_type > state_type;

View File

@@ -26,7 +26,7 @@
#include <cmath>
#include <boost/array.hpp>
#include <boost/bind.hpp>
#include <boost/bind/bind.hpp>
#include <boost/utility.hpp>
#include <boost/type_traits/integral_constant.hpp>
@@ -48,6 +48,7 @@
using namespace boost::unit_test;
using namespace boost::numeric::odeint;
using namespace boost::placeholders;
namespace mpl = boost::mpl;
@@ -56,7 +57,7 @@ namespace mpl = boost::mpl;
void constant_system( const test_array_type &x , test_array_type &dxdt , double t ) { dxdt[0] = 1.0; }
void constant_system( const test_array_type & , test_array_type &dxdt , double ) { dxdt[0] = 1.0; }
BOOST_AUTO_TEST_SUITE( check_resize_test )

View File

@@ -46,7 +46,7 @@ namespace odeint {
template<>
struct same_size_impl< test_array_type , test_array_type >
{
static bool same_size( const test_array_type &x1 , const test_array_type &x2 )
static bool same_size( const test_array_type &/*x1*/ , const test_array_type & /*x2*/ )
{
return false;
}
@@ -55,7 +55,7 @@ namespace odeint {
template<>
struct resize_impl< test_array_type , test_array_type >
{
static void resize( test_array_type &x1 , const test_array_type &x2 )
static void resize( test_array_type & /*x1*/, const test_array_type & /*x2*/)
{
adjust_size_count++;
}

View File

@@ -44,7 +44,7 @@ typedef boost::numeric::ublas::matrix< value_type > matrix_type;
struct sys
{
void operator()( const state_type &x , state_type &dxdt , const value_type &t ) const
void operator()( const state_type &x , state_type &dxdt , const value_type &/*t*/ ) const
{
dxdt( 0 ) = x( 0 ) + 2 * x( 1 );
dxdt( 1 ) = x( 1 );
@@ -53,7 +53,7 @@ struct sys
struct jacobi
{
void operator()( const state_type &x , matrix_type &jacobi , const value_type &t , state_type &dfdt ) const
void operator()( const state_type &/*x*/ , matrix_type &jacobi , const value_type &/*t*/ , state_type &dfdt ) const
{
jacobi( 0 , 0 ) = 1;
jacobi( 0 , 1 ) = 2;
@@ -72,9 +72,6 @@ BOOST_AUTO_TEST_CASE( test_rosenbrock4_stepper )
stepper_type stepper;
typedef stepper_type::state_type state_type;
typedef stepper_type::value_type stepper_value_type;
typedef stepper_type::deriv_type deriv_type;
typedef stepper_type::time_type time_type;
state_type x( 2 ) , xerr( 2 );
x(0) = 0.0; x(1) = 1.0;
@@ -98,9 +95,6 @@ BOOST_AUTO_TEST_CASE( test_rosenbrock4_controller )
stepper_type stepper;
typedef stepper_type::state_type state_type;
typedef stepper_type::value_type stepper_value_type;
typedef stepper_type::deriv_type deriv_type;
typedef stepper_type::time_type time_type;
state_type x( 2 );
x( 0 ) = 0.0 ; x(1) = 1.0;
@@ -117,9 +111,7 @@ BOOST_AUTO_TEST_CASE( test_rosenbrock4_dense_output )
stepper_type stepper( c_stepper );
typedef stepper_type::state_type state_type;
typedef stepper_type::value_type stepper_value_type;
typedef stepper_type::deriv_type deriv_type;
typedef stepper_type::time_type time_type;
state_type x( 2 );
x( 0 ) = 0.0 ; x(1) = 1.0;
stepper.initialize( x , 0.0 , 0.1 );
@@ -143,9 +135,7 @@ BOOST_AUTO_TEST_CASE( test_rosenbrock4_dense_output_ref )
stepper_type stepper( boost::ref( c_stepper ) );
typedef stepper_type::state_type state_type;
typedef stepper_type::value_type stepper_value_type;
typedef stepper_type::deriv_type deriv_type;
typedef stepper_type::time_type time_type;
state_type x( 2 );
x( 0 ) = 0.0 ; x(1) = 1.0;
stepper.initialize( x , 0.0 , 0.1 );

View File

@@ -45,7 +45,7 @@ typedef boost::numeric::ublas::matrix< value_type > matrix_type;
struct sys
{
void operator()( const state_type &x , state_type &dxdt , const value_type &t ) const
void operator()( const state_type &x , state_type &dxdt , const value_type &/*t*/ ) const
{
dxdt( 0 ) = x( 0 ) + 2 * x( 1 );
dxdt( 1 ) = x( 1 );
@@ -54,7 +54,7 @@ struct sys
struct jacobi
{
void operator()( const state_type &x , matrix_type &jacobi , const value_type &t , state_type &dfdt ) const
void operator()( const state_type &/*x*/ , matrix_type &jacobi , const value_type &/*t*/ , state_type &dfdt ) const
{
jacobi( 0 , 0 ) = 1;
jacobi( 0 , 1 ) = 2;
@@ -73,9 +73,6 @@ BOOST_AUTO_TEST_CASE( test_rosenbrock4_stepper )
stepper_type stepper;
typedef stepper_type::state_type state_type;
typedef stepper_type::value_type stepper_value_type;
typedef stepper_type::deriv_type deriv_type;
typedef stepper_type::time_type time_type;
state_type x( 2 ) , xerr( 2 );
x(0) = 0.0; x(1) = 1.0;
@@ -101,9 +98,6 @@ BOOST_AUTO_TEST_CASE( test_rosenbrock4_controller )
stepper_type stepper;
typedef stepper_type::state_type state_type;
typedef stepper_type::value_type stepper_value_type;
typedef stepper_type::deriv_type deriv_type;
typedef stepper_type::time_type time_type;
state_type x( 2 );
x( 0 ) = 0.0 ; x(1) = 1.0;
@@ -120,9 +114,7 @@ BOOST_AUTO_TEST_CASE( test_rosenbrock4_dense_output )
stepper_type stepper( c_stepper );
typedef stepper_type::state_type state_type;
typedef stepper_type::value_type stepper_value_type;
typedef stepper_type::deriv_type deriv_type;
typedef stepper_type::time_type time_type;
state_type x( 2 );
x( 0 ) = 0.0 ; x(1) = 1.0;
stepper.initialize( x , 0.0 , 0.1 );

View File

@@ -34,7 +34,7 @@
#include <boost/test/unit_test.hpp>
#include <boost/ref.hpp>
#include <boost/bind.hpp>
#include <boost/bind/bind.hpp>
#include <boost/utility.hpp>
#include <boost/type_traits/add_reference.hpp>
@@ -60,6 +60,7 @@ using std::vector;
using namespace boost::unit_test;
using namespace boost::numeric::odeint;
using namespace boost::placeholders;
namespace mpl = boost::mpl;
const double result = 2.2; // two steps

View File

@@ -148,7 +148,7 @@ namespace boost { namespace numeric { namespace odeint {
copy_count++;
}
state_wrapper_type& operator=( const state_wrapper_type &x )
state_wrapper_type& operator=( const state_wrapper_type & /*x*/ )
{
copy_count++;
return *this;
@@ -187,7 +187,7 @@ namespace boost { namespace numeric { namespace odeint {
copy2_count++;
}
state_wrapper_type& operator=( const state_wrapper_type &x )
state_wrapper_type& operator=( const state_wrapper_type & /*x*/ )
{
copy2_count++;
return *this;

View File

@@ -61,7 +61,7 @@ struct algebra_dispatcher< state_type2 >
struct system1
{
template< class State , class Deriv >
void operator()( const State &x_ , Deriv &dxdt_ , double t )
void operator()( const State &x_ , Deriv &dxdt_ , double /*t*/ )
{
typename boost::range_iterator< const State >::type x = boost::begin( x_ );
typename boost::range_iterator< Deriv >::type dxdt = boost::begin( dxdt_ );
@@ -72,7 +72,7 @@ struct system1
}
template< class State , class Deriv >
void operator()( const State &x_ , const Deriv &dxdt_ , double t )
void operator()( const State &x_ , const Deriv &dxdt_ , double /*t*/ )
{
typename boost::range_iterator< const State >::type x = boost::begin( x_ );
typename boost::range_iterator< Deriv >::type dxdt = boost::begin( dxdt_ );
@@ -89,7 +89,7 @@ struct system1
struct system2
{
template< class State , class Deriv >
void operator()( const State &x_ , Deriv &dxdt_ , double t )
void operator()( const State &/*x_*/ , Deriv &dxdt_ , double /*t*/ )
{
typename boost::range_iterator< Deriv >::type dxdt = boost::begin( dxdt_ );
@@ -99,7 +99,7 @@ struct system2
}
template< class State , class Deriv >
void operator()( const State &x_ , const Deriv &dxdt_ , double t )
void operator()( const State &/*x_*/ , const Deriv &dxdt_ , double /*t*/ )
{
typename boost::range_iterator< Deriv >::type dxdt = boost::begin( dxdt_ );
@@ -116,7 +116,7 @@ struct system2
struct ham_sys
{
template< class State , class Deriv >
void operator()( const State &x_ , Deriv &dxdt_ )
void operator()( const State &/*x_*/ , Deriv &dxdt_ )
{
typename boost::range_iterator< Deriv >::type dxdt = boost::begin( dxdt_ );
dxdt[0] = 1.0;
@@ -125,7 +125,7 @@ struct ham_sys
}
template< class State , class Deriv >
void operator()( const State &x_ , const Deriv &dxdt_ )
void operator()( const State &/*x_*/ , const Deriv &dxdt_ )
{
typename boost::range_iterator< Deriv >::type dxdt = boost::begin( dxdt_ );
dxdt[0] = 1.0;