file:/local_home/local_home/hugo/neurospaces_project/heccer/source/c/snapshots/0/heccer/heccer.h        (Sun Jul 13 18:47:20 2008 )        HOME


   1: //
   2: // Heccer : a compartmental solver that implements efficient Crank-Nicolson
   3: // integration for neuronal models.
   4: //
   5: 
   6: //////////////////////////////////////////////////////////////////////////////
   7: //'
   8: //' Heccer : testbed C implementation
   9: //'
  10: //' Copyright (C) 2006-2008 Hugo Cornelis
  11: //'
  12: //' functional ideas .. Hugo Cornelis, hugo.cornelis@gmail.com
  13: //'
  14: //' coding ............ Hugo Cornelis, hugo.cornelis@gmail.com
  15: //'
  16: //////////////////////////////////////////////////////////////////////////////
  17: 
  18: 
  19: #ifndef HECCER_HECCER_H
  20: #define HECCER_HECCER_H
  21: 
  22: 
  23: #include <stdio.h>
  24: 
  25: 
  26: struct Heccer;
  27: 
  28: 
  29: #include "eventdistributor.h"
  30: #include "intermediary.h"
  31: #include "indexers.h"
  32: #include "service.h"
  33: #include "table.h"
  34: #include "vm.h"
  35: 
  36: 
  37: #ifndef TRUE
  38: #define TRUE 1
  39: #endif
  40: #ifndef FALSE
  41: #define FALSE 0
  42: #endif
  43: 
  44: 
  45: //s global options
  46: 
  47: struct HeccerOptions
  48: {
  49:     //m global options and operation mode.
  50: 
  51:     int iOptions;
  52: 
  53:     //m interval has been set ?
  54: 
  55:     int iIntervalSet;
  56: 
  57:     //m discretized gate, membrane, interval start
  58: 
  59:     double dIntervalStart;
  60: 
  61:     //m discretized gate, membrane, interval end
  62: 
  63:     double dIntervalEnd;
  64: 
  65:     //m activator has been set ?
  66: 
  67:     int iActivatorSet;
  68: 
  69:     //m discretized gate, concentration, interval start
  70: 
  71:     double dConcentrationGateStart;
  72: 
  73:     //m discretized gate, concentration, interval end
  74: 
  75:     double dConcentrationGateEnd;
  76: 
  77:     //m discretized gate, membrane, number of entries
  78: 
  79:     int iIntervalEntries;
  80: 
  81:     //m pre interpolation table size, legacy from genesis tabchans
  82: 
  83:     int iSmallTableSize;
  84: };
  85: 
  86: 
  87: //d logical branch grouping for solution matrix :
  88: //d schedules first a leave and all attached compartments until a
  89: //d branch point.  When disabled, all the leaves are scheduled first,
  90: //d next the compartments attached to the leaves, etc.
  91: 
  92: #define HECCER_OPTION_BRANCHES_FIRST_SCHEDULING         1
  93: 
  94: //d use backward euler, default is crank-nicolson
  95: 
  96: #define HECCER_OPTION_BACKWARD_EULER                    2
  97: 
  98: //d simulate as a passive model, with synchans (springmass)
  99: 
 100: #define HECCER_OPTION_PASSIVE_SYNCHANS                  4
 101: 
 102: //d enable computation of individual currents and conductances
 103: 
 104: //! so by default the contribution of each channel to the overall
 105: //! compartmental current is computed, when this option is turned on,
 106: //! only the integrated current is computed.  Same for conductance.
 107: 
 108: #define HECCER_OPTION_ENABLE_INDIVIDUAL_CURRENTS        32
 109: 
 110: //d enable compilation and execution of aggregator operators
 111: 
 112: #define HECCER_OPTION_ENABLE_AGGREGATORS 64
 113: 
 114: 
 115: //d discretized gate, interval start
 116: 
 117: #define HECCER_INTERVAL_DEFAULT_START                   (-0.1)
 118: 
 119: //d discretized gate, interval end
 120: 
 121: #define HECCER_INTERVAL_DEFAULT_END                     (0.05)
 122: 
 123: //d concentration gate, interval end
 124: 
 125: #define HECCER_INTERVAL_CONCENTRATION_GATE_DEFAULT_START        (0.00004)
 126: 
 127: //d concentration gate, interval end
 128: 
 129: #define HECCER_INTERVAL_CONCENTRATION_GATE_DEFAULT_END  (0.300)
 130: 
 131: //d discretized gate, number of entries
 132: 
 133: #define HECCER_INTERVAL_DEFAULT_ENTRIES                 3000
 134: 
 135: //d discretized gate, number of entries before interpolation
 136: 
 137: #define HECCER_INTERPOL_INTERVAL_DEFAULT_ENTRIES        149
 138: 
 139: //s heccer main structure
 140: 
 141: struct Heccer
 142: {
 143:     //m name of this heccer
 144: 
 145:     //! if the name of a heccer is a system wide id depends on the
 146:     //! environment, heccer does not (and cannot) enforce it.
 147: 
 148:     char *pcName;
 149: 
 150:     //m status : reflects phases of compilation.
 151: 
 152:     int iStatus;
 153: 
 154:     int iErrorCount;
 155: 
 156:     //m options
 157: 
 158:     struct HeccerOptions ho;
 159: 
 160:     //m current time
 161: 
 162:     double dTime;
 163: 
 164:     //m time step
 165: 
 166:     double dStep;
 167: 
 168:     //m identification service : translates serials to math components.
 169: 
 170:     //! so to use this feature: define your translation service, and
 171:     //! set it during the construction of your heccer.
 172: 
 173:     //! wouldn't be surprised that I need several layers of services,
 174:     //! will see if that has repercussion at this low level or not.
 175:     //!
 176:     //! for the moment we have a function layer, which is fixed, and
 177:     //! a data layer, which is opaque.  The function layer defines the
 178:     //! real interface.
 179: 
 180:     struct TranslationService *pts;
 181: 
 182:     //m event distribution service: given an event, distributes it over the targets
 183: 
 184:     //! so to use this feature: define your event distribution service, and
 185:     //! set it during the construction of your heccer.
 186: 
 187:     //! wouldn't be surprised that I need several layers of services,
 188:     //! will see if that has repercussion at this low level or not.
 189:     //!
 190:     //! for the moment we have a function layer, which is fixed, and
 191:     //! a data layer, which is opaque.  The function layer defines the
 192:     //! real interface.
 193: 
 194:     struct EventDistributor *ped;
 195: 
 196:     //m event reception service: receive an event, and queue till it fires
 197: 
 198:     //! so to use this feature: define your event reception service, and
 199:     //! set it during the construction of your heccer.
 200: 
 201:     //! wouldn't be surprised that I need several layers of services,
 202:     //! will see if that has repercussion at this low level or not.
 203:     //!
 204:     //! for the moment we have a function layer, which is fixed, and
 205:     //! a data layer, which is opaque.  The function layer defines the
 206:     //! real interface.
 207: 
 208:     struct EventQueuer *peq;
 209: 
 210:     //m intermediary
 211: 
 212:     struct Intermediary inter;
 213: 
 214:     //m indexing structures
 215: 
 216:     struct Indexers indexers;
 217: 
 218:     //m tabulated gates and rearranged gates
 219: 
 220:     struct TabulatedGateTable tgt;
 221: 
 222:     //m tabulated spring mass channels
 223: 
 224:     struct TabulatedSpringMassTable tsmt;
 225: 
 226:     //m vm
 227: 
 228:     struct VM vm;
 229: 
 230: };
 231: 
 232: 
 233: //d brandnew allocated, nothing done
 234: 
 235: #define HECCER_STATUS_PHASE_0           0
 236: 
 237: //d correctly initialized
 238: 
 239: #define HECCER_STATUS_PHASE_1           10
 240: 
 241: //d intermediary has been built
 242: 
 243: #define HECCER_STATUS_PHASE_2           20
 244: 
 245: //d byte has been compiled
 246: 
 247: #define HECCER_STATUS_PHASE_3           30
 248: 
 249: //d initial values have been put in place
 250: 
 251: #define HECCER_STATUS_PHASE_4           40
 252: 
 253: //d heccs have been done, further status unknown
 254: 
 255: #define HECCER_STATUS_PHASE_5           50
 256: 
 257: 
 258: //f prototypes
 259: 
 260: int HeccerAggregatorsCompile(struct Heccer *pheccer);
 261: 
 262: int HeccerCanCompile(struct Heccer *pheccer);
 263: 
 264: int HeccerCompileP1(struct Heccer *pheccer);
 265: 
 266: int HeccerCompileP2(struct Heccer *pheccer);
 267: 
 268: int HeccerCompileP3(struct Heccer *pheccer);
 269: 
 270: int HeccerDumpV(struct Heccer *pheccer);
 271: 
 272: int HeccerDump(struct Heccer *pheccer, FILE *pfile, int iSelection);
 273: 
 274: #define HECCER_DUMP_ALL (0xffffffff & ~HECCER_DUMP_SERVICE)
 275: 
 276: #define HECCER_DUMP_SERVICE                                     (1 << 7)
 277: 
 278: #define HECCER_DUMP_INDEXERS_SUMMARY                            (1 << 8)
 279: #define HECCER_DUMP_INDEXERS_STRUCTURE                          (1 << 9)
 280: 
 281: #define HECCER_DUMP_INTERMEDIARY_COMPARTMENTS_PARAMETERS        (1 << 1)
 282: #define HECCER_DUMP_INTERMEDIARY_COMPARTMENT_SUMMARY            (1 << 2)
 283: #define HECCER_DUMP_INTERMEDIARY_MECHANISM_SUMMARY              (1 << 3)
 284: #define HECCER_DUMP_INTERMEDIARY_STRUCTURE                      (1 << 4)
 285: #define HECCER_DUMP_INTERMEDIARY_SUMMARY                        (1 << 5)
 286: 
 287: #define HECCER_DUMP_TABLE_GATE_SUMMARY                          (1 << 12)
 288: #define HECCER_DUMP_TABLE_GATE_TABLES                           (1 << 13)
 289: 
 290: #define HECCER_DUMP_VM_COMPARTMENT_MATRIX                       (1 << 16)
 291: #define HECCER_DUMP_VM_COMPARTMENT_DATA                         (1 << 17)
 292: #define HECCER_DUMP_VM_COMPARTMENT_OPERATIONS                   (1 << 18)
 293: #define HECCER_DUMP_VM_MECHANISM_DATA                           (1 << 19)
 294: #define HECCER_DUMP_VM_MECHANISM_OPERATIONS                     (1 << 20)
 295: #define HECCER_DUMP_VM_CHANNEL_POOL_FLUXES                      (1 << 21)
 296: #define HECCER_DUMP_VM_SUMMARY                                  (1 << 22)
 297: 
 298: #define HECCER_DUMP_VM_AGGREGATORS                              (1 << 25)
 299: 
 300: 
 301: char * HeccerGetVersion(void);
 302: 
 303: int HeccerError(struct Heccer *pheccer, char *pcContext, char *pcError, ...);
 304: 
 305: /* int HeccerHecc(struct Heccer *pheccer); */
 306: 
 307: int HeccerHeccs(struct Heccer *pheccer, double dTime);
 308: 
 309: int HeccerInitiate(struct Heccer *pheccer);
 310: 
 311: struct Heccer *
 312: HeccerNew
 313: (char *pc,
 314:  struct TranslationService *pts,
 315:  struct EventDistributor *ped,
 316:  struct EventQueuer *peq);
 317: 
 318: struct Heccer *
 319: HeccerNewP1
 320: (char *pc,
 321:  struct TranslationService *pts,
 322:  struct EventDistributor *ped,
 323:  struct EventQueuer *peq,
 324:  int iOptions,
 325:  double dStep);
 326: 
 327: struct Heccer *HeccerNewP2(char *pc, struct Intermediary *pinter);
 328: 
 329: 
 330: #endif
 331: 
 332: 
 333: 








































Generated by Xrefactory version 2.0.14 on Thu Jul 24 22:41:20 2008