MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
HSolveUtils Class Reference

#include <HSolveUtils.h>

+ Collaboration diagram for HSolveUtils:

Classes

class  Grid
 

Static Public Member Functions

static int adjacent (Id compartment, vector< Id > &ret)
 
static int adjacent (Id compartment, Id exclude, vector< Id > &ret)
 
static int caDepend (Id channel, vector< Id > &ret)
 
static int caTarget (Id channel, vector< Id > &ret)
 
static int channels (Id compartment, vector< Id > &ret)
 
static int children (Id compartment, vector< Id > &ret)
 
static int gates (Id channel, vector< Id > &ret, bool getOriginals=true)
 
static int hhchannels (Id compartment, vector< Id > &ret)
 
static void initialize (Id object)
 
static int leakageChannels (Id compartment, vector< Id > &ret)
 
static void rates (Id gate, Grid grid, vector< double > &A, vector< double > &B)
 
static int spikegens (Id compartment, vector< Id > &ret)
 
static int synchans (Id compartment, vector< Id > &ret)
 
static int targets (Id object, string msg, vector< Id > &target, string filter="", bool include=true)
 
static int targets (Id object, string msg, vector< Id > &target, const vector< string > &filter, bool include=true)
 

Detailed Description

Definition at line 26 of file HSolveUtils.h.

Member Function Documentation

int HSolveUtils::adjacent ( Id  compartment,
vector< Id > &  ret 
)
static

Definition at line 36 of file HSolveUtils.cpp.

References targets().

Referenced by adjacent(), and HSolvePassive::walkTree().

37 {
38  int size = 0;
39  size += targets( compartment, "axial", ret, "Compartment" );
40  size += targets( compartment, "raxial", ret, "Compartment" );
41  size += targets( compartment, "distalOut", ret, "SymCompartment" );
42  size += targets( compartment, "proximalOut", ret, "SymCompartment" );
43  size += targets( compartment, "cylinderOut", ret, "SymCompartment" );
44  return size;
45 }
static int targets(Id object, string msg, vector< Id > &target, string filter="", bool include=true)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int HSolveUtils::adjacent ( Id  compartment,
Id  exclude,
vector< Id > &  ret 
)
static

Definition at line 25 of file HSolveUtils.cpp.

References adjacent().

26 {
27  int size = ret.size();
28  adjacent( compartment, ret );
29  ret.erase(
30  remove( ret.begin(), ret.end(), exclude ),
31  ret.end()
32  );
33  return ret.size() - size;
34 }
static int adjacent(Id compartment, vector< Id > &ret)
Definition: HSolveUtils.cpp:36

+ Here is the call graph for this function:

int HSolveUtils::caDepend ( Id  channel,
vector< Id > &  ret 
)
static

Definition at line 144 of file HSolveUtils.cpp.

References targets().

Referenced by HSolveActive::readCalcium().

145 {
146  return targets( channel, "concen", ret, "CaConc" );
147 }
static int targets(Id object, string msg, vector< Id > &target, string filter="", bool include=true)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int HSolveUtils::caTarget ( Id  channel,
vector< Id > &  ret 
)
static

Definition at line 139 of file HSolveUtils.cpp.

References targets().

Referenced by HSolveActive::readCalcium().

140 {
141  return targets( channel, "IkOut", ret, "CaConc" );
142 }
static int targets(Id object, string msg, vector< Id > &target, string filter="", bool include=true)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int HSolveUtils::channels ( Id  compartment,
vector< Id > &  ret 
)
static

Gives all channels (hhchannels, synchans, any other) attached to a given compartment.

Definition at line 59 of file HSolveUtils.cpp.

References targets().

60 {
61  return targets( compartment, "channel", ret );
62 }
static int targets(Id object, string msg, vector< Id > &target, string filter="", bool include=true)

+ Here is the call graph for this function:

int HSolveUtils::children ( Id  compartment,
vector< Id > &  ret 
)
static

Definition at line 47 of file HSolveUtils.cpp.

References targets().

Referenced by HSolvePassive::storeTree().

48 {
49  int size = targets( compartment, "axial", ret, "Compartment" );
50  size += targets( compartment, "distalOut", ret, "SymCompartment" );
51  size += targets( compartment, "cylinderOut", ret, "SymCompartment" );
52  return size;
53 }
static int targets(Id object, string msg, vector< Id > &target, string filter="", bool include=true)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int HSolveUtils::gates ( Id  channel,
vector< Id > &  ret,
bool  getOriginals = true 
)
static

The 'getOriginals' flag requests Id:s of the prototype gates from which copies were created, instead of Id:s of the copied gates. Default is true.

Definition at line 75 of file HSolveUtils.cpp.

References errorSS, moose::fixPath(), Field< A >::get(), HHGate::originalGateId(), Id::path(), and SIMPLE_ASSERT_MSG.

