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

ne_std.c

Go to the documentation of this file.
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  ============================================================================*/
00024 #include "ne_std.h"
00025 #include "ne_dyn.h"
00026 #include <igraph.h>
00027 #include <gsl/gsl_rng.h>
00028 #include <string.h>
00029 #include <stdarg.h>
00030 #include <stdlib.h>
00031 
00032 
00037 gsl_rng* neRng;
00038 
00039 
00040 void ne_init (unsigned int rngSeed) 
00041 {  
00042 #ifdef DEBUG
00043    ne_log("DEBUG: ne_init - Initialising NetEvo toolkit.\n");
00044 #endif
00045    
00046    /* Turn on attribute handling */
00047    igraph_i_set_attribute_table(&igraph_cattribute_table);
00048    
00049    /* Create the random number generator using the Tausworthe generator */
00050    neRng = gsl_rng_alloc(gsl_rng_taus);
00051    
00052    /* Seed the new random number generator */
00053    gsl_rng_set(neRng, rngSeed);
00054 }
00055 
00056 
00057 void ne_finalise (void) 
00058 {
00059 #ifdef DEBUG
00060    ne_log("DEBUG: ne_finalise - Cleaning up NetEvo toolkit.\n");
00061 #endif
00062    
00063    /* Deallocate the random number generator */
00064    gsl_rng_free(neRng);
00065    
00066    /* Clean-up the dynamics library */
00067    ne_dyn_finalise();
00068 }
00069 
00070 
00071 void ne_error (const char *fmt, ...)
00072 {
00073    va_list arg;
00074    va_start(arg, fmt);
00075    fprintf(stderr, "[NetEvo Error] ");
00076    vfprintf(stderr, fmt, arg);
00077    fprintf(stderr, "\n");
00078    fflush(stderr);
00079    va_end(arg);
00080 }
00081 
00082 
00083 void ne_log (const char *fmt, ...)
00084 {
00085    va_list arg;
00086    va_start(arg, fmt);
00087    fprintf(stdout, "[NetEvo] ");
00088    vfprintf(stdout, fmt, arg);
00089    fprintf(stdout, "\n");
00090    fflush(stdout);
00091    va_end(arg);
00092 }
00093 

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