Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r71885 - in sandbox/odeint/branches/karsten/libs/numeric/odeint/ideas/fusion_runge_kutta: . performance
From: mario.mulansky_at_[hidden]
Date: 2011-05-12 04:17:50


Author: mariomulansky
Date: 2011-05-12 04:17:48 EDT (Thu, 12 May 2011)
New Revision: 71885
URL: http://svn.boost.org/trac/boost/changeset/71885

Log:
fixed free mem bug
Text files modified:
   sandbox/odeint/branches/karsten/libs/numeric/odeint/ideas/fusion_runge_kutta/performance/rt_generic_rk4_lorenz.cpp | 4 ++--
   sandbox/odeint/branches/karsten/libs/numeric/odeint/ideas/fusion_runge_kutta/rt_explicit_rk.hpp | 16 +++++++++++++---
   2 files changed, 15 insertions(+), 5 deletions(-)

Modified: sandbox/odeint/branches/karsten/libs/numeric/odeint/ideas/fusion_runge_kutta/performance/rt_generic_rk4_lorenz.cpp
==============================================================================
--- sandbox/odeint/branches/karsten/libs/numeric/odeint/ideas/fusion_runge_kutta/performance/rt_generic_rk4_lorenz.cpp (original)
+++ sandbox/odeint/branches/karsten/libs/numeric/odeint/ideas/fusion_runge_kutta/performance/rt_generic_rk4_lorenz.cpp 2011-05-12 04:17:48 EDT (Thu, 12 May 2011)
@@ -33,7 +33,7 @@
 {
 public:
 
- rt_generic_wrapper()
+ rt_generic_wrapper() : m_stepper( stage_count )
     {
         rk_stepper_type::coeff_a_type a( stage_count-1 );
         a[0].resize(1); a[0][0] = 0.5;
@@ -46,7 +46,7 @@
         rk_stepper_type::coeff_c_type c( stage_count );
         c[0] = 0.0; c[1] = 0.5; c[2] = 0.5; c[3] = 1.0;
 
- m_stepper = rk_stepper_type( stage_count , a , b , c );
+ m_stepper.set_params( a , b , c );
     }
 
     void reset_init_cond()

Modified: sandbox/odeint/branches/karsten/libs/numeric/odeint/ideas/fusion_runge_kutta/rt_explicit_rk.hpp
==============================================================================
--- sandbox/odeint/branches/karsten/libs/numeric/odeint/ideas/fusion_runge_kutta/rt_explicit_rk.hpp (original)
+++ sandbox/odeint/branches/karsten/libs/numeric/odeint/ideas/fusion_runge_kutta/rt_explicit_rk.hpp 2011-05-12 04:17:48 EDT (Thu, 12 May 2011)
@@ -22,9 +22,9 @@
     typedef vector< double > coeff_b_type;
     typedef vector< double > coeff_c_type;
 
- rt_explicit_rk()
+ rt_explicit_rk( size_t stage_count ) : m_s( stage_count )
     {
- m_F = 0;
+ m_F = new state_type[ m_s ];
     }
 
     rt_explicit_rk( size_t stage_count , coeff_a_type &a , coeff_b_type &b , coeff_c_type &c )
@@ -33,7 +33,17 @@
         m_F = new state_type[ m_s ];
     }
 
- ~rt_explicit_rk() { if( m_F ) delete[] m_F; }
+ ~rt_explicit_rk()
+ {
+ delete[] m_F;
+ }
+
+ void set_params( coeff_a_type &a , coeff_b_type &b , coeff_c_type &c )
+ {
+ m_a = a;
+ m_b = b;
+ m_c = c;
+ }
 
     template< class System >
     void do_step( System &sys , state_type &x , const double t , const double dt )


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk