00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "ne_dyn_node_ode_lib.h"
00024
00025
00026 ne_dyn_node_t * ne_dyn_ode_n1_none_alloc (void)
00027 {
00028 ne_dyn_node_t *nodeDyn;
00029
00030 if ((nodeDyn = (ne_dyn_node_t *)malloc(sizeof(ne_dyn_node_t))) == NULL) {
00031 ne_error("ne_dyn_ode_n1_none_alloc: Could not allocate memory.");
00032 return NULL;
00033 }
00034
00035
00036 nodeDyn->name = "ODE_N1_NONE";
00037 nodeDyn->states = 1;
00038 nodeDyn->fn = &ne_dyn_ode_n1_none_fn;
00039 return nodeDyn;
00040 }
00041
00042
00043 ne_err_code_t ne_dyn_ode_n1_none_fn (int i, void *S, double t, const double *y, double *dydt,
00044 double *params)
00045 {
00046 dydt[i] = 0.0;
00047 return NE_SUCCESS;
00048 }
00049
00050
00051 ne_dyn_node_t * ne_dyn_ode_n3_rossler_alloc (void)
00052 {
00053 ne_dyn_node_t *nodeDyn;
00054
00055 if ((nodeDyn = (ne_dyn_node_t *)malloc(sizeof(ne_dyn_node_t))) == NULL) {
00056 ne_error("ne_dyn_ode_n3_rossler_alloc: Could not allocate memory.");
00057 return NULL;
00058 }
00059
00060
00061 nodeDyn->name = "ODE_N3_ROSSLER";
00062 nodeDyn->states = 3;
00063 nodeDyn->fn = &ne_dyn_ode_n3_rossler_osc_fn;
00064 return nodeDyn;
00065 }
00066
00067
00068 ne_err_code_t ne_dyn_ode_n3_rossler_osc_fn (int i, void *S, double t, const double *y, double *dydt,
00069 double *params)
00070 {
00071 int xInd, yInd, zInd;
00072
00073
00074 xInd = i*3;
00075 yInd = (i*3)+1;
00076 zInd = (i*3)+2;
00077
00078
00079 dydt[xInd] = -y[yInd] - y[zInd];
00080 dydt[yInd] = y[xInd] + (params[0] * y[yInd]);
00081 dydt[zInd] = params[1] + ((y[xInd] - params[2]) * y[zInd]);
00082
00083 return NE_SUCCESS;
00084 }
00085