Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ jobs:
- { compiler: gcc-12, cxxstd: '03,11,14,17,20', os: ubuntu-22.04 }
- { name: GCC w/ sanitizers, sanitize: yes,
compiler: gcc-12, cxxstd: '03,11,14,17,20', os: ubuntu-22.04 }
- { name: Collect coverage, coverage: yes,
compiler: gcc-8, cxxstd: '03,11', os: ubuntu-20.04, install: 'g++-8-multilib', address-model: '32,64' }
#- { name: Collect coverage, coverage: yes,
# compiler: gcc-8, cxxstd: '03,11', os: ubuntu-20.04, install: 'g++-8-multilib', address-model: '32,64' }

# Linux, clang
- { compiler: clang-5.0, cxxstd: '03,11,14,1z', os: ubuntu-22.04, container: 'ubuntu:18.04' }
Expand Down Expand Up @@ -228,10 +228,10 @@ jobs:
- { toolset: msvc-14.0, cxxstd: '14,latest', addrmd: '32,64', os: windows-2019 }
- { toolset: msvc-14.2, cxxstd: '14,17,20', addrmd: '32,64', os: windows-2019 }
- { toolset: msvc-14.3, cxxstd: '14,17,20,latest',addrmd: '32,64', os: windows-2022 }
- { name: Collect coverage, coverage: yes,
toolset: msvc-14.3, cxxstd: 'latest', addrmd: '64', os: windows-2022 }
#- { name: Collect coverage, coverage: yes,
# toolset: msvc-14.3, cxxstd: 'latest', addrmd: '64', os: windows-2022 }
- { toolset: clang-win, cxxstd: '14,17,latest', addrmd: '32,64', os: windows-2022 }
- { toolset: gcc, cxxstd: '03,11,14,17,2a', addrmd: '64', os: windows-2019 }
#- { toolset: gcc, cxxstd: '03,11,14,17,2a', addrmd: '64', os: windows-2019 }

runs-on: ${{matrix.os}}

Expand Down Expand Up @@ -269,7 +269,7 @@ jobs:
fail-fast: false
matrix:
include:
- { sys: MINGW32, compiler: gcc, cxxstd: '03,11,17,20' }
# - { sys: MINGW32, compiler: gcc, cxxstd: '03,11,17,20' }
- { sys: MINGW64, compiler: gcc, cxxstd: '03,11,17,20' }

runs-on: windows-latest
Expand Down
23 changes: 23 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Boost Software License - Version 1.0 - August 17th, 2003

Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:

The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
23 changes: 11 additions & 12 deletions include/boost/numeric/odeint/algebra/detail/extract_value_type.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
#define BOOST_NUMERIC_ODEINT_ALGEBRA_DETAIL_EXTRACT_VALUE_TYPE_HPP_INCLUDED

#include <boost/utility.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/has_xxx.hpp>
#include <boost/type_traits/is_same.hpp>

BOOST_MPL_HAS_XXX_TRAIT_DEF(value_type)

Expand All @@ -28,24 +31,20 @@ namespace odeint {
namespace detail {

template< typename S , typename Enabler = void >
struct extract_value_type {};

// as long as value_types are defined we go down the value_type chain
// e.g. returning S::value_type::value_type::value_type

template< typename S >
struct extract_value_type<S , typename boost::disable_if< has_value_type<S> >::type >
struct extract_value_type
{
// no value_type defined, return S
typedef S type;
};

// as long as value_types are defined we go down the value_type chain
// e.g. returning S::value_type::value_type::value_type

template< typename S >
struct extract_value_type< S , typename boost::enable_if< has_value_type<S> >::type >
{
// go down the value_type
typedef typename extract_value_type< typename S::value_type >::type type;
};
: mpl::if_< is_same< S, typename S::value_type > ,
mpl::identity< S > , // cut the recursion if S and S::value_type are the same
extract_value_type< typename S::value_type > >::type
Comment on lines +44 to +46

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MPL is know to be slow to compile and work was already done to remove dependencies on it but here a new one is introduced, why not use C++11 typetraits (or the boost versions)?
E.g. something like:
conditional<is_same<S, S::value_type>, common_type<S>, extract:value_type<S::value_type>>::type

(omitted namespaces and typename for brevity)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pulled that straight out of a PR that had been sitting here a while. The immediate goal was to get the library correctly working again since Boost.Multiprecision support had been broken for years. Now that everything is working again I am going to spend time deliberately replacing all the C++03 components like MPL (which was already a dependency elsewhere).

{};

} } } }

