examples:poissongroup
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| examples:poissongroup [2013/11/01 16:42] – Adds example output zenke | examples:poissongroup [2013/12/09 14:50] (current) – removed zenke | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== The important bits ====== | ||
| - | |||
| - | Since Auryn simulations are executable c programs there is quite some overhead (see below). However since the header logic is usually the same let's focus first on the interesting bits, where the interesting stuff happens. | ||
| - | |||
| - | <code cpp> | ||
| - | PoissonGroup * poisson = new PoissonGroup(size, | ||
| - | poisson-> | ||
| - | |||
| - | sprintf(strbuf, | ||
| - | SpikeMonitor * smon_e = new SpikeMonitor( poisson, strbuf, size); | ||
| - | |||
| - | sprintf(strbuf, | ||
| - | PopulationRateMonitor * pmon_e = new PopulationRateMonitor( poisson, strbuf, 1.0 ); | ||
| - | |||
| - | RateChecker * chk = new RateChecker( poisson , -1 , 20.*kappa , 10); | ||
| - | if (!sys-> | ||
| - | errcode = 1; | ||
| - | </ | ||
| - | |||
| - | Running this script should usually in a very brief output like this one | ||
| - | <code shell> | ||
| - | bash-4.1$ ./ | ||
| - | seed set to 1231231. | ||
| - | [=========================] 100% t=10.0 s f=21.3 Hz | ||
| - | ( 0) Freeing ... | ||
| - | </ | ||
| - | In addition to this the script will create a [[manual: | ||
| - | |||
| - | |||
| - | ====== The full script ====== | ||
| - | |||
| - | |||
| - | <code cpp> | ||
| - | #include < | ||
| - | #include < | ||
| - | #include < | ||
| - | #include < | ||
| - | |||
| - | #include < | ||
| - | #include < | ||
| - | #include < | ||
| - | #include < | ||
| - | |||
| - | #include " | ||
| - | #include " | ||
| - | #include " | ||
| - | #include " | ||
| - | #include " | ||
| - | #include " | ||
| - | #include " | ||
| - | #include " | ||
| - | |||
| - | using namespace std; | ||
| - | |||
| - | namespace po = boost:: | ||
| - | namespace mpi = boost::mpi; | ||
| - | |||
| - | int main(int ac, char* av[]) | ||
| - | { | ||
| - | |||
| - | string dir = " | ||
| - | string file_prefix = " | ||
| - | |||
| - | char strbuf [255]; | ||
| - | string msg; | ||
| - | |||
| - | NeuronID size = 1000; | ||
| - | NeuronID seed = 1; | ||
| - | double kappa = 5.; | ||
| - | double simtime = 10.; | ||
| - | |||
| - | int errcode = 0; | ||
| - | |||
| - | try { | ||
| - | |||
| - | po:: | ||
| - | desc.add_options() | ||
| - | (" | ||
| - | (" | ||
| - | (" | ||
| - | (" | ||
| - | (" | ||
| - | ; | ||
| - | |||
| - | po:: | ||
| - | po:: | ||
| - | po:: | ||
| - | |||
| - | if (vm.count(" | ||
| - | cout << desc << " | ||
| - | return 1; | ||
| - | } | ||
| - | |||
| - | |||
| - | if (vm.count(" | ||
| - | cout << "kappa set to " | ||
| - | << | ||
| - | kappa = vm[" | ||
| - | } | ||
| - | |||
| - | if (vm.count(" | ||
| - | cout << " | ||
| - | << | ||
| - | simtime = vm[" | ||
| - | } | ||
| - | |||
| - | if (vm.count(" | ||
| - | cout << "size set to " | ||
| - | << | ||
| - | size = vm[" | ||
| - | } | ||
| - | |||
| - | if (vm.count(" | ||
| - | cout << "seed set to " | ||
| - | << | ||
| - | seed = vm[" | ||
| - | } | ||
| - | } | ||
| - | catch(exception& | ||
| - | cerr << " | ||
| - | return 1; | ||
| - | } | ||
| - | catch(...) { | ||
| - | cerr << " | ||
| - | } | ||
| - | |||
| - | // BEGIN Global stuff | ||
| - | mpi:: | ||
| - | mpi:: | ||
| - | communicator = &world; | ||
| - | |||
| - | sprintf(strbuf, | ||
| - | string logfile = strbuf; | ||
| - | logger = new Logger(logfile, | ||
| - | |||
| - | sys = new System(& | ||
| - | // END Global stuff | ||
| - | |||
| - | PoissonGroup * poisson = new PoissonGroup(size, | ||
| - | poisson-> | ||
| - | |||
| - | sprintf(strbuf, | ||
| - | SpikeMonitor * smon_e = new SpikeMonitor( poisson, strbuf, size); | ||
| - | |||
| - | sprintf(strbuf, | ||
| - | PopulationRateMonitor * pmon_e = new PopulationRateMonitor( poisson, strbuf, 1.0 ); | ||
| - | |||
| - | RateChecker * chk = new RateChecker( poisson , -1 , 20.*kappa , 10); | ||
| - | if (!sys-> | ||
| - | errcode = 1; | ||
| - | |||
| - | logger-> | ||
| - | delete sys; | ||
| - | |||
| - | if (errcode) | ||
| - | env.abort(errcode); | ||
| - | return errcode; | ||
| - | } | ||
| - | </ | ||
| - | |||
| - | |||
examples/poissongroup.1383324175.txt.gz · Last modified: 2013/11/01 16:42 (external edit)
