#ifndef __DMETODY_N_H__ #define __DMETODY_N_H__ #include "dtypyn.h" #include /* Jest to plik naglowkowy otwartych metod rozwiazywania */ /* ukladu rownan rozniczkowych zwyczajnych */ /* pierwszego rzedu */ /* ======================================================================= */ /* ============================ Jednokrokowe ============================= */ /* ======================================================================= */ typedef void RK_method( real* res, int dim, p_dequation1 *f, real* x, real t, real h ); /* #define RK_METHODS_NO 7 */ #define RK_METHODS_NO 6 #ifndef __DMETODY_N_C__ extern struct { char *Name; RK_method *pMethod; } RK_methods_table[RK_METHODS_NO]; #endif void Euler( real* res, int dim, p_dequation1 *f, real* x, real t, real h ); /* ---------------------------- Rungego Kutty ---------------------------- */ void Heun( real* res, int dim, p_dequation1 *f, real* x, real t, real h ); void ImprovedEuler( real* res, int dim, p_dequation1 *f, real* x, real t, real h ); void RungeKutta4_classic( real *res, int dim, p_dequation1 *f, real* x, real t, real h ); void RungeKutta4_three_eighths( real* res, int dim, p_dequation1 *f, real* x, real t, real h ); void RungeKutta4_Ralston( real* res, int dim, p_dequation1 *f, real* x, real t, real h ); void RungeKutta5_6_Scraton( real* res, int dim, p_dequation1 *f, real* x, real t, real h ); /* -------------------- Rungego Kutty o zmiennym kroku ------------------- */ typedef struct v_info_struct { real atol,rtol,fac,fac_min,fac_max,h_min,h_max; /* standardowo : atol = 1e-8 - wspolczynnik tolerancji bezwzglednej rtol = 1e-8 - wspolczynnik tolerancji wzglednej fac = 0.8 - mnoznik (zabezpieczenie aby zapewnic prog bezpieczenstwa dla err) fac_min = 0.2 - minimalny mnoznik (h' = mnoznik*h) fac_max = 5.0 - maksymalny mnoznik (h' = mnoznik*h) h_min np. 1e-8 - minimalny dopuszczalny krok h_max np. 10.0 - maksymalny dopuszczalny krok */ } v_info_t; void set_max_error(v_info_t *dane_zm, real max_err); typedef void RK_varstep_method( real *res, int dim, p_dequation1 *f, real* x, real t, real *h, v_info_t *dane_zm ); #define RK_VARSTEP_METHODS_NO 1 #ifndef __DMETODY_N_C__ extern v_info_t default_v_info; extern struct { char *Name; RK_method *pMethod; } RK_varstep_methods_table[RK_VARSTEP_METHODS_NO]; #endif /* metoda Rungego-Kutty 4. rzedu ze zmiennym krokiem calkowania */ /* z uzyciem ekstrapolacji Richardsona do szacowania bledu */ /* oraz poprawiania rzedu metody (z 4. na 5.) */ void RungeKutta4_5_classic( real *res, int dim, p_dequation1 *f, real *x, real t, real *h, v_info_t *dane_zm ); /* ======================================================================= */ /* ============================ Wielokrokowe ============================= */ /* ======================================================================= */ typedef void multistep_method( real* res, int dim, real* f, real* x, real h ); #define MULTISTEP_METHODS_NO 6 #ifndef __DMETODY_N_C__ extern struct { char *Name; multistep_method *pMethod; } mutistep_methods_table[MULTISTEP_METHODS_NO]; #endif void Midpoint( real* res, int dim, real* f, real* x, real h ); void open_1step_1( real* res, int dim, real* f, real* x, real h ); void open_2step_1( real* res, int dim, real* f, real* x, real h ); void open_3step_1( real* res, int dim, real* f, real* x, real h ); void open_4step_1( real* res, int dim, real* f, real* x, real h ); void open_4step_2( real* res, int dim, real* f, real* x, real h ); /* ----------------------------------------------------------------------- */ void InitializeHamming( void ); void Hamming( real* res, int dim, p_dequation1 *func, real* f[4], real* x[4], real t, real h ); #endif