Modified for parallel version. Had some lists

in the pack and unpack routines that now are 
maps.

git-svn-id: svn://136.177.114.72/svn_GW/phreeqcpp/trunk@3728 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
David L Parkhurst 2009-10-29 20:08:56 +00:00
parent cd38a8036d
commit 5f9cf78f01
6 changed files with 25 additions and 19 deletions

View File

@ -491,10 +491,10 @@ cxxExchange::mpi_pack(std::vector < int >&ints,
ints.push_back((int) this->pitzer_exchange_gammas); ints.push_back((int) this->pitzer_exchange_gammas);
ints.push_back((int) this->exchComps.size()); ints.push_back((int) this->exchComps.size());
for (std::list < cxxExchComp >::iterator it = this->exchComps.begin(); for (std::map < std::string, cxxExchComp >::iterator it = this->exchComps.begin();
it != this->exchComps.end(); it++) it != this->exchComps.end(); it++)
{ {
it->mpi_pack(ints, doubles); (*it).second.mpi_pack(ints, doubles);
} }
} }
@ -518,7 +518,8 @@ cxxExchange::mpi_unpack(int *ints, int *ii, double *doubles, int *dd)
{ {
cxxExchComp ec; cxxExchComp ec;
ec.mpi_unpack(ints, &i, doubles, &d); ec.mpi_unpack(ints, &i, doubles, &d);
this->exchComps.push_back(ec); std::string str(ec.get_formula());
this->exchComps[str] = ec;
} }
*ii = i; *ii = i;
*dd = d; *dd = d;

View File

@ -278,11 +278,11 @@ cxxPPassemblage::mpi_pack(std::vector < int >&ints,
/* int n_user; */ /* int n_user; */
ints.push_back(this->n_user); ints.push_back(this->n_user);
ints.push_back((int) this->ppAssemblageComps.size()); ints.push_back((int) this->ppAssemblageComps.size());
for (std::list < cxxPPassemblageComp >::iterator it = for (std::map < std::string, cxxPPassemblageComp >::iterator it =
this->ppAssemblageComps.begin(); it != this->ppAssemblageComps.end(); this->ppAssemblageComps.begin(); it != this->ppAssemblageComps.end();
it++) it++)
{ {
it->mpi_pack(ints, doubles); (*it).second.mpi_pack(ints, doubles);
} }
this->eltList.mpi_pack(ints, doubles); this->eltList.mpi_pack(ints, doubles);
} }
@ -305,7 +305,8 @@ cxxPPassemblage::mpi_unpack(int *ints, int *ii, double *doubles, int *dd)
{ {
cxxPPassemblageComp ppc; cxxPPassemblageComp ppc;
ppc.mpi_unpack(ints, &i, doubles, &d); ppc.mpi_unpack(ints, &i, doubles, &d);
this->ppAssemblageComps.push_back(ppc); std::string str(ppc.get_name());
this->ppAssemblageComps[str] = ppc;
} }
this->eltList.mpi_unpack(ints, &i, doubles, &d); this->eltList.mpi_unpack(ints, &i, doubles, &d);
*ii = i; *ii = i;

View File

@ -251,11 +251,11 @@ cxxSSassemblage::mpi_pack(std::vector < int >&ints,
/* int n_user; */ /* int n_user; */
ints.push_back(this->n_user); ints.push_back(this->n_user);
ints.push_back((int) this->ssAssemblageSSs.size()); ints.push_back((int) this->ssAssemblageSSs.size());
for (std::list < cxxSSassemblageSS >::iterator it = for (std::map < std::string, cxxSSassemblageSS >::iterator it =
this->ssAssemblageSSs.begin(); it != this->ssAssemblageSSs.end(); this->ssAssemblageSSs.begin(); it != this->ssAssemblageSSs.end();
it++) it++)
{ {
it->mpi_pack(ints, doubles); (*it).second.mpi_pack(ints, doubles);
} }
} }
@ -277,7 +277,8 @@ cxxSSassemblage::mpi_unpack(int *ints, int *ii, double *doubles, int *dd)
{ {
cxxSSassemblageSS ssc; cxxSSassemblageSS ssc;
ssc.mpi_unpack(ints, &i, doubles, &d); ssc.mpi_unpack(ints, &i, doubles, &d);
this->ssAssemblageSSs.push_back(ssc); std::string str(ssc.get_name());
this->ssAssemblageSSs[str] = ssc;
} }
*ii = i; *ii = i;
*dd = d; *dd = d;

View File

