001: #!/usr/bin/perl -w
002: #!/usr/bin/perl -d:ptkdb -w
003: #
004: 
005: use strict;
006: 
007: 
008: $| = 1;
009: 
010: 
011: BEGIN
012: {
013:     #! make check
014: 
015:     push @INC, '../perl';
016: 
017:     #! make distcheck
018: 
019:     push @INC, '../../perl';
020: 
021:     #! normal run
022: 
023:     push @INC, './perl';
024: 
025:     #! after install
026: 
027:     push @INC, '/usr/local/glue/swig/perl';
028: }
029: 
030: 
031: use SSP;
032: 
033: 
034: $SIG{__DIE__}
035:     = sub {
036:         use Carp;
037: 
038:         confess @_;
039:     };
040: 
041: $ENV{NEUROSPACES_NMC_MODELS} = '/usr/local/neurospaces/models/library';
042: 
043: 
044: sub main
045: {
046:     # model specification array
047: 
048:     my $modelname = $0;
049: 
050:     $modelname =~ s/.*\///;
051: 
052:     $modelname =~ s/-/_/g;
053: 
054:     my $args = [ "$0", "-P", "tests/cells/$modelname.ndf" ];
055: 
056:     # instantiate a scheduler
057: 
058:     my $scheduler
059:         = SSP->new(
060:                    {
061:                     apply => {
062:                               simulation => [
063:                                              {
064:                                               arguments => [ 10, { verbose => 2, }, ],
065:                                               method => 'steps',
066:                                              },
067:                                              {
068:                                               arguments => [ 0.1, ],
069:                                               method => 'advance',
070:                                              },
071:                                             ],
072:                              },
073:                     models => [
074:                                {
075:                                 modelname => "/$modelname",
076:                                 solverclass => "heccer",
077:                                },
078:                               ],
079:                     name => $modelname,
080:                     services => {
081:                                  model_container => {
082:                                                  initializers => [
083:                                                                   {
084:                                                                    arguments => [ $args, ],
085:                                                                    method => 'read',
086:                                                                   },
087:                                                                  ],
088:                                                  module_name => 'Neurospaces',
089:                                                 },
090:                                 },
091:                     solverclasses => {
092:                                       heccer => {
093:                                                  module_name => 'Heccer',
094:                                                  service_name => 'model_container',
095:                                                 },
096:                                      },
097:                    },
098:                   );
099: 
100:     use YAML;
101: 
102:     my $scheduler_yaml;
103: 
104:     {
105:         local $/;
106: 
107:         if (-e "./yaml/$modelname.yml")
108:         {
109:             $scheduler_yaml = Load(`cat ./yaml/$modelname.yml`);
110:         }
111:     }
112: 
113:     # run the schedule
114: 
115:     $scheduler->run();
116: }
117: 
118: 
119: main();
120: 
121: 
122: exit 0;
123: 
124: 
125: