73 config.getConfigParameter<std::string>(
"mesh");
77 std::begin(meshes), std::end(meshes),
78 [&mesh_name](
auto const& mesh)
80 assert(mesh !=
nullptr);
81 return mesh->getName() == mesh_name;
83 "Required mesh with name '" + mesh_name +
"' not found.");
85 assert(mesh.getID() != 0);
86 DBUG(
"Found mesh '{:s}' with id {:d}.", mesh.getName(), mesh.getID());
90 config.getConfigParameter<std::string>(
"linear_solver");
92 linear_solvers, ls_name,
93 "A linear solver with the given name does not exist.");
98 auto chemical_system =
102 auto reaction_rates = createReactionRates<PhreeqcIOData::ReactionRate>(
104 config.getConfigSubtreeOptional(
"rates"));
109 config.getConfigSubtreeOptional(
"surface"));
112 auto const& exchangers = chemical_system->exchangers;
119 if (!surface.empty() && !exchangers.empty())
122 "Using surface and exchange reactions simultaneously is not "
123 "supported at the moment");
126 auto dump = surface.empty() && exchangers.empty()
128 : std::make_unique<PhreeqcIOData::Dump>(project_file_name);
133 config.getConfigSubtree(
"knobs"));
138 config.getConfigSubtreeOptional(
"user_punch"), *meshes[0]);
141 auto const use_high_precision =
143 config.getConfigParameter<
bool>(
"use_high_precision",
true);
145 *chemical_system, user_punch, use_high_precision, project_file_name);
147 return std::make_unique<PhreeqcIOData::PhreeqcIO>(
148 *linear_solver, std::move(project_file_name),
149 std::move(path_to_database), std::move(chemical_system),
150 std::move(reaction_rates), std::move(surface), std::move(user_punch),
151 std::move(output), std::move(dump), std::move(knobs));
void DBUG(char const *fmt, Args const &... args)
Map::mapped_type & getOrError(Map &map, Key const &key, std::string const &error_message)
std::string extractBaseNameWithoutExtension(std::string const &pathname)
std::string joinPaths(std::string const &pathA, std::string const &pathB)
std::iterator_traits< InputIt >::reference findElementOrError(InputIt begin, InputIt end, Predicate predicate, std::string const &error="")
std::unique_ptr< UserPunch > createUserPunch(std::optional< BaseLib::ConfigTree > const &config, MeshLib::Mesh const &mesh)
std::unique_ptr< Output > createOutput(ChemicalSystem const &chemical_system, std::unique_ptr< UserPunch > const &user_punch, bool const use_high_precision, std::string const &project_file_name)
std::unique_ptr< ChemicalSystem > createChemicalSystem(BaseLib::ConfigTree const &config, MeshLib::Mesh &mesh)
Knobs createKnobs(BaseLib::ConfigTree const &config)
bool createSurface(GeoLib::Polyline const &ply, GeoLib::GEOObjects &geometries, std::string const &geometry_name, std::string const &gmsh_binary)
std::string parseDatabasePath(BaseLib::ConfigTree const &config)