int main(int argc, char *argv[]) { nest::Network *pNet = 0; /** * Create the interpreter object. Due to its dependence * on various static objects (e.g. of class Name), the * interpreter engine MUST NOT be global. */ SLIInterpreter engine; neststartup(argc, argv, engine, pNet); // start the interpreter session int exitcode = engine.execute(); nestshutdown(); // delete the Network before modules are deleted by interpreter's destructor // because otherwise models defined in a module might still be referenced by // the Network delete pNet; return exitcode; }
int main(int argc, char *argv[]) { #ifdef HAVE_MPI nest::Communicator::init(&argc, &argv); #endif #ifdef _OPENMP omp_set_num_threads(1); #endif nest::Network *pNet = 0; /** * Create the interpreter object. Due to its dependence * on various static objects (e.g. of class Name), the * interpreter engine MUST NOT be global. */ SLIInterpreter engine; neststartup(argc, argv, engine, pNet); // start the interpreter session int exitcode = engine.execute(); #ifdef HAVE_MPI nest::Communicator::finalize(); #endif // delete the Network before modules are deleted by interpreter's destructor // because otherwise models defined in a module might still be referenced by // the Network delete pNet; return exitcode; }
int neststartup(int argc, char**argv, SLIInterpreter &engine, nest::Network* &pNet) { // We disable synchronization between stdio and istd::ostreams // this has to be done before any in- or output has been done. /* * TODO: This block looks to me as if it would evaluate to the same stuff * in all cases. Can it be removed (or simplified, if I'm wrong ;-) */ #ifdef __GNUC__ #if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 1) // Broken with GCC 3.1 and higher. // cin.get() never returns, or leaves cin in a broken state. std::ios::sync_with_stdio(false); #endif #else // This is for all other compilers std::ios::sync_with_stdio(false); #endif addmodule<OOSupportModule>(engine); addmodule<RandomNumbers>(engine); #ifdef HAVE_READLINE addmodule<GNUReadline>(engine); #endif addmodule<SLIArrayModule>(engine); addmodule<SpecialFunctionsModule>(engine); // safe without GSL addmodule<SLIgraphics>(engine); engine.addmodule(new SLIStartup(argc,argv)); addmodule<Processes>(engine); addmodule<RegexpModule>(engine); addmodule<FilesystemModule>(engine); // create the network and register with NestModule class pNet = new nest::Network(engine); assert(pNet != 0); nest::NestModule::register_network(*pNet); addmodule<nest::NestModule>(engine); // now add static modules providing models add_static_modules(engine, *pNet); #ifdef HAVE_LIBLTDL // no dynamic loading without LIBLTDL //dynamic loader module for managing linked and dynamically loaded extension modules nest::DynamicLoaderModule *pDynLoader = new nest::DynamicLoaderModule(pNet, engine); // initialize all modules that were linked into at compile time // these modules have registered via calling DynamicLoader::registerLinkedModule // from their constructor pDynLoader->initLinkedModules(engine); // interpreter will delete module on destruction engine.addmodule(pDynLoader); #endif return engine.startup(); }
void DynamicLoaderModule::initLinkedModules( SLIInterpreter& interpreter ) { for ( vecLinkedModules::iterator it = getLinkedModules().begin(); it != getLinkedModules().end(); ++it ) { interpreter.message( SLIInterpreter::M_STATUS, "DynamicLoaderModule::initLinkedModules", "adding linked module" ); interpreter.message( SLIInterpreter::M_STATUS, "DynamicLoaderModule::initLinkedModules", ( *it )->name().c_str() ); interpreter.addlinkedusermodule( *it ); } }
/*! At the time when DynamicLoaderModule is constructed, the SLI Interpreter and NestModule must be already constructed and initialized. DynamicLoaderModule relies on the presence of the following SLI datastructures: Name, Dictionary and on the nest::NestModule::net. */ DynamicLoaderModule::DynamicLoaderModule( Network* pNet, SLIInterpreter& interpreter ) : loadmodule_function( pNet, dyn_modules ) { assert( pNet != NULL ); pNet_ = pNet; interpreter.def( "moduledict", new DictionaryDatum( moduledict_ ) ); }
int main( int argc, char* argv[] ) { /** * Create the interpreter object. Due to its dependence * on various static objects (e.g. of class Name), the * interpreter engine MUST NOT be global. */ SLIInterpreter engine; neststartup( &argc, &argv, engine ); // start the interpreter session int exitcode = engine.execute(); nestshutdown( exitcode ); return exitcode; }
/*! At the time when DynamicLoaderModule is constructed, the SLI Interpreter and NestModule must be already constructed and initialized. DynamicLoaderModule relies on the presence of the following SLI datastructures: Name, Dictionary. */ DynamicLoaderModule::DynamicLoaderModule( SLIInterpreter& interpreter ) : loadmodule_function( dyn_modules ) { interpreter.def( "moduledict", new DictionaryDatum( moduledict_ ) ); }