mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-15 16:18:22 +01:00
Updates
git-svn-id: svn://136.177.114.72/svn_GW/phreeqcpp/trunk@837 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
parent
e2b5a47014
commit
957551d0a7
27
Solution.cxx
27
Solution.cxx
@ -14,6 +14,7 @@
|
|||||||
#include <cassert> // assert
|
#include <cassert> // assert
|
||||||
#include <algorithm> // std::sort
|
#include <algorithm> // std::sort
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
// Construction/Destruction
|
// Construction/Destruction
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
@ -1118,11 +1119,29 @@ void test_classes(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
// get all c storage
|
||||||
|
cxxStorageBin cstorage(cxxStorageBin::SB_GLOBAL);
|
||||||
|
//std::ostringstream oss;
|
||||||
|
//cstorage.dump_raw(oss, 0);
|
||||||
|
//write it out
|
||||||
|
std::fstream myfile;
|
||||||
|
myfile.open("tfile", std::ios_base::out);
|
||||||
|
cstorage.dump_raw(myfile, 0);
|
||||||
|
myfile.close();
|
||||||
|
}
|
||||||
|
{
|
||||||
|
// empty storage bin
|
||||||
cxxStorageBin cstorage;
|
cxxStorageBin cstorage;
|
||||||
|
// fstream
|
||||||
|
std::fstream myfile;
|
||||||
|
myfile.open("tfile", std::ios_base::in);
|
||||||
|
// ostream
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
cstorage.dump_raw(oss, 0);
|
// parser
|
||||||
std::cerr << oss.str();
|
CParser cparser(myfile, oss, std::cerr);
|
||||||
//char string[200];
|
cstorage.read_raw(cparser);
|
||||||
//strcpy_s(string, "abc");
|
//std::cerr << oss.str();
|
||||||
|
|
||||||
|
// read it back
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,8 +18,11 @@
|
|||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
// Construction/Destruction
|
// Construction/Destruction
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
cxxStorageBin::cxxStorageBin()
|
cxxStorageBin::cxxStorageBin()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
cxxStorageBin::cxxStorageBin(cxxStorageBin::SB_CONSTRUCTOR flag)
|
||||||
//
|
//
|
||||||
// default constructor for cxxStorageBin
|
// default constructor for cxxStorageBin
|
||||||
// pull data out of c storage
|
// pull data out of c storage
|
||||||
@ -120,63 +123,30 @@ void cxxStorageBin::dump_raw(std::ostream& s_oss, unsigned int indent)const
|
|||||||
|
|
||||||
// Solutions
|
// Solutions
|
||||||
Utilities::dump_raw(Solutions, s_oss, indent);
|
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
|
// Exchange
|
||||||
Utilities::dump_raw(Exchangers, s_oss, indent);
|
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
|
// Gas Phases
|
||||||
Utilities::dump_raw(GasPhases, s_oss, indent);
|
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
|
// Kinetics
|
||||||
Utilities::dump_raw(Kinetics, s_oss, indent);
|
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
|
// PPassemblage
|
||||||
Utilities::dump_raw(PPassemblages, s_oss, indent);
|
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
|
// SSassemblage
|
||||||
Utilities::dump_raw(SSassemblages, s_oss, indent);
|
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
|
// Surface
|
||||||
Utilities::dump_raw(Surfaces, s_oss, indent);
|
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)
|
void cxxStorageBin::read_raw(CParser& parser)
|
||||||
{
|
{
|
||||||
CParser::LINE_TYPE i;
|
CParser::LINE_TYPE i;
|
||||||
while ((i = parser.check_line("Subroutine Read", false, true, true, true)) != CParser::LT_KEYWORD)
|
while ((i = parser.check_line("StorageBin read_raw", false, true, true, true)) != CParser::LT_KEYWORD)
|
||||||
{
|
{
|
||||||
if (i == CParser::LT_EOF) return; // CParser::LT_EOF;
|
if (i == CParser::LT_EOF) return; // CParser::LT_EOF;
|
||||||
}
|
}
|
||||||
@ -189,15 +159,15 @@ void cxxStorageBin::read_raw(CParser& parser)
|
|||||||
case CParser::KT_NONE:
|
case CParser::KT_NONE:
|
||||||
goto END_OF_SIMULATION_INPUT;
|
goto END_OF_SIMULATION_INPUT;
|
||||||
break;
|
break;
|
||||||
/*
|
/*
|
||||||
KT_SOLUTION_RAW = 5,
|
KT_SOLUTION_RAW = 5,
|
||||||
KT_EXCHANGE_RAW = 6,
|
KT_EXCHANGE_RAW = 6,
|
||||||
KT_GASPHASE_RAW = 7,
|
KT_GASPHASE_RAW = 7,
|
||||||
KT_KINETICS_RAW = 8,
|
KT_KINETICS_RAW = 8,
|
||||||
KT_PPASSEMBLAGE_RAW = 9,
|
KT_PPASSEMBLAGE_RAW = 9,
|
||||||
KT_SSASSEMBLAGE_RAW = 10,
|
KT_SSASSEMBLAGE_RAW = 10,
|
||||||
KT_SURFACE_RAW = 11
|
KT_SURFACE_RAW = 11
|
||||||
*/
|
*/
|
||||||
case CParser::KT_SOLUTION_RAW:
|
case CParser::KT_SOLUTION_RAW:
|
||||||
{
|
{
|
||||||
cxxSolution entity;
|
cxxSolution entity;
|
||||||
|
|||||||
@ -20,15 +20,16 @@
|
|||||||
#include <list> // std::list
|
#include <list> // std::list
|
||||||
#include <vector> // std::vector
|
#include <vector> // std::vector
|
||||||
|
|
||||||
template<class T>
|
|
||||||
bool exists (std::map<int, T> b, int i){
|
|
||||||
return (b.find(i) != b.end());}
|
|
||||||
|
|
||||||
class cxxStorageBin
|
class cxxStorageBin
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
enum SB_CONSTRUCTOR {
|
||||||
|
SB_GLOBAL = 1
|
||||||
|
};
|
||||||
|
|
||||||
cxxStorageBin();
|
cxxStorageBin();
|
||||||
|
cxxStorageBin(SB_CONSTRUCTOR flag);
|
||||||
~cxxStorageBin();
|
~cxxStorageBin();
|
||||||
|
|
||||||
//void dump_xml(std::ostream& os, unsigned int indent = 0)const;
|
//void dump_xml(std::ostream& os, unsigned int indent = 0)const;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user