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_TABLE_H 20: #define HECCER_TABLE_H 21: 22: 23: #include <string.h> 24: 25: #include "mechanism.h" 26: 27: 28: #ifndef TRUE 29: #define TRUE 1 30: #endif 31: #ifndef FALSE 32: #define FALSE 0 33: #endif 34: 35: 36: //s interval discretization 37: 38: struct HeccerInterval 39: { 40: //m start of interval 41: 42: double dStart; 43: 44: //m end of interval 45: 46: double dEnd; 47: 48: //m discretization step size 49: 50: double dStep; 51: }; 52: 53: 54: struct HeccerTableApproximationOptions 55: { 56: //m how do we do interpolation 57: 58: int iShape; 59: }; 60: 61: 62: struct HeccerTabulatedGate 63: { 64: //m original source parameters 65: 66: void *pvParameters; 67: 68: size_t iSizeParameters; 69: 70: //m interval of the tables 71: 72: struct HeccerInterval hi; 73: 74: //m calculation options 75: 76: //! almost tao 77: 78: struct HeccerTableApproximationOptions htao; 79: 80: //m number of entries, must always match with interval definition I guess 81: 82: int iEntries; 83: 84: //m A table 85: 86: double *pdA; 87: 88: //m backward table (alpha + beta) 89: 90: double *pdB; 91: }; 92: 93: 94: struct HeccerTabulatedSpringMass 95: { 96: //m original source parameters 97: 98: void *pvParameters; 99: 100: size_t iSizeParameters; 101: 102: //m two precalculated coefficients for first exponential 103: 104: double dX1; 105: double dX2; 106: 107: //m two precalculated coefficients for second exponential 108: 109: double dY1; 110: double dY2; 111: }; 112: 113: 114: //d maximum number of tabulated gates 115: 116: #define HECCER_TABULATED_GATES_MAX 100 117: 118: struct TabulatedGateTable 119: { 120: //m tabulated gates (preallocated array) 121: 122: struct HeccerTabulatedGate phtg[HECCER_TABULATED_GATES_MAX]; 123: 124: //m number of entries used in the above 125: 126: int iTabulatedGateCount; 127: }; 128: 129: 130: //d maximum number of tabulated spring mass channels 131: 132: #define HECCER_TABULATED_SPRINGMASS_MAX 10000 133: 134: struct TabulatedSpringMassTable 135: { 136: //m tabulated gates (preallocated array) 137: 138: struct HeccerTabulatedSpringMass phtsm[HECCER_TABULATED_SPRINGMASS_MAX]; 139: 140: //m number of entries used in the above 141: 142: int iTabulatedSpringMassCount; 143: }; 144: 145: 146: struct ConcentrationActivator; 147: struct GateConcept; 148: struct Heccer; 149: 150: 151: //f prototypes 152: 153: int 154: HeccerConcentrationGateTabulate 155: (struct ConcentrationActivator *pac, struct Heccer *pheccer); 156: 157: int 158: HeccerGateConceptTabulate 159: (struct GateConcept *pgc, struct Heccer *pheccer); 160: 161: int 162: HeccerTablesDump 163: (struct TabulatedGateTable *ptgt, FILE *pfile, int iSelection); 164: 165: int 166: HeccerTableInterpolate 167: (double *ppdSources[], 168: double *ppdDestinations[], 169: int iSourceSize, 170: int iDestinationSize); 171: 172: int 173: HeccerTabulateAny 174: (struct Heccer *pheccer, void *pv, int iType); 175: 176: int 177: HeccerTabulatedGateRegister(struct Heccer *pheccer, struct GateConcept *pgc); 178: 179: 180: #endif 181: 182: 183: