27 int size = ret.size();
30 remove( ret.begin(), ret.end(), exclude ),
33 return ret.size() - size;
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" );
49 int size =
targets( compartment,
"axial", ret,
"Compartment" );
50 size +=
targets( compartment,
"distalOut", ret,
"SymCompartment" );
51 size +=
targets( compartment,
"cylinderOut", ret,
"SymCompartment" );
61 return targets( compartment,
"channel", ret );
68 return targets( compartment,
"channel", ret,
"HHChannel" );
81 unsigned int oldSize = ret.size();
83 static string gateName[] = {
89 static string powerField[] = {
95 unsigned int nGates = 3;
96 for (
unsigned int i = 0; i < nGates; i++ ) {
107 errorSS <<
"Got " << gatePath <<
" expected " << gPath;
110 if ( getOriginals ) {
111 HHGate* g =
reinterpret_cast< HHGate*
>( gate.eref().data() );
115 ret.push_back( gate );
119 return ret.size() - oldSize;
124 return targets( compartment,
"VmOut", ret,
"SpikeGen" );
131 return targets( compartment,
"channel", ret,
"SynChan" );
136 return targets( compartment,
"channel", ret,
"Leakage" );
141 return targets( channel,
"IkOut", ret,
"CaConc" );
146 return targets( channel,
"concen", ret,
"CaConc" );
200 assert( i <= divs_ + 1 );
202 return ( min_ + dx_ * i );
209 vector< double >& B )
216 if ( grid ==
Grid( min, max, divs ) ) {
222 A.resize( grid.
size() );
223 B.resize( grid.
size() );
240 double* ia = &A[ 0 ];
241 double* ib = &B[ 0 ];
242 for ( igrid = 0; igrid < grid.
size(); ++igrid ) {
284 vector< Id >& target,
288 vector< string > filter_v;
291 filter_v.push_back( filter );
293 return targets(
object, msg, target, filter_v, include );
306 vector< Id >& target,
307 const vector< string >& filter,
313 unsigned int oldSize = target.size();
322 vector< Id >::iterator ia;
323 if ( filter.empty() ) {
324 target.insert( target.end(), all.begin(), all.end() );
326 for ( ia = all.begin(); ia != all.end(); ++ia ) {
327 string className = (*ia).element()->cinfo()->name();
335 if ( ( hit && include ) || ( !hit && !include ) )
336 target.push_back( *ia );
340 return target.size() - oldSize;
348 #include "../shell/Shell.h"
349 void testHSolveUtils( )
373 c[ 0 ] = shell->
doCreate(
"Compartment", n,
"c0", 1 );
374 c[ 1 ] = shell->
doCreate(
"Compartment", n,
"c1", 1 );
375 c[ 2 ] = shell->
doCreate(
"Compartment", n,
"c2", 1 );
376 c[ 3 ] = shell->
doCreate(
"Compartment", n,
"c3", 1 );
377 c[ 4 ] = shell->
doCreate(
"Compartment", n,
"c4", 1 );
378 c[ 5 ] = shell->
doCreate(
"Compartment", n,
"c5", 1 );
381 mid = shell->
doAddMsg(
"Single", c[ 0 ],
"axial", c[ 1 ],
"raxial" );
382 ASSERT( ! mid.
bad(),
"Linking compartments" );
383 mid = shell->
doAddMsg(
"Single", c[ 1 ],
"axial", c[ 2 ],
"raxial" );
384 ASSERT( ! mid.bad(),
"Linking compartments" );
385 mid = shell->
doAddMsg(
"Single", c[ 1 ],
"axial", c[ 3 ],
"raxial" );
386 ASSERT( ! mid.bad(),
"Linking compartments" );
387 mid = shell->
doAddMsg(
"Single", c[ 1 ],
"axial", c[ 4 ],
"raxial" );
388 ASSERT( ! mid.bad(),
"Linking compartments" );
389 mid = shell->
doAddMsg(
"Single", c[ 1 ],
"axial", c[ 5 ],
"raxial" );
390 ASSERT( ! mid.bad(),
"Linking compartments" );
401 ASSERT( nFound == found.size(),
"Finding adjacent compartments" );
403 ASSERT( nFound == 1,
"Finding adjacent compartments" );
404 ASSERT( found[ 0 ] == c[ 1 ],
"Finding adjacent compartments" );
409 ASSERT( nFound == 5,
"Finding adjacent compartments" );
412 find( found.begin(), found.end(), c[ 0 ] ) != found.end();
413 ASSERT( success,
"Finding adjacent compartments" );
415 for (
int i = 2; i < 6; i++ ) {
417 find( found.begin(), found.end(), c[ i ] ) != found.end();
418 ASSERT( success,
"Finding adjacent compartments" );
425 ASSERT( nFound == 1,
"Finding adjacent compartments" );
426 ASSERT( found[ 0 ] == c[ 1 ],
"Finding adjacent compartments" );
436 ASSERT( nFound == 4,
"Finding adjacent compartments" );
438 for (
int i = 2; i < 6; i++ ) {
440 find( found.begin(), found.end(), c[ i ] ) != found.end();
441 ASSERT( success,
"Finding adjacent compartments" );
447 ASSERT( nFound == 4,
"Finding adjacent compartments" );
450 find( found.begin(), found.end(), c[ 0 ] ) != found.end();
451 ASSERT( success,
"Finding adjacent compartments" );
453 for (
int i = 3; i < 6; i++ ) {
455 find( found.begin(), found.end(), c[ i ] ) != found.end();
456 ASSERT( success,
"Finding adjacent compartments" );
463 ASSERT( nFound == 0,
"Finding adjacent compartments" );
469 ASSERT( nFound == 1,
"Finding adjacent compartments" );
470 ASSERT( found[ 0 ] == c[ 1 ],
"Finding adjacent compartments" );
479 ASSERT( nFound == 1,
"Finding child compartments" );
481 ASSERT( found[ 0 ] == c[ 1 ],
"Finding child compartments" );
486 ASSERT( nFound == 4,
"Finding child compartments" );
488 for (
int i = 2; i < 6; i++ ) {
490 find( found.begin(), found.end(), c[ i ] ) != found.end();
491 ASSERT( success,
"Finding child compartments" );
498 ASSERT( nFound == 0,
"Finding child compartments" );
502 cout <<
"." << flush;
506 #endif // DO_UNIT_TESTS
#define ASSERT(unused, message)
static int children(Id compartment, vector< Id > &ret)
static int caDepend(Id channel, vector< Id > &ret)
static int leakageChannels(Id compartment, vector< Id > &ret)
std::string path(const std::string &separator="/") const
static int spikegens(Id compartment, vector< Id > &ret)
Id originalGateId() const
void setUseInterpolation(const Eref &e, bool val)
static int caTarget(Id channel, vector< Id > &ret)
static int adjacent(Id compartment, vector< Id > &ret)
static int gates(Id channel, vector< Id > &ret, bool getOriginals=true)
Id doCreate(string type, ObjId parent, string name, unsigned int numData, NodePolicy nodePolicy=MooseBlockBalance, unsigned int preferredNode=1)
static int targets(Id object, string msg, vector< Id > &target, string filter="", bool include=true)
void lookupBoth(double v, double *A, double *B) const
static int channels(Id compartment, vector< Id > &ret)
static void initialize(Id object)
string fixPath(string path)
Fix a path. For testing purpose.
static void rates(Id gate, Grid grid, vector< double > &A, vector< double > &B)
const Cinfo * cinfo() const
static int synchans(Id compartment, vector< Id > &ret)
stringstream errorSS
Global stringstream for message printing.
static int hhchannels(Id compartment, vector< Id > &ret)
ObjId doAddMsg(const string &msgType, ObjId src, const string &srcField, ObjId dest, const string &destField)
double entry(unsigned int i)
unsigned int getNeighbors(vector< Id > &ret, const Finfo *finfo) const
static A get(const ObjId &dest, const string &field)
#define SIMPLE_ASSERT_MSG(expr, msg)
const Finfo * findFinfo(const string &name) const