file:/local_home/local_home/hugo/neurospaces_project/heccer/source/c/snapshots/0/heccer/callout.h        (Mon Jun 16 00:04:17 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: //o
  20: //o How do you define external callout functions ?
  21: //o
  22: //o step 1 : implement your function.
  23: //o
  24: //o the signature for the function is given by the typedef ExternalFunction.
  25: //o Currently this is defined as a function that returns an integer (zero),
  26: //o and has arguments that gives access to the intermediary, results computed
  27: //o by Heccer, and results to be computed by the external function.  The exact
  28: //o definition can be found below.
  29: //o
  30: //o Note: Heccer does not do any overwriting of the result data of the external
  31: //o function.  So, if needed, the external function must reinitialize its result
  32: //o data (to zero or another appropriate value), every time it is called.
  33: //o
  34: //o step 2 : define your model.
  35: //o
  36: //o The important fact is that you have to link you model with the
  37: //o external function in the intermediary representation.  You use the struct
  38: //o Callout to do so.  This struct contains a direct pointer to the external
  39: //o function.
  40: //o
  41: //o other steps : compile and run your model.
  42: //o
  43: //o You compile and run your model as usual.  See the test scripts for examples
  44: //o how to do that.
  45: //o
  46: 
  47: 
  48: #ifndef HECCER_CALLOUT_H
  49: #define HECCER_CALLOUT_H
  50: 
  51: 
  52: #include "heccer.h"
  53: #include "mathcomponent.h"
  54: 
  55: 
  56: //s internal results, computed by heccer byte code
  57: 
  58: struct InternalResults
  59: {
  60:     //m membrane potential for this compartment
  61: 
  62:     double dVm;
  63: 
  64:     //! other potentially interesting things may follow: total
  65:     //! currents per channel, etc.
  66: };
  67: 
  68: 
  69: //s external results, computed by an external function
  70: 
  71: struct ExternalResults
  72: {
  73:     //m external conductance, this is just an example
  74: 
  75:     double dConductance;
  76: 
  77:     //m external current, another example
  78: 
  79:     double dCurrent;
  80: };
  81: 
  82: 
  83: //f external function
  84: 
  85: struct Callout;
  86: 
  87: typedef 
  88: int ExternalFunction
  89: (struct Callout *pco, struct Heccer *pheccer, struct InternalResults *pir, struct ExternalResults *per);
  90: 
  91: 
  92: //s call out intermediary
  93: 
  94: //! prefix all the intermediary struct's with something common, for
  95: //! readability.
  96: 
  97: struct Callout
  98: {
  99:     //m administration overhead
 100: 
 101:     struct MathComponent mc;
 102: 
 103:     //m external alien data
 104: 
 105:     void *pvAlien;
 106: 
 107:     //m internal results
 108: 
 109:     struct InternalResults *pir;
 110: 
 111:     //m external results
 112: 
 113:     struct ExternalResults *per;
 114: 
 115:     //m external function
 116: 
 117:     ExternalFunction *pef;
 118: 
 119:     //! descriptive values can follow here
 120: 
 121:     //! and if convenient, internal and external results can follow thereafter
 122: };
 123: 
 124: 
 125: #endif
 126: 
 127: 
 128: 








































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