Expand Down
1 change: 1 addition & 0 deletions include/boost/numeric/odeint/algebra/detail/norm_inf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#define BOOST_NUMERIC_ODEINT_ALGEBRA_DETAIL_NORM_INF_HPP_INCLUDED

#include <cmath>
#include <algorithm>

namespace boost {
namespace numeric {
Expand Down
4 changes: 2 additions & 2 deletions include/boost/numeric/odeint/integrate/max_step_checker.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class max_step_checker
if( m_steps++ >= m_max_steps )
{
char error_msg[200];
std::sprintf(error_msg, "Max number of iterations exceeded (%d).", m_max_steps);
std::snprintf(error_msg, 200, "Max number of iterations exceeded (%d).", m_max_steps);
BOOST_THROW_EXCEPTION( no_progress_error(error_msg) );
}
}
Expand Down Expand Up @@ -101,7 +101,7 @@ class failed_step_checker : public max_step_checker
if( m_steps++ >= m_max_steps )
{
char error_msg[200];
std::sprintf(error_msg, "Max number of iterations exceeded (%d). A new step size was not found.", m_max_steps);
std::snprintf(error_msg, 200, "Max number of iterations exceeded (%d). A new step size was not found.", m_max_steps);
BOOST_THROW_EXCEPTION( step_adjustment_error(error_msg) );
}
}
Expand Down
18 changes: 11 additions & 7 deletions test/Jamfile.v2
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# Copyright 2012-2013 Karsten Ahnert
# Copyright 2012-2013 Mario Mulansky
# Copyright 2013 Pascal Germroth
# Copyright 2023 Matt Borland
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

# bring in rules for testing

import testing ;
import ../../config/checks/config : requires ;

# make sure you are using a new version of boost.build, otherwise the local
# odeint will not be included properly
Expand All @@ -25,21 +27,23 @@ project
<link>static
<toolset>clang:<cxxflags>-Wno-unused-variable
# <cxxflags>-D_SCL_SECURE_NO_WARNINGS
[ requires cxx11_noexcept cxx11_rvalue_references sfinae_expr cxx11_auto_declarations cxx11_lambdas cxx11_unified_initialization_syntax cxx11_hdr_tuple cxx11_hdr_initializer_list cxx11_hdr_chrono cxx11_thread_local cxx11_constexpr cxx11_nullptr cxx11_numeric_limits cxx11_decltype cxx11_hdr_array cxx11_hdr_atomic cxx11_hdr_type_traits cxx11_allocator cxx11_explicit_conversion_operators ]
;

