Main Page | Namespace List | Alphabetical List | Class List | Directories | File List | Class Members | File Members

GlobalVariables.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   SpikeStream Library                                                   *
00003  *   Copyright (C) 2007 by David Gamez                                     *
00004  *   david@davidgamez.eu                                                   *
00005  *   Version 0.1                                                           *
00006  *                                                                         *
00007  *   This program is free software; you can redistribute it and/or modify  *
00008  *   it under the terms of the GNU General Public License as published by  *
00009  *   the Free Software Foundation; either version 2 of the License, or     *
00010  *   (at your option) any later version.                                   *
00011  *                                                                         *
00012  *   This program is distributed in the hope that it will be useful,       *
00013  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00014  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00015  *   GNU General Public License for more details.                          *
00016  *                                                                         *
00017  *   You should have received a copy of the GNU General Public License     *
00018  *   along with this program; if not, write to the                         *
00019  *   Free Software Foundation, Inc.,                                       *
00020  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00021  ***************************************************************************/
00022 
00023 //--------------------------  Global Variables  ----------------------------
00024 /*! Definitions of variables that apply across the whole application. */
00025 //--------------------------------------------------------------------------
00026 
00027 #ifndef GLOBALVARIABLES_H
00028 #define GLOBALVARIABLES_H
00029 
00030 //Other includes
00031 #include <cstring>
00032 
00033 
00034 /*! Defines of the different archive types. 
00035         A firing neurons archive records the firing state of the neurons at any point in time
00036         This is different from recording the spikes sent out from a neuron group, which are 
00037         generally spread out in time because of the delay.*/
00038 #define FIRING_NEURON_ARCHIVE 1
00039 #define SPIKE_ARCHIVE 10
00040 
00041 
00042 /*! Defines of the firing mode of a device. Input spikes from an external device can either
00043         fire the neuron directly or they can inject synaptic current into the neuron.
00044         When this value is set between -1.0 and 1.0 it is synaptic input mode. */
00045 #define INPUT_DIRECT_FIRING_MODE 100.0
00046 #define OUTPUT_FIRING_MODE 200.0
00047 
00048 
00049 /*! Reserved neuron ids used to initialise dense_hash_map.
00050         Auto increment always starts with 10 so a neuron ID of zero or 1 should not occur.*/
00051 #define EMPTY_NEURON_ID_KEY 0
00052 #define DELETED_NEURON_ID_KEY 1
00053 
00054 
00055 /*! The minimum neuron id. Any neuron id less than this is invalid.*/
00056 #define MINIMUM_NEURON_ID 10
00057 
00058 
00059 /*! A neuron id that will never exist in the database and which is not already
00060         used in the dense hash maps as a deleted or empty key.*/
00061 #define NULL_NEURON_ID 5
00062 
00063 
00064 /*! The maximum length of a name in the database.*/
00065 #define MAX_DATABASE_NAME_LENGTH 255
00066 
00067 
00068 /*! Monitor windows are added in the constructor.
00069         This is the size of the monitorWindowArray: this number of 
00070         dock windows will be added to the dock area.*/
00071 #define MAX_NUMBER_MONITOR_WINDOWS 100
00072 
00073 
00074 /*! The maximum number of spikes that can be received in a single packet
00075         This is the size of the receive array.*/
00076 #define MAX_NUMBER_OF_SPIKES 1000000
00077 
00078 
00079 /*! Maximum number of attempts to reconnect to the database. */
00080 #define MAX_NUMBER_RECONNECT_ATTEMPTS 2
00081 
00082 
00083 /*! File extension for saving archive file of databases.*/
00084 #define NEURON_APPLICATION_FILE_EXTENSION ".sql.tar.gz"
00085 
00086 
00087 /*! The number of delay values available to the simulation.
00088         These are created using a buffer to hold the spikes.*/
00089 #define NUMBER_OF_DELAY_VALUES 256
00090 
00091 
00092 /*! Number used to code for the percentage of neurons being selected
00093         randomly for the noise at each timestep. Used when maximum entropy
00094         is required in the layer. */
00095 #define RANDOM_PERCENT_NEURONS_NOISE 1000
00096 
00097 
00098 /*! Commenting or uncommenting this define determines whether 
00099         statistics are recorded for the simulation.*/
00100 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00101 //#define RECORD_STATISTICS
00102 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00103 
00104 
00105 /*! Function for comparing two char keys in a hash map.*/
00106 struct charKeyCompare{
00107   bool operator()(const char* key1, const char* key2) const{
00108     return strcmp(key1, key2) < 0;
00109   }
00110 };
00111 
00112 
00113 /*! Comparison function for synapseMonitorMap.
00114         Need a comparison function that returns true if s1 is less than s2, and false otherwise.
00115         This is made similar to an alphabetical comparison so that if the first byte in s1 is less than
00116         the first byte in s2. the whole int[] s1 is rated as less than s2.*/
00117 struct synapseKeyCompare {
00118         bool operator()(const unsigned int* key1, const unsigned int* key2) const {
00119                 if(key1[0] < key2[0])
00120                         return true; //key1[0] >= key2[0]
00121                 else if (key1[0] == key2[0])
00122                         if(key1[1] < key2[1])
00123                                 return true;//key1[0] == key2[0] && key1[1] < key2[1]
00124                 return false;
00125         }
00126 };
00127 
00128 
00129 /*! Data structure containing monitored data from the neuron or synapse.*/
00130 struct MonitorData {
00131         double* dataArray;
00132         int length;
00133 };
00134 
00135 
00136 /*! Random seed used to initialise random number generator.
00137         Use the same seed each time to get reproducible results.*/
00138 static const unsigned int randomSeed = 719253438;
00139 
00140 
00141 #endif //GLOBALVARIABLES_H
00142 

Generated on Mon Sep 3 22:18:50 2007 for SpikeStream Library by  doxygen 1.4.4