24 "Sends the output value every timestep."
42 "Sends out a request to a field with a double or array of doubles. "
43 "Issued from the process call."
44 "Works for any number of targets."
66 "Offset to apply to input message, before scaling",
72 "Offset to apply at output, after scaling",
78 "Scaling factor to apply to input",
84 "This is the linearly transformed output.",
93 "Input message to the adaptor. If multiple inputs are "
94 "received, the system averages the inputs.",
121 "Handles 'process' call",
125 "Handles 'reinit' call",
129 static Finfo* processShared[] =
134 "This is a shared message to receive Process message "
135 "from the scheduler. ",
136 processShared,
sizeof( processShared ) /
sizeof(
Finfo* )
142 static Finfo* adaptorFinfos[] =
154 static string doc[] =
157 "Author",
"Upinder S. Bhalla, 2008, NCBS",
159 " This is the adaptor class. It is used in interfacing different kinds"
160 " of solver with each other, especially for electrical to chemical"
162 " The Adaptor class is the core of the API for interfacing between"
163 " different solution engines. It is currently in use for interfacing"
164 " between chemical and electrical simulations, but could be used for other"
165 " cases such as mechanical models."
168 " The API for interfacing between solution engines rests on "
169 " the following capabilities of MOOSE."
170 " 1. The object-oriented interface with classes mapped to biological"
171 " and modeling concepts such as electrical and chemical compartments,"
172 " ion channels and molecular pools."
173 " 2. The invisible mapping of Solvers (Objects implementing numerical"
174 " engines) to the object-oriented interface. Solvers work behind the "
175 " scenes to update the objects."
176 " 3. The messaging interface which allows any visible field to be "
177 " accessed and updated from any other object. "
178 " 4. The clock-based scheduler which drives operations of any subset of"
179 " objects at any interval. For example, this permits the operations of"
180 " field access and update to take place at quite different timescales "
181 " from the numerical engines."
182 " 5. The implementation of Adaptor classes. These perform a linear"
185 " (y = scale * (x + inputOffset) + outputOffset ) "
187 " where y is output and x is the input. The input is the average of"
188 " any number of sources (through messages) and any number of timesteps."
189 " The output goes to any number of targets, again through messages."
191 " It is worth adding that messages can transport arbitrary data structures,"
192 " so it would also be possible to devise a complicated opaque message"
193 " directly between solvers. The implementation of Adaptors working on"
194 " visible fields does this much more transparently and gives the user "
195 " facile control over the scaling transformatoin."
197 " These adaptors are used especially in the rdesigneur framework of MOOSE,"
198 " which enables multiscale reaction-diffusion and electrical signaling"
200 " As an example of this API in operation, I consider two mappings: "
201 " 1. Calcium mapped from electrical to chemical computations."
202 " 2. phosphorylation state of a channel mapped to the channel conductance."
204 " 1. Calcium mapping."
205 " Problem statement."
206 " Calcium is computed in the electrical solver as one or more pools that"
207 " are fed by calcium currents, and is removed by an exponential "
208 " decay process. This calcium pool is non-diffusive in the current "
209 " electrical solver. It has to be mapped to chemical calcium pools at a"
210 " different spatial discretization, which do diffuse."
211 " In terms of the list of capabilities described above, this is how the"
213 " 1. The electrical model is partitioned into a number of electrical"
214 " compartments, some of which have the 'electrical' calcium pool"
215 " as child object in a UNIX filesystem-like tree. Thus the "
216 " 'electrical' calcium is represented as an object with "
217 " concentration, location and so on."
218 " 2. The Solver computes the time-course of evolution of the calcium"
219 " concentration. Whenever any function queries the 'concentration'"
220 " field of the calcium object, the Solver provides this value."
221 " 3. Messaging couples the 'electrical' calcium pool concentration to"
222 " the adaptor (see point 5). This can either be a 'push' operation,"
223 " where the solver pushes out the calcium value at its internal"
224 " update rate, or a 'pull' operation where the adaptor requests"
225 " the calcium concentration."
226 " 4. The clock-based scheduler keeps the electrical and chemical solvers"
227 " ticking away, but it also can drive the operations of the adaptor."
228 " Thus the rate of updates to and from the adaptor can be controlled."
229 " 5. The adaptor averages its inputs. Say the electrical solver is"
230 " going at a timestep of 50 usec, and the chemical solver at 5000 "
231 " usec. The adaptor will take 100 samples of the electrical "
232 " concentration, and average them to compute the 'input' to the"
233 " linear scaling. Suppose that the electrical model has calcium units"
234 " of micromolar, but has a zero baseline. The chemical model has"
235 " units of millimolar and a baseline of 1e-4 millimolar. This gives:"
237 " At the end of this calculation, the adaptor will typically 'push'"
238 " its output to the chemical solver. Here we have similar situation"
239 " to item (1), where the chemical entities are calcium pools in"
240 " space, each with their own calcium concentration."
241 " The messaging (3) determines another aspect of the mapping here: "
242 " the fan in or fan out. In this case, a single electrical "
243 " compartment may house 10 chemical compartments. Then the output"
244 " message from the adaptor goes to update the calcium pool "
245 " concentration on the appropriate 10 objects representing calcium"
246 " in each of the compartments."
248 " In much the same manner, the phosphorylation state can regulate"
249 " channel properties."
250 " 1. The chemical model contains spatially distributed chemical pools"
251 " that represent the unphosphorylated state of the channel, which in"
252 " this example is the conducting form. This concentration of this"
253 " unphosphorylated state is affected by the various reaction-"
254 " diffusion events handled by the chemical solver, below."
255 " 2. The chemical solver updates the concentrations"
256 " of the pool objects as per reaction-diffusion calculations."
257 " 3. Messaging couples these concentration terms to the adaptor. In this"
258 " case we have many chemical pool objects for every electrical"
259 " compartment. There would be a single adaptor for each electrical"
260 " compartment, and it would average all the input values for calcium"
261 " concentration, one for each mesh point in the chemical calculation."
262 " As before, the access to these fields could be through a 'push'"
263 " or a 'pull' operation."
264 " 4. The clock-based scheduler oeperates as above."
265 " 5. The adaptor averages the spatially distributed inputs from calcium,"
266 " and now does a different linear transform. In this case it converts"
267 " chemical concentration into the channel conductance. As before,"
268 " the 'electrical' channel is an object (point 1) with a field for "
269 " conductance, and this term is mapped into the internal data "
270 " structures of the solver (point 2) invisibly to the user."
279 sizeof( adaptorFinfos ) /
sizeof(
Finfo * ),
282 sizeof( doc ) /
sizeof(
string )
297 outputOffset_( 0.0 ),
370 vector< double > ret;
unsigned int numRequestOut_
Counts number of inputs received.
vector< ObjId > getMsgTargets(DataId srcDataId, const SrcFinfo *finfo) const
void reinit(const Eref &e, ProcPtr p)
unsigned int dataIndex() const
static const Cinfo * initCinfo()
Element * element() const
double getOutputOffset() const
double getInputOffset() const
void setInputOffset(double offset)
void setScale(double scale)
void setOutputOffset(double offset)
static SrcFinfo1< vector< double > * > * requestOut()
double sum_
Used for placeholding in cellreader mode.
static SrcFinfo1< double > * output()
static const Cinfo * adaptorCinfo
void process(const Eref &e, ProcPtr p)
static const Cinfo * initCinfo()