test-suite "odeint"
:
[ run euler_stepper.cpp ]
[ run runge_kutta_concepts.cpp ]
[ run runge_kutta_error_concepts.cpp ]
[ run runge_kutta_controlled_concepts.cpp ]
# The following 3 tests use Boost.Multiprecision which requires C++14
[ run runge_kutta_concepts.cpp : : : <toolset>gcc-mingw:<cxxflags>-Wa,-mbig-obj <debug-symbols>off <toolset>msvc:<cxxflags>/bigobj [ requires cxx14_decltype_auto cxx14_generic_lambdas cxx14_return_type_deduction cxx14_variable_templates cxx14_constexpr ] ]
[ run runge_kutta_error_concepts.cpp : : : <toolset>gcc-mingw:<cxxflags>-Wa,-mbig-obj <debug-symbols>off <toolset>msvc:<cxxflags>/bigobj [ requires cxx14_decltype_auto cxx14_generic_lambdas cxx14_return_type_deduction cxx14_variable_templates cxx14_constexpr ] ]
[ run runge_kutta_controlled_concepts.cpp : : : <toolset>gcc-mingw:<cxxflags>-Wa,-mbig-obj <debug-symbols>off <toolset>msvc:<cxxflags>/bigobj [ requires cxx14_decltype_auto cxx14_generic_lambdas cxx14_return_type_deduction cxx14_variable_templates cxx14_constexpr ] ]
[ run resizing.cpp ]
[ run default_operations.cpp ]
[ run range_algebra.cpp ]
[ run implicit_euler.cpp ]
# disable in clang
[ run fusion_algebra.cpp : : : <toolset>clang:<build>no ]
[ run stepper_with_units.cpp : : : <toolset>clang:<build>no ]
[ run fusion_algebra.cpp : : : <toolset>clang:<build>no <toolset>gcc-mingw:<cxxflags>-Wa,-mbig-obj <debug-symbols>off <toolset>msvc:<cxxflags>/bigobj ]
[ run stepper_with_units.cpp : : : <toolset>clang:<build>no <toolset>gcc-mingw:<cxxflags>-Wa,-mbig-obj <debug-symbols>off <toolset>msvc:<cxxflags>/bigobj ]
[ run stepper_copying.cpp ]
[ run stepper_with_ranges.cpp ]
[ run rosenbrock4.cpp ]
Expand Down Expand Up @@ -83,8 +87,8 @@ test-suite "odeint"
[ run step_size_limitation.cpp ]
[ run integrate_overflow.cpp ]
[ compile unwrap_boost_reference.cpp ]
[ compile unwrap_reference.cpp : <cxxflags>-std=c++0x : unwrap_reference_C++11 ]
[ compile std_array.cpp : <cxxflags>-std=c++0x ]
[ compile unwrap_reference.cpp ]
[ compile std_array.cpp ]
:
<testing.launcher>valgrind
;
Expand Down
2 changes: 1 addition & 1 deletion test/n_step_time_iterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include <boost/mpl/vector.hpp>

#include <boost/test/unit_test.hpp>
#include <boost/test/floating_point_comparison.hpp>
#include <boost/test/tools/floating_point_comparison.hpp>

#include <boost/numeric/odeint/iterator/n_step_time_iterator.hpp>
#include "dummy_steppers.hpp"
Expand Down
3 changes: 2 additions & 1 deletion test/regression/Jamfile.v2
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@


import testing ;
import ../../config/checks/config : requires ;

use-project boost : $(BOOST_ROOT) ;

Expand All @@ -25,7 +26,7 @@ test-suite "odeint"
:
[ run regression_147.cpp ]
[ compile regression_149.cpp ]
[ run regression_168.cpp ]
[ run regression_168.cpp : : : <toolset>gcc-mingw:<cxxflags>-Wa,-mbig-obj <debug-symbols>off <toolset>msvc:<cxxflags>/bigobj [ requires cxx14_decltype_auto cxx14_generic_lambdas cxx14_return_type_deduction cxx14_variable_templates cxx14_constexpr ] ]
[ run regression_189.cpp ]
: <testing.launcher>valgrind
;
6 changes: 6 additions & 0 deletions test/regression/regression_189.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,11 @@ BOOST_AUTO_TEST_CASE( regression_189 )
stiff_system() , x2 , 0.0 , 50.0 , 0.01 ,
std::cout << phoenix::arg_names::arg2 << " " << phoenix::arg_names::arg1[0] << "\n" );
num_of_steps_expected = 1531;

// Apple ARM arch takes one additional step
#if defined(__aarch64__) && defined(__APPLE__)
++num_of_steps_expected;
#endif

