file:/local_home/local_home/hugo/neurospaces_project/heccer/source/c/snapshots/0/tests/code/callout1.c        (Mon Jun 16 00:03:52 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: #include <stdio.h>
  20: 
  21: #include "../../heccer/callout.h"
  22: #include "../../heccer/compartment.h"
  23: #include "../../heccer/heccer.h"
  24: 
  25: 
  26: struct Compartment compSoma =
  27: {
  28:     //m administrative overhead
  29: 
  30:     {
  31:         //m type of structure
  32: 
  33:         MATH_TYPE_Compartment,
  34:     },
  35: 
  36:     //m index of parent compartment, -1 for none
  37: 
  38:     -1,
  39: 
  40: /*     //m first mechanism */
  41: 
  42: /*     NULL, */
  43: 
  44: /*     //m number of mechanisms */
  45: 
  46: /*     0, */
  47: 
  48:     //m descriptive values, alphabetical order
  49: 
  50: /*     double dCm; */
  51: 
  52:     4.57537e-11, // unscaled 0.0164,
  53: 
  54: /*     double dEm; */
  55: 
  56:     -0.08,
  57: 
  58: /*     double dInitVm; */
  59: 
  60:     -0.068,
  61: 
  62: /*     double dInject;           */
  63: 
  64:     0,
  65: 
  66: /*     double dRa; */
  67: 
  68:     360502, // unscaled 2.5,
  69: 
  70: /*     double dRm; */
  71: 
  72:     3.58441e+08, // unscaled 1
  73: };
  74: 
  75: 
  76: struct InternalResults pirSoma =
  77: {
  78:     //m membrane potential for this compartment
  79: 
  80:     0.0,
  81: };
  82: 
  83: 
  84: struct ExternalResults perSoma =
  85: {
  86:     //m external conductance, this is just an example
  87: 
  88:     10.0,
  89: 
  90:     //m external current, another example
  91: 
  92:     10.0,
  93: };
  94: 
  95: 
  96: ExternalFunction pefSoma;
  97: 
  98: 
  99: struct Callout callSoma =
 100: {
 101:     {
 102:         //m type of structure
 103: 
 104:         MATH_TYPE_CallOut_conductance_current,
 105:     },
 106: 
 107:     //m external alien data
 108: 
 109:     NULL,
 110: 
 111:     //m internal results
 112: 
 113:     &pirSoma,
 114: 
 115:     //m external results
 116: 
 117:     &perSoma,
 118: 
 119:     //m external function
 120: 
 121:     pefSoma,
 122: };
 123: 
 124: 
 125: int piC2m[] =
 126: {
 127:     1,
 128:     -1,
 129: };
 130: 
 131: 
 132: struct MathComponentArray mca =
 133: {
 134:     //m number of math components
 135: 
 136:     1,
 137: 
 138:     //m math component data
 139: 
 140:     &callSoma.mc,
 141: 
 142:     //m math component index, initialize to NULL
 143: 
 144:     NULL,
 145: 
 146: };
 147: 
 148: 
 149: struct Intermediary inter =
 150: {
 151:     //m compartment array
 152: 
 153:     1,
 154: 
 155:     &compSoma,
 156: 
 157:     //m all other mathematical components
 158: 
 159:     &mca,
 160: 
 161:     //m compartment 2 first mechanism number
 162: 
 163:     piC2m,
 164: };
 165: 
 166: 
 167: int pefSoma(struct Callout *pco, struct Heccer *pheccer, struct InternalResults *pir, struct ExternalResults *per)
 168: {
 169:     //- set default result
 170: 
 171:     int iResult = 0;
 172: 
 173:     //- initialize
 174: 
 175:     per->dConductance = 0.0;
 176:     per->dCurrent = 0.0;
 177: 
 178:     //t do something to compute the current and conductance, using pco->pvAlien
 179: 
 180:     //t fill in the conductance and current in the external results
 181: 
 182:     //- give some feedback for testing purposes
 183: 
 184:     fprintf(stdout, "The pefSoma callout says that it is computing current and conductance externally\n");
 185:     fprintf(stdout, "The pefSoma callout is advancing to time %g\n", pheccer->dTime);
 186: 
 187:     //- return result
 188: 
 189:     return(iResult);
 190: }
 191: 
 192: 
 193: #include "main.c"
 194: 
 195: 
 196: 








































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