mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-15 16:18:22 +01:00
81f180a0 Fixed bugs in inverse 6d575967 strcpy_safe and strcat_safe 6d98c4e1 trying different header files 72796f15 added <cstring> e8481607 warnings, strcat, strcpy 988bdee0 Try using goto(s) 9b10ce3f Try updated logical expression 812061be Turn off optimizing on k_temp git-subtree-dir: src git-subtree-split: 81f180a069285bcb4d180c860664b4b2a193854d
104 lines
2.4 KiB
C++
104 lines
2.4 KiB
C++
#include <algorithm> // std::replace
|
|
|
|
#include "Phreeqc.h"
|
|
#include "System.h"
|
|
#include "SSassemblage.h"
|
|
#include "Solution.h"
|
|
#include "Exchange.h"
|
|
#include "GasPhase.h"
|
|
#include "cxxKinetics.h"
|
|
#include "PPassemblage.h"
|
|
#include "SS.h"
|
|
#include "SSassemblage.h"
|
|
#include "Surface.h"
|
|
#include "cxxMix.h"
|
|
#include "Reaction.h"
|
|
#include "Temperature.h"
|
|
#include "Utils.h"
|
|
#if defined(PHREEQCI_GUI)
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
#endif
|
|
|
|
cxxSystem::cxxSystem(PHRQ_io *io)
|
|
:
|
|
PHRQ_base(io)
|
|
{
|
|
this->solution = NULL;
|
|
this->exchange = NULL;
|
|
this->ppassemblage = NULL;
|
|
this->gasphase = NULL;
|
|
this->ssassemblage = NULL;
|
|
this->kinetics = NULL;
|
|
this->surface = NULL;
|
|
this->mix = NULL;
|
|
this->reaction = NULL;
|
|
this->temperature = NULL;
|
|
this->pressure = NULL;
|
|
}
|
|
cxxSystem::~cxxSystem(void)
|
|
{
|
|
}
|
|
void
|
|
cxxSystem::Initialize(void)
|
|
{
|
|
this->solution = NULL;
|
|
this->exchange = NULL;
|
|
this->ppassemblage = NULL;
|
|
this->gasphase = NULL;
|
|
this->ssassemblage = NULL;
|
|
this->kinetics = NULL;
|
|
this->surface = NULL;
|
|
this->mix = NULL;
|
|
this->reaction = NULL;
|
|
this->temperature = NULL;
|
|
this->pressure = NULL;
|
|
}
|
|
void
|
|
cxxSystem::totalize(Phreeqc * phreeqc_ptr)
|
|
{
|
|
//initialize
|
|
this->totals.clear();
|
|
//add solution
|
|
if (this->solution != NULL)
|
|
{
|
|
char token[MAX_LENGTH];
|
|
Utilities::strcpy_safe(token, MAX_LENGTH, "O");
|
|
this->totals[token] = this->solution->Get_total_o();
|
|
Utilities::strcpy_safe(token, MAX_LENGTH, "H");
|
|
this->totals[token] = this->solution->Get_total_h();
|
|
Utilities::strcpy_safe(token, MAX_LENGTH, "Charge");
|
|
this->totals[token] = this->solution->Get_cb();
|
|
this->totals.add_extensive(this->solution->Get_totals(), 1.0);
|
|
}
|
|
if (this->exchange != NULL)
|
|
{
|
|
this->exchange->totalize();
|
|
this->totals.add_extensive(this->exchange->Get_totals(), 1.0);
|
|
}
|
|
if (this->ppassemblage != NULL)
|
|
{
|
|
this->ppassemblage->totalize(phreeqc_ptr);
|
|
this->totals.add_extensive(this->ppassemblage->Get_assemblage_totals(), 1.0);
|
|
}
|
|
if (this->gasphase != NULL)
|
|
{
|
|
this->gasphase->totalize(phreeqc_ptr);
|
|
this->totals.add_extensive(this->gasphase->Get_totals(), 1.0);
|
|
}
|
|
if (this->ssassemblage != NULL)
|
|
{
|
|
this->ssassemblage->totalize(phreeqc_ptr);
|
|
this->totals.add_extensive(this->ssassemblage->Get_totals(), 1.0);
|
|
}
|
|
if (this->surface != NULL)
|
|
{
|
|
this->surface->totalize();
|
|
this->totals.add_extensive(this->surface->Get_totals(), 1.0);
|
|
}
|
|
return;
|
|
}
|