file:/local_home/local_home/hugo/neurospaces_project/heccer/source/c/snapshots/0/tests/code/perfectclamp-passive1.c        (Mon Jun 16 00:03:55 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 <stdlib.h>
  20: 
  21: #include "../../heccer/addressing.h"
  22: #include "../../heccer/heccer.h"
  23: #include "../../heccer/perfectclamp.h"
  24: 
  25: 
  26: #include "main.h"
  27: 
  28: 
  29: #define HECCER_TEST_REPORTING_GRANULARITY 100
  30: #define HECCER_TEST_STEPS 1000
  31: #define HECCER_TEST_TESTED_THINGS ( HECCER_DUMP_VM_COMPARTMENT_MATRIX \
  32:                                     | HECCER_DUMP_VM_MECHANISM_OPERATIONS \
  33:         )
  34: #define HECCER_TEST_TIME_STEP (3e-6)
  35: 
  36: 
  37: struct Compartment compSoma =
  38: {
  39:     //m administrative overhead
  40: 
  41:     {
  42:         //m type of structure
  43: 
  44:         MATH_TYPE_Compartment,
  45:     },
  46: 
  47:     //m index of parent compartment, -1 for none
  48: 
  49:     -1,
  50: 
  51: /*     //m first mechanism */
  52: 
  53: /*     NULL, */
  54: 
  55: /*     //m number of mechanisms */
  56: 
  57: /*     0, */
  58: 
  59:     //m descriptive values, alphabetical order
  60: 
  61: /*     double dCm; */
  62: 
  63:     4.57537e-11, // unscaled 0.0164,
  64: 
  65: /*     double dEm; */
  66: 
  67:     -0.08,
  68: 
  69: /*     double dInitVm; */
  70: 
  71:     -0.068,
  72: 
  73: /*     double dInject;           */
  74: 
  75:     0,
  76: 
  77: /*     double dRa; */
  78: 
  79:     360502, // unscaled 2.5,
  80: 
  81: /*     double dRm; */
  82: 
  83:     3.58441e+08, // unscaled 1
  84: };
  85: 
  86: 
  87: int piC2m[] =
  88: {
  89:     0,
  90:     -1,
  91: };
  92: 
  93: 
  94: struct Intermediary inter =
  95: {
  96:     //m compartment array
  97: 
  98:     1,
  99: 
 100:     &compSoma,
 101: 
 102:     //m all other mathematical components
 103: 
 104:     NULL,
 105: 
 106:     //m compartment 2 first mechanism number
 107: 
 108:     piC2m,
 109: };
 110: 
 111: 
 112: int main(int argc, char *argv[])
 113: {
 114:     //- allocate a voltage clamp object
 115: 
 116:     ppc = PerfectClampNew("pc object");
 117: 
 118:     //- set fields
 119: 
 120:     double dCommand = 0.1;
 121: 
 122:     PerfectClampSetFields(ppc, dCommand, NULL);
 123: 
 124: //d connect the voltage clamp object with the compartment of interest
 125: 
 126: #define HECCER_TEST_INITIATE \
 127:     double *pdVm = HeccerAddressCompartmentVariable(pheccer, 0, "Vm");  \
 128:     PerfectClampAddVariable(ppc, pdVm)
 129: 
 130: //d schedule the voltage clamper
 131: 
 132: #define HECCER_TEST_SCHEDULE PerfectClampSingleStep(ppc, dSimulationTime)
 133: 
 134:     //- do the simulation
 135: 
 136:     simulate(argc, argv);
 137: }
 138: 
 139: 
 140: #define main(argc,argv) simulate(argc,argv)
 141: 
 142: //t this prototype can give warning and perhaps errors.
 143: 
 144: int main(int argc, char *argv[]);
 145: 
 146: 
 147: #include "main.c"
 148: 
 149: 
 150: 








































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