mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-16 16:44:49 +01:00
Added base to kinetics, mix, and exchange.
Going in alphabetical order in src. git-svn-id: svn://136.177.114.72/svn_GW/phreeqcpp/branches/ErrorHandling@5629 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
parent
aba479648c
commit
f6ed50af7e
20
Exchange.cxx
20
Exchange.cxx
@ -25,21 +25,23 @@
|
||||
// Construction/Destruction
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
cxxExchange::cxxExchange()
|
||||
cxxExchange::cxxExchange(PHRQ_io *io)
|
||||
//
|
||||
// default constructor for cxxExchange
|
||||
//
|
||||
: cxxNumKeyword()
|
||||
: cxxNumKeyword(),
|
||||
PHRQ_base(io)
|
||||
{
|
||||
pitzer_exchange_gammas = true;
|
||||
}
|
||||
|
||||
cxxExchange::cxxExchange(struct exchange * exchange_ptr)
|
||||
cxxExchange::cxxExchange(struct exchange * exchange_ptr, PHRQ_io *io)
|
||||
//
|
||||
// constructor for cxxExchange from struct exchange
|
||||
//
|
||||
:
|
||||
cxxNumKeyword()
|
||||
cxxNumKeyword(),
|
||||
PHRQ_base(io)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -59,8 +61,9 @@ cxxNumKeyword()
|
||||
|
||||
}
|
||||
cxxExchange::cxxExchange(PHREEQC_PTR_ARG_COMMA const std::map < int, cxxExchange > &entities,
|
||||
cxxMix & mix, int l_n_user):
|
||||
cxxNumKeyword()
|
||||
cxxMix & mix, int l_n_user, PHRQ_io *io):
|
||||
cxxNumKeyword(),
|
||||
PHRQ_base(io)
|
||||
{
|
||||
this->n_user = this->n_user_end = l_n_user;
|
||||
this->pitzer_exchange_gammas = true;
|
||||
@ -92,7 +95,7 @@ cxxNumKeyword()
|
||||
}
|
||||
}
|
||||
|
||||
cxxExchange::cxxExchange(PHREEQC_PTR_ARG_COMMA int l_n_user)
|
||||
cxxExchange::cxxExchange(PHREEQC_PTR_ARG_COMMA int l_n_user, PHRQ_io *io)
|
||||
//
|
||||
// constructor for cxxExchange from reaction calculation
|
||||
// equivalent of xexchange_save
|
||||
@ -100,7 +103,8 @@ cxxExchange::cxxExchange(PHREEQC_PTR_ARG_COMMA int l_n_user)
|
||||
// bool pitzer_exchange_gammas;
|
||||
// cxxNameDouble totals;
|
||||
:
|
||||
cxxNumKeyword()
|
||||
cxxNumKeyword(),
|
||||
PHRQ_base(io)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
11
Exchange.h
11
Exchange.h
@ -8,17 +8,18 @@
|
||||
#include "NumKeyword.h"
|
||||
#include "ExchComp.h"
|
||||
#include "NameDouble.h"
|
||||
#include "PHRQ_base.h"
|
||||
class cxxMix;
|
||||
|
||||
class cxxExchange:public cxxNumKeyword
|
||||
class cxxExchange:public cxxNumKeyword, PHRQ_base
|
||||
{
|
||||
|
||||
public:
|
||||
cxxExchange();
|
||||
cxxExchange(PHREEQC_PTR_ARG_COMMA int n_user);
|
||||
cxxExchange(struct exchange *);
|
||||
cxxExchange(PHRQ_io *io=NULL);
|
||||
cxxExchange(PHREEQC_PTR_ARG_COMMA int n_user, PHRQ_io *io);
|
||||
cxxExchange(struct exchange *, PHRQ_io *io);
|
||||
cxxExchange(PHREEQC_PTR_ARG_COMMA const std::map < int, cxxExchange > &exchange_map,
|
||||
cxxMix & mx, int n_user);
|
||||
cxxMix & mx, int n_user, PHRQ_io *io);
|
||||
~cxxExchange();
|
||||
|
||||
struct exchange *cxxExchange2exchange(PHREEQC_PTR_ARG);
|
||||
|
||||
@ -478,7 +478,7 @@ size_t Phreeqc::list_components(std::list<std::string> &list_c)
|
||||
// exchangers
|
||||
for (i = 0; i < count_exchange; i++)
|
||||
{
|
||||
cxxExchange entity(&exchange[i]);
|
||||
cxxExchange entity(&exchange[i], &this->phrq_io);
|
||||
entity.totalize();
|
||||
accumulator.add_extensive(entity.get_totals(), 1.0);
|
||||
}
|
||||
@ -511,7 +511,7 @@ size_t Phreeqc::list_components(std::list<std::string> &list_c)
|
||||
for (i = 0; i < count_kinetics; i++)
|
||||
{
|
||||
calc_dummy_kinetic_reaction_tally(&kinetics[i]);
|
||||
cxxKinetics entity(&kinetics[i]);
|
||||
cxxKinetics entity(&kinetics[i], &this->phrq_io);
|
||||
accumulator.add_extensive(entity.get_totals(), 1.0);
|
||||
}
|
||||
|
||||
|
||||
@ -202,7 +202,7 @@ read_exchange_raw(void)
|
||||
std::istream::pos_type next_char;
|
||||
parser.get_option(vopts, next_char);
|
||||
|
||||
cxxExchange ex;
|
||||
cxxExchange ex(&this->phrq_io);
|
||||
ex.read_raw(PHREEQC_THIS_COMMA parser);
|
||||
struct exchange *exchange_ptr = ex.cxxExchange2exchange(PHREEQC_THIS);
|
||||
int n;
|
||||
@ -487,7 +487,7 @@ read_kinetics_raw(void)
|
||||
std::istream::pos_type next_char;
|
||||
parser.get_option(vopts, next_char);
|
||||
|
||||
cxxKinetics ex;
|
||||
cxxKinetics ex(&this->phrq_io);
|
||||
ex.read_raw(PHREEQC_THIS_COMMA parser);
|
||||
struct kinetics *kinetics_ptr = ex.cxxKinetics2kinetics(PHREEQC_THIS);
|
||||
int n;
|
||||
@ -868,7 +868,7 @@ read_mix_raw(void)
|
||||
std::istream::pos_type next_char;
|
||||
parser.get_option(vopts, next_char);
|
||||
|
||||
cxxMix ex;
|
||||
cxxMix ex(&this->phrq_io);
|
||||
ex.read_raw(parser);
|
||||
struct mix *mix_ptr = ex.cxxMix2mix(PHREEQC_THIS);
|
||||
int n;
|
||||
@ -1510,7 +1510,7 @@ read_exchange_modify(void)
|
||||
}
|
||||
|
||||
// read entity
|
||||
cxxExchange entity(&(exchange[n]));
|
||||
cxxExchange entity(&(exchange[n]), &this->phrq_io);
|
||||
entity.read_raw(PHREEQC_THIS_COMMA parser, false);
|
||||
|
||||
// save entity
|
||||
@ -1883,7 +1883,7 @@ read_kinetics_modify(void)
|
||||
}
|
||||
|
||||
// read entity
|
||||
cxxKinetics entity(&(kinetics[n]));
|
||||
cxxKinetics entity(&(kinetics[n]), &this->phrq_io);
|
||||
entity.read_raw(PHREEQC_THIS_COMMA parser, false);
|
||||
|
||||
// save entity
|
||||
@ -2731,7 +2731,7 @@ dump_ostream(std::ostream& os)
|
||||
{
|
||||
for (i = 0; i < count_exchange; i++)
|
||||
{
|
||||
cxxExchange cxxentity(&exchange[i]);
|
||||
cxxExchange cxxentity(&exchange[i], &this->phrq_io);
|
||||
cxxentity.dump_raw(os,0);
|
||||
}
|
||||
}
|
||||
@ -2743,7 +2743,7 @@ dump_ostream(std::ostream& os)
|
||||
|
||||
if (exchange_bsearch(*it, &n) != NULL)
|
||||
{
|
||||
cxxExchange cxxentity(&exchange[n]);
|
||||
cxxExchange cxxentity(&exchange[n], &this->phrq_io);
|
||||
cxxentity.dump_raw(os,0);
|
||||
}
|
||||
}
|
||||
@ -2835,7 +2835,7 @@ dump_ostream(std::ostream& os)
|
||||
{
|
||||
for (i = 0; i < count_kinetics; i++)
|
||||
{
|
||||
cxxKinetics cxxentity(&kinetics[i]);
|
||||
cxxKinetics cxxentity(&kinetics[i], &this->phrq_io);
|
||||
cxxentity.dump_raw(os,0);
|
||||
}
|
||||
}
|
||||
@ -2847,7 +2847,7 @@ dump_ostream(std::ostream& os)
|
||||
|
||||
if (kinetics_bsearch(*it, &n) != NULL)
|
||||
{
|
||||
cxxKinetics cxxentity(&kinetics[n]);
|
||||
cxxKinetics cxxentity(&kinetics[n], &this->phrq_io);
|
||||
cxxentity.dump_raw(os,0);
|
||||
}
|
||||
}
|
||||
@ -2861,7 +2861,7 @@ dump_ostream(std::ostream& os)
|
||||
{
|
||||
for (i = 0; i < count_mix; i++)
|
||||
{
|
||||
cxxMix cxxentity(&mix[i]);
|
||||
cxxMix cxxentity(&mix[i], &this->phrq_io);
|
||||
cxxentity.dump_raw(os,0);
|
||||
}
|
||||
}
|
||||
@ -2873,7 +2873,7 @@ dump_ostream(std::ostream& os)
|
||||
|
||||
if (mix_bsearch(*it, &n) != NULL)
|
||||
{
|
||||
cxxMix cxxentity(&mix[n]);
|
||||
cxxMix cxxentity(&mix[n], &this->phrq_io);
|
||||
cxxentity.dump_raw(os,0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -128,7 +128,7 @@ PHRQ_base(io)
|
||||
struct mix *struct_entity = P_INSTANCE_POINTER mix_bsearch(use_ptr->n_mix_user, &n);
|
||||
if (struct_entity != NULL)
|
||||
{
|
||||
cxxMix entity(struct_entity);
|
||||
cxxMix entity(struct_entity, this->Get_io());
|
||||
this->setMix(use_ptr->n_mix_user, &entity);
|
||||
|
||||
std::map<int, double> c = *(this->getMix(use_ptr->n_mix_user)->comps());
|
||||
@ -167,7 +167,7 @@ PHRQ_base(io)
|
||||
struct exchange *struct_entity = P_INSTANCE_POINTER exchange_bsearch(use_ptr->n_exchange_user, &n);
|
||||
if (struct_entity != NULL)
|
||||
{
|
||||
cxxExchange entity(struct_entity);
|
||||
cxxExchange entity(struct_entity, this->Get_io());
|
||||
this->setExchange(use_ptr->n_exchange_user, &entity);
|
||||
}
|
||||
}
|
||||
@ -203,7 +203,7 @@ PHRQ_base(io)
|
||||
struct kinetics *struct_entity = P_INSTANCE_POINTER kinetics_bsearch(use_ptr->n_kinetics_user, &n);
|
||||
if (struct_entity != NULL)
|
||||
{
|
||||
cxxKinetics entity(struct_entity);
|
||||
cxxKinetics entity(struct_entity, this->Get_io());
|
||||
this->setKinetics(use_ptr->n_kinetics_user, &entity);
|
||||
}
|
||||
}
|
||||
@ -517,7 +517,7 @@ cxxStorageBin::import_phreeqc(PHREEQC_PTR_ARG)
|
||||
// Exchangers
|
||||
for (i = 0; i < P_INSTANCE_POINTER count_exchange; i++)
|
||||
{
|
||||
Exchangers[P_INSTANCE_POINTER exchange[i].n_user] = cxxExchange(&P_INSTANCE_POINTER exchange[i]);
|
||||
Exchangers[P_INSTANCE_POINTER exchange[i].n_user] = cxxExchange(&P_INSTANCE_POINTER exchange[i], this->Get_io());
|
||||
}
|
||||
|
||||
// GasPhases
|
||||
@ -529,7 +529,7 @@ cxxStorageBin::import_phreeqc(PHREEQC_PTR_ARG)
|
||||
// Kinetics
|
||||
for (i = 0; i < P_INSTANCE_POINTER count_kinetics; i++)
|
||||
{
|
||||
Kinetics[P_INSTANCE_POINTER kinetics[i].n_user] = cxxKinetics(&P_INSTANCE_POINTER kinetics[i]);
|
||||
Kinetics[P_INSTANCE_POINTER kinetics[i].n_user] = cxxKinetics(&P_INSTANCE_POINTER kinetics[i], this->Get_io());
|
||||
}
|
||||
|
||||
// PPassemblages
|
||||
@ -555,7 +555,7 @@ cxxStorageBin::import_phreeqc(PHREEQC_PTR_ARG)
|
||||
// Mixes
|
||||
for (i = 0; i < P_INSTANCE_POINTER count_mix; i++)
|
||||
{
|
||||
Mixes[P_INSTANCE_POINTER mix[i].n_user] = cxxMix(&P_INSTANCE_POINTER mix[i]);
|
||||
Mixes[P_INSTANCE_POINTER mix[i].n_user] = cxxMix(&P_INSTANCE_POINTER mix[i], this->Get_io());
|
||||
}
|
||||
|
||||
// Reactions
|
||||
@ -740,7 +740,7 @@ cxxStorageBin::read_raw(PHREEQC_PTR_ARG_COMMA CParser & parser)
|
||||
|
||||
case CParser::KT_EXCHANGE_RAW:
|
||||
{
|
||||
cxxExchange entity;
|
||||
cxxExchange entity(this->Get_io());
|
||||
entity.read_raw(P_INSTANCE_COMMA parser);
|
||||
Exchangers[entity.get_n_user()] = entity;
|
||||
}
|
||||
@ -756,7 +756,7 @@ cxxStorageBin::read_raw(PHREEQC_PTR_ARG_COMMA CParser & parser)
|
||||
|
||||
case CParser::KT_KINETICS_RAW:
|
||||
{
|
||||
cxxKinetics entity;
|
||||
cxxKinetics entity(this->Get_io());
|
||||
entity.read_raw(P_INSTANCE_COMMA parser);
|
||||
Kinetics[entity.get_n_user()] = entity;
|
||||
}
|
||||
@ -852,7 +852,7 @@ cxxStorageBin::read_raw_keyword(PHREEQC_PTR_ARG_COMMA CParser & parser)
|
||||
|
||||
case CParser::KT_EXCHANGE_RAW:
|
||||
{
|
||||
cxxExchange entity;
|
||||
cxxExchange entity(this->Get_io());
|
||||
entity.read_raw(P_INSTANCE_COMMA parser);
|
||||
Exchangers[entity.get_n_user()] = entity;
|
||||
entity_number = entity.get_n_user();
|
||||
@ -870,7 +870,7 @@ cxxStorageBin::read_raw_keyword(PHREEQC_PTR_ARG_COMMA CParser & parser)
|
||||
|
||||
case CParser::KT_KINETICS_RAW:
|
||||
{
|
||||
cxxKinetics entity;
|
||||
cxxKinetics entity(this->Get_io());
|
||||
entity.read_raw(P_INSTANCE_COMMA parser);
|
||||
Kinetics[entity.get_n_user()] = entity;
|
||||
entity_number = entity.get_n_user();
|
||||
@ -946,7 +946,7 @@ cxxStorageBin::add(struct system *system_ptr)
|
||||
if (system_ptr->exchange != NULL)
|
||||
{
|
||||
this->Exchangers[system_ptr->exchange->n_user] =
|
||||
cxxExchange(system_ptr->exchange);
|
||||
cxxExchange(system_ptr->exchange, this->Get_io());
|
||||
}
|
||||
|
||||
// GasPhases
|
||||
@ -960,7 +960,7 @@ cxxStorageBin::add(struct system *system_ptr)
|
||||
if (system_ptr->kinetics != NULL)
|
||||
{
|
||||
this->Kinetics[system_ptr->kinetics->n_user] =
|
||||
cxxKinetics(system_ptr->kinetics);
|
||||
cxxKinetics(system_ptr->kinetics, this->Get_io());
|
||||
}
|
||||
|
||||
// PPassemblages
|
||||
@ -1118,7 +1118,7 @@ cxxStorageBin::phreeqc2cxxStorageBin(PHREEQC_PTR_ARG_COMMA int n)
|
||||
{
|
||||
if (P_INSTANCE_POINTER exchange_bsearch(n, &pos) != NULL)
|
||||
{
|
||||
this->Exchangers[n] = cxxExchange(&(P_INSTANCE_POINTER exchange[pos]));
|
||||
this->Exchangers[n] = cxxExchange(&(P_INSTANCE_POINTER exchange[pos]), this->Get_io());
|
||||
}
|
||||
}
|
||||
|
||||
@ -1134,7 +1134,7 @@ cxxStorageBin::phreeqc2cxxStorageBin(PHREEQC_PTR_ARG_COMMA int n)
|
||||
{
|
||||
if (P_INSTANCE_POINTER kinetics_bsearch(n, &pos) != NULL)
|
||||
{
|
||||
this->Kinetics[n] = cxxKinetics(&(P_INSTANCE_POINTER kinetics[pos]));
|
||||
this->Kinetics[n] = cxxKinetics(&(P_INSTANCE_POINTER kinetics[pos]), this->Get_io());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -20,17 +20,19 @@
|
||||
|
||||
#include "phqalloc.h"
|
||||
#include "phrqproto.h"
|
||||
#include "PHRQ_io.h"
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Construction/Destruction
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
cxxKinetics::cxxKinetics()
|
||||
cxxKinetics::cxxKinetics(PHRQ_io *io)
|
||||
//
|
||||
// default constructor for cxxKinetics
|
||||
//
|
||||
: cxxNumKeyword()
|
||||
: cxxNumKeyword(),
|
||||
PHRQ_base(io)
|
||||
{
|
||||
step_divide = 1.0;
|
||||
rk = 3;
|
||||
@ -42,12 +44,13 @@ cxxKinetics::cxxKinetics()
|
||||
equal_steps = 0;
|
||||
}
|
||||
|
||||
cxxKinetics::cxxKinetics(struct kinetics *kinetics_ptr)
|
||||
cxxKinetics::cxxKinetics(struct kinetics *kinetics_ptr, PHRQ_io *io)
|
||||
//
|
||||
// constructor for cxxKinetics from struct kinetics
|
||||
//
|
||||
:
|
||||
cxxNumKeyword(),
|
||||
PHRQ_base(io),
|
||||
totals(kinetics_ptr->totals)
|
||||
{
|
||||
int i;
|
||||
@ -85,8 +88,9 @@ totals(kinetics_ptr->totals)
|
||||
}
|
||||
}
|
||||
cxxKinetics::cxxKinetics(const std::map < int, cxxKinetics > &entities,
|
||||
cxxMix & mix, int l_n_user):
|
||||
cxxNumKeyword()
|
||||
cxxMix & mix, int l_n_user, PHRQ_io *io):
|
||||
cxxNumKeyword(),
|
||||
PHRQ_base(io)
|
||||
{
|
||||
this->n_user = this->n_user_end = l_n_user;
|
||||
step_divide = 1.0;
|
||||
|
||||
@ -9,16 +9,17 @@
|
||||
|
||||
#include "NumKeyword.h"
|
||||
#include "KineticsComp.h"
|
||||
#include "PHRQ_base.h"
|
||||
class cxxMix;
|
||||
|
||||
class cxxKinetics:public cxxNumKeyword
|
||||
class cxxKinetics:public cxxNumKeyword, PHRQ_base
|
||||
{
|
||||
|
||||
public:
|
||||
cxxKinetics();
|
||||
cxxKinetics(struct kinetics *);
|
||||
cxxKinetics(PHRQ_io *io = NULL);
|
||||
cxxKinetics(struct kinetics *, PHRQ_io *io);
|
||||
cxxKinetics(const std::map < int, cxxKinetics > &entity_map, cxxMix & mx,
|
||||
int n_user);
|
||||
int n_user, PHRQ_io *io);
|
||||
~cxxKinetics();
|
||||
|
||||
struct kinetics *cxxKinetics2kinetics(PHREEQC_PTR_ARG);
|
||||
|
||||
10
cxxMix.cxx
10
cxxMix.cxx
@ -24,20 +24,22 @@
|
||||
// Construction/Destruction
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
cxxMix::cxxMix()
|
||||
cxxMix::cxxMix(PHRQ_io *io)
|
||||
//
|
||||
// default constructor for cxxMix
|
||||
//
|
||||
: cxxNumKeyword()
|
||||
: cxxNumKeyword(),
|
||||
PHRQ_base(io)
|
||||
{
|
||||
}
|
||||
|
||||
cxxMix::cxxMix(struct mix *mix_ptr)
|
||||
cxxMix::cxxMix(struct mix *mix_ptr, PHRQ_io *io)
|
||||
//
|
||||
// constructor for cxxMix from struct mix
|
||||
//
|
||||
:
|
||||
cxxNumKeyword()
|
||||
cxxNumKeyword(),
|
||||
PHRQ_base(io)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
7
cxxMix.h
7
cxxMix.h
@ -8,13 +8,14 @@
|
||||
#include <vector> // std::vector
|
||||
#include "Phreeqc_class.h"
|
||||
#include "NumKeyword.h"
|
||||
#include "PHRQ_base.h"
|
||||
|
||||
class cxxMix:public cxxNumKeyword
|
||||
class cxxMix:public cxxNumKeyword, PHRQ_base
|
||||
{
|
||||
|
||||
public:
|
||||
cxxMix();
|
||||
cxxMix(struct mix *);
|
||||
cxxMix(PHRQ_io *io=NULL);
|
||||
cxxMix(struct mix *, PHRQ_io *io);
|
||||
~cxxMix();
|
||||
|
||||
struct mix *cxxMix2mix(PHREEQC_PTR_ARG);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user