mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-15 16:18:22 +01:00
Dump_raw for storage bin works, but have not tested.
git-svn-id: svn://136.177.114.72/svn_GW/phreeqcpp/trunk@800 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
parent
bc11981448
commit
e2b5a47014
12
Solution.cxx
12
Solution.cxx
@ -817,11 +817,11 @@ cxxSolution& cxxSolution::read(CParser& parser)
|
||||
#include <fstream>
|
||||
void test_classes(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
int i;
|
||||
std::map<int, cxxSolution> Solutions;
|
||||
cxxSolution soln(solution[0]);
|
||||
Solutions[solution[0]->n_user] = soln;
|
||||
@ -834,6 +834,7 @@ void test_classes(void)
|
||||
x[solution[0]->n_user] = soln;
|
||||
*/
|
||||
|
||||
#ifdef SKIP
|
||||
for (i=0; i < count_solution; i++) {
|
||||
if (solution[i]->new_def == TRUE) {
|
||||
cxxISolution sol(solution[i]);
|
||||
@ -1115,4 +1116,13 @@ void test_classes(void)
|
||||
free_check_null(temperature_ptr);
|
||||
|
||||
}
|
||||
#endif
|
||||
{
|
||||
cxxStorageBin cstorage;
|
||||
std::ostringstream oss;
|
||||
cstorage.dump_raw(oss, 0);
|
||||
std::cerr << oss.str();
|
||||
//char string[200];
|
||||
//strcpy_s(string, "abc");
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
|
||||
#include "Utils.h" // define first
|
||||
#include "StorageBin.h"
|
||||
#include "Solution.h"
|
||||
#define EXTERNAL extern
|
||||
#include "global.h"
|
||||
#include "phqalloc.h"
|
||||
@ -21,8 +22,60 @@
|
||||
cxxStorageBin::cxxStorageBin()
|
||||
//
|
||||
// default constructor for cxxStorageBin
|
||||
// pull data out of c storage
|
||||
//
|
||||
{
|
||||
int i;
|
||||
|
||||
// Solutions
|
||||
for (i = 0; i < count_solution; i++) {
|
||||
Solutions[solution[i]->n_user] = cxxSolution(solution[i]);
|
||||
}
|
||||
|
||||
// Exchangers
|
||||
for (i = 0; i < count_exchange; i++) {
|
||||
Exchangers[exchange[i].n_user] = cxxExchange(&exchange[i]);
|
||||
}
|
||||
|
||||
// GasPhases
|
||||
for (i = 0; i < count_gas_phase; i++) {
|
||||
GasPhases[gas_phase[i].n_user] = cxxGasPhase(&gas_phase[i]);
|
||||
}
|
||||
|
||||
// Kinetics
|
||||
for (i = 0; i < count_kinetics; i++) {
|
||||
Kinetics[kinetics[i].n_user] = cxxKinetics(&kinetics[i]);
|
||||
}
|
||||
|
||||
// PPassemblages
|
||||
for (i = 0; i < count_pp_assemblage; i++) {
|
||||
PPassemblages[pp_assemblage[i].n_user] = cxxPPassemblage(&pp_assemblage[i]);
|
||||
}
|
||||
|
||||
// SSassemblages
|
||||
for (i = 0; i < count_s_s_assemblage; i++) {
|
||||
SSassemblages[s_s_assemblage[i].n_user] = cxxSSassemblage(&s_s_assemblage[i]);
|
||||
}
|
||||
|
||||
// Surfaces
|
||||
for (i = 0; i < count_surface; i++) {
|
||||
Surfaces[surface[i].n_user] = cxxSurface(&surface[i]);
|
||||
}
|
||||
|
||||
// Mixes
|
||||
for (i = 0; i < count_mix; i++) {
|
||||
Mixes[mix[i].n_user] = cxxMix(&mix[i]);
|
||||
}
|
||||
|
||||
// Reactions
|
||||
for (i = 0; i < count_irrev; i++) {
|
||||
Reactions[irrev[i].n_user] = cxxReaction(&irrev[i]);
|
||||
}
|
||||
|
||||
// Temperatures
|
||||
for (i = 0; i < count_temperature; i++) {
|
||||
Temperatures[temperature[i].n_user] = cxxTemperature(&temperature[i]);
|
||||
}
|
||||
}
|
||||
|
||||
cxxStorageBin::~cxxStorageBin()
|
||||
@ -66,35 +119,58 @@ void cxxStorageBin::dump_raw(std::ostream& s_oss, unsigned int indent)const
|
||||
s_oss.precision(DBL_DIG - 1);
|
||||
|
||||
// Solutions
|
||||
|
||||
// for (std::map<int, cxxSolution>::const_iterator it = this->Solutions.begin(); it != this->Solutions.end(); ++it) {
|
||||
Utilities::dump_raw(Solutions, s_oss, indent);
|
||||
//for (std::map<int, cxxSolution>::const_iterator it = this->Solutions.begin(); it != this->Solutions.end(); ++it) {
|
||||
//it->second.dump_raw(s_oss, indent);
|
||||
//}
|
||||
|
||||
// Exchange
|
||||
Utilities::dump_raw(Exchangers, s_oss, indent);
|
||||
/*
|
||||
for (std::map<int, cxxExchange>::const_iterator it = this->Exchangers.begin(); it != this->Exchangers.end(); ++it) {
|
||||
it->second.dump_raw(s_oss, indent);
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
// Gas Phases
|
||||
Utilities::dump_raw(GasPhases, s_oss, indent);
|
||||
/*
|
||||
for (std::map<int, cxxGasPhase>::const_iterator it = this->GasPhases.begin(); it != this->GasPhases.end(); ++it) {
|
||||
it->second.dump_raw(s_oss, indent);
|
||||
}
|
||||
*/
|
||||
// Kinetics
|
||||
Utilities::dump_raw(Kinetics, s_oss, indent);
|
||||
/*
|
||||
for (std::map<int, cxxKinetics>::const_iterator it = this->Kinetics.begin(); it != this->Kinetics.end(); ++it) {
|
||||
it->second.dump_raw(s_oss, indent);
|
||||
}
|
||||
*/
|
||||
|
||||
// PPassemblage
|
||||
Utilities::dump_raw(PPassemblages, s_oss, indent);
|
||||
/*
|
||||
for (std::map<int, cxxPPassemblage>::const_iterator it = this->PPassemblages.begin(); it != this->PPassemblages.end(); ++it) {
|
||||
it->second.dump_raw(s_oss, indent);
|
||||
}
|
||||
*/
|
||||
|
||||
// SSassemblage
|
||||
Utilities::dump_raw(SSassemblages, s_oss, indent);
|
||||
/*
|
||||
for (std::map<int, cxxSSassemblage>::const_iterator it = this->SSassemblages.begin(); it != this->SSassemblages.end(); ++it) {
|
||||
it->second.dump_raw(s_oss, indent);
|
||||
}
|
||||
*/
|
||||
|
||||
// Surface
|
||||
Utilities::dump_raw(Surfaces, s_oss, indent);
|
||||
/*
|
||||
for (std::map<int, cxxSurface>::const_iterator it = this->Surfaces.begin(); it != this->Surfaces.end(); ++it) {
|
||||
it->second.dump_raw(s_oss, indent);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void cxxStorageBin::read_raw(CParser& parser)
|
||||
|
||||
20
Utils.h
20
Utils.h
@ -32,21 +32,25 @@ namespace Utilities {
|
||||
void error_msg(const std::string&, const int stopflag);
|
||||
|
||||
// operations on maps of entities (Solution, Exchange, ...)
|
||||
template<class T>
|
||||
bool exists (std::map<int, T> b, int i){
|
||||
return (b.find(i) != b.end());}
|
||||
|
||||
/*
|
||||
template<class T>
|
||||
void dump_raw ( std::map<int, T> b, std::ostream& s_oss, unsigned int indent )
|
||||
template<typename T>
|
||||
void dump_raw (const T &b, std::ostream& s_oss, unsigned int indent)
|
||||
{
|
||||
std :: map < int, T > :: iterator it;
|
||||
//std :: map < int, T > :: const_iterator it;
|
||||
typename T::const_iterator it;
|
||||
for (it = b.begin(); it != b.end(); ++it) {
|
||||
it->second.dump_raw(s_oss, indent);
|
||||
}
|
||||
return;
|
||||
}
|
||||
template<typename T>
|
||||
bool exists (const T &b, int i){
|
||||
return (b.find(i) != b.end());}
|
||||
/*
|
||||
template<class T>
|
||||
bool exists (std::map<int, T> b, int i){
|
||||
return (b.find(i) != b.end());}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
#endif // UTILITIES_H_INCLUDED
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user