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/chaos_base.hpp | 37 +++++++++---------------------------- 1 file changed, 9 insertions(+), 28 deletions(-) (limited to 'chaos/src/chaos_base.hpp') diff --git a/chaos/src/chaos_base.hpp b/chaos/src/chaos_base.hpp index 5c87bed..4b984d9 100644 --- a/chaos/src/chaos_base.hpp +++ b/chaos/src/chaos_base.hpp @@ -1,7 +1,7 @@ // // // chaos~ -// Copyright (C) 2004 Tim Blechmann +// Copyright (C) 2004, 2006 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 @@ -23,26 +23,23 @@ #include "chaos.hpp" #include -#define MAXDIMENSION 5 // this should be enough for the first - +template class chaos_base { public: - chaos_base(int n): - m_num_eq(n) + chaos_base() { - m_data = new data_t[n]; } - inline t_sample get_data(unsigned int i) { + assert(i attr_ind; - // TableAnyMap attr_ind; /* thomas fragen :-) */ // check the integrity of the system - virtual void m_verify() + inline void m_verify() { } inline void m_bash_denormals() { - for (int i = 0; i != get_num_eq(); ++i) + for (int i = 0; i != dimensions; ++i) { #ifndef DOUBLE_PRECISION if (PD_BIGORSMALL(m_data[i])) @@ -71,28 +67,13 @@ public: } }; - data_t * m_data; // state of the system + data_t m_data[dimensions]; // state of the system protected: - virtual void m_step() = 0; // iteration - const int m_num_eq; // number of equations of the system + virtual void m_step() = 0; // iteration 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 */ -- cgit v1.2.1