From 2393d5bab1917825e806871d9050ca54dc3041f3 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Sat, 12 Feb 2005 08:58:21 +0000 Subject: stability improvement and others svn path=/trunk/externals/tb/; revision=2568 --- chaos/src/Makefile.am | 2 +- chaos/src/chaos.hpp | 1 + chaos/src/chaos_base.hpp | 2 +- chaos/src/driven_anharmonic.hpp | 2 +- chaos/src/latoocarfian.hpp | 12 ++++++++++++ chaos/src/latoomutalpha.hpp | 12 ++++++++++++ chaos/src/latoomutbeta.hpp | 13 +++++++++++++ chaos/src/latoomutgamma.hpp | 13 +++++++++++++ chaos/src/main.cpp | 3 ++- 9 files changed, 56 insertions(+), 4 deletions(-) (limited to 'chaos') diff --git a/chaos/src/Makefile.am b/chaos/src/Makefile.am index 213e313..2b87927 100644 --- a/chaos/src/Makefile.am +++ b/chaos/src/Makefile.am @@ -1,6 +1,6 @@ NAME = chaos -BUILT_SOURCES = main.cpp ode_base.cpp chaos_base.cpp chaos_dsp.cpp \ +BUILT_SOURCES = main.cpp ode_base.cpp chaos_dsp.cpp \ bernoulli_dsp.cpp bernoulli_msg.cpp \ bungalow_tent_dsp.cpp bungalow_tent_msg.cpp \ circle_map_dsp.cpp circle_map_msg.cpp \ diff --git a/chaos/src/chaos.hpp b/chaos/src/chaos.hpp index a1a3467..0f87b51 100644 --- a/chaos/src/chaos.hpp +++ b/chaos/src/chaos.hpp @@ -22,6 +22,7 @@ #define FLEXT_ATTRIBUTES 1 +#define _USE_MATH_DEFINES /* tg says: define this before including cmath */ #include "flext.h" #include "chaos_defs.hpp" #include diff --git a/chaos/src/chaos_base.hpp b/chaos/src/chaos_base.hpp index a2072d0..3e11201 100644 --- a/chaos/src/chaos_base.hpp +++ b/chaos/src/chaos_base.hpp @@ -56,7 +56,7 @@ public: data_t * m_data; // state of the system protected: - virtual void m_step(); + virtual void m_step() = 0; int m_num_eq; // number of equations of the system }; diff --git a/chaos/src/driven_anharmonic.hpp b/chaos/src/driven_anharmonic.hpp index 8c319e9..56d81e0 100644 --- a/chaos/src/driven_anharmonic.hpp +++ b/chaos/src/driven_anharmonic.hpp @@ -71,7 +71,7 @@ public: m_t += m_dt; if (m_t > 2 * M_PI) - m_t = fmod(m_t, 2*M_PI); + m_t = fmod(m_t, (data_t)2*M_PI); } data_t m_t; diff --git a/chaos/src/latoocarfian.hpp b/chaos/src/latoocarfian.hpp index c2a31a1..1fe1b9a 100644 --- a/chaos/src/latoocarfian.hpp +++ b/chaos/src/latoocarfian.hpp @@ -76,6 +76,18 @@ public: { return (f > -0.5) && (f < 1.5); } + + /* function has a fix point for x1 == x2 == 0 */ + virtual void m_verify() + { + for (int i = 0; i != get_num_eq(); ++i) + { +#ifndef DOUBLE_PRECISION + if (PD_BIGORSMALL(m_data[i])) + m_data[i] = 0.01; +#endif + } + }; }; diff --git a/chaos/src/latoomutalpha.hpp b/chaos/src/latoomutalpha.hpp index 6926d1b..015eddf 100644 --- a/chaos/src/latoomutalpha.hpp +++ b/chaos/src/latoomutalpha.hpp @@ -61,6 +61,18 @@ public: m_data[1] = sin(x1*a) + tmp1*tmp1 + tmp2*tmp2*tmp2; } + /* function has a fix point for x1 == x2 == 0 */ + virtual void m_verify() + { + for (int i = 0; i != get_num_eq(); ++i) + { +#ifndef DOUBLE_PRECISION + if (PD_BIGORSMALL(m_data[i])) + m_data[i] = 0.01; +#endif + } + }; + CHAOS_SYSVAR_FUNCS(x1, 0); CHAOS_SYSVAR_FUNCS(x2, 1); diff --git a/chaos/src/latoomutbeta.hpp b/chaos/src/latoomutbeta.hpp index 4940be1..fac43d6 100644 --- a/chaos/src/latoomutbeta.hpp +++ b/chaos/src/latoomutbeta.hpp @@ -58,6 +58,19 @@ public: m_data[1] = sin(x1*a) + tmp*tmp; } + + /* function has a fix point for x1 == x2 == 0 */ + virtual void m_verify() + { + for (int i = 0; i != get_num_eq(); ++i) + { +#ifndef DOUBLE_PRECISION + if (PD_BIGORSMALL(m_data[i])) + m_data[i] = 0.01; +#endif + } + }; + CHAOS_SYSVAR_FUNCS(x1, 0); CHAOS_SYSVAR_FUNCS(x2, 1); diff --git a/chaos/src/latoomutgamma.hpp b/chaos/src/latoomutgamma.hpp index b4f3bf8..d83059e 100644 --- a/chaos/src/latoomutgamma.hpp +++ b/chaos/src/latoomutgamma.hpp @@ -58,6 +58,19 @@ public: m_data[1] = CHAOS_ABS(sin(x1*a)) + tmp*tmp; } + + /* function has a fix point for x1 == x2 == 0 */ + virtual void m_verify() + { + for (int i = 0; i != get_num_eq(); ++i) + { +#ifndef DOUBLE_PRECISION + if (PD_BIGORSMALL(m_data[i])) + m_data[i] = 0.01; +#endif + } + }; + CHAOS_SYSVAR_FUNCS(x1, 0); CHAOS_SYSVAR_FUNCS(x2, 1); diff --git a/chaos/src/main.cpp b/chaos/src/main.cpp index dcb7ea8..c78a7b5 100644 --- a/chaos/src/main.cpp +++ b/chaos/src/main.cpp @@ -23,7 +23,8 @@ void chaos_library_setup() { - post("chaos~ version "PACKAGE_VERSION"\n"); + post("chaos~ version "PACKAGE_VERSION", compiled on "__DATE__" \n"); + CHAOS_ADD(bernoulli); CHAOS_ADD(bungalow_tent); -- cgit v1.2.1