CSIM: network.h Source File

network.h

Go to the documentation of this file.
00001 
00005 #ifndef _NETWORK_H_
00006 #define _NETWORK_H_
00007 
00008 //#include "csimclass.h"
00009 #include "csimlist.h"
00010 #include "spikingsynapse.h"
00011 
00012 class Forceable;
00013 class Neuron;
00014 class Synapse;
00015 class Teacher;
00016 class csimRecorder;
00017 /* ************** BEGIN MICHAEL PFEIFFER **************** */
00018 class Readout;
00019 class Preprocessor;
00020 class Algorithm;
00021 class PhysicalModel;
00022 /* ************** END MICHAEL PFEIFFER **************** */
00023 struct csimInputChannel;
00024 
00026 
00029 class Network {
00030 
00031 public:
00032 
00034   Network(void);
00035 
00037   virtual ~Network();
00038 
00040   virtual int addNewObject(Advancable *a);
00041 
00043   Advancable *getObject(uint32 idx);
00044 
00045 
00047   int connect(uint32 destination, uint32 source);
00048   int connect(uint32 dst, uint32 *src, uint32 n);
00049   int connect(uint32 *dst, uint32 src, uint32 n);
00050   int connect(uint32 *dst, uint32 *src, uint32 n);
00051   int connect(uint32 recorderIdx, uint32 *objIdx, uint32 n, char *fieldName);
00052   int connect(uint32 *postIdx, uint32 *preIdx, uint32 *synIdx , uint32 n);
00053 
00055   int reset(void);
00056 
00058   int simulate(unsigned long nSteps, csimInputChannel *inputSignal, int ni, csimInputChannel *teacherSignal, int nt);
00059 
00061   unsigned long totalSpikeCount(void);
00062 
00064   void getSpikes(uint32 *idx, double *times);
00065 
00067   int getNumOf(char *className);
00068 
00070   int getNumObjects(void) {return objectList.n;}
00071 
00073   int setParameter(uint32 *idx, int nIdx, char *paramName, double *value, int m, int n);
00074 
00076   int getParameter(uint32 *idx, int n, char *paramName, double **value, int *m);
00077 
00079   int updateObjects(void);
00080 
00082   // void preSpikeNotify(SpikingSynapse *s);
00083 
00085   void ScheduleSpike(SpikingSynapse *s, pSpikeHandler h, double delay);
00086 
00088   int listObjects(bool fields);
00089 
00092 
00093   int setField(char *fieldName, double v);
00094 
00096   int getField(char *fieldName, double *v);
00097 
00099   void printFields(void);
00100 
00102   int getFieldArraySize(void);
00103   
00105   double *getFieldArray(void);
00106 
00108   void setFieldArray(double *p);
00110 
00111 
00112   /* ******************* BEGIN MICHAEL PFEIFFER ******************** */
00114   int importObject(uint32 *idx, int nIdx, double *value, int n);
00115 
00117   int exportObject(uint32 *idx, int nIdx, double ***value, int **m);
00118 
00119   /* ******************* END MICHAEL PFEIFFER ******************** */
00120 
00122   double dt;
00123 
00125   int randSeed;
00126 
00128   int verboseLevel;
00129 
00131   int nThreads;
00132 
00134   int spikeOutput;
00135 
00137   double t;
00138 
00140   unsigned long step;
00141 
00142 private:
00143   friend class Teacher;
00144   friend class MexNetwork;
00145 
00147   int moveToTeached(Forceable *f);
00148 
00150   int assignInputs(csimInputChannel *input, int n);
00151 
00153   int unAssignInputs(csimInputChannel *input, int n);
00154 
00156   int connect(Advancable *destination, Advancable *source);
00157   //int connect(Advancable *destination, char *ip, Advancable *source, char *op);
00158 
00160   int isReset;
00161 
00163   bool dtChanged;
00164 
00166   bool fieldsOfSomeObjectChanged;
00167 
00169   csimList<Neuron,100> allNeuronList;
00170 
00172   csimList<Forceable,100> notTeachedList;
00173 
00175   csimList<Forceable,100> teachedList;
00176 
00178   csimList<Synapse, 10000> synapseList;
00179 
00180   csimList<Synapse, 10000> activeSyn;
00181 
00183   csimList<Teacher,2> teacherList;
00184 
00186   csimList<csimRecorder,2> recorderList;
00187 
00188   /* *************** BEGIN MICHAEL PFEIFFER ************* */
00190   csimList<Readout,2> readoutList;
00191 
00193   csimList<Preprocessor,2> preprocessorList;
00194 
00196   csimList<Algorithm,2> algorithmList;
00197 
00199   csimList<PhysicalModel,2> modelList;
00200   /* *************** END MICHAEL PFEIFFER ************* */
00201 
00203   csimList<Advancable,20000> objectList;
00204 
00206   long DT_us;
00207 
00209   long lastSyncTime;
00210 
00212   struct event {
00214     SpikingSynapse *s; 
00215 
00217     pSpikeHandler h;
00218 
00220     event *next;
00221   };
00222         
00223   csimList<event, 20> allocList;
00224 
00225   event *recycledEvent;
00226   event *freeList;
00227   int lfreeList;
00228   int freeIdx;
00229   unsigned allocIdx;
00230 
00231   int ldelayList;
00232   event **delayList;
00233   int delayIdx;
00234 
00235 protected:
00236 
00237   unsigned nDst;
00238   unsigned lDst;
00239   uint32 *dst;
00240 
00241   unsigned nSrc;
00242   unsigned lSrc;
00243   uint32 *src;
00244 
00245   unsigned nRecMem;
00246   unsigned lRecMem;
00247   char *RecMem,*pRecMem;
00248 
00249   /* ******** BEGIN MICHAEL PFEIFFER ******** */
00250   unsigned nReadoutMem;
00251   unsigned lReadoutMem;
00252   char *ReadoutMem,*pReadoutMem;
00253 
00254   unsigned nModelMem;
00255   unsigned lModelMem;
00256   char *ModelMem,*pModelMem;
00257   /* ******** END MICHAEL PFEIFFER ******** */
00258 };
00259 
00260 #endif

 
(C) 2003, Thomas Natschläger last modified 07/10/2006