From 5f9cf78f0104ffe358647d605aa99eecddca4ddf Mon Sep 17 00:00:00 2001 From: David L Parkhurst Date: Thu, 29 Oct 2009 20:08:56 +0000 Subject: [PATCH] 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 --- Exchange.cxx | 7 ++++--- PPassemblage.cxx | 7 ++++--- SSassemblage.cxx | 7 ++++--- StorageBinList.cpp | 2 +- Surface.cxx | 14 ++++++++------ cxxKinetics.cxx | 7 ++++--- 6 files changed, 25 insertions(+), 19 deletions(-) diff --git a/Exchange.cxx b/Exchange.cxx index e16f6ecc..6c851571 100644 --- a/Exchange.cxx +++ b/Exchange.cxx @@ -491,10 +491,10 @@ cxxExchange::mpi_pack(std::vector < int >&ints, ints.push_back((int) this->pitzer_exchange_gammas); 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->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; ec.mpi_unpack(ints, &i, doubles, &d); - this->exchComps.push_back(ec); + std::string str(ec.get_formula()); + this->exchComps[str] = ec; } *ii = i; *dd = d; diff --git a/PPassemblage.cxx b/PPassemblage.cxx index 4417c2a0..b4b96f20 100644 --- a/PPassemblage.cxx +++ b/PPassemblage.cxx @@ -278,11 +278,11 @@ cxxPPassemblage::mpi_pack(std::vector < int >&ints, /* int n_user; */ ints.push_back(this->n_user); 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(); it++) { - it->mpi_pack(ints, doubles); + (*it).second.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; 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); *ii = i; diff --git a/SSassemblage.cxx b/SSassemblage.cxx index bd101b4e..101c7949 100644 --- a/SSassemblage.cxx +++ b/SSassemblage.cxx @@ -251,11 +251,11 @@ cxxSSassemblage::mpi_pack(std::vector < int >&ints, /* int n_user; */ ints.push_back(this->n_user); 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(); 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; ssc.mpi_unpack(ints, &i, doubles, &d); - this->ssAssemblageSSs.push_back(ssc); + std::string str(ssc.get_name()); + this->ssAssemblageSSs[str] = ssc; } *ii = i; *dd = d; diff --git a/StorageBinList.cpp b/StorageBinList.cpp index d65f8bf0..3ccc64dc 100644 --- a/StorageBinList.cpp +++ b/StorageBinList.cpp @@ -14,7 +14,7 @@ void StorageBinListItem::Augment(std::string token) if (token.size() == 0) return; // split string accounting for possible negative numbers - unsigned int pos; + size_t pos; if ((pos = token.find("--")) != std::string::npos) { token.replace(pos,2," &"); diff --git a/Surface.cxx b/Surface.cxx index e1ed2f24..1d79498b 100644 --- a/Surface.cxx +++ b/Surface.cxx @@ -746,16 +746,16 @@ cxxSurface::mpi_pack(std::vector < int >&ints, std::vector < double >&doubles) /* int n_user; */ ints.push_back(this->n_user); 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++) { - it->mpi_pack(ints, doubles); + (*it).second.mpi_pack(ints, doubles); } 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++) { - it->mpi_pack(ints, doubles); + (*it).second.mpi_pack(ints, doubles); } //ints.push_back((int) this->diffuse_layer); //ints.push_back((int) this->edl); @@ -790,7 +790,8 @@ cxxSurface::mpi_unpack(int *ints, int *ii, double *doubles, int *dd) { cxxSurfaceComp sc; 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++]; this->surfaceCharges.clear(); @@ -798,7 +799,8 @@ cxxSurface::mpi_unpack(int *ints, int *ii, double *doubles, int *dd) { cxxSurfaceCharge sc; 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->edl = (bool) ints[i++]; diff --git a/cxxKinetics.cxx b/cxxKinetics.cxx index e771e3eb..4b8299ce 100644 --- a/cxxKinetics.cxx +++ b/cxxKinetics.cxx @@ -525,10 +525,10 @@ cxxKinetics::mpi_pack(std::vector < int >&ints, { ints.push_back(this->n_user); 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++) { - it->mpi_pack(ints, doubles); + (*it).second.mpi_pack(ints, doubles); } ints.push_back((int) this->steps.size()); 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; 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++]; this->steps.clear();