@ -14,7 +14,7 @@ void StorageBinListItem::Augment(std::string token)
if (token.size() == 0) return; if (token.size() == 0) return;
// split string accounting for possible negative numbers // split string accounting for possible negative numbers
unsigned int pos; size_t pos;
if ((pos = token.find("--")) != std::string::npos) if ((pos = token.find("--")) != std::string::npos)
{ {
token.replace(pos,2," &"); token.replace(pos,2," &");

View File

@ -746,16 +746,16 @@ cxxSurface::mpi_pack(std::vector < int >&ints, std::vector < double >&doubles)
/* int n_user; */ /* int n_user; */
ints.push_back(this->n_user); ints.push_back(this->n_user);
ints.push_back((int) this->surfaceComps.size()); ints.push_back((int) this->surfaceComps.size());
for (std::list < cxxSurfaceComp >::iterator it = for (std::map < std::string, cxxSurfaceComp >::iterator it =
this->surfaceComps.begin(); it != this->surfaceComps.end(); it++) this->surfaceComps.begin(); it != this->surfaceComps.end(); it++)
{ {
it->mpi_pack(ints, doubles); (*it).second.mpi_pack(ints, doubles);
} }
ints.push_back((int) this->surfaceCharges.size()); ints.push_back((int) this->surfaceCharges.size());
for (std::list < cxxSurfaceCharge >::iterator it = for (std::map < std::string, cxxSurfaceCharge >::iterator it =
this->surfaceCharges.begin(); it != this->surfaceCharges.end(); it++) this->surfaceCharges.begin(); it != this->surfaceCharges.end(); it++)
{ {
it->mpi_pack(ints, doubles); (*it).second.mpi_pack(ints, doubles);
} }
//ints.push_back((int) this->diffuse_layer); //ints.push_back((int) this->diffuse_layer);
//ints.push_back((int) this->edl); //ints.push_back((int) this->edl);
@ -790,7 +790,8 @@ cxxSurface::mpi_unpack(int *ints, int *ii, double *doubles, int *dd)
{ {
cxxSurfaceComp sc; cxxSurfaceComp sc;
sc.mpi_unpack(ints, &i, doubles, &d); sc.mpi_unpack(ints, &i, doubles, &d);
this->surfaceComps.push_back(sc); std::string str(sc.get_formula());
this->surfaceComps[str] = sc;
} }
count = ints[i++]; count = ints[i++];
this->surfaceCharges.clear(); this->surfaceCharges.clear();
@ -798,7 +799,8 @@ cxxSurface::mpi_unpack(int *ints, int *ii, double *doubles, int *dd)
{ {
cxxSurfaceCharge sc; cxxSurfaceCharge sc;
sc.mpi_unpack(ints, &i, doubles, &d); sc.mpi_unpack(ints, &i, doubles, &d);
this->surfaceCharges.push_back(sc); std::string str(sc.get_name());
this->surfaceCharges[str] = sc;
} }
//this->diffuse_layer = (bool) ints[i++]; //this->diffuse_layer = (bool) ints[i++];
//this->edl = (bool) ints[i++]; //this->edl = (bool) ints[i++];

View File

@ -525,10 +525,10 @@ cxxKinetics::mpi_pack(std::vector < int >&ints,
{ {
ints.push_back(this->n_user); ints.push_back(this->n_user);
ints.push_back((int) this->kineticsComps.size()); ints.push_back((int) this->kineticsComps.size());
for (std::list < cxxKineticsComp >::iterator it = for (std::map < std::string, cxxKineticsComp >::iterator it =
this->kineticsComps.begin(); it != this->kineticsComps.end(); it++) this->kineticsComps.begin(); it != this->kineticsComps.end(); it++)
{ {
it->mpi_pack(ints, doubles); (*it).second.mpi_pack(ints, doubles);
} }
ints.push_back((int) this->steps.size()); ints.push_back((int) this->steps.size());
for (std::vector < double >::iterator it = this->steps.begin(); for (std::vector < double >::iterator it = this->steps.begin();
@ -559,7 +559,8 @@ cxxKinetics::mpi_unpack(int *ints, int *ii, double *doubles, int *dd)
{ {
cxxKineticsComp kc; cxxKineticsComp kc;
kc.mpi_unpack(ints, &i, doubles, &d); kc.mpi_unpack(ints, &i, doubles, &d);
this->kineticsComps.push_back(kc); std::string str(kc.get_rate_name());
this->kineticsComps[str] = kc;
} }
n = ints[i++]; n = ints[i++];
this->steps.clear(); this->steps.clear();