Update of /cvsroot/pure-data/externals/tb/chaos/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30481
Modified Files:
bernoulli_map.hpp bungalow_tent_map.hpp chaos_base.hpp
chaos_defs.hpp chaos_dsp.hpp chaos_msg.hpp chaos_search.hpp
chua.hpp circle_map.hpp coupled_logistic.hpp
delayed_logistic.hpp driven_anharmonic.hpp
driven_van_der_pol.hpp duffing.hpp duffing_map.hpp
gauss_map.hpp gaussian_map.hpp henon_map.hpp hydrogen.hpp
ikeda_laser_map.hpp latoocarfian.hpp latoomutalpha.hpp
latoomutbeta.hpp latoomutgamma.hpp linear_congruental.hpp
logistic_map.hpp lorenz.hpp lozi_map.hpp map_base.hpp
ode_base.cpp ode_base.hpp roessler.hpp sine_map.hpp
standard_map.hpp tent_map.hpp
Log Message:
rewrote most stuff using templates
Index: bungalow_tent_map.hpp
===================================================================
RCS file: /cvsroot/pure-data/externals/tb/chaos/src/bungalow_tent_map.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** bungalow_tent_map.hpp 22 Oct 2005 15:11:45 -0000 1.6
--- bungalow_tent_map.hpp 21 May 2006 18:34:34 -0000 1.7
***************
*** 34,42 ****
class bungalow_tent:
! public map_base
{
public:
! bungalow_tent():
! map_base(1)
{
CHAOS_SYS_INIT(x, 0.6,0);
--- 34,41 ----
class bungalow_tent:
! public map_base<1>
{
public:
! bungalow_tent()
{
CHAOS_SYS_INIT(x, 0.6,0);
***************
*** 44,52 ****
}
- ~bungalow_tent()
- {
-
- }
-
virtual void m_step()
{
--- 43,46 ----
Index: latoomutgamma.hpp
===================================================================
RCS file: /cvsroot/pure-data/externals/tb/chaos/src/latoomutgamma.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** latoomutgamma.hpp 22 Oct 2005 15:11:45 -0000 1.6
--- latoomutgamma.hpp 21 May 2006 18:34:34 -0000 1.7
***************
*** 28,36 ****
class latoomutgamma
! : public map_base
{
public:
! latoomutgamma():
! map_base(2)
{
CHAOS_SYS_INIT(x1,0.5,0);
--- 28,35 ----
class latoomutgamma
! : public map_base<2>
{
public:
! latoomutgamma()
{
CHAOS_SYS_INIT(x1,0.5,0);
***************
*** 40,48 ****
CHAOS_PAR_INIT(b,2.879879);
}
-
- ~latoomutgamma()
- {
-
- }
virtual void m_step()
--- 39,42 ----
***************
*** 60,64 ****
/* function has a fix point for x1 == x2 == 0 */
! virtual void m_verify()
{
if (m_data[0] == 0 && m_data[1] == 0)
--- 54,58 ----
/* function has a fix point for x1 == x2 == 0 */
! void m_verify()
{
if (m_data[0] == 0 && m_data[1] == 0)
Index: lozi_map.hpp
===================================================================
RCS file: /cvsroot/pure-data/externals/tb/chaos/src/lozi_map.hpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** lozi_map.hpp 22 Oct 2005 15:11:45 -0000 1.7
--- lozi_map.hpp 21 May 2006 18:34:34 -0000 1.8
***************
*** 27,35 ****
class lozi_map:
! public map_base
{
public:
! lozi_map():
! map_base(2)
{
CHAOS_SYS_INIT(x,0,0);
--- 27,34 ----
class lozi_map:
! public map_base<2>
{
public:
! lozi_map()
{
CHAOS_SYS_INIT(x,0,0);
***************
*** 40,48 ****
}
- ~lozi_map()
- {
-
- }
-
virtual void m_step()
{
--- 39,42 ----
Index: duffing.hpp
===================================================================
RCS file: /cvsroot/pure-data/externals/tb/chaos/src/duffing.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** duffing.hpp 1 Nov 2005 21:28:21 -0000 1.1
--- duffing.hpp 21 May 2006 18:34:34 -0000 1.2
***************
*** 27,35 ****
class duffing:
! public ode_base
{
public:
! duffing():
! ode_base(2)
{
CHAOS_PAR_INIT(method,0);
--- 27,34 ----
class duffing:
! public ode_base<2>
{
public:
! duffing()
{
CHAOS_PAR_INIT(method,0);
***************
*** 46,52 ****
}
- ~duffing()
- {
- }
virtual void m_system(data_t* deriv, data_t* data)
--- 45,48 ----
Index: linear_congruental.hpp
===================================================================
RCS file: /cvsroot/pure-data/externals/tb/chaos/src/linear_congruental.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** linear_congruental.hpp 22 Oct 2005 15:11:45 -0000 1.1
--- linear_congruental.hpp 21 May 2006 18:34:34 -0000 1.2
***************
*** 26,34 ****
class linear_congruental:
! public map_base
{
public:
! linear_congruental():
! map_base(1)
{
CHAOS_SYS_INIT(x, 0, 0);
--- 26,33 ----
class linear_congruental:
! public map_base<2>
{
public:
! linear_congruental()
{
CHAOS_SYS_INIT(x, 0, 0);
Index: hydrogen.hpp
===================================================================
RCS file: /cvsroot/pure-data/externals/tb/chaos/src/hydrogen.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** hydrogen.hpp 22 Oct 2005 15:11:45 -0000 1.2
--- hydrogen.hpp 21 May 2006 18:34:34 -0000 1.3
***************
*** 25,35 ****
class hydrogen
! : public ode_base
{
public:
! hydrogen():
! ode_base(4)
{
CHAOS_PAR_INIT(method,2);
--- 25,34 ----
class hydrogen
! : public ode_base<4>
{
public:
! hydrogen()
{
CHAOS_PAR_INIT(method,2);
***************
*** 46,52 ****
}
- ~hydrogen()
- {
- }
virtual void m_system(data_t* deriv, data_t* data)
--- 45,48 ----
Index: logistic_map.hpp
===================================================================
RCS file: /cvsroot/pure-data/externals/tb/chaos/src/logistic_map.hpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** logistic_map.hpp 22 Oct 2005 15:11:45 -0000 1.9
--- logistic_map.hpp 21 May 2006 18:34:34 -0000 1.10
***************
*** 26,34 ****
class logistic:
! public map_base
{
public:
! logistic():
! map_base(1)
{
CHAOS_PAR_INIT(alpha, 3.8);
--- 26,33 ----
class logistic:
! public map_base<1>
{
public:
! logistic()
{
CHAOS_PAR_INIT(alpha, 3.8);
Index: chaos_msg.hpp
===================================================================
RCS file: /cvsroot/pure-data/externals/tb/chaos/src/chaos_msg.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** chaos_msg.hpp 1 Nov 2005 21:28:21 -0000 1.3
--- chaos_msg.hpp 21 May 2006 18:34:34 -0000 1.4
***************
*** 21,47 ****
#include "chaos_base.hpp"
! template <class system> class chaos_msg
! : public flext_base
{
FLEXT_HEADER(chaos_msg, flext_base);
! ~chaos_msg()
! {
! delete m_system;
! }
public:
! /* local data for system, output and interpolation */
! system * m_system; /* the system */
void m_bang()
{
! m_system->m_perform();
! int outlets = m_system->get_num_eq();
while (outlets--)
{
! ToOutFloat(outlets, m_system->get_data(outlets));
}
}
--- 21,52 ----
#include "chaos_base.hpp"
! template <class system>
! class chaos_msg:
! public flext_base
{
FLEXT_HEADER(chaos_msg, flext_base);
! protected:
! chaos_msg(int argc, t_atom* argv)
! {
! int size = m_system.get_num_eq();
!
! for (int i = 0; i != size; ++i)
! AddOutFloat();
! FLEXT_ADDBANG(0, m_bang);
! }
public:
! system m_system; /* the system */
void m_bang()
{
! m_system.m_perform();
! int outlets = m_system.get_num_eq();
while (outlets--)
{
! ToOutFloat(outlets, m_system.get_data(outlets));
}
}
***************
*** 55,68 ****
FLEXT_HEADER(SYSTEM##_msg, chaos_msg<SYSTEM>) \
\
! SYSTEM##_msg(int argc, t_atom* argv ) \
{ \
- m_system = new SYSTEM; \
- \
- int size = m_system->get_num_eq(); \
- \
- for (int i = 0; i != size; ++i) \
- AddOutFloat(); \
- \
ATTRIBUTES; \
- FLEXT_ADDBANG(0, m_bang); \
}
--- 60,66 ----
FLEXT_HEADER(SYSTEM##_msg, chaos_msg<SYSTEM>) \
\
! SYSTEM##_msg(int argc, t_atom* argv ): \
! chaos_msg<SYSTEM>(argc, argv) \
{ \
ATTRIBUTES; \
}
Index: tent_map.hpp
===================================================================
RCS file: /cvsroot/pure-data/externals/tb/chaos/src/tent_map.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** tent_map.hpp 22 Oct 2005 15:11:45 -0000 1.6
--- tent_map.hpp 21 May 2006 18:34:34 -0000 1.7
***************
*** 27,43 ****
class tent_map:
! public map_base
{
public:
! tent_map():
! map_base(1)
{
CHAOS_SYS_INIT(x, 0.6,0);
}
- ~tent_map()
- {
-
- }
virtual void m_step()
--- 27,38 ----
class tent_map:
! public map_base<1>
{
public:
! tent_map()
{
CHAOS_SYS_INIT(x, 0.6,0);
}
virtual void m_step()
Index: driven_anharmonic.hpp
===================================================================
RCS file: /cvsroot/pure-data/externals/tb/chaos/src/driven_anharmonic.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** driven_anharmonic.hpp 22 Oct 2005 15:11:45 -0000 1.5
--- driven_anharmonic.hpp 21 May 2006 18:34:34 -0000 1.6
***************
*** 30,38 ****
class driven_anharmonic
! : public ode_base
{
public:
! driven_anharmonic():
! ode_base(2)
{
CHAOS_PAR_INIT(method,0);
--- 30,37 ----
class driven_anharmonic
! : public ode_base<2>
{
public:
! driven_anharmonic()
{
CHAOS_PAR_INIT(method,0);
***************
*** 51,58 ****
m_t = 0;
}
!
! ~driven_anharmonic()
! {
! }
virtual void m_system(data_t* deriv, data_t* data)
--- 50,54 ----
m_t = 0;
}
!
virtual void m_system(data_t* deriv, data_t* data)
Index: chaos_dsp.hpp
===================================================================
RCS file: /cvsroot/pure-data/externals/tb/chaos/src/chaos_dsp.hpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** chaos_dsp.hpp 7 Jan 2006 20:48:29 -0000 1.15
--- chaos_dsp.hpp 21 May 2006 18:34:34 -0000 1.16
***************
*** 21,31 ****
#include "chaos_base.hpp"
! template <class system> class chaos_dsp
: public flext_dsp
{
FLEXT_HEADER(chaos_dsp, flext_dsp);
! public:
/* signal functions: */
/* for frequency = sr */
--- 21,86 ----
#include "chaos_base.hpp"
! template <class system>
! class chaos_dsp
: public flext_dsp
{
FLEXT_HEADER(chaos_dsp, flext_dsp);
! protected:
! chaos_dsp(int argc, t_atom* argv)
! {
! m_sr = 44100; /* assume default sampling rate */
! int size = m_system.get_num_eq();
!
! m_values = new t_float[size];
! m_slopes = new t_float[size];
! m_nextvalues = new t_float[size];
! m_nextmidpts = new t_float[size];
! m_curves = new t_float[size];
!
! /* create inlets and zero arrays*/
! for (int i = 0; i != size; ++i)
! {
! AddOutSignal();
! m_values[i] = 0;
! m_slopes[i] = 0;
! m_nextvalues[i] = 0;
! m_nextmidpts[i] = 0;
! m_curves[i] = 0;
! }
!
! FLEXT_ADDATTR_VAR("frequency", get_freq, set_freq);
! FLEXT_ADDATTR_VAR("interpolation_method",get_imethod, set_imethod);
!
! if (argc > 0)
! {
! CHAOS_INIT(freq, GetAInt(argv[0]));
! }
! else
! {
! CHAOS_INIT(freq, 440);
! }
!
! if (argc > 1)
! {
! CHAOS_INIT(imethod, GetAInt(argv[1]));
! }
! else
! {
! CHAOS_INIT(imethod, 0);
! }
! m_phase = 0;
! }
+ ~chaos_dsp()
+ {
+ delete[] m_values;
+ delete[] m_slopes;
+ delete[] m_nextvalues;
+ delete[] m_nextmidpts;
+ delete[] m_curves;
+ }
+
+ public:
/* signal functions: */
/* for frequency = sr */
***************
*** 59,63 ****
/* local data for system, output and interpolation */
! system * m_system; /* the system */
t_sample * m_values; /* actual value */
--- 114,118 ----
/* local data for system, output and interpolation */
! system m_system; /* the system */
t_sample * m_values; /* actual value */
***************
*** 107,113 ****
if (imethod == 0)
! for (int j = 0; j != m_system->get_num_eq(); ++j)
{
! m_values[j] = m_system->get_data(j);
m_slopes[j] = 0;
}
--- 162,168 ----
if (imethod == 0)
! for (int j = 0; j != m_system.get_num_eq(); ++j)
{
! m_values[j] = m_system.get_data(j);
m_slopes[j] = 0;
}
***************
*** 115,119 ****
if(i == 2 && imethod != 2)
{
! for (int j = 0; j != m_system->get_num_eq(); ++j)
{
m_phase = 0; /* reschedule to avoid click, find a better way later*/
--- 170,174 ----
if(i == 2 && imethod != 2)
{
! for (int j = 0; j != m_system.get_num_eq(); ++j)
{
m_phase = 0; /* reschedule to avoid click, find a better way later*/
***************
*** 184,248 ****
FLEXT_HEADER(SYSTEM##_dsp, chaos_dsp<SYSTEM>) \
\
! SYSTEM##_dsp(int argc, t_atom* argv ) \
! { \
! m_sr = 44100; /* assume default sampling rate */ \
! m_system = new SYSTEM; \
! \
! int size = m_system->get_num_eq(); \
! \
! m_values = new t_float[size]; \
! m_slopes = new t_float[size]; \
! m_nextvalues = new t_float[size]; \
! m_nextmidpts = new t_float[size]; \
! m_curves = new t_float[size]; \
! \
! /* create inlets and zero arrays*/ \
! for (int i = 0; i != size; ++i) \
! { \
! AddOutSignal(); \
! m_values[i] = 0; \
! m_slopes[i] = 0; \
! m_nextvalues[i] = 0; \
! m_nextmidpts[i] = 0; \
! m_curves[i] = 0; \
! } \
! \
! FLEXT_ADDATTR_VAR("frequency", get_freq, set_freq); \
! FLEXT_ADDATTR_VAR("interpolation_method",get_imethod, set_imethod); \
! \
! if (argc > 0) \
! { \
! CHAOS_INIT(freq, GetAInt(argv[0])); \
! } \
! else \
! { \
! CHAOS_INIT(freq, 440); \
! } \
! \
! if (argc > 1) \
! { \
! CHAOS_INIT(imethod, GetAInt(argv[1])); \
! } \
! else \
! { \
! CHAOS_INIT(imethod, 0); \
! } \
! \
! m_phase = 0; \
! \
! ATTRIBUTES; \
! } \
! \
! ~SYSTEM##_dsp() \
{ \
! delete m_system; \
! delete[] m_values; \
! delete[] m_slopes; \
! delete[] m_nextvalues; \
! delete[] m_nextmidpts; \
! delete[] m_curves; \
} \
\
! FLEXT_ATTRVAR_F(m_freq); \
FLEXT_ATTRVAR_I(m_imethod);
--- 239,249 ----
FLEXT_HEADER(SYSTEM##_dsp, chaos_dsp<SYSTEM>) \
\
! SYSTEM##_dsp(int argc, t_atom* argv): \
! chaos_dsp<SYSTEM>(argc, argv) \
{ \
! ATTRIBUTES; \
} \
\
! FLEXT_ATTRVAR_F(m_freq); \
FLEXT_ATTRVAR_I(m_imethod);
***************
*** 253,264 ****
t_sample *const *outsigs)
{
! int outlets = m_system->get_num_eq();
for (int i = 0; i!=n; ++i)
{
! m_system->m_perform();
for (int j = 0; j != outlets; ++j)
{
! outsigs[j][i] = m_system->get_data(j);
}
}
--- 254,265 ----
t_sample *const *outsigs)
{
! int outlets = m_system.get_num_eq();
for (int i = 0; i!=n; ++i)
{
! m_system.m_perform();
for (int j = 0; j != outlets; ++j)
{
! outsigs[j][i] = m_system.get_data(j);
}
}
***************
*** 270,274 ****
t_sample *const *outsigs)
{
! int outlets = m_system->get_num_eq();
float phase = m_phase;
--- 271,275 ----
t_sample *const *outsigs)
{
! int outlets = m_system.get_num_eq();
float phase = m_phase;
***************
*** 279,283 ****
while (phase <= 0)
{
! m_system->m_perform();
phase += m_sr * m_invfreq;
}
--- 280,284 ----
while (phase <= 0)
{
! m_system.m_perform();
phase += m_sr * m_invfreq;
}
***************
*** 288,292 ****
for (int i = 0; i != outlets; ++i)
{
! SetSamples(outsigs[i]+offset, next, m_system->get_data(i));
}
offset += next;
--- 289,293 ----
for (int i = 0; i != outlets; ++i)
{
! SetSamples(outsigs[i]+offset, next, m_system.get_data(i));
}
offset += next;
***************
*** 300,304 ****
t_sample *const *outsigs)
{
! int outlets = m_system->get_num_eq();
int phase = int(m_phase);
--- 301,305 ----
t_sample *const *outsigs)
{
! int outlets = m_system.get_num_eq();
int phase = int(m_phase);
***************
*** 309,313 ****
if (phase == 0)
{
! m_system->m_perform();
phase = int (m_sr * m_invfreq);
}
--- 310,314 ----
if (phase == 0)
{
! m_system.m_perform();
phase = int (m_sr * m_invfreq);
}
***************
*** 319,323 ****
for (int i = 0; i != outlets; ++i)
{
! SetSamples(outsigs[i]+offset, next, m_system->get_data(i));
}
offset += next;
--- 320,324 ----
for (int i = 0; i != outlets; ++i)
{
! SetSamples(outsigs[i]+offset, next, m_system.get_data(i));
}
offset += next;
***************
*** 331,335 ****
t_sample *const *outsigs)
{
! int outlets = m_system->get_num_eq();
int phase = int(m_phase);
--- 332,336 ----
t_sample *const *outsigs)
{
! int outlets = m_system.get_num_eq();
int phase = int(m_phase);
***************
*** 341,349 ****
if (phase == 0)
{
! m_system->m_perform();
phase = int (m_sr * m_invfreq);
for (int j = 0; j != outlets; ++j)
! m_slopes[j] = (m_system->get_data(j) - m_values[j]) / phase;
}
--- 342,350 ----
if (phase == 0)
{
! m_system.m_perform();
phase = int (m_sr * m_invfreq);
for (int j = 0; j != outlets; ++j)
! m_slopes[j] = (m_system.get_data(j) - m_values[j]) / phase;
}
***************
*** 371,375 ****
t_sample *const *outsigs)
{
! int outlets = m_system->get_num_eq();
float phase = m_phase;
--- 372,376 ----
t_sample *const *outsigs)
{
! int outlets = m_system.get_num_eq();
float phase = m_phase;
***************
*** 381,389 ****
if (phase <= 0)
{
! m_system->m_perform();
phase = m_sr * m_invfreq;
for (int j = 0; j != outlets; ++j)
! m_slopes[j] = (m_system->get_data(j) - m_values[j]) / phase;
}
--- 382,390 ----
if (phase <= 0)
{
! m_system.m_perform();
phase = m_sr * m_invfreq;
for (int j = 0; j != outlets; ++j)
! m_slopes[j] = (m_system.get_data(j) - m_values[j]) / phase;
}
***************
*** 410,414 ****
t_sample *const *outsigs)
{
! int outlets = m_system->get_num_eq();
int phase = int(m_phase);
--- 411,415 ----
t_sample *const *outsigs)
{
! int outlets = m_system.get_num_eq();
int phase = int(m_phase);
***************
*** 420,424 ****
if (phase == 0)
{
! m_system->m_perform();
phase = int (m_sr * m_invfreq);
phase = (phase > 2) ? phase : 2;
--- 421,425 ----
if (phase == 0)
{
! m_system.m_perform();
phase = int (m_sr * m_invfreq);
phase = (phase > 2) ? phase : 2;
***************
*** 427,431 ****
{
t_sample value = m_nextvalues[j];
! m_nextvalues[j]= m_system->get_data(j);
m_values[j] = m_nextmidpts[j];
--- 428,432 ----
{
t_sample value = m_nextvalues[j];
! m_nextvalues[j]= m_system.get_data(j);
m_values[j] = m_nextmidpts[j];
***************
*** 462,466 ****
t_sample *const *outsigs)
{
! int outlets = m_system->get_num_eq();
float phase = m_phase;
--- 463,467 ----
t_sample *const *outsigs)
{
! int outlets = m_system.get_num_eq();
float phase = m_phase;
***************
*** 472,476 ****
if (phase == 0)
{
! m_system->m_perform();
phase = int (m_sr * m_invfreq);
phase = (phase > 2) ? phase : 2;
--- 473,477 ----
if (phase == 0)
{
! m_system.m_perform();
phase = int (m_sr * m_invfreq);
phase = (phase > 2) ? phase : 2;
***************
*** 479,483 ****
{
t_sample value = m_nextvalues[j];
! m_nextvalues[j]= m_system->get_data(j);
m_values[j] = m_nextmidpts[j];
--- 480,484 ----
{
t_sample value = m_nextvalues[j];
! m_nextvalues[j]= m_system.get_data(j);
m_values[j] = m_nextmidpts[j];
Index: lorenz.hpp
===================================================================
RCS file: /cvsroot/pure-data/externals/tb/chaos/src/lorenz.hpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** lorenz.hpp 22 Oct 2005 15:11:45 -0000 1.9
--- lorenz.hpp 21 May 2006 18:34:34 -0000 1.10
***************
*** 27,35 ****
class lorenz
! : public ode_base
{
public:
! lorenz():
! ode_base(3)
{
CHAOS_PAR_INIT(method,0);
--- 27,34 ----
class lorenz
! : public ode_base<3>
{
public:
! lorenz()
{
CHAOS_PAR_INIT(method,0);
Index: coupled_logistic.hpp
===================================================================
RCS file: /cvsroot/pure-data/externals/tb/chaos/src/coupled_logistic.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** coupled_logistic.hpp 22 Oct 2005 15:11:45 -0000 1.5
--- coupled_logistic.hpp 21 May 2006 18:34:34 -0000 1.6
***************
*** 27,35 ****
class coupled_logistic:
! public map_base
{
public:
! coupled_logistic():
! map_base(2)
{
CHAOS_PAR_INIT(e, 0.06);
--- 27,34 ----
class coupled_logistic:
! public map_base<2>
{
public:
! coupled_logistic()
{
CHAOS_PAR_INIT(e, 0.06);
***************
*** 40,48 ****
}
! ~coupled_logistic()
! {
! }
!
! virtual void m_step()
{
data_t x = m_data[0];
--- 39,43 ----
}
! virtual inline void m_step()
{
data_t x = m_data[0];
***************
*** 57,61 ****
CHAOS_SYSPAR_FUNCS(e);
CHAOS_SYSPAR_FUNCS_PRED(r, m_pred_r);
! bool m_pred_r(t_float f)
{
return (f > 0) && (f < 4);
--- 52,56 ----
CHAOS_SYSPAR_FUNCS(e);
CHAOS_SYSPAR_FUNCS_PRED(r, m_pred_r);
! static bool m_pred_r(t_float f)
{
return (f > 0) && (f < 4);
***************
*** 65,74 ****
CHAOS_SYSVAR_FUNCS_PRED(y, 0, m_pred_xy);
! bool m_pred_xy(t_float f)
{
return (f > 0) && (f < 1);
}
! virtual void m_verify()
{
data_t x = m_data[0];
--- 60,69 ----
CHAOS_SYSVAR_FUNCS_PRED(y, 0, m_pred_xy);
! static bool m_pred_xy(t_float f)
{
return (f > 0) && (f < 1);
}
! inline void m_verify()
{
data_t x = m_data[0];
***************
*** 84,89 ****
}
}
-
-
};
--- 79,82 ----
Index: delayed_logistic.hpp
===================================================================
RCS file: /cvsroot/pure-data/externals/tb/chaos/src/delayed_logistic.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** delayed_logistic.hpp 22 Oct 2005 15:11:45 -0000 1.2
--- delayed_logistic.hpp 21 May 2006 18:34:34 -0000 1.3
***************
*** 27,35 ****
class delayed_logistic:
! public map_base
{
public:
! delayed_logistic():
! map_base(1)
{
CHAOS_SYS_INIT(x, 0.5, 0);
--- 27,34 ----
class delayed_logistic:
! public map_base<1>
{
public:
! delayed_logistic()
{
CHAOS_SYS_INIT(x, 0.5, 0);
***************
*** 39,46 ****
}
! ~delayed_logistic()
! {
!
! }
virtual void m_step()
--- 38,42 ----
}
!
virtual void m_step()
Index: latoocarfian.hpp
===================================================================
RCS file: /cvsroot/pure-data/externals/tb/chaos/src/latoocarfian.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** latoocarfian.hpp 22 Oct 2005 15:11:45 -0000 1.5
--- latoocarfian.hpp 21 May 2006 18:34:34 -0000 1.6
***************
*** 29,37 ****
class latoocarfian
! : public map_base
{
public:
! latoocarfian():
! map_base(2)
{
CHAOS_SYS_INIT(x1,0.5,0);
--- 29,36 ----
class latoocarfian
! : public map_base<2>
{
public:
! latoocarfian()
{
CHAOS_SYS_INIT(x1,0.5,0);
***************
*** 43,50 ****
CHAOS_PAR_INIT(d,0.744728);
}
-
- ~latoocarfian()
- {
- }
virtual void m_step()
--- 42,45 ----
Index: map_base.hpp
===================================================================
RCS file: /cvsroot/pure-data/externals/tb/chaos/src/map_base.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** map_base.hpp 22 Oct 2005 15:11:45 -0000 1.4
--- map_base.hpp 21 May 2006 18:34:34 -0000 1.5
***************
*** 24,36 ****
#include "chaos_base.hpp"
class map_base
! : public chaos_base
{
protected:
- map_base(int n):
- chaos_base(n)
- {
- }
-
virtual void m_step()
{
--- 24,32 ----
#include "chaos_base.hpp"
+ template <int dimensions>
class map_base
! : public chaos_base<dimensions>
{
protected:
virtual void m_step()
{
***************
*** 38,47 ****
};
! #define MAP_CALLBACKS \
! CHAOS_CALLBACKS
!
!
! #define MAP_ATTRIBUTES \
! CHAOS_ATTRIBUTES;
#define __map_base_hpp
--- 34,39 ----
};
! #define MAP_CALLBACKS
! #define MAP_ATTRIBUTES
#define __map_base_hpp
Index: latoomutbeta.hpp
===================================================================
RCS file: /cvsroot/pure-data/externals/tb/chaos/src/latoomutbeta.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** latoomutbeta.hpp 22 Oct 2005 15:11:45 -0000 1.5
--- latoomutbeta.hpp 21 May 2006 18:34:34 -0000 1.6
***************
*** 28,36 ****
class latoomutbeta
! : public map_base
{
public:
! latoomutbeta():
! map_base(2)
{
CHAOS_SYS_INIT(x1,0.5,0);
--- 28,35 ----
class latoomutbeta
! : public map_base<2>
{
public:
! latoomutbeta()
{
CHAOS_SYS_INIT(x1,0.5,0);
***************
*** 41,49 ****
}
- ~latoomutbeta()
- {
-
- }
-
virtual void m_step()
{
--- 40,43 ----
Index: standard_map.hpp
===================================================================
RCS file: /cvsroot/pure-data/externals/tb/chaos/src/standard_map.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** standard_map.hpp 22 Oct 2005 15:11:45 -0000 1.6
--- standard_map.hpp 21 May 2006 18:34:34 -0000 1.7
***************
*** 28,36 ****
class standard_map:
! public map_base
{
public:
! standard_map():
! map_base(2)
{
CHAOS_SYS_INIT(I,0.1,0);
--- 28,35 ----
class standard_map:
! public map_base<2>
{
public:
! standard_map()
{
CHAOS_SYS_INIT(I,0.1,0);
Index: driven_van_der_pol.hpp
===================================================================
RCS file: /cvsroot/pure-data/externals/tb/chaos/src/driven_van_der_pol.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** driven_van_der_pol.hpp 22 Oct 2005 15:11:45 -0000 1.4
--- driven_van_der_pol.hpp 21 May 2006 18:34:34 -0000 1.5
***************
*** 31,39 ****
class driven_van_der_pol
! : public ode_base
{
public:
! driven_van_der_pol():
! ode_base(3)
{
CHAOS_PAR_INIT(method,2);
--- 31,38 ----
class driven_van_der_pol
! : public ode_base<3>
{
public:
! driven_van_der_pol()
{
CHAOS_PAR_INIT(method,2);
***************
*** 49,55 ****
}
! ~driven_van_der_pol()
! {
! }
virtual void m_system(data_t* deriv, data_t* data)
--- 48,52 ----
}
!
virtual void m_system(data_t* deriv, data_t* data)
Index: duffing_map.hpp
===================================================================
RCS file: /cvsroot/pure-data/externals/tb/chaos/src/duffing_map.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** duffing_map.hpp 22 Oct 2005 15:11:45 -0000 1.3
--- duffing_map.hpp 21 May 2006 18:34:34 -0000 1.4
***************
*** 27,35 ****
class duffing_map:
! public map_base
{
public:
! duffing_map():
! map_base(2)
{
CHAOS_SYS_INIT(x1, 0.5, 0);
--- 27,34 ----
class duffing_map:
! public map_base<2>
{
public:
! duffing_map()
{
CHAOS_SYS_INIT(x1, 0.5, 0);
***************
*** 39,46 ****
}
! ~duffing_map()
! {
!
! }
virtual void m_step()
--- 38,42 ----
}
!
virtual void m_step()
Index: gaussian_map.hpp
===================================================================
RCS file: /cvsroot/pure-data/externals/tb/chaos/src/gaussian_map.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** gaussian_map.hpp 22 Oct 2005 15:11:45 -0000 1.2
--- gaussian_map.hpp 21 May 2006 18:34:34 -0000 1.3
***************
*** 27,35 ****
class gaussian_map:
! public map_base
{
public:
! gaussian_map():
! map_base(1)
{
CHAOS_SYS_INIT(x, 0.5, 0);
--- 27,34 ----
class gaussian_map:
! public map_base<1>
{
public:
! gaussian_map()
{
CHAOS_SYS_INIT(x, 0.5, 0);
***************
*** 39,46 ****
}
! ~gaussian_map()
! {
!
! }
virtual void m_step()
--- 38,42 ----
}
!
virtual void m_step()
Index: ikeda_laser_map.hpp
===================================================================
RCS file: /cvsroot/pure-data/externals/tb/chaos/src/ikeda_laser_map.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** ikeda_laser_map.hpp 22 Oct 2005 15:11:45 -0000 1.6
--- ikeda_laser_map.hpp 21 May 2006 18:34:34 -0000 1.7
***************
*** 33,41 ****
class ikeda_laser_map:
! public map_base
{
public:
! ikeda_laser_map():
! map_base(1)
{
CHAOS_PAR_INIT(c1,0.4);
--- 33,40 ----
class ikeda_laser_map:
! public map_base<1>
{
public:
! ikeda_laser_map()
{
CHAOS_PAR_INIT(c1,0.4);
***************
*** 48,55 ****
}
- ~ikeda_laser_map()
- {
- }
-
virtual void m_step()
{
--- 47,50 ----
Index: chaos_base.hpp
===================================================================
RCS file: /cvsroot/pure-data/externals/tb/chaos/src/chaos_base.hpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** chaos_base.hpp 22 Oct 2005 15:11:45 -0000 1.9
--- chaos_base.hpp 21 May 2006 18:34:34 -0000 1.10
***************
*** 2,6 ****
//
// chaos~
! // Copyright (C) 2004 Tim Blechmann
//
// This program is free software; you can redistribute it and/or modify
--- 2,6 ----
//
// chaos~
! // Copyright (C) 2004, 2006 Tim Blechmann
//
// This program is free software; you can redistribute it and/or modify
***************
*** 24,41 ****
#include <map>
! #define MAXDIMENSION 5 // this should be enough for the first
!
class chaos_base
{
public:
! chaos_base(int n):
! m_num_eq(n)
{
- m_data = new data_t[n];
}
-
inline t_sample get_data(unsigned int i)
{
return (t_sample)m_data[i]; /* this is not save, but fast */
}
--- 24,38 ----
#include <map>
! template <int dimensions>
class chaos_base
{
public:
! chaos_base()
{
}
inline t_sample get_data(unsigned int i)
{
+ assert(i<dimensions);
return (t_sample)m_data[i]; /* this is not save, but fast */
}
***************
*** 43,47 ****
inline int get_num_eq() const
{
! return m_num_eq;
}
--- 40,44 ----
inline int get_num_eq() const
{
! return dimensions;
}
***************
*** 54,61 ****
std::map<const t_symbol*,int> attr_ind;
- // TableAnyMap attr_ind; /* thomas fragen :-) */
// check the integrity of the system
! virtual void m_verify()
{
}
--- 51,57 ----
std::map<const t_symbol*,int> attr_ind;
// check the integrity of the system
! inline void m_verify()
{
}
***************
*** 63,67 ****
inline void m_bash_denormals()
{
! for (int i = 0; i != get_num_eq(); ++i)
{
#ifndef DOUBLE_PRECISION
--- 59,63 ----
inline void m_bash_denormals()
{
! for (int i = 0; i != dimensions; ++i)
{
#ifndef DOUBLE_PRECISION
***************
*** 72,98 ****
};
! data_t * m_data; // state of the system
protected:
! virtual void m_step() = 0; // iteration
! const int m_num_eq; // number of equations of the system
flext::AtomList Parameter; // parameter
flext::AtomList System; // system
};
- #define CHAOS_CALLBACKS \
- public: \
- void get_dimension(int &i) \
- { \
- i = m_system->get_num_eq(); \
- } \
- FLEXT_CALLGET_I(get_dimension);
-
-
- #define CHAOS_ATTRIBUTES \
- FLEXT_ADDATTR_GET("dimension",get_dimension);
-
-
-
#define __chaos_base_hpp
#endif /* __chaos_base_hpp */
--- 68,79 ----
};
! data_t m_data[dimensions]; // state of the system
protected:
! virtual void m_step() = 0; // iteration
flext::AtomList Parameter; // parameter
flext::AtomList System; // system
};
#define __chaos_base_hpp
#endif /* __chaos_base_hpp */
Index: roessler.hpp
===================================================================
RCS file: /cvsroot/pure-data/externals/tb/chaos/src/roessler.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** roessler.hpp 22 Oct 2005 15:11:45 -0000 1.5
--- roessler.hpp 21 May 2006 18:34:34 -0000 1.6
***************
*** 24,35 ****
// dx2/dt = x1 + a * x2
// dx3/dt = b + (x1 - c) * x3
! // taken from Peitgen / Jürgens / Saupe: Chaos and Fractals
class roessler
! : public ode_base
{
public:
! roessler():
! ode_base(3)
{
CHAOS_PAR_INIT(method,0);
--- 24,34 ----
// dx2/dt = x1 + a * x2
// dx3/dt = b + (x1 - c) * x3
! // taken from Peitgen / Jï¿œrgens / Saupe: Chaos and Fractals
class roessler
! : public ode_base<3>
{
public:
! roessler()
{
CHAOS_PAR_INIT(method,0);
***************
*** 45,51 ****
}
- ~roessler()
- {
- }
virtual void m_system(data_t* deriv, data_t* data)
--- 44,47 ----
Index: chaos_defs.hpp
===================================================================
RCS file: /cvsroot/pure-data/externals/tb/chaos/src/chaos_defs.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** chaos_defs.hpp 16 Jun 2005 13:02:01 -0000 1.5
--- chaos_defs.hpp 21 May 2006 18:34:34 -0000 1.6
***************
*** 101,109 ****
void get_##NAME(t_float &f) \
{ \
! f = m_system->get_##NAME(); \
} \
void set_##NAME(t_float &f) \
{ \
! m_system->set_##NAME(f); \
} \
FLEXT_CALLVAR_F(get_##NAME, set_##NAME);
--- 101,109 ----
void get_##NAME(t_float &f) \
{ \
! f = m_system.get_##NAME(); \
} \
void set_##NAME(t_float &f) \
{ \
! m_system.set_##NAME(f); \
} \
FLEXT_CALLVAR_F(get_##NAME, set_##NAME);
***************
*** 114,122 ****
void get_##NAME(int &i) \
{ \
! i = m_system->get_##NAME(); \
} \
void set_##NAME(int &i) \
{ \
! m_system->set_##NAME(i); \
} \
FLEXT_CALLVAR_I(get_##NAME, set_##NAME);
--- 114,122 ----
void get_##NAME(int &i) \
{ \
! i = m_system.get_##NAME(); \
} \
void set_##NAME(int &i) \
{ \
! m_system.set_##NAME(i); \
} \
FLEXT_CALLVAR_I(get_##NAME, set_##NAME);
Index: sine_map.hpp
===================================================================
RCS file: /cvsroot/pure-data/externals/tb/chaos/src/sine_map.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** sine_map.hpp 22 Oct 2005 15:11:45 -0000 1.6
--- sine_map.hpp 21 May 2006 18:34:34 -0000 1.7
***************
*** 27,36 ****
class sine_map:
! public map_base
{
public:
! sine_map():
! map_base(1)
{
CHAOS_SYS_INIT(x,0,0);
--- 27,35 ----
class sine_map:
! public map_base<1>
{
public:
! sine_map()
{
CHAOS_SYS_INIT(x,0,0);
Index: circle_map.hpp
===================================================================
RCS file: /cvsroot/pure-data/externals/tb/chaos/src/circle_map.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** circle_map.hpp 22 Oct 2005 15:11:45 -0000 1.6
--- circle_map.hpp 21 May 2006 18:34:34 -0000 1.7
***************
*** 28,36 ****
class circle_map:
! public map_base
{
public:
circle_map()
- : map_base(1)
{
CHAOS_SYS_INIT(x, 0.4,0);
--- 28,35 ----
class circle_map:
! public map_base<1>
{
public:
circle_map()
{
CHAOS_SYS_INIT(x, 0.4,0);
***************
*** 40,47 ****
}
- ~circle_map()
- {
-
- }
virtual void m_step()
--- 39,42 ----
Index: gauss_map.hpp
===================================================================
RCS file: /cvsroot/pure-data/externals/tb/chaos/src/gauss_map.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** gauss_map.hpp 22 Oct 2005 15:11:45 -0000 1.6
--- gauss_map.hpp 21 May 2006 18:34:34 -0000 1.7
***************
*** 29,45 ****
class gauss_map:
! public map_base
{
public:
! gauss_map():
! map_base(1)
{
CHAOS_SYS_INIT(x,0.5, 0);
}
- ~gauss_map()
- {
-
- }
virtual void m_step()
--- 29,40 ----
class gauss_map:
! public map_base<1>
{
public:
! gauss_map()
{
CHAOS_SYS_INIT(x,0.5, 0);
}
virtual void m_step()
Index: ode_base.hpp
===================================================================
RCS file: /cvsroot/pure-data/externals/tb/chaos/src/ode_base.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** ode_base.hpp 22 Oct 2005 15:11:45 -0000 1.6
--- ode_base.hpp 21 May 2006 18:34:34 -0000 1.7
***************
*** 24,54 ****
#include "chaos_base.hpp"
! class ode_base
! : public chaos_base
{
public:
- ode_base(int n):
- chaos_base (n)
- {
- for (int i = 0; i != 3; ++i)
- {
- m_k[i] = new data_t[n];
- }
- m_tmp = new data_t[n];
-
- }
- ~ode_base()
- {
- for (int i = 0; i != 3; ++i)
- {
- delete[] m_k[i];
- }
- delete[] m_tmp;
- }
-
void set_method(int i)
{
! if (i >=0 && i <4)
{
m_method = (unsigned char) i;
--- 24,36 ----
#include "chaos_base.hpp"
! template <int dimensions>
! class ode_base:
! public chaos_base<dimensions>
{
public:
void set_method(int i)
{
! if (i >= 0 && i < 4)
{
m_method = (unsigned char) i;
***************
*** 56,66 ****
{
case 0:
! m_routine = &ode_base::rk1;
break;
case 1:
! m_routine = &ode_base::rk2;
break;
case 2:
! m_routine = &ode_base::rk4;
}
}
--- 38,48 ----
{
case 0:
! m_routine = &ode_base<dimensions>::rk1;
break;
case 1:
! m_routine = &ode_base<dimensions>::rk2;
break;
case 2:
! m_routine = &ode_base<dimensions>::rk4;
}
}
***************
*** 87,111 ****
protected:
! void (ode_base::*m_routine)(void);
unsigned char m_method; /* 0: rk1, 1: rk2, 3: rk4 */
! data_t* m_k[3]; /* temporary arrays for runge kutta */
! data_t* m_tmp;
virtual void m_system (data_t* deriv, data_t* data) = 0;
! void rk1 ();
! void rk2 ();
! void rk4 ();
};
#define ODE_CALLBACKS \
- CHAOS_CALLBACKS; \
CHAOS_SYS_CALLBACKS_I(method); \
CHAOS_SYS_CALLBACKS(dt);
#define ODE_ATTRIBUTES \
- CHAOS_ATTRIBUTES; \
CHAOS_SYS_ATTRIBUTE(method); \
CHAOS_SYS_ATTRIBUTE(dt);
--- 69,141 ----
protected:
! void (ode_base<dimensions>::*m_routine)(void);
unsigned char m_method; /* 0: rk1, 1: rk2, 3: rk4 */
! data_t m_k0[dimensions];
! data_t m_k1[dimensions];
! data_t m_k2[dimensions];
! data_t m_k3[dimensions];
! data_t m_tmp[dimensions];
! // data_t m_tmp[dimensions];
virtual void m_system (data_t* deriv, data_t* data) = 0;
! void rk1()
! {
! // m_system (m_k0, m_data);
! // for (int i = 0; i != dimensions; ++i)
! // m_data[i] += m_dt * m_k0[i];
! }
!
! void rk2()
! {
! // m_system (m_k0, m_data);
! // for (int i = 0; i != dimensions; ++i)
! // m_k0[i] = m_k0[i] * 0.5 * m_dt + m_data[i];
! //
! // m_system (m_k1, m_k0);
! // for (int i = 0; i != dimensions; ++i)
! // m_data[i] += m_dt * m_k1[i];
! }
!
! void rk4()
! {
! // m_system (m_k0, m_data);
! // for (int i = 0; i != dimensions; ++i)
! // {
! // m_k0[i] *= m_dt;
! // m_tmp[i] = m_data[i] + 0.5 * m_k0[i];
! // }
! //
! // m_system (m_k1, m_tmp);
! // for (int i = 0; i != dimensions; ++i)
! // {
! // m_k1[i] *= m_dt;
! // m_tmp[i] = m_data[i] + 0.5 * m_k1[i];
! // }
! //
! // m_system (m_k2, m_tmp);
! // for (int i = 0; i != dimensions; ++i)
! // {
! // m_k2[i] *= m_dt;
! // m_tmp[i] = m_data[i] + m_k2[i];
! // }
! //
! // m_system (m_k3, m_tmp);
! // for (int i = 0; i != dimensions; ++i)
! // m_k3[i] *= m_dt;
! //
! // for (int i = 0; i != dimensions; ++i)
! // m_data[i] += (m_k0[i] + 2. * (m_k1[i] + m_k2[i]) + m_k3[i])
! // / 6.;
! }
};
#define ODE_CALLBACKS \
CHAOS_SYS_CALLBACKS_I(method); \
CHAOS_SYS_CALLBACKS(dt);
#define ODE_ATTRIBUTES \
CHAOS_SYS_ATTRIBUTE(method); \
CHAOS_SYS_ATTRIBUTE(dt);
Index: bernoulli_map.hpp
===================================================================
RCS file: /cvsroot/pure-data/externals/tb/chaos/src/bernoulli_map.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** bernoulli_map.hpp 22 Oct 2005 15:11:45 -0000 1.6
--- bernoulli_map.hpp 21 May 2006 18:34:34 -0000 1.7
***************
*** 26,44 ****
class bernoulli:
! public map_base
{
public:
! bernoulli():
! map_base(1)
{
CHAOS_SYS_INIT(x,0.5,0);
}
- ~bernoulli()
- {
-
- }
-
virtual void m_step()
{
--- 26,38 ----
class bernoulli:
! public map_base<1>
{
public:
! bernoulli()
{
CHAOS_SYS_INIT(x,0.5,0);
}
virtual void m_step()
{
Index: ode_base.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/tb/chaos/src/ode_base.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** ode_base.cpp 1 Jan 2005 11:06:58 -0000 1.3
--- ode_base.cpp 21 May 2006 18:34:34 -0000 1.4
***************
*** 21,74 ****
#include "ode_base.hpp"
- void ode_base::rk1()
- {
- m_system (m_k[0], m_data);
- for (int i = 0; i != m_num_eq; ++i)
- m_data[i] += m_dt * m_k[0][i];
- }
-
-
- void ode_base::rk2()
- {
- m_system (m_k[0], m_data);
- for (int i = 0; i != m_num_eq; ++i)
- m_k[0][i] = m_k[0][i] * 0.5 * m_dt + m_data[i];
-
- m_system (m_k[1], m_k[0]);
- for (int i = 0; i != m_num_eq; ++i)
- m_data[i] += m_dt * m_k[1][i];
- }
-
-
- void ode_base::rk4()
- {
- m_system (m_k[0], m_data);
- for (int i = 0; i != m_num_eq; ++i)
- {
- m_k[0][i] *= m_dt;
- m_tmp[i] = m_data[i] + 0.5 * m_k[0][i];
- }
-
- m_system (m_k[1], m_tmp);
- for (int i = 0; i != m_num_eq; ++i)
- {
- m_k[1][i] *= m_dt;
- m_tmp[i] = m_data[i] + 0.5 * m_k[1][i];
- }
-
- m_system (m_k[2], m_tmp);
- for (int i = 0; i != m_num_eq; ++i)
- {
- m_k[2][i] *= m_dt;
- m_tmp[i] = m_data[i] + m_k[2][i];
- }
-
- m_system (m_k[3], m_tmp);
- for (int i = 0; i != m_num_eq; ++i)
- m_k[3][i] *= m_dt;
-
- for (int i = 0; i != m_num_eq; ++i)
- m_data[i] += (m_k[0][i] + 2. * (m_k[1][i] + m_k[2][i]) + m_k[3][i])
- / 6.;
- }
--- 21,23 ----
Index: chua.hpp
===================================================================
RCS file: /cvsroot/pure-data/externals/tb/chaos/src/chua.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** chua.hpp 22 Oct 2005 15:11:45 -0000 1.4
--- chua.hpp 21 May 2006 18:34:34 -0000 1.5
***************
*** 32,40 ****
class chua:
! public ode_base
{
public:
! chua():
! ode_base(3)
{
CHAOS_PAR_INIT(method,2);
--- 32,39 ----
class chua:
! public ode_base<3>
{
public:
! chua()
{
CHAOS_PAR_INIT(method,2);
***************
*** 51,58 ****
}
- ~chua()
- {
- }
-
virtual void m_system(data_t* deriv, data_t* data)
{
--- 50,53 ----
Index: henon_map.hpp
===================================================================
RCS file: /cvsroot/pure-data/externals/tb/chaos/src/henon_map.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** henon_map.hpp 22 Oct 2005 15:11:45 -0000 1.6
--- henon_map.hpp 21 May 2006 18:34:34 -0000 1.7
***************
*** 27,35 ****
class henon:
! public map_base
{
public:
! henon():
! map_base(2)
{
CHAOS_SYS_INIT(x,0,0);
--- 27,34 ----
class henon:
! public map_base<2>
{
public:
! henon()
{
CHAOS_SYS_INIT(x,0,0);
***************
*** 40,47 ****
}
- ~henon()
- {
-
- }
virtual void m_step()
--- 39,42 ----
Index: latoomutalpha.hpp
===================================================================
RCS file: /cvsroot/pure-data/externals/tb/chaos/src/latoomutalpha.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** latoomutalpha.hpp 22 Oct 2005 15:11:45 -0000 1.5
--- latoomutalpha.hpp 21 May 2006 18:34:34 -0000 1.6
***************
*** 28,36 ****
class latoomutalpha
! : public map_base
{
public:
! latoomutalpha():
! map_base(2)
{
CHAOS_SYS_INIT(x1,0.5,0);
--- 28,35 ----
class latoomutalpha
! : public map_base<2>
{
public:
! latoomutalpha()
{
CHAOS_SYS_INIT(x1,0.5,0);
***************
*** 42,49 ****
}
- ~latoomutalpha()
- {
-
- }
virtual void m_step()
--- 41,44 ----
Index: chaos_search.hpp
===================================================================
RCS file: /cvsroot/pure-data/externals/tb/chaos/src/chaos_search.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** chaos_search.hpp 16 Jun 2005 13:02:01 -0000 1.1
--- chaos_search.hpp 21 May 2006 18:34:34 -0000 1.2
***************
*** 21,24 ****
--- 21,26 ----
#include "chaos_base.hpp"
+ #define MAXDIMENSION 5
+
template <class system> class chaos_search
: public flext_base
***************
*** 29,33 ****
/* local data for system, output and interpolation */
! system * m_system; /* the system */
--- 31,35 ----
/* local data for system, output and interpolation */
! system m_system; /* the system */
***************
*** 76,84 ****
*/
! for (std::map<const t_symbol*,int>::iterator it = m_system->attr_ind.begin();
! it != m_system->attr_ind.end(); ++it)
{
post("key %s", it->first->s_name);
! post("value %f", m_system->get_data(it->second));
}
}
--- 78,86 ----
*/
! for (std::map<const t_symbol*,int>::iterator it = m_system.attr_ind.begin();
! it != m_system.attr_ind.end(); ++it)
{
post("key %s", it->first->s_name);
! post("value %f", m_system.get_data(it->second));
}
}
***************
*** 100,106 ****
SYSTEM##_search(int argc, t_atom* argv ) \
{ \
! m_system = new SYSTEM; \
! \
! int size = m_system->get_num_eq(); \
\
\
--- 102,106 ----
SYSTEM##_search(int argc, t_atom* argv ) \
{ \
! int size = m_system.get_num_eq(); \
\
\
***************
*** 120,127 ****
} \
\
- ~SYSTEM##_search() \
- { \
- delete m_system; \
- } \
\
FLEXT_ATTRVAR_I(m_transient_steps); \
--- 120,123 ----
***************
*** 133,137 ****
void chaos_search<system>::m_search()
{
! int dimensions = m_system->get_num_eq();
ly = 0;
--- 129,133 ----
void chaos_search<system>::m_search()
{
! int dimensions = m_system.get_num_eq();
ly = 0;
***************
*** 142,151 ****
for (int i = 0; i != m_transient_steps; ++i)
{
! m_system->m_perform();
}
for (int i = 0; i != dimensions; ++i)
{
! last[i] = min[i] = max[i] = m_system->m_data[i];
}
--- 138,147 ----
for (int i = 0; i != m_transient_steps; ++i)
{
! m_system.m_perform();
}
for (int i = 0; i != dimensions; ++i)
{
! last[i] = min[i] = max[i] = m_system.m_data[i];
}
***************
*** 155,159 ****
{
! m_system->m_perform();
data_t diff = 0;
--- 151,155 ----
{
! m_system.m_perform();
data_t diff = 0;
***************
*** 161,165 ****
{
/* update min/max */
! data_t datum = m_system->m_data[j];
if (datum > max[j])
max[j] = datum;
--- 157,161 ----
{
/* update min/max */
! data_t datum = m_system.m_data[j];
if (datum > max[j])
max[j] = datum;