// Get selected outputstd::vector<double> so;brm.GetValue("SelectedOutput", so);
Cell number 19 Calculated Density: 0.99832 Calculated Volume: 0.199758 Components: 0 H: 110.679 1 O: 55.3438 2 Charge: -3.37139e-16 3 Ca: 0 4 Cl: 0 5 K: 0.000196302 6 N: 0.0011964 7 Na: 0.0010001 Selected output: 0 Na(mol/kgw): 0.00100311 1 Cl(mol/kgw): 0 2 K(mol/kgw): 0.000196893 3 Ca(mol/kgw): 0 4 Temperature: 20 5 Pressure: 2 6 Hyd_K: 0
int selected_output_count;brm.GetValue("SelectedOutputCount", selected_output_count);for (int isel = 0; isel < selected_output_count; isel++){ std::ostringstream oss; // Loop through possible multiple selected output definitions brm.SetValue("NthSelectedOutput", isel); oss << "Selected output sequence number: " << isel << "\n"; int n_user; brm.GetValue("CurrentSelectedOutputUserNumber", n_user); if (n_user == 333) continue; // Skip internal SELECTED_OUTPUT oss << "Selected output user number: " << n_user << "\n"; // Get array of selected output values int col; brm.GetValue("SelectedOutputColumnCount", col); int bmi_row_count; brm.GetValue("SelectedOutputRowCount", bmi_row_count); // Get selected output std::vector<double> so; brm.GetValue("SelectedOutput", so); // Get headings std::vector<std::string> headings; brm.GetValue("SelectedOutputHeadings", headings); // Print results for (int i = 0; i < bmi_row_count / 2; i++) { oss << "Cell number " << i << "\n"; oss << " Calculated Density: " << density[i] << "\n"; oss << " Calculated Volume: " << volume[i] << "\n"; oss << " Components: " << "\n"; for (int j = 0; j < ncomps; j++) { oss << " " << j << " " << components[j] << ": " << c[j * nxyz + i] << "\n"; } oss << " Selected output: " << "\n"; for (int j = 0; j < col; j++) { oss << " " << j << " " << headings[j] << ": " << so[j * nxyz + i] << "\n"; } } brm.OutputMessage(oss.str()); ...}
if (print_chemistry_on != 0){ { std::ostringstream oss; oss << "Current distribution of cells for workers\n"; oss << "Worker First cell Last Cell\n"; int n; n = phreeqc_rm.GetThreadCount() * phreeqc_rm.GetMpiTasks(); for (int i = 0; i < n; i++) { oss << i << " " << phreeqc_rm.GetStartCell()[i] << " " << phreeqc_rm.GetEndCell()[i] << "\n"; } phreeqc_rm.OutputMessage(oss.str()); } for (int isel = 0; isel < phreeqc_rm.GetSelectedOutputCount(); isel++) { // Loop through possible multiple selected output definitions int n_user = phreeqc_rm.GetNthSelectedOutputUserNumber(isel); status = phreeqc_rm.SetCurrentSelectedOutputUserNumber(n_user); std::cerr << "Selected output sequence number: " << isel << "\n"; std::cerr << "Selected output user number: " << n_user << "\n"; // Get double array of selected output values std::vector<double> so; int col = phreeqc_rm.GetSelectedOutputColumnCount(); status = phreeqc_rm.GetSelectedOutput(so); // Print results //for (int i = 0; i < phreeqc_rm.GetSelectedOutputRowCount() / 2; i++) for (int i = 0; i < 1; i++) { std::cerr << "Cell number " << i << "\n"; std::cerr << " Calculated Density: " << density[i] << "\n"; std::cerr << " Volume: " << volume[i] << "\n"; std::cerr << " Components: " << "\n"; for (int j = 0; j < ncomps; j++) { std::cerr << " " << j << " " << components[j] << ": " << c[j * nxyz + i] << "\n"; } std::vector<std::string> headings; headings.resize(col); std::cerr << " Selected output: " << "\n"; for (int j = 0; j < col; j++) { status = phreeqc_rm.GetSelectedOutputHeading(j, headings[j]); std::cerr << " " << j << " " << headings[j] << ": " << so[j * nxyz + i] << "\n"; } } }}