PhreeqcRM
PhreeqcRM.h
Go to the documentation of this file.
1
11#if !defined(PHREEQCRM_H_INCLUDED)
12#define PHREEQCRM_H_INCLUDED
13#ifdef USE_MPI
14#include "mpi.h"
15#define MP_TYPE MPI_Comm
16#else
17#define MP_TYPE int
18#endif
19
20// forward declarations
21class cxxNameDouble;
22class cxxSolution;
23class cxxStorageBin;
24class IPhreeqc;
25class IPhreeqcPhast;
26class PHRQ_io;
27
28#if defined(SWIG) || defined(swig_python_EXPORTS)
29// Forward-declare CPython's PyObject so headers can refer to it without
30// including Python.h here. This must be the global PyObject type (not a
31// nested class-scoped typedef) so it matches the interpreter's API and
32// SWIG-generated wrappers.
33typedef struct _object PyObject;
34#endif
35
36#include "NameDouble.h"
37#include <vector>
38#include <list>
39#include <set>
40#include <map>
41#include <mutex>
42#include <string>
43#include <memory>
44#include "RMVARS.h"
45
46#include "irm_dll_export.h"
47
48#if SWIG
49#define IRM_DLL_EXPORT
50#endif
51
52//class BMI_Var;
59class IRM_DLL_EXPORT PhreeqcRMStop : public std::exception
60{
61public:
62 const char *what() const throw () {return "Failure in PhreeqcRM\n";}
63};
64//class LetItThrow : public std::logic_error {
65//public:
66// LetItThrow(std::string error_string) : std::logic_error(error_string.c_str()) { };
67//};
70#include "IrmResult.h"
71enum {
133} /* MPI_METHOD */;
134
135
136template<typename T>
138{
139public:
141 {
142 const std::lock_guard<std::mutex> lock(StaticIndexer<T>::_InstancesLock);
145 }
146
148 {
149 const std::lock_guard<std::mutex> lock(StaticIndexer<T>::_InstancesLock);
150 auto search = StaticIndexer<T>::_Instances.find(this->_Index);
151 assert(search != StaticIndexer<T>::_Instances.end());
152 if (search != StaticIndexer<T>::_Instances.end())
153 {
154 StaticIndexer<T>::_Instances.erase(search);
155 }
156 }
157
158 static T* GetInstance(int id)
159 {
160 const std::lock_guard<std::mutex> lock(_InstancesLock);
161 auto search = StaticIndexer<T>::_Instances.find(size_t(id));
162 if (search != StaticIndexer<T>::_Instances.end())
163 {
164 return search->second;
165 }
166 return nullptr;
167 }
168
169 template<typename Derived>
170 static Derived* GetInstance(int id)
171 {
172 const std::lock_guard<std::mutex> lock(_InstancesLock);
173 auto search = StaticIndexer<T>::_Instances.find(size_t(id));
174 if (search != StaticIndexer<T>::_Instances.end())
175 {
176 if (Derived* derived = dynamic_cast<Derived*>(search->second))
177 {
178 return derived;
179 }
180 }
181 return nullptr;
182 }
183
184 static IRM_RESULT Destroy(int id)
185 {
186 auto search = StaticIndexer<T>::_Instances.find(size_t(id));
187 if (search != StaticIndexer<T>::_Instances.end())
188 {
189 assert(dynamic_cast<T*>(search->second));
190 delete search->second;
191 return IRM_OK;
192 }
193 return IRM_BADINSTANCE;
194 }
195
196 //template<typename Derived>
197 //static IRM_RESULT Destroy(int id)
198 //{
199 // auto search = StaticIndexer<T>::_Instances.find(size_t(id));
200 // if (search != StaticIndexer<T>::_Instances.end())
201 // {
202 // assert(dynamic_cast<T*>(search->second));
203 // if (Derived* derived = dynamic_cast<Derived*>(search->second))
204 // {
205 // delete derived;
206 // return IRM_OK;
207 // }
208 // }
209 // return IRM_BADINSTANCE;
210 //}
211
212 static void DestroyAll()
213 {
214 std::list<T*> items;
215 for (auto pair : StaticIndexer<T>::_Instances)
216 {
217 assert(dynamic_cast<T*>(pair.second));
218 items.push_back(pair.second);
219 }
220 for (auto item : items)
221 {
222 delete item;
223 }
224 }
225
226 //template<typename Derived>
227 //static void DestroyAll()
228 //{
229 // const std::lock_guard<std::mutex> lock(_InstancesLock);
230 // std::list<Derived*> derived_items;
231 // for (auto pair : StaticIndexer<T>::_Instances)
232 // {
233 // assert(dynamic_cast<T*>(pair.second));
234 // if (Derived* derived = dynamic_cast<Derived*>(pair.second))
235 // {
236 // derived_items.push_back(derived);
237 // }
238 // }
239 // for (auto item : derived_items)
240 // {
241 // delete item;
242 // }
243 //}
244
246 {
247 return (int)this->_Index;
248 }
249
250protected:
251 size_t _Index;
252
253 static std::mutex _InstancesLock;
254 static std::map<size_t, T*> _Instances;
255 static size_t _InstancesIndex;
256};
257
258// static members of StaticIndexer
259
260template<typename T>
262
263template<typename T>
264std::map<size_t, T*> StaticIndexer<T>::_Instances;
265
266template<typename T>
268
269
270
278class IRM_DLL_EXPORT PhreeqcRM : public StaticIndexer<PhreeqcRM>
279{
280public:
282 static int CreateReactionModule(int nxyz, MP_TYPE nthreads);
284private:
285 virtual void AddOutputVars(std::string option, std::string def);
286 virtual void ClearBMISelectedOutput();
287 virtual void GenerateAutoOutputVars();
288 virtual void UpdateBMI(RMVARS v_enum);
289public:
290#ifdef USE_YAML
318 static int GetGridCellCountYAML(const char* YAML_file);
319#endif // #ifdef USE_YAML
320
383 PhreeqcRM(int nxyz, MP_TYPE thread_count_or_communicator, PHRQ_io * io=NULL, bool delay_construct=false);
384 virtual ~PhreeqcRM(void);
447 IPhreeqc * Concentrations2Utility(const std::vector< double > &c,
448 const std::vector< double > &tc, const std::vector< double > &p_atm);
484 IRM_RESULT CreateMapping(const std::vector< int > &grid2chem);
518 void DecodeError(int result);
540 IRM_RESULT DumpModule(bool dump_on, bool append = false);
563 void ErrorHandler(int result, const std::string &e_string);
580 void ErrorMessage(const std::string &error_string, bool prepend = true);
688 const std::vector < std::vector <int> > & GetBackwardMapping(void) {return this->backward_mapping;}
690 void GetBackwardMappingSWIG(std::vector<int>& nback_output, std::vector<int>& cellnumbers_output);
714 int GetChemistryCellCount(void) const {return this->count_chemistry;}
734 int GetComponentCount(void) const {return (int) this->components.size();}
759const std::vector< std::string > & GetComponents(void) const {return this->components;}
760
801 IRM_RESULT GetConcentrations(std::vector< double > &c_output);
867 std::string GetDatabaseFileName(void) {return this->database_file_name;}
894 IRM_RESULT GetDensityCalculated(std::vector< double > & d_output);
895 IRM_RESULT GetDensity(std::vector< double >& d_output);
931 const std::vector < int> & GetEndCell(void) {return this->end_cell;}
961const std::vector< std::string > & GetEquilibriumPhases(void) const { return this->EquilibriumPhasesList; }
989int GetEquilibriumPhasesCount(void) const { return (int) this->EquilibriumPhasesList.size(); }
990
991
1012 int GetErrorHandlerMode(void) {return this->error_handler_mode;}
1031 std::string GetErrorString(void);
1032
1068const std::vector< std::string > & GetExchangeNames(void) const { return this->ExchangeNamesList; }
1103const std::vector< std::string > & GetExchangeSpecies(void) const { return this->ExchangeSpeciesNamesList; }
1135int GetExchangeSpeciesCount(void) const { return (int) this->ExchangeSpeciesNamesList.size(); }
1136
1137
1155 std::string GetFilePrefix(void) {return this->file_prefix;}
1176const std::vector < int > & GetForwardMapping(void) {return this->forward_mapping_root;}
1177
1207const std::vector< std::string > & GetGasComponents(void) const { return this->GasComponentsList; }
1235int GetGasComponentsCount(void) const { return (int) this->GasComponentsList.size(); }
1236
1269IRM_RESULT GetGasCompMoles(std::vector< double >& gas_moles_output);
1270
1304IRM_RESULT GetGasCompPhi(std::vector< double >& gas_phi);
1305
1338IRM_RESULT GetGasCompPressures(std::vector< double >& gas_pressure);
1339
1371IRM_RESULT GetGasPhaseVolume(std::vector< double >& gas_volume_output);
1372
1399 const std::vector < double > & GetGfw(void) {return this->gfw;}
1421 int GetGridCellCount(void) {return this->nxyz;}
1448IPhreeqc * GetIPhreeqcPointer(int i);
1475IRM_RESULT GetIthConcentration(int i, std::vector< double >& c_output);
1505IRM_RESULT GetIthSpeciesConcentration(int i, std::vector< double >& c_output);
1506
1536const std::vector< std::string > & GetKineticReactions(void) const { return this->KineticReactionsList; }
1564int GetKineticReactionsCount(void) const { return (int) this->KineticReactionsList.size(); }
1565
1590 int GetMpiMyself(void) const {return this->mpi_myself;}
1616 int GetMpiTasks(void) const {return this->mpi_tasks;}
1694 bool GetPartitionUZSolids(void) const {return this->partition_uz_solids;}
1695#ifdef USE_RV
1716 std::vector< double > & GetPoreVolume(void) {return this->pore_volume;}
1717#endif
1737 const std::vector< double >& GetPorosity(void);
1759 const std::vector< double > & GetPressure(void);
1780 const std::vector< int > & GetPrintChemistryMask (void) {return this->print_chem_mask_root;}
1809 const std::vector <bool> & GetPrintChemistryOn(void) {return this->print_chemistry_on;}
1833 bool GetRebalanceByCell(void) const {return this->rebalance_by_cell;}
1858 double GetRebalanceFraction(void) const {return this->rebalance_fraction;}
1894IRM_RESULT GetSaturationCalculated(std::vector< double > & sat_output);
1895IRM_RESULT GetSaturation(std::vector< double >& sat_output);
1935 IRM_RESULT GetSelectedOutput(std::vector< double > &s_output);
2062 IRM_RESULT GetSelectedOutputHeading(int icol, std::string &heading);
2107 IRM_RESULT GetSelectedOutputHeadings(std::vector< std::string >& headings);
2136 bool GetSelectedOutputOn(void) {return this->selected_output_on;}
2185
2212int GetSICount(void) const { return (int) this->SINamesList.size(); }
2246const std::vector< std::string > & GetSINames(void) const { return this->SINamesList; }
2247
2283const std::vector< std::string > & GetSolidSolutionComponents(void) const { return this->SolidSolutionComponentsList; }
2316int GetSolidSolutionComponentsCount(void) const { return (int) this->SolidSolutionComponentsList.size(); }
2317
2354const std::vector< std::string > & GetSolidSolutionNames(void) const { return this->SolidSolutionNamesList; }
2355
2376 const std::vector< double > & GetSolutionVolume(void);
2422 IRM_RESULT GetSpeciesConcentrations(std::vector< double > & species_conc_output);
2454 int GetSpeciesCount(void) {return (int) this->species_names.size();}
2489 const std::vector< double > & GetSpeciesD25(void) {return this->species_d_25;}
2531 IRM_RESULT GetSpeciesLog10Gammas(std::vector< double > & species_log10gammas);
2532
2573IRM_RESULT GetSpeciesLog10Molalities(std::vector< double >& species_log10molalities);
2574
2608 const std::vector< std::string > & GetSpeciesNames(void) {return this->species_names;}
2644 bool GetSpeciesSaveOn(void) {return this->species_save_on;}
2645
2695 const std::vector<cxxNameDouble> & GetSpeciesStoichiometry(void) {return this->species_stoichiometry;}
2697 void GetSpeciesStoichiometrySWIG(std::vector<std::string>& species_output,
2698 std::vector<int>& nelt_output, std::vector<std::string>& elts_output, std::vector<double>& coef_output);
2731 const std::vector< double > & GetSpeciesZ(void) {return this->species_z;}
2766const std::vector < int> & GetStartCell(void) {return this->start_cell;}
2767
2804const std::vector< std::string > & GetSurfaceNames(void) const { return this->SurfaceNamesList; }
2805
2841const std::vector< std::string > & GetSurfaceSpecies(void) const { return this->SurfaceSpeciesNamesList; }
2842
2875int GetSurfaceSpeciesCount(void) const { return (int) this->SurfaceSpeciesNamesList.size(); }
2876
2877
2915const std::vector< std::string > & GetSurfaceTypes(void) const { return this->SurfaceTypesList; }
2916
2937 //const std::vector< double > & GetTemperature(void) {return this->tempc;}
2938 const std::vector< double > & GetTemperature(void);
2939 //int PhreeqcRM::GetVarItemsize(const std::string name);
2940 //int PhreeqcRM::GetVarNbytes(const std::string name);
2941
2962 int GetThreadCount() {return this->nthreads;}
2985 double GetTime(void) const {return this->time;}
3010 double GetTimeConversion(void) {return this->time_conversion;}
3034 double GetTimeStep(void) {return this->time_step;}
3059 int GetUnitsExchange(void) {return this->units_Exchange;}
3084 int GetUnitsGasPhase(void) {return this->units_GasPhase;}
3109 int GetUnitsKinetics(void) {return this->units_Kinetics;}
3134 int GetUnitsPPassemblage(void) {return this->units_PPassemblage;}
3189 int GetUnitsSolution(void) {return this->units_Solution;}
3214 int GetUnitsSSassemblage(void) {return this->units_SSassemblage;}
3239 int GetUnitsSurface(void) {return this->units_Surface;}
3259 const std::vector<double>& GetViscosity();
3260
3261
3284 const std::vector<IPhreeqcPhast *> & GetWorkers() {return this->workers;}
3285#ifdef USE_YAML
3405IRM_RESULT InitializeYAML(std::string yamlfile);
3406#endif
3434IRM_RESULT InitialPhreeqc2Concentrations(std::vector < double > & destination_c,
3435 const std::vector < int > & boundary_solution1);
3475 std::vector < double > & destination_c,
3476 const std::vector < int > & boundary_solution1,
3477 const std::vector < int > & boundary_solution2,
3478 const std::vector < double > & fraction1);
3508IRM_RESULT InitialEquilibriumPhases2Module(const std::vector < int >& equilibrium_phases);
3538IRM_RESULT InitialExchanges2Module(const std::vector < int >& exchanges);
3567IRM_RESULT InitialGasPhases2Module(const std::vector < int >& gas_phases);
3596IRM_RESULT InitialKinetics2Module(const std::vector < int >& kinetics);
3637IRM_RESULT InitialPhreeqc2Module(const std::vector < int >& initial_conditions1);
3701 const std::vector < int >& initial_conditions1,
3702 const std::vector < int >& initial_conditions2,
3703 const std::vector < double >& fraction1);
3733IRM_RESULT InitialPhreeqc2SpeciesConcentrations(std::vector < double >& destination_c,
3734 const std::vector < int >& boundary_solution1);
3774IRM_RESULT InitialPhreeqc2SpeciesConcentrations(std::vector < double >& destination_c,
3775 const std::vector < int >& boundary_solution1,
3776 const std::vector < int >& boundary_solution2,
3777 const std::vector < double >& fraction1);
3805 const std::vector< int >& cell_numbers);
3806
3835IRM_RESULT InitialSolidSolutions2Module(const std::vector < int >& solid_solutions);
3865IRM_RESULT InitialSolutions2Module(const std::vector < int >& solutions);
3894IRM_RESULT InitialSurfaces2Module(const std::vector < int >& surfaces);
3895
3912 virtual IRM_RESULT LoadDatabase(const std::string &database);
3931 void LogMessage(const std::string &str);
4059 void OutputMessage(const std::string &str);
4080 IRM_RESULT ReturnHandler(IRM_RESULT result, const std::string& e_string);
4081
4082
4140 IRM_RESULT RunFile(bool workers, bool initial_phreeqc, bool utility, const std::string & chemistry_name);
4167 IRM_RESULT RunString(bool workers, bool initial_phreeqc, bool utility, const std::string & input_string);
4190 void ScreenMessage(const std::string &str);
4257 IRM_RESULT SetConcentrations(const std::vector< double > &c);
4321 IRM_RESULT SetDensityUser(const std::vector< double > &density);
4322 IRM_RESULT SetDensity(const std::vector< double >& density);
4342 IRM_RESULT SetDumpFileName(const std::string & dump_name);
4402 IRM_RESULT SetFilePrefix(const std::string & prefix);
4403
4439IRM_RESULT SetGasCompMoles(const std::vector< double >& gas_moles);
4478IRM_RESULT SetGasPhaseVolume(const std::vector< double >& gas_volume);
4505IRM_RESULT SetIthConcentration(int i, std::vector< double >& c);
4535IRM_RESULT SetIthSpeciesConcentration(int i, std::vector< double >& c);
4536
4632 IRM_RESULT SetMpiWorkerCallbackC(int (*fcn)(int *method, void * cookie));
4708 IRM_RESULT SetMpiWorkerCallbackFortran(int (*fcn)(int *method));
4818 IRM_RESULT SetPorosity(const std::vector< double > &por);
4819
4840 IRM_RESULT SetPressure(const std::vector< double > &p);
4867 IRM_RESULT SetPrintChemistryMask(const std::vector<int> & cell_mask);
4902 IRM_RESULT SetPrintChemistryOn(bool workers, bool initial_phreeqc, bool utility);
4988 IRM_RESULT SetRepresentativeVolume(const std::vector< double > &rv);
5018 IRM_RESULT SetSaturationUser(const std::vector< double > &sat);
5019 IRM_RESULT SetSaturation(const std::vector< double >& sat);
5134 IRM_RESULT SetTemperature(const std::vector< double > &t);
5152 IRM_RESULT SetTime(double time);
5171 IRM_RESULT SetTimeConversion(double conv_factor);
5191 IRM_RESULT SetTimeStep(double time_step);
5504IRM_RESULT SpeciesConcentrations2Module(const std::vector< double > & species_conc);
5505
5640 void WarningMessage(const std::string &warnstr);
5641
5642#if defined(SWIG) || defined(swig_python_EXPORTS)
5643// Python helpers
5644public:
5645 // BasicCallback handling.
5646
5658 void set_basic_callback(PyObject* py_callable, PyObject* py_cookie = nullptr);
5659
5672 double _execute_basic_callback(double val1, double val2, const char* message);
5673
5674 struct PythonBasicCallbackData {
5675 PyObject* py_callable = nullptr;
5676 PyObject* py_callback_cookie = nullptr;
5677 };
5678
5679private:
5680 PythonBasicCallbackData python_basic_callback_data;
5681#endif
5682
5683#if defined(SWIG) || defined(swig_python_EXPORTS)
5684// Python helpers
5685public:
5686 // MPI Callback handling.
5687
5701 void set_mpi_worker_callback(PyObject* py_callable, PyObject* py_cookie = nullptr);
5702
5714 int _execute_mpi_worker_callback(int val);
5715
5716 struct PythonMpiWorkerCallbackData {
5717 PyObject* py_callable = nullptr;
5718 PyObject* py_callback_cookie = nullptr;
5719 };
5720
5721private:
5722 PythonMpiWorkerCallbackData python_mpi_worker_callback_data;
5723#endif
5724
5725public:
5726// Utilities
5727 static std::string Char2TrimString(const char * str, size_t l = 0);
5728 static bool FileExists(const std::string &name);
5729 static void FileRename(const std::string &temp_name, const std::string &name,
5730 const std::string &backup_name);
5731 static IRM_RESULT Int2IrmResult(int r, bool positive_ok);
5732private:
5733 IRM_RESULT CellInitialize(
5734 int i,
5735 int n_user_new,
5736 const int *initial_conditions1,
5737 const int *initial_conditions2,
5738 double *fraction1,
5739 std::set<std::string> &error_set);
5740 IRM_RESULT CheckCells();
5741 int CheckSelectedOutput();
5742 //void Collapse2Nchem(double *d_in, double *d_out);
5743 //void Collapse2Nchem(int *i_in, int *i_out);
5744 IPhreeqc * Concentrations2UtilityH2O(const std::vector< double > &c_in,
5745 const std::vector< double > &t_in, const std::vector< double > &p_in);
5746 IPhreeqc * Concentrations2UtilityNoH2O(const std::vector< double > &c_in,
5747 const std::vector< double > &t_in, const std::vector< double > &p_in);
5748 void Concentrations2Solutions(int n, std::vector< double > &c);
5749 void Concentrations2SolutionsH2O(int n, std::vector< double > &c);
5750 void Concentrations2SolutionsNoH2O(int n, std::vector< double > &c);
5751 void cxxSolution2concentration(cxxSolution * cxxsoln_ptr, std::vector< double > & d, double v, double dens);
5752 void cxxSolution2concentrationH2O(cxxSolution * cxxsoln_ptr, std::vector< double > & d, double v, double dens);
5753 void cxxSolution2concentrationNoH2O(cxxSolution * cxxsoln_ptr, std::vector< double > & d, double v, double dens);
5754 void GatherNchem(std::vector< double > &source, std::vector< double > &destination);
5755 cxxStorageBin & Get_phreeqc_bin(void) {return *this->phreeqc_bin;}
5756 IRM_RESULT HandleErrorsInternal(std::vector< int > & r);
5757 void PartitionUZ(int n, int iphrq, int ihst, double new_frac);
5758 void RebalanceLoad(void);
5759 void RebalanceLoadPerCell(void);
5760 IRM_RESULT RunCellsThread(int i);
5761 IRM_RESULT RunFileThread(int n);
5762 IRM_RESULT RunStringThread(int n, std::string & input);
5763 IRM_RESULT RunCellsThreadNoPrint(int n);
5764 void Scale_solids(int n, int iphrq, double frac);
5765 void ScatterNchem(double *d_array);
5766 void ScatterNchem(int *i_array);
5767 void ScatterNchem(std::vector< double > &source, std::vector< double > &destination);
5768 void ScatterNchem(std::vector< int > &source, std::vector< int > &destination);
5769 IRM_RESULT SetChemistryFileName(const char * prefix = NULL);
5770 IRM_RESULT SetDatabaseFileName(const char * db = NULL);
5771 void SetEndCells(void);
5772 void SetEndCellsHeterogeneous(void);
5773 double TimeStandardTask(void);
5774 IRM_RESULT TransferCells(cxxStorageBin &t_bin, int old, int nnew);
5775 IRM_RESULT TransferCellsUZ(std::ostringstream &raw_stream, int old, int nnew);
5776
5777private:
5778 //IRM_RESULT SetGeneric(std::vector< double > &destination, int newSize, const std::vector< double > &origin, int mpiMethod, const std::string &name, const double newValue = 0.0);
5779 IRM_RESULT SetGeneric(const std::vector< double > &source, std::vector< double > &destination_root, std::vector< double > &destination_worker, int mpiMethod, const std::string &name);
5780public:
5781
5782protected:
5783
5784#if defined(_MSC_VER)
5785/* disable warning C4251: 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2' */
5786#pragma warning(disable:4251)
5787#endif
5789 bool component_h2o; // true: use H2O, excess H, excess O, and charge;
5790 // false total H, total O, and charge
5791 std::string database_file_name;
5792 std::string chemistry_file_name;
5793 std::string dump_file_name;
5794 std::string file_prefix;
5795 cxxStorageBin * phreeqc_bin;
5796 int mpi_myself;
5797 int mpi_tasks;
5798 std::vector <std::string> components; // list of components to be transported
5799 std::vector <double> gfw; // gram formula weights converting mass to moles (1 for each component)
5800 double gfw_water; // gfw of water
5801 bool partition_uz_solids;
5802 int nxyz; // number of nodes
5803 int count_chemistry; // number of cells for chemistry
5804 double time; // time from transport, sec
5805 double time_step; // time step from transport, sec
5806 double time_conversion; // time conversion factor, multiply to convert to preferred time unit for output
5807 std::vector <double> CurrentConcentrations;
5808 std::vector <double> CurrentSpeciesConcentrations;
5809 std::vector <double> IthCurrentConcentrations;
5810 std::vector <double> IthCurrentSpeciesConcentrations;
5811 std::set<int> IthConcentrationSet;
5812 std::set<int> IthSpeciesConcentrationSet;
5813 std::vector <double> old_saturation_root; // saturation fraction from previous step
5814 std::vector <double> old_saturation_worker;
5815 std::vector< double > saturation_root; // nxyz saturation fraction
5816 std::vector< double > saturation_worker; // nchem on workers saturation fraction
5817 std::vector< double > pressure_root; // nxyz on root current pressure
5818 std::vector< double > pressure_worker; // nchem on workers current pressure
5819 std::vector< double > rv_root; // nxyz on root representative volume
5820 std::vector< double > rv_worker; // nchem on workers representative volume
5821 std::vector< double > porosity_root; // nxyz porosity
5822 std::vector< double > porosity_worker; // nchem on workers porosity
5823 std::vector< double > tempc_root; // nxyz on root temperature Celsius
5824 std::vector< double > tempc_worker; // nchem on workers temperature Celsius
5825 std::vector< double > density_root; // nxyz density
5826 std::vector< double > density_worker; // nchem on workers density
5827 std::vector< double > viscosity_root; // nxyz viscosity
5828 std::vector< double > viscosity_worker; // nchem on workers viscosity
5829 std::vector< double > solution_volume_root; // nxyz on root solution volume
5830 std::vector< double > solution_volume_worker; // nchem on workers solution_volume
5831 std::vector< int > print_chem_mask_root; // nxyz print flags for output file
5832 std::vector< int > print_chem_mask_worker; // nchem print flags for output file
5833 bool rebalance_by_cell; // rebalance method 0 std, 1 by_cell
5834 double rebalance_fraction; // parameter for rebalancing process load for parallel
5835 int units_Solution; // 1 mg/L, 2 mol/L, 3 kg/kgs
5836 int units_PPassemblage; // 0, mol/L cell; 1, mol/L water; 2 mol/L rock
5837 int units_Exchange; // 0, mol/L cell; 1, mol/L water; 2 mol/L rock
5838 int units_Surface; // 0, mol/L cell; 1, mol/L water; 2 mol/L rock
5839 int units_GasPhase; // 0, mol/L cell; 1, mol/L water; 2 mol/L rock
5840 int units_SSassemblage; // 0, mol/L cell; 1, mol/L water; 2 mol/L rock
5841 int units_Kinetics; // 0, mol/L cell; 1, mol/L water; 2 mol/L rock
5842 std::vector <int> forward_mapping_root; // mapping from nxyz cells to count_chem chemistry cells
5843 std::vector <std::vector <int> > backward_mapping; // mapping from count_chem chemistry cells to nxyz cells
5844 bool use_solution_density_volume;
5845 bool worker_waiting;
5846 // print flags
5847 std::vector< bool > print_chemistry_on; // print flag for chemistry output file
5848 bool selected_output_on; // create selected output
5849
5850 int error_count;
5851 int error_handler_mode; // 0, return code; 1, throw; 2 exit;
5852 bool need_error_check;
5853 std::string phreeqcrm_error_string;
5854
5855 std::map<std::string, int> method_map;
5856 // threading
5857 int nthreads;
5858 std::vector<IPhreeqcPhast *> workers;
5859 //std::vector< int > start_cell;
5860 //std::vector< int > end_cell;
5861 PHRQ_io *phreeqcrm_io;
5862 bool delete_phreeqcrm_io;
5863
5864 // mpi
5865#ifdef USE_MPI
5866 MPI_Comm phreeqcrm_comm; // MPI communicator
5867#endif
5868 int (*mpi_worker_callback_fortran) (int *method);
5869 int (*mpi_worker_callback_c) (int *method, void *cookie);
5870 void *mpi_worker_callback_cookie;
5871
5872 // mcd
5873 bool species_save_on;
5874 std::vector <std::string> species_names;
5875 std::vector <double> species_z;
5876 std::vector <double> species_d_25;
5877 std::vector <cxxNameDouble> species_stoichiometry;
5878 std::map<int, int> s_num2rm_species_num;
5879 std::vector< double > standard_task_vector; // root only
5880
5881 std::vector< int > start_cell;
5882 std::vector< int > end_cell;
5883 // reactant lists
5884 std::vector <std::string> ExchangeSpeciesNamesList;
5885 std::vector <std::string> ExchangeNamesList;
5886 std::vector <std::string> SurfaceSpeciesNamesList;
5887 std::vector <std::string> SurfaceTypesList;
5888 std::vector <std::string> SurfaceNamesList;
5889
5890 std::vector <std::string> EquilibriumPhasesList;
5891 std::vector <std::string> GasComponentsList;
5892 std::vector <std::string> KineticReactionsList;
5893 std::vector <std::string> SolidSolutionComponentsList;
5894 std::vector <std::string> SolidSolutionNamesList;
5895 std::vector <std::string> SINamesList;
5896 std::set <std::string> ElementRedoxSet;
5897
5898protected:
5899 static const int default_nxyz = 10;
5900 static const MP_TYPE default_data_for_parallel_processing;
5901
5902 class Initializer; // Forward declaration
5903 std::unique_ptr<Initializer> initializer;
5904
5905 virtual void Construct();
5906
5907 void set_data_for_parallel_processing(MP_TYPE value);
5908 void set_io(PHRQ_io* value);
5909 void set_nxyz(int value);
5910
5912private:
5913 //friend class RM_interface;
5914 friend class BMIPhreeqcRM;
5915 friend class VarManager;
5916
5917#if defined(_MSC_VER)
5918/* reset warning C4251 */
5919#pragma warning(default:4251)
5920#endif
5921
5922};
5923#endif // !defined(PHREEQCRM_H_INCLUDED)
Enumeration used to return error codes.
IRM_RESULT
Enumeration for PhreeqcRM function return codes.
Definition IrmResult.h:8
@ IRM_BADINSTANCE
Definition IrmResult.h:15
@ IRM_OK
Definition IrmResult.h:9
@ METHOD_GETSPECIESLOG10GAMMAS
Definition PhreeqcRM.h:88
@ METHOD_SETCONCENTRATIONS
Definition PhreeqcRM.h:100
@ METHOD_STATEDELETE
Definition PhreeqcRM.h:131
@ METHOD_RUNCELLS
Definition PhreeqcRM.h:96
@ METHOD_CONSTRUCT
Definition PhreeqcRM.h:72
@ METHOD_SETSELECTEDOUTPUTON
Definition PhreeqcRM.h:115
@ METHOD_SETTEMPERATURE
Definition PhreeqcRM.h:117
@ METHOD_SETCOMPONENTH2O
Definition PhreeqcRM.h:99
@ METHOD_GETSATURATIONCALCULATED
Definition PhreeqcRM.h:84
@ METHOD_GETSPECIESCONCENTRATIONS
Definition PhreeqcRM.h:87
@ METHOD_SETUNITSGASPHASE
Definition PhreeqcRM.h:122
@ METHOD_SETSPECIESSAVEON
Definition PhreeqcRM.h:116
@ METHOD_FINDCOMPONENTS
Definition PhreeqcRM.h:75
@ METHOD_CREATEMAPPING
Definition PhreeqcRM.h:73
@ METHOD_SETPOROSITY
Definition PhreeqcRM.h:107
@ METHOD_GETSPECIESLOG10MOLALITIES
Definition PhreeqcRM.h:89
@ METHOD_GETPRESSURE
Definition PhreeqcRM.h:83
@ METHOD_RUNSTRING
Definition PhreeqcRM.h:98
@ METHOD_GETCONCENTRATIONS
Definition PhreeqcRM.h:76
@ METHOD_SETPRINTCHEMISTRYON
Definition PhreeqcRM.h:109
@ METHOD_GETGASCOMPPHI
Definition PhreeqcRM.h:81
@ METHOD_GETGASCOMPPRESSURES
Definition PhreeqcRM.h:80
@ METHOD_SETUNITSKINETICS
Definition PhreeqcRM.h:123
@ METHOD_SETFILEPREFIX
Definition PhreeqcRM.h:103
@ METHOD_INITIALPHREEQCCELL2MODULE
Definition PhreeqcRM.h:93
@ METHOD_SETSATURATIONUSER
Definition PhreeqcRM.h:114
@ METHOD_GETGASCOMPMOLES
Definition PhreeqcRM.h:79
@ METHOD_INITIALPHREEQC2MODULE
Definition PhreeqcRM.h:92
@ METHOD_SETREBALANCEFRACTION
Definition PhreeqcRM.h:112
@ METHOD_GETTEMPERATURE
Definition PhreeqcRM.h:90
@ METHOD_SETUNITSEXCHANGE
Definition PhreeqcRM.h:121
@ METHOD_RUNFILE
Definition PhreeqcRM.h:97
@ METHOD_SETPARTITIONUZSOLIDS
Definition PhreeqcRM.h:106
@ METHOD_SETTIMESTEP
Definition PhreeqcRM.h:120
@ METHOD_GETERRORSTRING
Definition PhreeqcRM.h:78
@ METHOD_GETVISCOSITY
Definition PhreeqcRM.h:91
@ METHOD_SETUNITSPPASSEMBLAGE
Definition PhreeqcRM.h:124
@ METHOD_GETSOLUTIONVOLUME
Definition PhreeqcRM.h:86
@ METHOD_SETGASCOMPMOLES
Definition PhreeqcRM.h:104
@ METHOD_SETTIMECONVERSION
Definition PhreeqcRM.h:119
@ METHOD_STATESAVE
Definition PhreeqcRM.h:129
@ METHOD_SETGASPHASEVOLUME
Definition PhreeqcRM.h:105
@ METHOD_GETGASPHASEVOLUME
Definition PhreeqcRM.h:82
@ METHOD_SETUNITSSOLUTION
Definition PhreeqcRM.h:125
@ METHOD_SETREPRESENTATIVEVOLUME
Definition PhreeqcRM.h:113
@ METHOD_SETTIME
Definition PhreeqcRM.h:118
@ METHOD_MPIWORKERBREAK
Definition PhreeqcRM.h:95
@ METHOD_GETDENSITYCALCULATED
Definition PhreeqcRM.h:77
@ METHOD_SETERRORHANDLERMODE
Definition PhreeqcRM.h:102
@ METHOD_SETREBALANCEBYCELL
Definition PhreeqcRM.h:111
@ METHOD_SETUNITSSURFACE
Definition PhreeqcRM.h:127
@ METHOD_SETUNITSSSASSEMBLAGE
Definition PhreeqcRM.h:126
@ METHOD_LOADDATABASE
Definition PhreeqcRM.h:94
@ METHOD_SETPRINTCHEMISTRYMASK
Definition PhreeqcRM.h:110
@ METHOD_USESOLUTIONDENSITYVOLUME
Definition PhreeqcRM.h:132
@ METHOD_GETSELECTEDOUTPUT
Definition PhreeqcRM.h:85
@ METHOD_SETDENSITYUSER
Definition PhreeqcRM.h:101
@ METHOD_SETPRESSURE
Definition PhreeqcRM.h:108
@ METHOD_DUMPMODULE
Definition PhreeqcRM.h:74
@ METHOD_SPECIESCONCENTRATIONS2MODULE
Definition PhreeqcRM.h:128
@ METHOD_STATEAPPLY
Definition PhreeqcRM.h:130
#define MP_TYPE
Definition PhreeqcRM.h:17
Basic Model Interface implementation of the geochemical reaction module PhreeqcRM.
Definition BMIPhreeqcRM.h:44
This class is derived from std::exception and is thrown when an unrecoverable error has occurred.
Definition PhreeqcRM.h:60
const char * what() const
Definition PhreeqcRM.h:62
Geochemical reaction module.
Definition PhreeqcRM.h:279
IRM_RESULT CloseFiles(void)
const std::vector< double > & GetGfw(void)
Definition PhreeqcRM.h:1399
IRM_RESULT GetSaturation(std::vector< double > &sat_output)
int GetExchangeSpeciesCount(void) const
Definition PhreeqcRM.h:1135
IRM_RESULT SetNthSelectedOutput(int n)
IRM_RESULT RunCells(void)
IRM_RESULT SetUnitsKinetics(int option)
static IRM_RESULT Int2IrmResult(int r, bool positive_ok)
IRM_RESULT SetScreenOn(bool tf)
IRM_RESULT GetIthSpeciesConcentration(int i, std::vector< double > &c_output)
int GetSolidSolutionComponentsCount(void) const
Definition PhreeqcRM.h:2316
IRM_RESULT SetMpiWorkerCallbackFortran(int(*fcn)(int *method))
IRM_RESULT SetPrintChemistryOn(bool workers, bool initial_phreeqc, bool utility)
static IRM_RESULT DestroyReactionModule(int n)
IRM_RESULT InitialSolidSolutions2Module(const std::vector< int > &solid_solutions)
const std::vector< int > & GetPrintChemistryMask(void)
Definition PhreeqcRM.h:1780
IRM_RESULT SetFilePrefix(const std::string &prefix)
IRM_RESULT InitialEquilibriumPhases2Module(const std::vector< int > &equilibrium_phases)
IRM_RESULT GetSelectedOutputHeadings(std::vector< std::string > &headings)
IRM_RESULT GetDensityCalculated(std::vector< double > &d_output)
int GetSelectedOutputCount(void)
IRM_RESULT GetSaturationCalculated(std::vector< double > &sat_output)
void LogMessage(const std::string &str)
bool GetRebalanceByCell(void) const
Definition PhreeqcRM.h:1833
IPhreeqc * Concentrations2Utility(const std::vector< double > &c, const std::vector< double > &tc, const std::vector< double > &p_atm)
const std::vector< double > & GetTemperature(void)
int GetUnitsKinetics(void)
Definition PhreeqcRM.h:3109
const std::vector< std::string > & GetKineticReactions(void) const
Definition PhreeqcRM.h:1536
int GetUnitsSSassemblage(void)
Definition PhreeqcRM.h:3214
int GetChemistryCellCount(void) const
Definition PhreeqcRM.h:714
IRM_RESULT SetUnitsSSassemblage(int option)
const std::vector< double > & GetSpeciesD25(void)
Definition PhreeqcRM.h:2489
IRM_RESULT SetPorosity(const std::vector< double > &por)
int GetCurrentSelectedOutputUserNumber(void)
const std::vector< std::string > & GetGasComponents(void) const
Definition PhreeqcRM.h:1207
IRM_RESULT InitialGasPhases2Module(const std::vector< int > &gas_phases)
const std::vector< cxxNameDouble > & GetSpeciesStoichiometry(void)
Definition PhreeqcRM.h:2695
const std::vector< std::string > & GetExchangeNames(void) const
Definition PhreeqcRM.h:1068
IRM_RESULT SetDumpFileName(const std::string &dump_name)
IRM_RESULT SetErrorOn(bool tf)
void ScreenMessage(const std::string &str)
static int GetGridCellCountYAML(const char *YAML_file)
bool GetSpeciesSaveOn(void)
Definition PhreeqcRM.h:2644
const std::vector< std::string > & GetExchangeSpecies(void) const
Definition PhreeqcRM.h:1103
IRM_RESULT SetSelectedOutputOn(bool tf)
const std::vector< std::string > & GetSpeciesNames(void)
Definition PhreeqcRM.h:2608
IRM_RESULT InitialPhreeqc2SpeciesConcentrations(std::vector< double > &destination_c, const std::vector< int > &boundary_solution1)
IRM_RESULT InitialPhreeqc2SpeciesConcentrations(std::vector< double > &destination_c, const std::vector< int > &boundary_solution1, const std::vector< int > &boundary_solution2, const std::vector< double > &fraction1)
int GetUnitsPPassemblage(void)
Definition PhreeqcRM.h:3134
IRM_RESULT SetUnitsPPassemblage(int option)
const std::vector< int > & GetEndCell(void)
Definition PhreeqcRM.h:931
int GetThreadCount()
Definition PhreeqcRM.h:2962
IRM_RESULT InitialPhreeqc2Module(const std::vector< int > &initial_conditions1, const std::vector< int > &initial_conditions2, const std::vector< double > &fraction1)
IRM_RESULT StateSave(int istate)
const std::vector< double > & GetPorosity(void)
IRM_RESULT SetTime(double time)
int GetComponentCount(void) const
Definition PhreeqcRM.h:734
IRM_RESULT RunString(bool workers, bool initial_phreeqc, bool utility, const std::string &input_string)
IRM_RESULT SetPartitionUZSolids(bool tf)
const std::vector< std::string > & GetSolidSolutionComponents(void) const
Definition PhreeqcRM.h:2283
std::string GetDatabaseFileName(void)
Definition PhreeqcRM.h:867
IRM_RESULT RunFile(bool workers, bool initial_phreeqc, bool utility, const std::string &chemistry_name)
PhreeqcRM(int nxyz, int thread_count_or_communicator, PHRQ_io *io=NULL, bool delay_construct=false)
IRM_RESULT GetGasPhaseVolume(std::vector< double > &gas_volume_output)
IRM_RESULT InitialPhreeqc2Concentrations(std::vector< double > &destination_c, const std::vector< int > &boundary_solution1, const std::vector< int > &boundary_solution2, const std::vector< double > &fraction1)
IRM_RESULT GetSpeciesConcentrations(std::vector< double > &species_conc_output)
const std::vector< std::string > & GetSurfaceNames(void) const
Definition PhreeqcRM.h:2804
static std::string Char2TrimString(const char *str, size_t l=0)
IRM_RESULT GetSpeciesLog10Gammas(std::vector< double > &species_log10gammas)
IRM_RESULT SetIthSpeciesConcentration(int i, std::vector< double > &c)
IRM_RESULT SetPrintChemistryMask(const std::vector< int > &cell_mask)
IRM_RESULT GetConcentrations(std::vector< double > &c_output)
IRM_RESULT SpeciesConcentrations2Module(const std::vector< double > &species_conc)
int GetSelectedOutputRowCount(void)
IRM_RESULT GetSelectedOutputHeading(int icol, std::string &heading)
void DecodeError(int result)
bool GetPartitionUZSolids(void) const
Definition PhreeqcRM.h:1694
IRM_RESULT GetGasCompPhi(std::vector< double > &gas_phi)
int GetMpiMyself(void) const
Definition PhreeqcRM.h:1590
const std::vector< std::string > & GetSolidSolutionNames(void) const
Definition PhreeqcRM.h:2354
const std::vector< std::string > & GetComponents(void) const
Definition PhreeqcRM.h:759
IRM_RESULT InitialSolutions2Module(const std::vector< int > &solutions)
double GetTime(void) const
Definition PhreeqcRM.h:2985
int GetEquilibriumPhasesCount(void) const
Definition PhreeqcRM.h:989
int GetMpiTasks(void) const
Definition PhreeqcRM.h:1616
IRM_RESULT SetGasPhaseVolume(const std::vector< double > &gas_volume)
IRM_RESULT StateApply(int istate)
int GetSpeciesCount(void)
Definition PhreeqcRM.h:2454
IRM_RESULT SetMpiWorkerCallbackCookie(void *cookie)
static void FileRename(const std::string &temp_name, const std::string &name, const std::string &backup_name)
const std::vector< double > & GetPressure(void)
int FindComponents()
int GetNthSelectedOutputUserNumber(int n)
const std::vector< int > & GetForwardMapping(void)
Definition PhreeqcRM.h:1176
int GetSelectedOutputColumnCount(void)
IRM_RESULT InitializeYAML(std::string yamlfile)
IRM_RESULT SetUnitsExchange(int option)
std::string GetErrorString(void)
int GetGridCellCount(void)
Definition PhreeqcRM.h:1421
IRM_RESULT GetSpeciesLog10Molalities(std::vector< double > &species_log10molalities)
IRM_RESULT ReturnHandler(IRM_RESULT result, const std::string &e_string)
IRM_RESULT InitialPhreeqc2Concentrations(std::vector< double > &destination_c, const std::vector< int > &boundary_solution1)
const std::vector< std::string > & GetSINames(void) const
Definition PhreeqcRM.h:2246
void ErrorMessage(const std::string &error_string, bool prepend=true)
const std::vector< int > & GetStartCell(void)
Definition PhreeqcRM.h:2766
int GetErrorHandlerMode(void)
Definition PhreeqcRM.h:1012
bool GetSelectedOutputOn(void)
Definition PhreeqcRM.h:2136
static int CreateReactionModule(int nxyz, int nthreads)
void OutputMessage(const std::string &str)
IRM_RESULT SetSpeciesSaveOn(bool save_on)
virtual ~PhreeqcRM(void)
IRM_RESULT OpenFiles(void)
IRM_RESULT SetRebalanceFraction(double f)
int GetKineticReactionsCount(void) const
Definition PhreeqcRM.h:1564
IRM_RESULT SetSaturation(const std::vector< double > &sat)
IRM_RESULT SetMpiWorkerCallbackC(int(*fcn)(int *method, void *cookie))
IRM_RESULT SetTemperature(const std::vector< double > &t)
IPhreeqc * GetIPhreeqcPointer(int i)
IRM_RESULT InitialPhreeqc2Module(const std::vector< int > &initial_conditions1)
IRM_RESULT SetPressure(const std::vector< double > &p)
const std::vector< std::vector< int > > & GetBackwardMapping(void)
Definition PhreeqcRM.h:688
IRM_RESULT SetUnitsSolution(int option)
IRM_RESULT InitialSurfaces2Module(const std::vector< int > &surfaces)
double GetTimeStep(void)
Definition PhreeqcRM.h:3034
int GetUnitsExchange(void)
Definition PhreeqcRM.h:3059
static void CleanupReactionModuleInstances(void)
IRM_RESULT SetIthConcentration(int i, std::vector< double > &c)
IRM_RESULT SetTimeStep(double time_step)
const std::vector< IPhreeqcPhast * > & GetWorkers()
Definition PhreeqcRM.h:3284
IRM_RESULT SetDensityUser(const std::vector< double > &density)
IRM_RESULT CreateMapping(const std::vector< int > &grid2chem)
std::string GetFilePrefix(void)
Definition PhreeqcRM.h:1155
const std::vector< double > & GetSpeciesZ(void)
Definition PhreeqcRM.h:2731
IRM_RESULT SetCurrentSelectedOutputUserNumber(int n_user)
int MpiAbort()
int GetSICount(void) const
Definition PhreeqcRM.h:2212
IRM_RESULT SetUnitsSurface(int option)
double GetTimeConversion(void)
Definition PhreeqcRM.h:3010
IRM_RESULT GetDensity(std::vector< double > &d_output)
double GetRebalanceFraction(void) const
Definition PhreeqcRM.h:1858
void WarningMessage(const std::string &warnstr)
const std::vector< double > & GetSolutionVolume(void)
virtual IRM_RESULT LoadDatabase(const std::string &database)
IRM_RESULT SetErrorHandlerMode(int mode)
int GetGasComponentsCount(void) const
Definition PhreeqcRM.h:1235
IRM_RESULT SetSaturationUser(const std::vector< double > &sat)
const std::vector< std::string > & GetSurfaceTypes(void) const
Definition PhreeqcRM.h:2915
IRM_RESULT InitialKinetics2Module(const std::vector< int > &kinetics)
IRM_RESULT MpiWorker()
IRM_RESULT SetGasCompMoles(const std::vector< double > &gas_moles)
IRM_RESULT GetSelectedOutput(std::vector< double > &s_output)
const std::vector< std::string > & GetEquilibriumPhases(void) const
Definition PhreeqcRM.h:961
IRM_RESULT GetGasCompMoles(std::vector< double > &gas_moles_output)
IRM_RESULT SetRebalanceByCell(bool tf)
IRM_RESULT InitialExchanges2Module(const std::vector< int > &exchanges)
IRM_RESULT SetComponentH2O(bool tf)
IRM_RESULT InitialPhreeqcCell2Module(int n, const std::vector< int > &cell_numbers)
IRM_RESULT SetTimeConversion(double conv_factor)
IRM_RESULT StateDelete(int istate)
IRM_RESULT SetRepresentativeVolume(const std::vector< double > &rv)
void UseSolutionDensityVolume(bool tf)
const std::vector< double > & GetViscosity()
const std::vector< bool > & GetPrintChemistryOn(void)
Definition PhreeqcRM.h:1809
const std::vector< std::string > & GetSurfaceSpecies(void) const
Definition PhreeqcRM.h:2841
static bool FileExists(const std::string &name)
IRM_RESULT GetGasCompPressures(std::vector< double > &gas_pressure)
IRM_RESULT SetConcentrations(const std::vector< double > &c)
IRM_RESULT GetIthConcentration(int i, std::vector< double > &c_output)
IRM_RESULT MpiWorkerBreak()
IRM_RESULT DumpModule(bool dump_on, bool append=false)
void ErrorHandler(int result, const std::string &e_string)
int GetUnitsSurface(void)
Definition PhreeqcRM.h:3239
int GetSurfaceSpeciesCount(void) const
Definition PhreeqcRM.h:2875
int GetUnitsSolution(void)
Definition PhreeqcRM.h:3189
IRM_RESULT SetDensity(const std::vector< double > &density)
int GetUnitsGasPhase(void)
Definition PhreeqcRM.h:3084
IRM_RESULT SetUnitsGasPhase(int option)
Definition PhreeqcRM.h:138
static std::map< size_t, T * > _Instances
Definition PhreeqcRM.h:254
static IRM_RESULT Destroy(int id)
Definition PhreeqcRM.h:184
static Derived * GetInstance(int id)
Definition PhreeqcRM.h:170
static size_t _InstancesIndex
Definition PhreeqcRM.h:255
size_t _Index
Definition PhreeqcRM.h:251
StaticIndexer(T *self)
Definition PhreeqcRM.h:140
int GetIndex()
Definition PhreeqcRM.h:245
~StaticIndexer()
Definition PhreeqcRM.h:147
static void DestroyAll()
Definition PhreeqcRM.h:212
static std::mutex _InstancesLock
Definition PhreeqcRM.h:253
static T * GetInstance(int id)
Definition PhreeqcRM.h:158