std::vector<Source *> Source::factory(Options options) { std::vector<Source*> sources; for (auto i = 0; i < options.NumberSources(); i++) try { if (options.SourceType() == "ricker") { sources.push_back(new Ricker(options, i)); } else { throw std::runtime_error("Runtime error: Source type " + options.SourceType() + " not supported."); } } catch (std::exception &e) { std::cout << e.what() << std::endl; MPI::COMM_WORLD.Abort(-1); } return sources; }