29 using namespace icedb;
30 namespace po = boost::program_options;
32 po::options_description desc(
"Allowed options"),
33 subst_opts(
"Substance options"),
34 unit_opts(
"Unit options"),
35 environ_opts(
"Environment options"),
36 scatt_matrix_opts(
"Scattering matrix options"),
37 scatt_provider_opts(
"Scattering method options"),
38 cmdline(
"Command-line options"),
39 config(
"Config options"), hidden(
"Hidden options"), oall(
"all options");
41 unit_opts.add_options()
42 (
"length-units", po::value<string>()->default_value(
"um"),
"Units of length (um, mm, cm, m)")
43 (
"volume-units", po::value<string>()->default_value(
"um^3"),
"Units of volume (um^3, m^3, cm^3)")
44 (
"frequency-units", po::value<string>()->default_value(
"GHz"),
"Units of frequency (GHz, Hz)")
45 (
"temperature-units", po::value<string>()->default_value(
"K"),
"Units of temperature (K, degC)")
46 (
"temp-units", po::value<string>()->default_value(
"K"),
"Temperature units")
48 subst_opts.add_options()
49 (
"refractive-index,r", po::value<vector<string> >()->multitoken(),
"Refractive indices of target (may instead specify substance and temperature)")
50 (
"volume,v", po::value<vector<string> >()->multitoken(),
"Volumes")
51 (
"radii,a", po::value<vector<string> >()->multitoken(),
"Sphere radii")
52 (
"diameters,d", po::value<vector<string> >()->multitoken(),
"Sphere diameters")
54 (
"substance,S", po::value<vector<string> >(),
"Substances of interest. See icedb-refract for a list of pure substances. If not provided, you must specify refractive indices manually.")
55 (
"temp,T", po::value<vector<string> >()->multitoken(),
"Temperatures. Needed to calculate the refractive indices of certain substances.")
57 environ_opts.add_options()
58 (
"wavelength,w", po::value<vector<string> >()->multitoken(),
"Incident wavelengths")
59 (
"frequency,f", po::value<vector<string> >()->multitoken(),
"Incident frequencies")
60 (
"environ-refractive-index", po::value<complex<double> >()->default_value(std::complex<double>(1,0)),
61 "Refractive index of the ambient environment")
63 scatt_matrix_opts.add_options()
64 (
"angles", po::value<string>()->default_value(
"0:19:180:lin"),
"Write the output scattering matrices at these scattering angles")
66 scatt_provider_opts.add_options()
67 (
"list-scattering-methods",
"Generate a list of implemented methods for calculating scattering by spheres.")
68 (
"scattering-method,M", po::value<vector<string > >()->default_value(vector<string> ({
"mie"}))->multitoken(),
69 "Choose the scattering methods (mie, rayleigh, rayleigh-gans)")
72 (
"help,h",
"produce help message")
73 (
"help-all",
"produce verbose help for all possible options")
74 (
"output-cross-sections,o", po::value<string>(),
"Output file for cross sections. If no output file, then these are written to stdout.")
75 (
"output-short",
"Write terse output. Useful when writing to screen.")
76 (
"output-scatt-matrices", po::value<string>(),
"Path to an HDF5 file with scattering matrix results. If unspecified, then " 77 "the scattering matrices will not be calculated.")
78 (
"output-format", po::value<string>()->default_value(
"text"),
"Output cross sections file format: text or HDF5. Must specify output-cross-sections for this to have any effect.")
80 config.add(unit_opts).add(subst_opts).add(environ_opts).add(scatt_matrix_opts).add(scatt_provider_opts);
84 oall.add(cmdline).add(hidden);
87 po::store(po::command_line_parser(argc, argv).
88 options(oall).run(), vm);
91 auto doHelp = [&](
const std::string &m) {
92 cerr << desc <<
"\n" << m << endl;
95 if (vm.count(
"help") || argc < 2) doHelp(
"");
96 if (vm.count(
"help-all")) { cerr << oall << endl; exit(1); }
99 catch (std::exception &e) {
100 cerr <<
"An exception has occurred: " << e.what() << endl;