feat(sandbox): added example input params
This commit is contained in:
2
build-config/CLI11/meson.build
Normal file
2
build-config/CLI11/meson.build
Normal file
@@ -0,0 +1,2 @@
|
||||
cli11_proj = subproject('cli11')
|
||||
cli11_dep = cli11_proj.get_variable('CLI11_dep')
|
||||
@@ -2,4 +2,5 @@ cmake = import('cmake')
|
||||
|
||||
subdir('fourdst')
|
||||
subdir('xxHash')
|
||||
subdir('CLI11')
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace fourdst::composition::io {
|
||||
L09
|
||||
};
|
||||
|
||||
std::unordered_map<SolarCompositions, std::string> SolarCompositions_to_string_map = {
|
||||
inline std::unordered_map<SolarCompositions, std::string> SolarCompositions_to_string_map = {
|
||||
{SolarCompositions::AG89, "AG89"},
|
||||
{SolarCompositions::GN93, "GN93"},
|
||||
{SolarCompositions::GS98, "GS98"},
|
||||
@@ -57,7 +57,7 @@ namespace fourdst::composition::io {
|
||||
{SolarCompositions::L09, "L09"}
|
||||
};
|
||||
|
||||
std::unordered_map<IsotopicPercentages, std::string> IsotopicPercentages_to_string_map = {
|
||||
inline std::unordered_map<IsotopicPercentages, std::string> IsotopicPercentages_to_string_map = {
|
||||
{IsotopicPercentages::L03, "L03"},
|
||||
{IsotopicPercentages::L09, "L09"}
|
||||
};
|
||||
@@ -114,9 +114,9 @@ namespace fourdst::composition {
|
||||
double initial_z,
|
||||
double initial_y);
|
||||
|
||||
[[nodiscard]] Composition get_composition_record(const SolarCompositions metal_fraction_scheme,
|
||||
const IsotopicPercentages isotopic_percentage_scheme,
|
||||
double initial_z,
|
||||
double initial_y);
|
||||
// [[nodiscard]] Composition get_composition_record(const SolarCompositions metal_fraction_scheme,
|
||||
// const IsotopicPercentages isotopic_percentage_scheme,
|
||||
// double initial_z,
|
||||
// double initial_y);
|
||||
|
||||
}
|
||||
|
||||
@@ -344,15 +344,15 @@ namespace fourdst::composition {
|
||||
|
||||
}
|
||||
|
||||
Composition get_composition_record(const SolarCompositions metal_fraction_scheme,
|
||||
const IsotopicPercentages isotopic_percentage_scheme,
|
||||
double initial_z,
|
||||
double initial_y) {
|
||||
return get_composition_record(
|
||||
SolarComposition_to_string_map.at(metal_fraction_scheme),
|
||||
IsotopicPercentages_to_string.at(isotopic_percentage_scheme),
|
||||
initial_z,
|
||||
initial_y
|
||||
);
|
||||
}
|
||||
// Composition get_composition_record(const io::SolarCompositions metal_fraction_scheme,
|
||||
// const io::IsotopicPercentages isotopic_percentage_scheme,
|
||||
// double initial_z,
|
||||
// double initial_y) {
|
||||
// return get_composition_record(
|
||||
// io::SolarComposition_to_string_map.at(metal_fraction_scheme),
|
||||
// io::IsotopicPercentages_to_string.at(isotopic_percentage_scheme),
|
||||
// initial_z,
|
||||
// initial_y
|
||||
// );
|
||||
// }
|
||||
}
|
||||
|
||||
10
subprojects/cli11.wrap
Normal file
10
subprojects/cli11.wrap
Normal file
@@ -0,0 +1,10 @@
|
||||
[wrap-file]
|
||||
directory = CLI11-2.6.1
|
||||
source_url = https://github.com/CLIUtils/CLI11/archive/refs/tags/v2.6.1.tar.gz
|
||||
source_filename = CLI11-2.6.1.tar.gz
|
||||
source_hash = 377691f3fac2b340f12a2f79f523c780564578ba3d6eaf5238e9f35895d5ba95
|
||||
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/cli11_2.6.1-1/CLI11-2.6.1.tar.gz
|
||||
wrapdb_version = 2.6.1-1
|
||||
|
||||
[provide]
|
||||
dependency_names = CLI11
|
||||
@@ -1 +1 @@
|
||||
executable('sandbox', 'sandbox.cpp', dependencies: [species_weight_dep, composition_dep, config_dep,])
|
||||
executable('sandbox', 'sandbox.cpp', dependencies: [species_weight_dep, composition_dep, config_dep, cli11_dep])
|
||||
@@ -15,6 +15,8 @@
|
||||
#include <unordered_map>
|
||||
#include <print>
|
||||
#include <ranges>
|
||||
#include <algorithm>
|
||||
#include "CLI/CLI.hpp"
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
|
||||
@@ -23,21 +25,29 @@ int main(int argc, char** argv) {
|
||||
// Options for metal_frac_scheme: ['AG89', 'GN93', 'GS98', 'L03', 'AGS05', 'AGSS09', 'A09_Przybilla', 'MB22_photospheric', 'AAG21_photospheric', 'L09']
|
||||
// Options for isotopic percentage scheme: [L03_data, L09_data]
|
||||
|
||||
|
||||
// CLI::App app("Loading Z fractions");
|
||||
double initial_z;
|
||||
std::string metal_fraction_scheme;
|
||||
|
||||
// fourdst::config::Config<Options> config;
|
||||
// fourdst::config::register_as_cli(config, app);
|
||||
// app.parse(argc, argv)
|
||||
auto keys = fourdst::composition::io::SolarCompositions_to_string_map | std::views::values | std::ranges::to<std::vector>();
|
||||
|
||||
std::string metal_fraction_scheme, isotopic_percentage_scheme;
|
||||
double initial_z, initial_y;
|
||||
CLI::App app("Example App To Load Solar Composition");
|
||||
app.add_option("-z,--initial_z", initial_z, "Initial Z")->required();
|
||||
app.add_option("-c,--solar-composition", metal_fraction_scheme)->
|
||||
check(
|
||||
CLI::IsMember(
|
||||
keys,
|
||||
CLI::ignore_case)
|
||||
);
|
||||
|
||||
CLI11_PARSE(app, argc, argv);
|
||||
|
||||
std::string isotopic_percentage_scheme;
|
||||
double initial_y;
|
||||
|
||||
// the following four should be user input
|
||||
// initial_y can be optional
|
||||
initial_z = 0.02;
|
||||
// initial_z = 0.02;
|
||||
initial_y = 0.24 + 2*initial_z;
|
||||
metal_fraction_scheme = "AG89";
|
||||
isotopic_percentage_scheme = "L03_data";
|
||||
|
||||
fourdst::composition::io::ChemicalFileParser parser;
|
||||
|
||||
Reference in New Issue
Block a user