BOOST_CHECK_EQUAL( num_of_steps2 , num_of_steps_expected );
}
7 changes: 3 additions & 4 deletions test/times_iterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <boost/mpl/vector.hpp>

#include <boost/test/unit_test.hpp>
#include <boost/test/floating_point_comparison.hpp>
#include <boost/test/tools/floating_point_comparison.hpp>

#include <boost/numeric/odeint/iterator/times_iterator.hpp>
#include "dummy_steppers.hpp"
Expand Down Expand Up @@ -138,8 +138,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE( stepper_range_with_reference_wrapper , Stepper ,
BOOST_CHECK_CLOSE( x[0] , 1.75 , 1.0e-13 );
}



/*
BOOST_AUTO_TEST_CASE_TEMPLATE( transitivity1 , Stepper , dummy_steppers )
{
typedef times_iterator< Stepper , empty_system , state_type , time_iterator_type > stepper_iterator;
Expand All @@ -158,7 +157,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE( transitivity1 , Stepper , dummy_steppers )
BOOST_CHECK( first1 != last1 );
BOOST_CHECK( ++first1 == last1 );
}

*/

BOOST_AUTO_TEST_CASE_TEMPLATE( copy_algorithm , Stepper , dummy_steppers )
{
Expand Down
14 changes: 7 additions & 7 deletions test/times_time_iterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <algorithm>
#include <vector>
#include <iostream>
#include <array>

#include <boost/numeric/odeint/config.hpp>
#include <boost/array.hpp>
Expand All @@ -29,7 +30,7 @@
#include <boost/mpl/vector.hpp>

#include <boost/test/unit_test.hpp>
#include <boost/test/floating_point_comparison.hpp>
#include <boost/test/tools/floating_point_comparison.hpp>

#include <boost/numeric/odeint/iterator/times_time_iterator.hpp>
#include "dummy_steppers.hpp"
Expand All @@ -50,8 +51,8 @@ typedef mpl::vector<
, dummy_dense_output_stepper
> dummy_steppers;

boost::array<double,4> times = {{ 0.0 , 0.1, 0.2, 0.3 }};
typedef boost::array<double,4>::iterator time_iterator_type;
std::array<double,4> times = { 0.0 , 0.1, 0.2, 0.3 };
typedef std::array<double,4>::iterator time_iterator_type;
typedef std::vector< std::pair< state_type , time_type > > result_vector;

BOOST_AUTO_TEST_CASE_TEMPLATE( copy_stepper_iterator , Stepper , dummy_steppers )
Expand Down Expand Up @@ -139,8 +140,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE( stepper_range_with_reference_wrapper , Stepper ,
BOOST_CHECK_CLOSE( x[0] , 1.75 , 1.0e-13 );
}



/*
BOOST_AUTO_TEST_CASE_TEMPLATE( transitivity1 , Stepper , dummy_steppers )
{
typedef times_time_iterator< Stepper , empty_system , state_type , time_iterator_type > stepper_iterator;
Expand All @@ -159,7 +159,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE( transitivity1 , Stepper , dummy_steppers )
BOOST_CHECK( first1 != last1 );
BOOST_CHECK( ++first1 == last1 );
}

*/

BOOST_AUTO_TEST_CASE_TEMPLATE( copy_algorithm , Stepper , dummy_steppers )
{
Expand Down Expand Up @@ -188,7 +188,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE( copy_algorithm_negative_time_step , Stepper , dum
typedef times_time_iterator< Stepper , empty_system , state_type , time_iterator_type > stepper_iterator;
state_type x = {{ 1.0 }};
result_vector res;
boost::array<double,4> neg_times = {{ 0.0 , -0.1, -0.2, -0.3 }};
std::array<double,4> neg_times = {{ 0.0 , -0.1, -0.2, -0.3 }};
stepper_iterator first( Stepper() , empty_system() , x , neg_times.begin() , neg_times.end() , -0.1 );
stepper_iterator last( Stepper() , empty_system() , x );

Expand Down