Page 1 of 1

How to iterate over all states of all mechanisms in a sec?

Posted: Wed Apr 10, 2013 6:05 pm
by hhshih
Does any one know how to iterate over all states of all mechanisms in a section?

I want to do this because I'm trying to record all states with vectors.
I can record the state if the mechanism's and state's names are known.

However, since the sets of mechanisms differ from cell to cell and from section to section,
it would be much better if we can know the names of mechanisms in currently accessed section.

Thanks!

Re: How to iterate over all states of all mechanisms in a se

Posted: Wed Apr 10, 2013 9:18 pm
by ted
hhshih wrote:Does any one know how to iterate over all states of all mechanisms in a section?

I want to do this because I'm trying to record all states with vectors.
I can record the state if the mechanism's and state's names are known.
They are known, by you, during the course of model setup. Just pair each insert statement with corresponding Vector.record() statements. An alternative strategy is to use subsets (SectionLists) to keep track of which sections have which mechanisms during model setup, then after model setup is completed, iterate over each SectionList and execute the appropriate Vector.record() statements. A third strategy would be not to intrude on model setup at all, but instead after setup is complete do

Code: Select all

forall {
  if (ismembrane("foo")) {
    . . . statements that set up Vector recording of foo's states
  }
  if (ismembrane("bar")) {
    . . . statements that set up Vector recording of bar's states
  }
  . . . etc . . .
}
Be sure to read about ismembrane() in the Programmer's Reference.

Hints:
1. It is pointless to record density mechanism states at a section's 0 or 1 locations, because only internal nodes (i.e. nodes at segment centers) have their own states.
2. You're going to end up with a lot of Vectors. Make it easy on yourself by managing them with Lists; there's probably a note about this in the Forum's "Hot tips" area--if not, ask for an example.

Re: How to iterate over all states of all mechanisms in a se

Posted: Thu Apr 11, 2013 9:54 am
by hhshih
Thanks!