• Main Page
  • Data Structures
  • Files
  • File List
  • Globals

ne_dyn_node_ode_lib.c

00001 /*===========================================================================
00002  NetEvo Foundation Library
00003  Copyright (C) 2009, 2010 Thomas E. Gorochowski <tgorochowski@me.com>
00004  Bristol Centre for Complexity Sciences, University of Bristol, Bristol, UK
00005  ---------------------------------------------------------------------------- 
00006  NetEvo is a computing framework designed to allow researchers to investigate 
00007  evolutionary aspects of dynamical complex networks. By providing tools to 
00008  easily integrate each of these factors in a coherent way, it is hoped a 
00009  greater understanding can be gained of key attributes and features displayed 
00010  by complex systems.
00011  
00012  NetEvo is open-source software released under the Open Source Initiative 
00013  (OSI) approved Non-Profit Open Software License ("Non-Profit OSL") 3.0. 
00014  Detailed information about this licence can be found in the COPYING file 
00015  included as part of the source distribution.
00016  
00017  This library is distributed in the hope that it will be useful, but
00018  WITHOUT ANY WARRANTY; without even the implied warranty of
00019  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
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    /* Define the dynamics structure */
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    /* Define the dynamics structure */
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    /* Precalculate index for xi, yi, zi components */
00074    xInd = i*3;
00075    yInd = (i*3)+1;
00076    zInd = (i*3)+2;
00077    
00078    /* Calculate derivite values */
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 

Generated on Thu Aug 26 2010 11:04:24 for NetEvo by  doxygen 1.7.1