17 int const id = CreateIPhreeqc();
21 "Failed to create PHREEQC instance (IPQ_RESULT error code = {}).",
24 if (LoadDatabase(
id, database.c_str()) != IPQ_OK)
26 OutputErrorString(
id);
28 "Failed to load thermodynamic database '{:s}' for PHREEQC "
37 SetSelectedOutputFileOn(
id, 0);
38 if (SetSelectedOutputStringOn(
id, 1) != IPQ_OK)
40 OGS_FATAL(
"Failed to enable string output for PHREEQC instance {}.",
44 if (SetDumpStringOn(
id, 1) != IPQ_OK)
46 OGS_FATAL(
"Failed to enable dump string for PHREEQC instance {}.",
id);
51 int const num_instances)
53 if (num_instances < 1)
55 OGS_FATAL(
"PhreeqcInstancePool requires at least 1 instance, got {}.",
60 for (
int i = 0; i < num_instances; ++i)
67 INFO(
"Created {} PHREEQC instances for parallel chemistry execution.",
81 if (thread_id < 0 || thread_id >=
static_cast<int>(
instance_ids_.size()))
84 "Thread ID {} is out of range [0, {}). This indicates a bug in "
85 "the parallel chemistry implementation.",
void INFO(fmt::format_string< Args... > fmt, Args &&... args)
PhreeqcInstancePool(std::string const &database, int num_instances)
static int createInstance(std::string const &database)
std::vector< int > instance_ids_
int getInstanceForThread(int thread_id) const
static void configureForStringIO(int id)