Referenced by HSolveActive::readGates().

79 {
80 // dump("HSolveUtils::gates() is not tested with new hsolve api", "FIXME");
81  unsigned int oldSize = ret.size();
82 
83  static string gateName[] = {
84  string( "gateX[0]" ),
85  string( "gateY[0]" ),
86  string( "gateZ[0]" )
87  };
88 
89  static string powerField[] = {
90  string( "Xpower" ),
91  string( "Ypower" ),
92  string( "Zpower" )
93  };
94 
95  unsigned int nGates = 3; // Number of possible gates
96  for ( unsigned int i = 0; i < nGates; i++ ) {
97  double power = Field< double >::get ( channel, powerField[i] );
98 
99  if ( power > 0.0 ) {
100  // string gatePath = moose::joinPath(channel.path(), gateName[i]);
101  string gatePath = moose::fixPath( channel.path() ) +
102  "/" + gateName[i];
103  Id gate( gatePath );
104 
105  string gPath = moose::fixPath(gate.path());
106  errorSS.str("");
107  errorSS << "Got " << gatePath << " expected " << gPath;
108  SIMPLE_ASSERT_MSG(gPath == gatePath, errorSS.str().c_str());
109 
110  if ( getOriginals ) {
111  HHGate* g = reinterpret_cast< HHGate* >( gate.eref().data() );
112  gate = g->originalGateId();
113  }
114 
115  ret.push_back( gate );
116  }
117  }
118 
119  return ret.size() - oldSize;
120 }
Definition: HHGate.h:31
std::string path(const std::string &separator="/") const
Definition: Id.cpp:76
Id originalGateId() const
Definition: HHGate.cpp:801
string fixPath(string path)
Fix a path. For testing purpose.
Definition: global.cpp:74
stringstream errorSS
Global stringstream for message printing.
Definition: global.cpp:32
Definition: Id.h:17
static A get(const ObjId &dest, const string &field)
Definition: SetGet.h:284
#define SIMPLE_ASSERT_MSG(expr, msg)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int HSolveUtils::hhchannels ( Id  compartment,
vector< Id > &  ret 
)
static

Definition at line 64 of file HSolveUtils.cpp.

References targets().

Referenced by HSolveActive::readHHChannels().

65 {
66  // Request for elements of type "HHChannel" only since
67  // channel messages can lead to synchans as well.
68  return targets( compartment, "channel", ret, "HHChannel" );
69 }
static int targets(Id object, string msg, vector< Id > &target, string filter="", bool include=true)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void HSolveUtils::initialize ( Id  object)
static

Definition at line 12 of file HSolveUtils.cpp.

13 {
14  //~ ProcInfoBase p;
15  //~ SetConn c( object(), 0 );
16  //~
17  //~ if ( object()->className() == "Compartment" )
18  //~ moose::Compartment::reinitFunc( &c, &p );
19  //~ else if ( object()->className() == "HHChannel" )
20  //~ HHChannel::reinitFunc( &c, &p );
21  //~ else if ( object()->className() == "CaConc" )
22  //~ CaConc::reinitFunc( &c, &p );
23 }
int HSolveUtils::leakageChannels ( Id  compartment,
vector< Id > &  ret 
)
static

Definition at line 134 of file HSolveUtils.cpp.

References targets().

Referenced by HSolvePassive::initialize().

135 {
136  return targets( compartment, "channel", ret, "Leakage" );
137 }
static int targets(Id object, string msg, vector< Id > &target, string filter="", bool include=true)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void HSolveUtils::rates ( Id  gate,
HSolveUtils::Grid  grid,
vector< double > &  A,
vector< double > &  B 
)
static

Definition at line 205 of file HSolveUtils.cpp.

References Eref::data(), HSolveUtils::Grid::entry(), Id::eref(), Field< A >::get(), HHGate::lookupBoth(), HHGate::originalGateId(), HHGate::setUseInterpolation(), and HSolveUtils::Grid::size().

Referenced by HSolveActive::createLookupTables().

