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/bungalow_tent_map.hpp | 121 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 chaos/src/bungalow_tent_map.hpp (limited to 'chaos/src/bungalow_tent_map.hpp') diff --git a/chaos/src/bungalow_tent_map.hpp b/chaos/src/bungalow_tent_map.hpp new file mode 100644 index 0000000..6708eae --- /dev/null +++ b/chaos/src/bungalow_tent_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" + +// bungalow_tent map: x[n+1] = 1 + 2 * r + 2 * (r + 1) * x[n] +// (for -1 <= x[n] < -0.5f) +// 1 + 2 * (1 - r) * (x[n]) +// (for -0.5 <= x[n] < 0) +// 1 + 2 * (r - 1) * (x[n]) +// (for 0 <= x[n] < 0.5) +// 1 + 2 * r - 2 * (r + 1) * (x[n]) +// (for 0.5 <= x[n] < 1) +// -1 <= x[n] < 1 +// -0.5 <= r < 1 +// taken from Willi-Hans Steeb: Chaos and Fractals + +class bungalow_tent: + protected map_base +{ +public: + bungalow_tent() + : m_r(0.5) + { + m_num_eq = 1; + m_data = new data_t[1]; + set_x(0.5f); + } + + ~bungalow_tent() + { + delete m_data; + } + + virtual void m_step() + { + data_t x = m_data[0]; + data_t r = m_r; + + if ( x < - 0.5) + { + m_data[0] = 1 + 2 * r + 2 * (r + 1) * x; + return; + } + if ( x < 0) + { + m_data[0] = 1 + 2 * (1 - r) * x; + return; + } + if ( x < 0.5) + { + m_data[0] = 1 + 2 * (r - 1) * x; + return; + } + else + { + m_data[0] = 1 + 2 * r - 2 * (r + 1) * x; + return; + } + + } + + void set_x(t_float f) + { + if ( (f > -1) && (f < 1)) + m_data[0] = (data_t) f; + else + post("value for x %f out of range", f); + } + + t_float get_x() + { + return (t_float)m_data[0]; + } + + void set_r(t_float f) + { + if ( (f > -.5) && (f < 1)) + m_data[0] = (data_t) f; + else + post("value for r %f out of range", f); + } + + t_float get_r() + { + return (t_float)m_data[0]; + } + +private: + data_t m_r; + +}; + + +#define BUNGALOW_TENT_CALLBACKS \ +MAP_CALLBACKS; \ +FLEXT_CALLVAR_F(m_system->get_r, m_system->set_r); \ +FLEXT_CALLVAR_F(m_system->get_x, m_system->set_x); \ + + +#define BUNGALOW_TENT_ATTRIBUTES \ +MAP_ATTRIBUTES; \ +FLEXT_ADDATTR_VAR("r",m_system->get_r, m_system->set_r); \ +FLEXT_ADDATTR_VAR("x",m_system->get_x, m_system->set_x); -- 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/bungalow_tent_map.hpp | 54 +++++++++++++---------------------------- 1 file changed, 17 insertions(+), 37 deletions(-) (limited to 'chaos/src/bungalow_tent_map.hpp') diff --git a/chaos/src/bungalow_tent_map.hpp b/chaos/src/bungalow_tent_map.hpp index 6708eae..dfb6e25 100644 --- a/chaos/src/bungalow_tent_map.hpp +++ b/chaos/src/bungalow_tent_map.hpp @@ -37,11 +37,11 @@ class bungalow_tent: { public: bungalow_tent() - : m_r(0.5) { m_num_eq = 1; m_data = new data_t[1]; - set_x(0.5f); + CHAOS_SYS_INIT(x, 0.5); + CHAOS_SYS_INIT(r, 0.5); } ~bungalow_tent() @@ -52,7 +52,7 @@ public: virtual void m_step() { data_t x = m_data[0]; - data_t r = m_r; + data_t r = CHAOS_PARAMETER(r); if ( x < - 0.5) { @@ -77,45 +77,25 @@ public: } - void set_x(t_float f) + CHAOS_SYSVAR_FUNCS_PRED(x, 0, m_pred_x); + bool m_pred_x(t_float f) { - if ( (f > -1) && (f < 1)) - m_data[0] = (data_t) f; - else - post("value for x %f out of range", f); - } - - t_float get_x() - { - return (t_float)m_data[0]; - } - - void set_r(t_float f) - { - if ( (f > -.5) && (f < 1)) - m_data[0] = (data_t) f; - else - post("value for r %f out of range", f); + return (f >= -1) && (f < 1); } - t_float get_r() + CHAOS_SYSVAR_FUNCS_PRED(r, 0, m_pred_r); + bool m_pred_r(t_float f) { - return (t_float)m_data[0]; + return (f >= -0.5) && (f < 1); } - -private: - data_t m_r; - }; +#define BUNGALOW_TENT_CALLBACKS \ +MAP_CALLBACKS; \ +CHAOS_SYS_CALLBACKS(x); \ +CHAOS_SYS_CALLBACKS(r); -#define BUNGALOW_TENT_CALLBACKS \ -MAP_CALLBACKS; \ -FLEXT_CALLVAR_F(m_system->get_r, m_system->set_r); \ -FLEXT_CALLVAR_F(m_system->get_x, m_system->set_x); \ - - -#define BUNGALOW_TENT_ATTRIBUTES \ -MAP_ATTRIBUTES; \ -FLEXT_ADDATTR_VAR("r",m_system->get_r, m_system->set_r); \ -FLEXT_ADDATTR_VAR("x",m_system->get_x, m_system->set_x); +#define BUNGALOW_TENT_ATTRIBUTES \ +MAP_ATTRIBUTES; \ +CHAOS_SYS_ATTRIBUTE(x) \ +CHAOS_SYS_ATTRIBUTE(r) -- 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/bungalow_tent_map.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'chaos/src/bungalow_tent_map.hpp') diff --git a/chaos/src/bungalow_tent_map.hpp b/chaos/src/bungalow_tent_map.hpp index dfb6e25..185753a 100644 --- a/chaos/src/bungalow_tent_map.hpp +++ b/chaos/src/bungalow_tent_map.hpp @@ -33,14 +33,14 @@ // taken from Willi-Hans Steeb: Chaos and Fractals class bungalow_tent: - protected map_base + public map_base { public: bungalow_tent() { m_num_eq = 1; m_data = new data_t[1]; - CHAOS_SYS_INIT(x, 0.5); + CHAOS_SYS_INIT(x, 0.6); CHAOS_SYS_INIT(r, 0.5); } @@ -83,7 +83,7 @@ public: return (f >= -1) && (f < 1); } - CHAOS_SYSVAR_FUNCS_PRED(r, 0, m_pred_r); + CHAOS_SYSPAR_FUNCS_PRED(r, m_pred_r); bool m_pred_r(t_float f) { return (f >= -0.5) && (f < 1); -- 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/bungalow_tent_map.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'chaos/src/bungalow_tent_map.hpp') diff --git a/chaos/src/bungalow_tent_map.hpp b/chaos/src/bungalow_tent_map.hpp index 185753a..0dfe709 100644 --- a/chaos/src/bungalow_tent_map.hpp +++ b/chaos/src/bungalow_tent_map.hpp @@ -39,7 +39,7 @@ public: bungalow_tent() { m_num_eq = 1; - m_data = new data_t[1]; + m_data = new data_t[m_num_eq]; CHAOS_SYS_INIT(x, 0.6); CHAOS_SYS_INIT(r, 0.5); } -- 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/bungalow_tent_map.hpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'chaos/src/bungalow_tent_map.hpp') diff --git a/chaos/src/bungalow_tent_map.hpp b/chaos/src/bungalow_tent_map.hpp index 0dfe709..5da431d 100644 --- a/chaos/src/bungalow_tent_map.hpp +++ b/chaos/src/bungalow_tent_map.hpp @@ -38,15 +38,17 @@ class bungalow_tent: public: bungalow_tent() { - m_num_eq = 1; - m_data = new data_t[m_num_eq]; - CHAOS_SYS_INIT(x, 0.6); - CHAOS_SYS_INIT(r, 0.5); + CHAOS_PRECONSTRUCTOR; + + CHAOS_SYS_INIT(x, 0.6,0); + CHAOS_PAR_INIT(r, 0.5); + + CHAOS_POSTCONSTRUCTOR; } ~bungalow_tent() { - 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/bungalow_tent_map.hpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'chaos/src/bungalow_tent_map.hpp') diff --git a/chaos/src/bungalow_tent_map.hpp b/chaos/src/bungalow_tent_map.hpp index 5da431d..4d4836b 100644 --- a/chaos/src/bungalow_tent_map.hpp +++ b/chaos/src/bungalow_tent_map.hpp @@ -36,14 +36,11 @@ class bungalow_tent: public map_base { public: - bungalow_tent() + bungalow_tent(): + map_base(1) { - CHAOS_PRECONSTRUCTOR; - CHAOS_SYS_INIT(x, 0.6,0); CHAOS_PAR_INIT(r, 0.5); - - CHAOS_POSTCONSTRUCTOR; } ~bungalow_tent() -- 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/bungalow_tent_map.hpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'chaos/src/bungalow_tent_map.hpp') diff --git a/chaos/src/bungalow_tent_map.hpp b/chaos/src/bungalow_tent_map.hpp index 4d4836b..fd098f3 100644 --- a/chaos/src/bungalow_tent_map.hpp +++ b/chaos/src/bungalow_tent_map.hpp @@ -33,21 +33,15 @@ // taken from Willi-Hans Steeb: Chaos and Fractals class bungalow_tent: - public map_base + public map_base<1> { public: - bungalow_tent(): - map_base(1) + bungalow_tent() { CHAOS_SYS_INIT(x, 0.6,0); CHAOS_PAR_INIT(r, 0.5); } - ~bungalow_tent() - { - - } - virtual void m_step() { data_t x = m_data[0]; -- 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/bungalow_tent_map.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'chaos/src/bungalow_tent_map.hpp') diff --git a/chaos/src/bungalow_tent_map.hpp b/chaos/src/bungalow_tent_map.hpp index fd098f3..492b6d5 100644 --- a/chaos/src/bungalow_tent_map.hpp +++ b/chaos/src/bungalow_tent_map.hpp @@ -42,7 +42,7 @@ public: CHAOS_PAR_INIT(r, 0.5); } - virtual void m_step() + void m_step() { data_t x = m_data[0]; data_t r = CHAOS_PARAMETER(r); -- cgit v1.2.1