added initialize function to controlled_runge_kutta (fsal version)

This commit is contained in:
Karsten Ahnert 2012-05-29 16:46:40 +02:00
parent 8fc311693b
commit 47dbdac33c
2 changed files with 31 additions and 11 deletions

View File

@ -406,9 +406,7 @@ public:
{
if( m_dxdt_resizer.adjust_size( in , detail::bind( &controlled_runge_kutta::template resize_m_dxdt_impl< StateIn > , detail::ref( *this ) , detail::_1 ) ) || m_first_call )
{
typename odeint::unwrap_reference< System >::type &sys = system;
sys( in , m_dxdt.m_v ,t );
m_first_call = false;
initialize( system , in , t );
}
return try_step( system , in , m_dxdt.m_v , t , out , dt );
}
@ -480,6 +478,32 @@ public:
void reset( void )
{
m_first_call = true;
}
template< class DerivIn >
void initialize( const DerivIn &deriv )
{
boost::numeric::odeint::copy( deriv , m_dxdt.m_v );
m_first_call = false;
}
template< class System , class StateIn >
void initialize( System system , const StateIn &x , const time_type &t )
{
typename odeint::unwrap_reference< System >::type &sys = system;
sys( x , m_dxdt.m_v , t );
m_first_call = false;
}
bool is_initialized( void ) const
{
return ! m_first_call;
}
template< class StateType >
void adjust_size( const StateType &x )
@ -536,9 +560,7 @@ private:
{
if( m_dxdt_resizer.adjust_size( x , detail::bind( &controlled_runge_kutta::template resize_m_dxdt_impl< StateInOut > , detail::ref( *this ) , detail::_1 ) ) || m_first_call )
{
typename odeint::unwrap_reference< System >::type &sys = system;
sys( x , m_dxdt.m_v , t );
m_first_call = false;
initialize( system , x , t );
}
return try_step( system , x , m_dxdt.m_v , t , dt );
}

View File

@ -3,13 +3,11 @@
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Chapter&#160;1.&#160;Boost.Numeric.Odeint</title>
<link rel="stylesheet" href="boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<meta name="generator" content="DocBook XSL Stylesheets V1.77.0">
<link rel="home" href="index.html" title="Chapter&#160;1.&#160;Boost.Numeric.Odeint">
<link rel="next" href="boost_numeric_odeint/getting_started.html" title="Getting started">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr><td valign="top"></td></tr></table>
<hr>
<div class="spirit-nav"><a accesskey="n" href="boost_numeric_odeint/getting_started.html"><img src="images/next.png" alt="Next"></a></div>
<div class="chapter">
<div class="titlepage"><div>
@ -24,7 +22,7 @@
<div><p class="copyright">Copyright &#169; 2009-2011 Karsten Ahnert
and Mario Mulansky</p></div>
<div><div class="legalnotice">
<a name="id566702"></a><p>
<a name="odeint.legal"></a><p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
@ -94,7 +92,7 @@
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"><p><small>Last revised: May 23, 2012 at 20:24:00 GMT</small></p></td>
<td align="left"><p><small>Last revised: May 29, 2012 at 14:07:10 GMT</small></p></td>
<td align="right"><div class="copyright-footer"></div></td>
</tr></table>
<hr>