210 {
211  // dump("HSolveUtils::rates() has not been tested yet.", "WARN");
212  double min = Field< double >::get( gateId, "min" );
213  double max = Field< double >::get( gateId, "max" );
214  unsigned int divs = Field< unsigned int >::get( gateId, "divs" );
215 
216  if ( grid == Grid( min, max, divs ) ) {
217  A = Field< vector< double > >::get( gateId, "tableA" );
218  B = Field< vector< double > >::get( gateId, "tableB" );
219  return;
220  }
221 
222  A.resize( grid.size() );
223  B.resize( grid.size() );
224 
225  /*
226  * Getting Id of original (prototype) gate, so that we can set fields on
227  * it. Copied gates are read-only.
228  */
229  HHGate* gate = reinterpret_cast< HHGate* >( gateId.eref().data() );
230  gateId = gate->originalGateId();
231 
232  /*
233  * Setting interpolation flag on. Will set back to its original value once
234  * we're done.
235  */
236  bool useInterpolation = Field< bool >::get( gateId, "useInterpolation");
237  gate->setUseInterpolation( gateId.eref(), true );
238 
239  unsigned int igrid;
240  double* ia = &A[ 0 ];
241  double* ib = &B[ 0 ];
242  for ( igrid = 0; igrid < grid.size(); ++igrid ) {
243  gate->lookupBoth( grid.entry( igrid ), ia, ib );
244 
245  ++ia, ++ib;
246  }
247 
248  // Setting interpolation flag back to its original value.
249  //~ HSolveUtils::set< HHGate, bool >
250  //~ ( gateId, "useInterpolation", useInterpolation );
251  gate->setUseInterpolation( gateId.eref(), useInterpolation );
252 }
Definition: HHGate.h:31
Definition: SetGet.h:236
Id originalGateId() const
Definition: HHGate.cpp:801
void setUseInterpolation(const Eref &e, bool val)
Definition: HHGate.cpp:485
unsigned int size()
void lookupBoth(double v, double *A, double *B) const
Definition: HHGate.cpp:275
double entry(unsigned int i)
static A get(const ObjId &dest, const string &field)
Definition: SetGet.h:284

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int HSolveUtils::spikegens ( Id  compartment,
vector< Id > &  ret 
)
static

Definition at line 122 of file HSolveUtils.cpp.

References targets().

Referenced by HSolveActive::readSynapses().

123 {
124  return targets( compartment, "VmOut", ret, "SpikeGen" );
125 }
static int targets(Id object, string msg, vector< Id > &target, string filter="", bool include=true)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int HSolveUtils::synchans ( Id  compartment,
vector< Id > &  ret 
)
static

Definition at line 127 of file HSolveUtils.cpp.

References targets().

Referenced by HSolveActive::readSynapses().

128 {
129  // "channel" msgs lead to SynChans as well HHChannels, so request
130  // explicitly for former.
131  return targets( compartment, "channel", ret, "SynChan" );
132 }
static int targets(Id object, string msg, vector< Id > &target, string filter="", bool include=true)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int HSolveUtils::targets ( Id  object,
string  msg,
vector< Id > &  target,
string  filter = "",
bool  include = true 
)
static

Definition at line 281 of file HSolveUtils.cpp.

Referenced by adjacent(), caDepend(), caTarget(), channels(), children(), hhchannels(), leakageChannels(), HSolveActive::manageOutgoingMessages(), spikegens(), and synchans().

287 {
288  vector< string > filter_v;
289 
290  if ( filter != "" )
291  filter_v.push_back( filter );
292 
293  return targets( object, msg, target, filter_v, include );
294 }
static int targets(Id object, string msg, vector< Id > &target, string filter="", bool include=true)

+ Here is the caller graph for this function:

int HSolveUtils::targets ( Id  object,
string  msg,
vector< Id > &  target,
const vector< string > &  filter,
bool  include = true 
)
static

Appends to 'target' any destination objects of messages of the specified name found on the object. The filter restricts the returns to those objects of the specified class include is a flag, when false it flips the returns to objects not of the specified class.

Definition at line 303 of file HSolveUtils.cpp.

References Element::cinfo(), Cinfo::findFinfo(), and Element::getNeighbors().

312 {
313  unsigned int oldSize = target.size();
314 
315  vector< Id > all;
316  Element* e = object.element();
317  const Finfo* f = e->cinfo()->findFinfo( msg );
318  if ( !f ) // Might not find SymCompartment Finfos if it is a Compartment
319  return 0;
320  e->getNeighbors( all, f );
321 
322  vector< Id >::iterator ia;
323  if ( filter.empty() ) {
324  target.insert( target.end(), all.begin(), all.end() );
325  } else {
326  for ( ia = all.begin(); ia != all.end(); ++ia ) {
327  string className = (*ia).element()->cinfo()->name();
328  bool hit =
329  find(
330  filter.begin(),
331  filter.end(),
332  className
333  ) != filter.end();
334 
335  if ( ( hit && include ) || ( !hit && !include ) )
336  target.push_back( *ia );
337  }
338  }
339 
340  return target.size() - oldSize;
341 }
const Cinfo * cinfo() const
Definition: Element.cpp:66
unsigned int getNeighbors(vector< Id > &ret, const Finfo *finfo) const
Definition: Element.cpp:949
const Finfo * findFinfo(const string &name) const
Definition: Cinfo.cpp:224
Definition: Finfo.h:12

+ Here is the call graph for this function:


The documentation for this class was generated from the following files: