From 5233c01a26329306c9f1d08c1a39733aee2cc518 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Tue, 21 Dec 2004 09:22:10 +0000 Subject: This commit was generated by cvs2svn to compensate for changes in r2423, which included commits to RCS files with non-trunk default branches. svn path=/trunk/externals/tb/; revision=2424 --- chaos/src/henon_map.hpp | 121 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 chaos/src/henon_map.hpp (limited to 'chaos/src/henon_map.hpp') diff --git a/chaos/src/henon_map.hpp b/chaos/src/henon_map.hpp new file mode 100644 index 0000000..d29e8a7 --- /dev/null +++ b/chaos/src/henon_map.hpp @@ -0,0 +1,121 @@ +// +// +// 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" + +// henon map: x[n+1] = y[n] + 1 - a * x[n] * x[n] +// y[n+1] = b * x[n] +// b != 0 +// taken from Willi-Hans Steeb: Chaos and Fractals + +class henon: + protected map_base +{ +public: + henon() + : m_a(1.4), m_b(0.3) + { + m_num_eq = 2; + m_data = new data_t[1]; + set_x(0.f); + set_y(0.f); + } + + ~henon() + { + delete m_data; + } + + virtual void m_step() + { + data_t x = m_data[0]; + data_t y = m_data[1]; + + m_data[0] = 1 + y - m_a * x * x; + m_data[1] = m_b * x; + + } + + + void set_x(t_float f) + { + m_data[0] = (data_t) f; + } + + t_float get_x() + { + return (t_float)m_data[0]; + } + + + void set_y(t_float f) + { + m_data[1] = (data_t) f; + } + + t_float get_y() + { + return (t_float)m_data[1]; + } + + + void set_a(t_float f) + { + m_a = (data_t) f; + } + + t_float get_a() + { + return (t_float)m_a; + } + + + void set_b(t_float f) + { + if (f != 0) + m_b = (data_t) f; + else + post("value for b %f out of range", f); + } + + t_float get_b() + { + return (t_float)m_b; + } + +private: + data_t m_a; + data_t m_b; +}; + + +#define HENON_CALLBACKS \ +MAP_CALLBACKS; \ +FLEXT_CALLVAR_F(m_system->get_a, m_system->set_a); \ +FLEXT_CALLVAR_F(m_system->get_b, m_system->set_b); \ +FLEXT_CALLVAR_F(m_system->get_x, m_system->set_x); \ +FLEXT_CALLVAR_F(m_system->get_y, m_system->set_y); + +#define HENON_ATTRIBUTES \ +MAP_ATTRIBUTES; \ +FLEXT_ADDATTR_VAR("a",m_system->get_a, m_system->set_a); \ +FLEXT_ADDATTR_VAR("b",m_system->get_b, m_system->set_b); \ +FLEXT_ADDATTR_VAR("x",m_system->get_x, m_system->set_x); \ +FLEXT_ADDATTR_VAR("y",m_system->get_y, m_system->set_y); -- cgit v1.2.1 From 404bfef9e23dfc3166cb2005367e7e8a41863914 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Thu, 23 Dec 2004 10:07:17 +0000 Subject: base class macros svn path=/trunk/externals/tb/; revision=2426 --- chaos/src/henon_map.hpp | 90 ++++++++++++++----------------------------------- 1 file changed, 26 insertions(+), 64 deletions(-) (limited to 'chaos/src/henon_map.hpp') diff --git a/chaos/src/henon_map.hpp b/chaos/src/henon_map.hpp index d29e8a7..0aecbee 100644 --- a/chaos/src/henon_map.hpp +++ b/chaos/src/henon_map.hpp @@ -30,12 +30,14 @@ class henon: { public: henon() - : m_a(1.4), m_b(0.3) { m_num_eq = 2; m_data = new data_t[1]; - set_x(0.f); - set_y(0.f); + + CHAOS_SYS_INIT(x,0); + CHAOS_SYS_INIT(y,0); + CHAOS_SYS_INIT(a,1.4); + CHAOS_SYS_INIT(b,0.3); } ~henon() @@ -48,74 +50,34 @@ public: data_t x = m_data[0]; data_t y = m_data[1]; - m_data[0] = 1 + y - m_a * x * x; - m_data[1] = m_b * x; - + m_data[0] = 1 + y - CHAOS_PARAMETER(a) * x * x; + m_data[1] = CHAOS_PARAMETER(b) * x; } + CHAOS_SYSVAR_FUNCS(x, 0); + CHAOS_SYSVAR_FUNCS(y, 1); - void set_x(t_float f) - { - m_data[0] = (data_t) f; - } - - t_float get_x() - { - return (t_float)m_data[0]; - } - - - void set_y(t_float f) - { - m_data[1] = (data_t) f; - } + CHAOS_SYSPAR_FUNCS(a); - t_float get_y() + CHAOS_SYSPAR_FUNCS_PRED(b, m_pred_b); + bool m_pred_b(t_float f) { - return (t_float)m_data[1]; + return (f != 0); } - - - void set_a(t_float f) - { - m_a = (data_t) f; - } - - t_float get_a() - { - return (t_float)m_a; - } - - - void set_b(t_float f) - { - if (f != 0) - m_b = (data_t) f; - else - post("value for b %f out of range", f); - } - - t_float get_b() - { - return (t_float)m_b; - } - -private: - data_t m_a; - data_t m_b; }; -#define HENON_CALLBACKS \ -MAP_CALLBACKS; \ -FLEXT_CALLVAR_F(m_system->get_a, m_system->set_a); \ -FLEXT_CALLVAR_F(m_system->get_b, m_system->set_b); \ -FLEXT_CALLVAR_F(m_system->get_x, m_system->set_x); \ -FLEXT_CALLVAR_F(m_system->get_y, m_system->set_y); +#define HENON_CALLBACKS \ +MAP_CALLBACKS; \ +CHAOS_SYS_CALLBACKS(a); \ +CHAOS_SYS_CALLBACKS(b); \ +CHAOS_SYS_CALLBACKS(x); \ +CHAOS_SYS_CALLBACKS(y); + +#define HENON_ATTRIBUTES \ +MAP_ATTRIBUTES; \ +CHAOS_SYS_ATTRIBUTE(a); \ +CHAOS_SYS_ATTRIBUTE(b); \ +CHAOS_SYS_ATTRIBUTE(x); \ +CHAOS_SYS_ATTRIBUTE(y); -#define HENON_ATTRIBUTES \ -MAP_ATTRIBUTES; \ -FLEXT_ADDATTR_VAR("a",m_system->get_a, m_system->set_a); \ -FLEXT_ADDATTR_VAR("b",m_system->get_b, m_system->set_b); \ -FLEXT_ADDATTR_VAR("x",m_system->get_x, m_system->set_x); \ -FLEXT_ADDATTR_VAR("y",m_system->get_y, m_system->set_y); -- cgit v1.2.1 From b2f2fd990f9059db784a7849726c6fc5006c70f9 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Mon, 27 Dec 2004 14:44:11 +0000 Subject: a lot of new objects ... svn path=/trunk/externals/tb/; revision=2431 --- chaos/src/henon_map.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'chaos/src/henon_map.hpp') diff --git a/chaos/src/henon_map.hpp b/chaos/src/henon_map.hpp index 0aecbee..9e379ae 100644 --- a/chaos/src/henon_map.hpp +++ b/chaos/src/henon_map.hpp @@ -26,7 +26,7 @@ // taken from Willi-Hans Steeb: Chaos and Fractals class henon: - protected map_base + public map_base { public: henon() -- cgit v1.2.1 From 2a0d532e5965402f19f74f70dfdcc7efd1055b15 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Sat, 1 Jan 2005 11:06:58 +0000 Subject: speedup using function pointers svn path=/trunk/externals/tb/; revision=2439 --- chaos/src/henon_map.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'chaos/src/henon_map.hpp') diff --git a/chaos/src/henon_map.hpp b/chaos/src/henon_map.hpp index 9e379ae..b43034a 100644 --- a/chaos/src/henon_map.hpp +++ b/chaos/src/henon_map.hpp @@ -32,7 +32,7 @@ public: henon() { m_num_eq = 2; - m_data = new data_t[1]; + m_data = new data_t[m_num_eq]; CHAOS_SYS_INIT(x,0); CHAOS_SYS_INIT(y,0); -- cgit v1.2.1 From 2434290915cda6ed855e4dc2249312153b995817 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Thu, 9 Jun 2005 12:52:17 +0000 Subject: changed initialisation svn path=/trunk/externals/tb/; revision=3145 --- chaos/src/henon_map.hpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'chaos/src/henon_map.hpp') diff --git a/chaos/src/henon_map.hpp b/chaos/src/henon_map.hpp index b43034a..73aed66 100644 --- a/chaos/src/henon_map.hpp +++ b/chaos/src/henon_map.hpp @@ -31,18 +31,20 @@ class henon: public: henon() { - m_num_eq = 2; - m_data = new data_t[m_num_eq]; + CHAOS_PRECONSTRUCTOR; - CHAOS_SYS_INIT(x,0); - CHAOS_SYS_INIT(y,0); - CHAOS_SYS_INIT(a,1.4); - CHAOS_SYS_INIT(b,0.3); + CHAOS_SYS_INIT(x,0,0); + CHAOS_SYS_INIT(y,0,1); + + CHAOS_PAR_INIT(a,1.4); + CHAOS_PAR_INIT(b,0.3); + + CHAOS_POSTCONSTRUCTOR; } ~henon() { - delete m_data; + } virtual void m_step() -- cgit v1.2.1 From ef53e19b3d9019b1b1f3345390f55ae9229ce390 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Sat, 22 Oct 2005 15:11:45 +0000 Subject: cleanups and new system svn path=/trunk/externals/tb/; revision=3750 --- chaos/src/henon_map.hpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'chaos/src/henon_map.hpp') diff --git a/chaos/src/henon_map.hpp b/chaos/src/henon_map.hpp index 73aed66..bb1c6c7 100644 --- a/chaos/src/henon_map.hpp +++ b/chaos/src/henon_map.hpp @@ -29,17 +29,14 @@ class henon: public map_base { public: - henon() + henon(): + map_base(2) { - CHAOS_PRECONSTRUCTOR; - CHAOS_SYS_INIT(x,0,0); CHAOS_SYS_INIT(y,0,1); CHAOS_PAR_INIT(a,1.4); CHAOS_PAR_INIT(b,0.3); - - CHAOS_POSTCONSTRUCTOR; } ~henon() -- cgit v1.2.1 From 13cba7a7997e318fbba01a36912219355e387d52 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Sun, 21 May 2006 18:34:34 +0000 Subject: rewrote most stuff using templates svn path=/trunk/externals/tb/; revision=5105 --- chaos/src/henon_map.hpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'chaos/src/henon_map.hpp') diff --git a/chaos/src/henon_map.hpp b/chaos/src/henon_map.hpp index bb1c6c7..014fa68 100644 --- a/chaos/src/henon_map.hpp +++ b/chaos/src/henon_map.hpp @@ -26,11 +26,10 @@ // taken from Willi-Hans Steeb: Chaos and Fractals class henon: - public map_base + public map_base<2> { public: - henon(): - map_base(2) + henon() { CHAOS_SYS_INIT(x,0,0); CHAOS_SYS_INIT(y,0,1); @@ -39,10 +38,6 @@ public: CHAOS_PAR_INIT(b,0.3); } - ~henon() - { - - } virtual void m_step() { -- cgit v1.2.1 From 2c157bd8aa1f5387169cc0c0910d36c8068c4068 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Sun, 21 May 2006 19:17:04 +0000 Subject: improved inlining for maps svn path=/trunk/externals/tb/; revision=5106 --- chaos/src/henon_map.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'chaos/src/henon_map.hpp') diff --git a/chaos/src/henon_map.hpp b/chaos/src/henon_map.hpp index 014fa68..b7ca5bf 100644 --- a/chaos/src/henon_map.hpp +++ b/chaos/src/henon_map.hpp @@ -39,7 +39,7 @@ public: } - virtual void m_step() + void m_step() { data_t x = m_data[0]; data_t y = m_data[1]; -- cgit v1.2.1