Update of /cvsroot/pure-data/externals/chaos/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20765
Modified Files: Makefile.am bernoulli_dsp.cpp bungalow_tent_dsp.cpp bungalow_tent_msg.cpp chaos.hpp chaos_base.hpp chaos_defs.hpp circle_map_dsp.cpp circle_map_msg.cpp gauss_map_dsp.cpp gauss_map_msg.cpp henon_map_dsp.cpp henon_map_msg.cpp ikeda_laser_map_dsp.cpp ikeda_laser_map_msg.cpp logistic_dsp.cpp logistic_msg.cpp lorenz.hpp lorenz_dsp.cpp lorenz_msg.cpp lozi_map_dsp.cpp lozi_map_msg.cpp main.cpp sine_map_dsp.cpp sine_map_msg.cpp standard_map_dsp.cpp standard_map_msg.cpp tent_map_dsp.cpp tent_map_msg.cpp Added Files: coupled_logistic.hpp coupled_logistic_dsp.cpp coupled_logistic_msg.cpp driven_anharmonic.hpp driven_anharmonic_dsp.cpp driven_anharmonic_msg.cpp driven_van_der_pol.hpp driven_van_der_pol_dsp.cpp driven_van_der_pol_msg.cpp roessler.hpp roessler_dsp.cpp roessler_msg.cpp Log Message: additions and better code reuse
Index: lozi_map_msg.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/chaos/src/lozi_map_msg.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** lozi_map_msg.cpp 27 Dec 2004 14:44:11 -0000 1.1 --- lozi_map_msg.cpp 27 Dec 2004 22:55:41 -0000 1.2 *************** *** 22,34 **** #include "chaos_msg.hpp"
! class lozi_map_msg: ! public chaos_msg<lozi_map> ! { ! CHAOS_MSG_INIT(lozi_map, LOZI_MAP_ATTRIBUTES); ! ! LOZI_MAP_CALLBACKS; ! }; ! ! ! ! FLEXT_LIB_V("lozi", lozi_map_msg); --- 22,24 ---- #include "chaos_msg.hpp"
! CHAOS_MSG_CLASS_NAME(lozi_map, LOZI_MAP, "lozi");
Index: main.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/chaos/src/main.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** main.cpp 27 Dec 2004 14:44:11 -0000 1.5 --- main.cpp 27 Dec 2004 22:55:41 -0000 1.6 *************** *** 20,23 **** --- 20,24 ----
#include "chaos.hpp" + #include "chaos_defs.hpp"
void chaos_library_setup() *************** *** 25,63 **** post("chaos~ version "PACKAGE_VERSION"\n");
! FLEXT_DSP_SETUP(bernoulli_dsp); ! FLEXT_SETUP(bernoulli_msg); ! ! FLEXT_DSP_SETUP(bungalow_tent_dsp); ! FLEXT_SETUP(bungalow_tent_msg); ! ! FLEXT_DSP_SETUP(circle_map_dsp); ! FLEXT_SETUP(circle_map_msg); ! ! FLEXT_DSP_SETUP(gauss_map_dsp); ! FLEXT_SETUP(gauss_map_msg); ! ! FLEXT_DSP_SETUP(henon_dsp); ! FLEXT_SETUP(henon_msg); ! ! FLEXT_DSP_SETUP(ikeda_laser_map_dsp); ! FLEXT_SETUP(ikeda_laser_map_msg); ! ! FLEXT_DSP_SETUP(logistic_dsp); ! FLEXT_SETUP(logistic_msg); ! ! FLEXT_DSP_SETUP(lorenz_dsp); ! FLEXT_SETUP(lorenz_msg); ! ! FLEXT_DSP_SETUP(lozi_map_dsp); ! FLEXT_SETUP(lozi_map_msg); ! ! FLEXT_DSP_SETUP(sine_map_dsp); ! FLEXT_SETUP(sine_map_msg); ! ! FLEXT_DSP_SETUP(standard_map_dsp); ! FLEXT_SETUP(standard_map_msg); ! ! FLEXT_DSP_SETUP(tent_map_dsp); ! FLEXT_SETUP(tent_map_msg); }
--- 26,45 ---- post("chaos~ version "PACKAGE_VERSION"\n");
! CHAOS_ADD(bernoulli); ! CHAOS_ADD(bungalow_tent); ! CHAOS_ADD(circle_map); ! CHAOS_ADD(coupled_logistic); ! CHAOS_ADD(driven_anharmonic); ! CHAOS_ADD(driven_van_der_pol); ! CHAOS_ADD(gauss_map); ! CHAOS_ADD(henon); ! CHAOS_ADD(ikeda_laser_map); ! CHAOS_ADD(logistic); ! CHAOS_ADD(lorenz); ! CHAOS_ADD(lozi_map); ! CHAOS_ADD(roesser); ! CHAOS_ADD(sine_map); ! CHAOS_ADD(standard_map); ! CHAOS_ADD(tent_map); }
--- NEW FILE: roessler.hpp --- // // // chaos~ // Copyright (C) 2004 Tim Blechmann // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; see the file COPYING. If not, write to // the Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA.
#include "ode_base.hpp"
// roessler model: dx1/dt = - (x2 + x3) // 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() { m_num_eq = 3; m_data = new data_t[m_num_eq];
CHAOS_SYS_INIT(method,0); CHAOS_SYS_INIT(x1,0); CHAOS_SYS_INIT(x2,0); CHAOS_SYS_INIT(x3,0); CHAOS_SYS_INIT(a,4); CHAOS_SYS_INIT(b,4); CHAOS_SYS_INIT(c,4);
ode_base_alloc(); } ~roessler() { ode_base_free(); delete m_data; }
virtual void m_system(data_t* deriv, data_t* data) { data_t x1 = data[0], x2 = data[1], x3 = data[2]; deriv[0] = - (x2 - x1); deriv[1] = x1 + CHAOS_PARAMETER(a) * x2; deriv[2] = CHAOS_PARAMETER(b) + (x1 - CHAOS_PARAMETER(c)) * x3; }
CHAOS_SYSVAR_FUNCS(x1, 0); CHAOS_SYSVAR_FUNCS(x2, 1); CHAOS_SYSVAR_FUNCS(x3, 2);
CHAOS_SYSPAR_FUNCS(a); CHAOS_SYSPAR_FUNCS(b); CHAOS_SYSPAR_FUNCS(c); };
#define ROESSLER_CALLBACKS \ ODE_CALLBACKS; \ CHAOS_SYS_CALLBACKS(x1); \ CHAOS_SYS_CALLBACKS(x2); \ CHAOS_SYS_CALLBACKS(x3); \ CHAOS_SYS_CALLBACKS(a); \ CHAOS_SYS_CALLBACKS(b); \ CHAOS_SYS_CALLBACKS(c);
#define ROESSLER_ATTRIBUTES \ ODE_ATTRIBUTES; \ CHAOS_SYS_ATTRIBUTE(x1); \ CHAOS_SYS_ATTRIBUTE(x2); \ CHAOS_SYS_ATTRIBUTE(x3); \ CHAOS_SYS_ATTRIBUTE(a); \ CHAOS_SYS_ATTRIBUTE(b); \ CHAOS_SYS_ATTRIBUTE(c);
Index: standard_map_dsp.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/chaos/src/standard_map_dsp.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** standard_map_dsp.cpp 27 Dec 2004 14:44:11 -0000 1.1 --- standard_map_dsp.cpp 27 Dec 2004 22:55:41 -0000 1.2 *************** *** 22,34 **** #include "chaos_dsp.hpp"
- class standard_map_dsp: - public chaos_dsp<standard_map> - { - CHAOS_DSP_INIT(standard_map, STANDARD_MAP_ATTRIBUTES);
! STANDARD_MAP_CALLBACKS; ! }; ! ! ! ! FLEXT_LIB_DSP_V("standard_map~", standard_map_dsp); --- 22,25 ---- #include "chaos_dsp.hpp"
! CHAOS_DSP_CLASS(standard_map, STANDARD_MAP);
Index: circle_map_msg.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/chaos/src/circle_map_msg.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** circle_map_msg.cpp 27 Dec 2004 14:44:11 -0000 1.1 --- circle_map_msg.cpp 27 Dec 2004 22:55:41 -0000 1.2 *************** *** 22,34 **** #include "chaos_msg.hpp"
! class circle_map_msg: ! public chaos_msg<circle_map> ! { ! CHAOS_MSG_INIT(circle_map, CIRCLE_MAP_ATTRIBUTES); ! ! CIRCLE_MAP_CALLBACKS; ! }; ! ! ! ! FLEXT_LIB_V("circle_map", circle_map_msg); --- 22,24 ---- #include "chaos_msg.hpp"
! CHAOS_MSG_CLASS(circle_map, CIRCLE_MAP);
Index: sine_map_msg.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/chaos/src/sine_map_msg.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sine_map_msg.cpp 27 Dec 2004 14:44:11 -0000 1.1 --- sine_map_msg.cpp 27 Dec 2004 22:55:41 -0000 1.2 *************** *** 22,34 **** #include "chaos_msg.hpp"
! class sine_map_msg: ! public chaos_msg<sine_map> ! { ! CHAOS_MSG_INIT(sine_map, SINE_MAP_ATTRIBUTES); ! ! SINE_MAP_CALLBACKS; ! }; ! ! ! ! FLEXT_LIB_V("sine_map", sine_map_msg); --- 22,24 ---- #include "chaos_msg.hpp"
! CHAOS_MSG_CLASS(sine_map, SINE_MAP);
Index: circle_map_dsp.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/chaos/src/circle_map_dsp.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** circle_map_dsp.cpp 27 Dec 2004 14:44:11 -0000 1.1 --- circle_map_dsp.cpp 27 Dec 2004 22:55:41 -0000 1.2 *************** *** 22,34 **** #include "chaos_dsp.hpp"
! class circle_map_dsp: ! public chaos_dsp<circle_map> ! { ! CHAOS_DSP_INIT(circle_map, CIRCLE_MAP_ATTRIBUTES); ! ! CIRCLE_MAP_CALLBACKS; ! }; ! ! ! ! FLEXT_LIB_DSP_V("circle_map~", circle_map_dsp); --- 22,24 ---- #include "chaos_dsp.hpp"
! CHAOS_DSP_CLASS(circle_map, CIRCLE_MAP)
Index: logistic_msg.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/chaos/src/logistic_msg.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** logistic_msg.cpp 27 Dec 2004 14:44:11 -0000 1.1 --- logistic_msg.cpp 27 Dec 2004 22:55:41 -0000 1.2 *************** *** 22,34 **** #include "chaos_msg.hpp"
! class logistic_msg: ! public chaos_msg<logistic> ! { ! CHAOS_MSG_INIT(logistic, LOGISTIC_ATTRIBUTES); ! ! LOGISTIC_CALLBACKS; ! }; ! ! ! ! FLEXT_LIB_V("logistic", logistic_msg); --- 22,24 ---- #include "chaos_msg.hpp"
! CHAOS_MSG_CLASS(logistic, LOGISTIC);
Index: lorenz_dsp.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/chaos/src/lorenz_dsp.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** lorenz_dsp.cpp 27 Dec 2004 14:44:11 -0000 1.1 --- lorenz_dsp.cpp 27 Dec 2004 22:55:41 -0000 1.2 *************** *** 22,34 **** #include "chaos_dsp.hpp"
! class lorenz_dsp: ! public chaos_dsp<lorenz> ! { ! CHAOS_DSP_INIT(lorenz, LORENZ_ATTRIBUTES); ! ! LORENZ_CALLBACKS; ! }; ! ! ! ! FLEXT_LIB_DSP_V("lorenz~", lorenz_dsp); --- 22,24 ---- #include "chaos_dsp.hpp"
! CHAOS_DSP_CLASS(lorenz, LORENZ);
Index: tent_map_dsp.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/chaos/src/tent_map_dsp.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tent_map_dsp.cpp 27 Dec 2004 14:44:11 -0000 1.1 --- tent_map_dsp.cpp 27 Dec 2004 22:55:41 -0000 1.2 *************** *** 22,34 **** #include "chaos_dsp.hpp"
- class tent_map_dsp: - public chaos_dsp<tent_map> - { - CHAOS_DSP_INIT(tent_map, TENT_MAP_ATTRIBUTES); - - TENT_MAP_CALLBACKS; - }; -
! FLEXT_LIB_DSP_V("tent~", tent_map_dsp); --- 22,26 ---- #include "chaos_dsp.hpp"
! CHAOS_DSP_CLASS_NAME(tent_map, TENT_MAP, "tent~");
Index: ikeda_laser_map_dsp.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/chaos/src/ikeda_laser_map_dsp.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ikeda_laser_map_dsp.cpp 27 Dec 2004 14:44:11 -0000 1.1 --- ikeda_laser_map_dsp.cpp 27 Dec 2004 22:55:41 -0000 1.2 *************** *** 22,34 **** #include "chaos_dsp.hpp"
- class ikeda_laser_map_dsp: - public chaos_dsp<ikeda_laser_map> - { - CHAOS_DSP_INIT(ikeda_laser_map, IKEDA_LASER_MAP_ATTRIBUTES); - - IKEDA_LASER_MAP_CALLBACKS; - }; -
- FLEXT_LIB_DSP_V("ikeda~", ikeda_laser_map_dsp); --- 22,26 ---- #include "chaos_dsp.hpp"
+ CHAOS_DSP_CLASS_NAME(ikeda_laser_map, IKEDA_LASER_MAP, "ikeda");
--- NEW FILE: driven_van_der_pol_msg.cpp --- // // // chaos~ // Copyright (C) 2004 Tim Blechmann // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; see the file COPYING. If not, write to // the Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA.
#include "driven_van_der_pol.hpp" #include "chaos_msg.hpp"
CHAOS_MSG_CLASS(driven_van_der_pol, DRIVEN_VAN_DER_POL);
Index: henon_map_msg.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/chaos/src/henon_map_msg.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** henon_map_msg.cpp 27 Dec 2004 14:44:11 -0000 1.1 --- henon_map_msg.cpp 27 Dec 2004 22:55:41 -0000 1.2 *************** *** 22,34 **** #include "chaos_msg.hpp"
! class henon_msg: ! public chaos_msg<henon> ! { ! CHAOS_MSG_INIT(henon, HENON_ATTRIBUTES); ! ! HENON_CALLBACKS; ! }; ! ! ! ! FLEXT_LIB_V("henon", henon_msg); --- 22,24 ---- #include "chaos_msg.hpp"
! CHAOS_MSG_CLASS_NAME(henon, HENON, "henon");
Index: chaos_defs.hpp =================================================================== RCS file: /cvsroot/pure-data/externals/chaos/src/chaos_defs.hpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** chaos_defs.hpp 27 Dec 2004 14:44:11 -0000 1.1 --- chaos_defs.hpp 27 Dec 2004 22:55:41 -0000 1.2 *************** *** 132,136 **** --- 132,176 ----
+ /* macros for class generation */ + #define CHAOS_DSP_CLASS(CLASSNAME,CLASSNAME_UC) \ + class CLASSNAME##_dsp: \ + public chaos_dsp<CLASSNAME> \ + { \ + CHAOS_DSP_INIT(CLASSNAME, CLASSNAME_UC##_ATTRIBUTES); \ + CLASSNAME_UC##_CALLBACKS; \ + }; \ + FLEXT_LIB_DSP_V(#CLASSNAME"~", CLASSNAME##_dsp); + + #define CHAOS_DSP_CLASS_NAME(CLASSNAME,CLASSNAME_UC, NAME) \ + class CLASSNAME##_dsp: \ + public chaos_dsp<CLASSNAME> \ + { \ + CHAOS_DSP_INIT(CLASSNAME, CLASSNAME_UC##_ATTRIBUTES); \ + CLASSNAME_UC##_CALLBACKS; \ + }; \ + FLEXT_LIB_DSP_V(#NAME, CLASSNAME##_dsp); + + + #define CHAOS_MSG_CLASS(CLASSNAME,CLASSNAME_UC) \ + class CLASSNAME##_msg: \ + public chaos_msg<CLASSNAME> \ + { \ + CHAOS_MSG_INIT(CLASSNAME, CLASSNAME_UC##_ATTRIBUTES); \ + CLASSNAME_UC##_CALLBACKS; \ + }; \ + FLEXT_LIB_V(#CLASSNAME, CLASSNAME##_msg); + + #define CHAOS_MSG_CLASS_NAME(CLASSNAME,CLASSNAME_UC, NAME) \ + class CLASSNAME##_msg: \ + public chaos_msg<CLASSNAME> \ + { \ + CHAOS_MSG_INIT(CLASSNAME, CLASSNAME_UC##_ATTRIBUTES); \ + CLASSNAME_UC##_CALLBACKS; \ + }; \ + FLEXT_LIB_V(#NAME, CLASSNAME##_msg);
+ #define CHAOS_ADD(NAME) \ + FLEXT_DSP_SETUP(NAME##_dsp); \ + FLEXT_SETUP(NAME##_msg);
#define __chaos_defs_hpp
Index: bernoulli_dsp.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/chaos/src/bernoulli_dsp.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** bernoulli_dsp.cpp 27 Dec 2004 14:44:11 -0000 1.1 --- bernoulli_dsp.cpp 27 Dec 2004 22:55:40 -0000 1.2 *************** *** 22,34 **** #include "chaos_dsp.hpp"
! class bernoulli_dsp: ! public chaos_dsp<bernoulli> ! { ! CHAOS_DSP_INIT(bernoulli, BERNOULLI_ATTRIBUTES); ! ! BERNOULLI_CALLBACKS; ! }; ! ! ! ! FLEXT_LIB_DSP_V("bernoulli~", bernoulli_dsp); --- 22,24 ---- #include "chaos_dsp.hpp"
! CHAOS_DSP_CLASS(bernoulli, BERNOULLI);
Index: sine_map_dsp.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/chaos/src/sine_map_dsp.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sine_map_dsp.cpp 27 Dec 2004 14:44:11 -0000 1.1 --- sine_map_dsp.cpp 27 Dec 2004 22:55:41 -0000 1.2 *************** *** 22,34 **** #include "chaos_dsp.hpp"
- class sine_map_dsp: - public chaos_dsp<sine_map> - { - CHAOS_DSP_INIT(sine_map, SINE_MAP_ATTRIBUTES);
! SINE_MAP_CALLBACKS; ! }; ! ! ! ! FLEXT_LIB_DSP_V("sine_map~", sine_map_dsp); --- 22,25 ---- #include "chaos_dsp.hpp"
! CHAOS_DSP_CLASS(sine_map, SINE_MAP);
Index: Makefile.am =================================================================== RCS file: /cvsroot/pure-data/externals/chaos/src/Makefile.am,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Makefile.am 27 Dec 2004 14:44:10 -0000 1.5 --- Makefile.am 27 Dec 2004 22:55:40 -0000 1.6 *************** *** 5,8 **** --- 5,11 ---- bungalow_tent_dsp.cpp bungalow_tent_msg.cpp \ circle_map_dsp.cpp circle_map_msg.cpp \ + coupled_logistic_dsp.cpp coupled_logistic_msg.cpp \ + driven_anharmonic_dsp.cpp driven_anharmonic_msg.cpp \ + driven_van_der_pol_dsp.cpp driven_van_der_pol_msg.cpp \ gauss_map_dsp.cpp gauss_map_msg.cpp \ henon_map_dsp.cpp henon_map_msg.cpp \ *************** *** 11,14 **** --- 14,18 ---- lorenz_dsp.cpp lorenz_msg.cpp \ lozi_map_dsp.cpp lozi_map_msg.cpp \ + roessler_dsp.cpp roessler_msg.cpp \ sine_map_dsp.cpp sine_map_msg.cpp \ standard_map_dsp.cpp standard_map_msg.cpp \
Index: lorenz.hpp =================================================================== RCS file: /cvsroot/pure-data/externals/chaos/src/lorenz.hpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** lorenz.hpp 25 Dec 2004 12:50:41 -0000 1.5 --- lorenz.hpp 27 Dec 2004 22:55:41 -0000 1.6 *************** *** 45,50 ****
ode_base_alloc(); - - set_method(0); } --- 45,48 ----
--- NEW FILE: driven_anharmonic.hpp --- // // // chaos~ // Copyright (C) 2004 Tim Blechmann // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; see the file COPYING. If not, write to // the Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA.
#include "ode_base.hpp" #include <cmath>
// driven anharmonic: // d2u/dt2 + a * du/dt + b*u + c * u*u*u = k1 + k2*cos(Omega*t) // equivalent: // du1/dt = u2 // du2/dt = -a*u2 - b*u1 -c*u*u*u + k1 + k2*cos(Omega*t) // taken from Willi-Hans Steeb: Chaos and Fractals
class driven_anharmonic : public ode_base { public: driven_anharmonic() { m_num_eq = 2; m_data = new data_t[m_num_eq];
CHAOS_SYS_INIT(method,0); CHAOS_SYS_INIT(dt,0.01);
CHAOS_SYS_INIT(u1,0); CHAOS_SYS_INIT(u2,1);
CHAOS_SYS_INIT(a,1); CHAOS_SYS_INIT(b,-10); CHAOS_SYS_INIT(c,100); CHAOS_SYS_INIT(Omega,3.5); CHAOS_SYS_INIT(k1,0.01); CHAOS_SYS_INIT(k2,1);
ode_base_alloc(); m_t = 0; } ~driven_anharmonic() { ode_base_free(); delete m_data; }
virtual void m_system(data_t* deriv, data_t* data) { data_t u1 = data[0], u2 = data[1]; deriv[0] = u2; deriv[1] = - CHAOS_PARAMETER(a) * u2 - CHAOS_PARAMETER(b) * u1 - CHAOS_PARAMETER(c) * u1*u1*u1 + CHAOS_PARAMETER(k1) + CHAOS_PARAMETER(k2) * cos (CHAOS_PARAMETER(Omega) * m_t); m_t += m_dt; if (m_t > 2 * M_PI) m_t = fmod(m_t, 2*M_PI); } data_t m_t; CHAOS_SYSVAR_FUNCS(u1, 0); CHAOS_SYSVAR_FUNCS(u2, 1);
CHAOS_SYSPAR_FUNCS(a); CHAOS_SYSPAR_FUNCS(b); CHAOS_SYSPAR_FUNCS(c); CHAOS_SYSPAR_FUNCS(k1); CHAOS_SYSPAR_FUNCS(k2); CHAOS_SYSPAR_FUNCS(Omega); };
#define DRIVEN_ANHARMONIC_CALLBACKS \ ODE_CALLBACKS; \ CHAOS_SYS_CALLBACKS(u1); \ CHAOS_SYS_CALLBACKS(u2); \ CHAOS_SYS_CALLBACKS(a); \ CHAOS_SYS_CALLBACKS(b); \ CHAOS_SYS_CALLBACKS(c); \ CHAOS_SYS_CALLBACKS(k1); \ CHAOS_SYS_CALLBACKS(k2); \ CHAOS_SYS_CALLBACKS(Omega);
#define DRIVEN_ANHARMONIC_ATTRIBUTES \ ODE_ATTRIBUTES; \ CHAOS_SYS_ATTRIBUTE(u1); \ CHAOS_SYS_ATTRIBUTE(u2); \ CHAOS_SYS_ATTRIBUTE(a); \ CHAOS_SYS_ATTRIBUTE(b); \ CHAOS_SYS_ATTRIBUTE(c); \ CHAOS_SYS_ATTRIBUTE(k1); \ CHAOS_SYS_ATTRIBUTE(k2); \ CHAOS_SYS_ATTRIBUTE(Omega);
Index: gauss_map_dsp.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/chaos/src/gauss_map_dsp.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** gauss_map_dsp.cpp 27 Dec 2004 14:44:11 -0000 1.1 --- gauss_map_dsp.cpp 27 Dec 2004 22:55:41 -0000 1.2 *************** *** 22,34 **** #include "chaos_dsp.hpp"
! class gauss_map_dsp: ! public chaos_dsp<gauss_map> ! { ! CHAOS_DSP_INIT(gauss_map, GAUSS_MAP_ATTRIBUTES); ! ! GAUSS_MAP_CALLBACKS; ! }; ! ! ! ! FLEXT_LIB_DSP_V("gauss_map~", gauss_map_dsp); --- 22,24 ---- #include "chaos_dsp.hpp"
! CHAOS_DSP_CLASS(gauss_map, GAUSS_MAP);
Index: chaos_base.hpp =================================================================== RCS file: /cvsroot/pure-data/externals/chaos/src/chaos_base.hpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** chaos_base.hpp 24 Dec 2004 15:31:14 -0000 1.3 --- chaos_base.hpp 27 Dec 2004 22:55:41 -0000 1.4 *************** *** 22,26 ****
#include "chaos.hpp" - #include "chaos_defs.hpp"
class chaos_base --- 22,25 ----
Index: lozi_map_dsp.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/chaos/src/lozi_map_dsp.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** lozi_map_dsp.cpp 27 Dec 2004 14:44:11 -0000 1.1 --- lozi_map_dsp.cpp 27 Dec 2004 22:55:41 -0000 1.2 *************** *** 22,34 **** #include "chaos_dsp.hpp"
! class lozi_map_dsp: ! public chaos_dsp<lozi_map> ! { ! CHAOS_DSP_INIT(lozi_map, LOZI_MAP_ATTRIBUTES); ! ! LOZI_MAP_CALLBACKS; ! }; ! ! ! ! FLEXT_LIB_DSP_V("lozi~", lozi_map_dsp); --- 22,24 ---- #include "chaos_dsp.hpp"
! CHAOS_DSP_CLASS_NAME(lozi_map, LOZI_MAP, "lozi");
Index: henon_map_dsp.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/chaos/src/henon_map_dsp.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** henon_map_dsp.cpp 27 Dec 2004 14:44:11 -0000 1.1 --- henon_map_dsp.cpp 27 Dec 2004 22:55:41 -0000 1.2 *************** *** 22,34 **** #include "chaos_dsp.hpp"
! class henon_dsp: ! public chaos_dsp<henon> ! { ! CHAOS_DSP_INIT(henon, HENON_ATTRIBUTES); ! ! HENON_CALLBACKS; ! }; ! ! ! ! FLEXT_LIB_DSP_V("henon~", henon_dsp); --- 22,24 ---- #include "chaos_dsp.hpp"
! CHAOS_DSP_CLASS_NAME(henon, HENON, "henon~");
--- NEW FILE: roessler_msg.cpp --- // // // chaos~ // Copyright (C) 2004 Tim Blechmann // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; see the file COPYING. If not, write to // the Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA.
#include "roessler.hpp" #include "chaos_msg.hpp"
CHAOS_MSG_CLASS(roessler,ROESSLER);
--- NEW FILE: roessler_dsp.cpp --- // // // chaos~ // Copyright (C) 2004 Tim Blechmann // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; see the file COPYING. If not, write to // the Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA.
#include "roessler.hpp" #include "chaos_dsp.hpp"
CHAOS_DSP_CLASS(roessler,ROESSLER);
Index: bungalow_tent_dsp.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/chaos/src/bungalow_tent_dsp.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** bungalow_tent_dsp.cpp 27 Dec 2004 14:44:11 -0000 1.1 --- bungalow_tent_dsp.cpp 27 Dec 2004 22:55:41 -0000 1.2 *************** *** 22,34 **** #include "chaos_dsp.hpp"
! class bungalow_tent_dsp: ! public chaos_dsp<bungalow_tent> ! { ! CHAOS_DSP_INIT(bungalow_tent, BUNGALOW_TENT_ATTRIBUTES); ! ! BUNGALOW_TENT_CALLBACKS; ! }; ! ! ! ! FLEXT_LIB_DSP_V("bungalow_tent~", bungalow_tent_dsp); --- 22,24 ---- #include "chaos_dsp.hpp"
! CHAOS_DSP_CLASS(bungalow_tent,BUNGALOW_TENT);
Index: ikeda_laser_map_msg.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/chaos/src/ikeda_laser_map_msg.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ikeda_laser_map_msg.cpp 27 Dec 2004 14:44:11 -0000 1.1 --- ikeda_laser_map_msg.cpp 27 Dec 2004 22:55:41 -0000 1.2 *************** *** 22,34 **** #include "chaos_msg.hpp"
! class ikeda_laser_map_msg: ! public chaos_msg<ikeda_laser_map> ! { ! CHAOS_MSG_INIT(ikeda_laser_map, IKEDA_LASER_MAP_ATTRIBUTES); ! ! IKEDA_LASER_MAP_CALLBACKS; ! }; ! ! ! ! FLEXT_LIB_V("ikeda_laser_map", ikeda_laser_map_msg); --- 22,24 ---- #include "chaos_msg.hpp"
! CHAOS_MSG_CLASS_NAME(ikeda_laser_map, IKEDA_LASER_MAP, "ikeda~");
--- NEW FILE: coupled_logistic_dsp.cpp --- // // // chaos~ // Copyright (C) 2004 Tim Blechmann // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; see the file COPYING. If not, write to // the Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA.
#include "coupled_logistic.hpp" #include "chaos_dsp.hpp"
CHAOS_DSP_CLASS(coupled_logistic, COUPLED_LOGISTIC)
--- NEW FILE: driven_anharmonic_msg.cpp --- // // // chaos~ // Copyright (C) 2004 Tim Blechmann // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; see the file COPYING. If not, write to // the Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA.
#include "driven_anharmonic.hpp" #include "chaos_msg.hpp"
CHAOS_MSG_CLASS(driven_anharmonic, DRIVEN_ANHARMONIC);
Index: chaos.hpp =================================================================== RCS file: /cvsroot/pure-data/externals/chaos/src/chaos.hpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** chaos.hpp 24 Dec 2004 15:31:14 -0000 1.3 --- chaos.hpp 27 Dec 2004 22:55:41 -0000 1.4 *************** *** 24,27 **** --- 24,28 ----
#include "flext.h" + #include "chaos_defs.hpp"
/* internal we can work with a higher precision than pd */
--- NEW FILE: driven_anharmonic_dsp.cpp --- // // // chaos~ // Copyright (C) 2004 Tim Blechmann // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; see the file COPYING. If not, write to // the Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA.
#include "driven_anharmonic.hpp" #include "chaos_dsp.hpp"
CHAOS_DSP_CLASS(driven_anharmonic, DRIVEN_ANHARMONIC);
--- NEW FILE: coupled_logistic.hpp --- // // // chaos~ // Copyright (C) 2004 Tim Blechmann // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; see the file COPYING. If not, write to // the Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA.
#include "map_base.hpp"
// coupled_logistic map: x[n+1] = r * x[n] * (1 - x[n]) + e * (y[n] - x[n]) // y[n+1] = r * y[n] * (1 - y[n]) + e * (x[t] - y[t]) // 1 <= r <= 4 // taken from Willi-Hans Steeb: Chaos and Fractals
class coupled_logistic: public map_base { public: coupled_logistic() { m_num_eq = 2; m_data = new data_t[2]; CHAOS_SYS_INIT(e, 0.06); CHAOS_SYS_INIT(r, 3.7); CHAOS_SYS_INIT(x, 0.1); CHAOS_SYS_INIT(x, 0.2); }
~coupled_logistic() { delete m_data; }
virtual void m_step() { data_t x = m_data[0]; data_t y = m_data[1]; data_t e = CHAOS_PARAMETER(e); data_t r = CHAOS_PARAMETER(r); m_data[0] = r * x * (1.f - x) + e * (y - x); m_data[1] = r * y * (1.f - y) + e * (x - y); }
CHAOS_SYSPAR_FUNCS(e); CHAOS_SYSPAR_FUNCS_PRED(r, m_pred_r); bool m_pred_r(t_float f) { return (f > 0) && (f < 4); }
CHAOS_SYSVAR_FUNCS(x, 0); CHAOS_SYSVAR_FUNCS(y, 0); };
#define COUPLED_LOGISTIC_CALLBACKS \ MAP_CALLBACKS; \ CHAOS_SYS_CALLBACKS(e); \ CHAOS_SYS_CALLBACKS(r); \ CHAOS_SYS_CALLBACKS(x); \ CHAOS_SYS_CALLBACKS(y);
#define COUPLED_LOGISTIC_ATTRIBUTES \ MAP_ATTRIBUTES; \ CHAOS_SYS_ATTRIBUTE(e); \ CHAOS_SYS_ATTRIBUTE(r); \ CHAOS_SYS_ATTRIBUTE(x); \ CHAOS_SYS_ATTRIBUTE(y);
--- NEW FILE: driven_van_der_pol_dsp.cpp --- // // // chaos~ // Copyright (C) 2004 Tim Blechmann // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; see the file COPYING. If not, write to // the Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA.
#include "driven_van_der_pol.hpp" #include "chaos_dsp.hpp"
CHAOS_DSP_CLASS(driven_van_der_pol, DRIVEN_VAN_DER_POL);
Index: gauss_map_msg.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/chaos/src/gauss_map_msg.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** gauss_map_msg.cpp 27 Dec 2004 14:44:11 -0000 1.1 --- gauss_map_msg.cpp 27 Dec 2004 22:55:41 -0000 1.2 *************** *** 22,34 **** #include "chaos_msg.hpp"
! class gauss_map_msg: ! public chaos_msg<gauss_map> ! { ! CHAOS_MSG_INIT(gauss_map, GAUSS_MAP_ATTRIBUTES); ! ! GAUSS_MAP_CALLBACKS; ! }; ! ! ! ! FLEXT_LIB_V("gauss_map", gauss_map_msg); --- 22,24 ---- #include "chaos_msg.hpp"
! CHAOS_MSG_CLASS(gauss_map, GAUSS_MAP);
Index: tent_map_msg.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/chaos/src/tent_map_msg.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tent_map_msg.cpp 27 Dec 2004 14:44:11 -0000 1.1 --- tent_map_msg.cpp 27 Dec 2004 22:55:41 -0000 1.2 *************** *** 22,34 **** #include "chaos_msg.hpp"
! class tent_map_msg: ! public chaos_msg<tent_map> ! { ! CHAOS_MSG_INIT(tent_map, TENT_MAP_ATTRIBUTES); ! ! TENT_MAP_CALLBACKS; ! }; ! ! ! ! FLEXT_LIB_V("tent", tent_map_msg); --- 22,24 ---- #include "chaos_msg.hpp"
! CHAOS_MSG_CLASS_NAME(tent_map, TENT_MAP, "tent");
Index: lorenz_msg.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/chaos/src/lorenz_msg.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** lorenz_msg.cpp 27 Dec 2004 14:44:11 -0000 1.1 --- lorenz_msg.cpp 27 Dec 2004 22:55:41 -0000 1.2 *************** *** 22,34 **** #include "chaos_msg.hpp"
! class lorenz_msg: ! public chaos_msg<lorenz> ! { ! CHAOS_MSG_INIT(lorenz, LORENZ_ATTRIBUTES); ! ! LORENZ_CALLBACKS; ! }; ! ! ! ! FLEXT_LIB_V("lorenz", lorenz_msg); --- 22,24 ---- #include "chaos_msg.hpp"
! CHAOS_MSG_CLASS(lorenz, LORENZ);
Index: bungalow_tent_msg.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/chaos/src/bungalow_tent_msg.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** bungalow_tent_msg.cpp 27 Dec 2004 14:44:11 -0000 1.1 --- bungalow_tent_msg.cpp 27 Dec 2004 22:55:41 -0000 1.2 *************** *** 22,34 **** #include "chaos_msg.hpp"
! class bungalow_tent_msg: ! public chaos_msg<bungalow_tent> ! { ! CHAOS_MSG_INIT(bungalow_tent, BUNGALOW_TENT_ATTRIBUTES); ! ! BUNGALOW_TENT_CALLBACKS; ! }; ! ! ! ! FLEXT_LIB_V("bungalow_tent", bungalow_tent_msg); --- 22,24 ---- #include "chaos_msg.hpp"
! CHAOS_MSG_CLASS(bungalow_tent, BUNGALOW_TENT);
--- NEW FILE: coupled_logistic_msg.cpp --- // // // chaos~ // Copyright (C) 2004 Tim Blechmann // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; see the file COPYING. If not, write to // the Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA.
#include "coupled_logistic.hpp" #include "chaos_msg.hpp"
class coupled_logistic_msg: public chaos_msg<coupled_logistic> { CHAOS_MSG_INIT(coupled_logistic, COUPLED_LOGISTIC_ATTRIBUTES);
COUPLED_LOGISTIC_CALLBACKS; };
FLEXT_LIB_V("coupled_logistic", coupled_logistic_msg);
Index: standard_map_msg.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/chaos/src/standard_map_msg.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** standard_map_msg.cpp 27 Dec 2004 14:44:11 -0000 1.1 --- standard_map_msg.cpp 27 Dec 2004 22:55:41 -0000 1.2 *************** *** 22,34 **** #include "chaos_msg.hpp"
! class standard_map_msg: ! public chaos_msg<standard_map> ! { ! CHAOS_MSG_INIT(standard_map, STANDARD_MAP_ATTRIBUTES); ! ! STANDARD_MAP_CALLBACKS; ! }; ! ! ! ! FLEXT_LIB_V("standard_map", standard_map_msg); --- 22,24 ---- #include "chaos_msg.hpp"
! CHAOS_MSG_CLASS(standard_map, STANDARD_MAP);
--- NEW FILE: driven_van_der_pol.hpp --- // // // chaos~ // Copyright (C) 2004 Tim Blechmann // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; see the file COPYING. If not, write to // the Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA.
#include "ode_base.hpp" #include <cmath>
// driven van_der_pol: // d2u/dt2 + a*(u*u -1)*du/dt + u = k * cos(Omega*t) // equivalent: // du1/dt = u2 // du2/dt = -a*(u1*u1 - 1)*u2 - u1 + k*cos(u3) // du3/dt = Omega // taken from Willi-Hans Steeb: Chaos and Fractals
class driven_van_der_pol : public ode_base { public: driven_van_der_pol() { m_num_eq = 2; m_data = new data_t[m_num_eq];
CHAOS_SYS_INIT(method,0); CHAOS_SYS_INIT(dt,0.01);
CHAOS_SYS_INIT(u1,0.8); CHAOS_SYS_INIT(u2,0.6); CHAOS_SYS_INIT(u3,0.4);
CHAOS_SYS_INIT(a,5); CHAOS_SYS_INIT(Omega,2.466); CHAOS_SYS_INIT(k,5);
ode_base_alloc(); } ~driven_van_der_pol() { ode_base_free(); delete m_data; }
virtual void m_system(data_t* deriv, data_t* data) { data_t u1 = data[0], u2 = data[1], u3 = data[2]; deriv[0] = u2; deriv[1] = - CHAOS_PARAMETER(a) * (u1*u1 -1) * u2 - u1 + CHAOS_PARAMETER(k)*cos(u3); deriv[2] = CHAOS_PARAMETER(Omega); } CHAOS_SYSVAR_FUNCS(u1, 0); CHAOS_SYSVAR_FUNCS(u2, 1); CHAOS_SYSVAR_FUNCS(u3, 2);
CHAOS_SYSPAR_FUNCS(a); CHAOS_SYSPAR_FUNCS(k); CHAOS_SYSPAR_FUNCS(Omega); };
#define DRIVEN_VAN_DER_POL_CALLBACKS \ ODE_CALLBACKS; \ CHAOS_SYS_CALLBACKS(u1); \ CHAOS_SYS_CALLBACKS(u2); \ CHAOS_SYS_CALLBACKS(a); \ CHAOS_SYS_CALLBACKS(k); \ CHAOS_SYS_CALLBACKS(Omega);
#define DRIVEN_VAN_DER_POL_ATTRIBUTES \ ODE_ATTRIBUTES; \ CHAOS_SYS_ATTRIBUTE(u1); \ CHAOS_SYS_ATTRIBUTE(u2); \ CHAOS_SYS_ATTRIBUTE(a); \ CHAOS_SYS_ATTRIBUTE(k); \ CHAOS_SYS_ATTRIBUTE(Omega);
Index: logistic_dsp.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/chaos/src/logistic_dsp.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** logistic_dsp.cpp 27 Dec 2004 14:44:11 -0000 1.1 --- logistic_dsp.cpp 27 Dec 2004 22:55:41 -0000 1.2 *************** *** 22,34 **** #include "chaos_dsp.hpp"
! class logistic_dsp: ! public chaos_dsp<logistic> ! { ! CHAOS_DSP_INIT(logistic, LOGISTIC_ATTRIBUTES); ! ! LOGISTIC_CALLBACKS; ! }; ! ! ! ! FLEXT_LIB_DSP_V("logistic~", logistic_dsp); --- 22,24 ---- #include "chaos_dsp.hpp"
! CHAOS_DSP_CLASS(logistic, LOGISTIC);