mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-15 16:18:22 +01:00
moved list_components from class_main.cpp to Phreeqc.cpp
git-svn-id: svn://136.177.114.72/svn_GW/phreeqcpp/trunk@4173 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
parent
4eb0dbc99b
commit
ffb8ee86be
96
Phreeqc.cpp
96
Phreeqc.cpp
@ -6,6 +6,16 @@
|
||||
//};
|
||||
#include <algorithm> // std::replace
|
||||
|
||||
#include "NameDouble.h"
|
||||
#include "Solution.h"
|
||||
#include "Reaction.h"
|
||||
#include "PPassemblage.h"
|
||||
#include "Exchange.h"
|
||||
#include "Surface.h"
|
||||
#include "GasPhase.h"
|
||||
#include "SSassemblage.h"
|
||||
#include "cxxKinetics.h"
|
||||
|
||||
Phreeqc::Phreeqc(void)
|
||||
{
|
||||
phast = FALSE;
|
||||
@ -389,3 +399,89 @@ void Phreeqc::set_phast(int tf)
|
||||
{
|
||||
this->phast = tf;
|
||||
}
|
||||
size_t Phreeqc::list_components(std::list<std::string> &list_c)
|
||||
/*
|
||||
* Find all elements in any class definition
|
||||
*/
|
||||
{
|
||||
cxxNameDouble accumulator;
|
||||
accumulator.add("H", 1);
|
||||
accumulator.add("O", 1);
|
||||
|
||||
int i;
|
||||
|
||||
// solutions
|
||||
for (i = 0; i < count_solution; i++)
|
||||
{
|
||||
cxxSolution entity(solution[i]);
|
||||
accumulator.add_extensive(entity.get_totals(), 1.0);
|
||||
}
|
||||
|
||||
// irreversible reactions
|
||||
for (i = 0; i < count_irrev; i++)
|
||||
{
|
||||
reaction_calc(&irrev[i]);
|
||||
cxxReaction entity(&irrev[i]);
|
||||
accumulator.add_extensive(entity.get_elementList(), 1.0);
|
||||
}
|
||||
|
||||
// pure phases
|
||||
for (i = 0; i < count_pp_assemblage; i++)
|
||||
{
|
||||
cxxPPassemblage entity(&pp_assemblage[i]);
|
||||
entity.totalize(this);
|
||||
accumulator.add_extensive(entity.get_totals(), 1.0);
|
||||
}
|
||||
|
||||
// exchangers
|
||||
for (i = 0; i < count_exchange; i++)
|
||||
{
|
||||
cxxExchange entity(&exchange[i]);
|
||||
entity.totalize();
|
||||
accumulator.add_extensive(entity.get_totals(), 1.0);
|
||||
}
|
||||
|
||||
// surfaces
|
||||
for (i = 0; i < count_surface; i++)
|
||||
{
|
||||
cxxSurface entity(&surface[i]);
|
||||
entity.totalize();
|
||||
accumulator.add_extensive(entity.get_totals(), 1.0);
|
||||
}
|
||||
|
||||
// gas phases
|
||||
for (i = 0; i < count_gas_phase; i++)
|
||||
{
|
||||
cxxGasPhase entity(&gas_phase[i]);
|
||||
entity.totalize(this);
|
||||
accumulator.add_extensive(entity.get_totals(), 1.0);
|
||||
}
|
||||
|
||||
// solid-solutions
|
||||
for (i = 0; i < count_s_s_assemblage; i++)
|
||||
{
|
||||
cxxSSassemblage entity(&s_s_assemblage[i]);
|
||||
entity.totalize(this);
|
||||
accumulator.add_extensive(entity.get_totals(), 1.0);
|
||||
}
|
||||
|
||||
// kinetics
|
||||
for (i = 0; i < count_kinetics; i++)
|
||||
{
|
||||
calc_dummy_kinetic_reaction_tally(&kinetics[i]);
|
||||
cxxKinetics entity(&kinetics[i]);
|
||||
accumulator.add_extensive(entity.get_totals(), 1.0);
|
||||
}
|
||||
|
||||
// print list
|
||||
cxxNameDouble::iterator it;
|
||||
for (it = accumulator.begin(); it != accumulator.end(); it++)
|
||||
{
|
||||
struct master *master_ptr = master_bsearch(it->first.c_str());
|
||||
if (master_ptr == NULL) continue;
|
||||
if (master_ptr->type != AQ) continue;
|
||||
if (master_ptr->primary == 0) continue;
|
||||
list_c.push_back(it->first);
|
||||
}
|
||||
return(list_c.size());
|
||||
}
|
||||
@ -204,90 +204,3 @@ write_banner(void)
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
size_t CLASS_QUALIFIER
|
||||
list_components(std::list<std::string> &list_c)
|
||||
/*
|
||||
* Find all elements in any class definition
|
||||
*/
|
||||
{
|
||||
cxxNameDouble accumulator;
|
||||
accumulator.add("H", 1);
|
||||
accumulator.add("O", 1);
|
||||
|
||||
int i;
|
||||
|
||||
// solutions
|
||||
for (i = 0; i < count_solution; i++)
|
||||
{
|
||||
cxxSolution entity(solution[i]);
|
||||
accumulator.add_extensive(entity.get_totals(), 1.0);
|
||||
}
|
||||
|
||||
// irreversible reactions
|
||||
for (i = 0; i < count_irrev; i++)
|
||||
{
|
||||
reaction_calc(&irrev[i]);
|
||||
cxxReaction entity(&irrev[i]);
|
||||
accumulator.add_extensive(entity.get_elementList(), 1.0);
|
||||
}
|
||||
|
||||
// pure phases
|
||||
for (i = 0; i < count_pp_assemblage; i++)
|
||||
{
|
||||
cxxPPassemblage entity(&pp_assemblage[i]);
|
||||
entity.totalize(this);
|
||||
accumulator.add_extensive(entity.get_totals(), 1.0);
|
||||
}
|
||||
|
||||
// exchangers
|
||||
for (i = 0; i < count_exchange; i++)
|
||||
{
|
||||
cxxExchange entity(&exchange[i]);
|
||||
entity.totalize();
|
||||
accumulator.add_extensive(entity.get_totals(), 1.0);
|
||||
}
|
||||
|
||||
// surfaces
|
||||
for (i = 0; i < count_surface; i++)
|
||||
{
|
||||
cxxSurface entity(&surface[i]);
|
||||
entity.totalize();
|
||||
accumulator.add_extensive(entity.get_totals(), 1.0);
|
||||
}
|
||||
|
||||
// gas phases
|
||||
for (i = 0; i < count_gas_phase; i++)
|
||||
{
|
||||
cxxGasPhase entity(&gas_phase[i]);
|
||||
entity.totalize(this);
|
||||
accumulator.add_extensive(entity.get_totals(), 1.0);
|
||||
}
|
||||
|
||||
// solid-solutions
|
||||
for (i = 0; i < count_s_s_assemblage; i++)
|
||||
{
|
||||
cxxSSassemblage entity(&s_s_assemblage[i]);
|
||||
entity.totalize(this);
|
||||
accumulator.add_extensive(entity.get_totals(), 1.0);
|
||||
}
|
||||
|
||||
// kinetics
|
||||
for (i = 0; i < count_kinetics; i++)
|
||||
{
|
||||
calc_dummy_kinetic_reaction_tally(&kinetics[i]);
|
||||
cxxKinetics entity(&kinetics[i]);
|
||||
accumulator.add_extensive(entity.get_totals(), 1.0);
|
||||
}
|
||||
|
||||
// print list
|
||||
cxxNameDouble::iterator it;
|
||||
for (it = accumulator.begin(); it != accumulator.end(); it++)
|
||||
{
|
||||
struct master *master_ptr = master_bsearch(it->first.c_str());
|
||||
if (master_ptr == NULL) continue;
|
||||
if (master_ptr->type != AQ) continue;
|
||||
if (master_ptr->primary == 0) continue;
|
||||
list_c.push_back(it->first);
|
||||
}
|
||||
return(accumulator.size());
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user