PHREEQC should now have no USE_MPI

Also no MERGE_FILES in PHREEQC

Not sure about deallocates in worker_closef

git-svn-id: svn://136.177.114.72/svn_GW/phreeqc3/trunk@7045 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
David L Parkhurst 2012-10-29 23:16:27 +00:00
parent 63a1879a3d
commit 9d4bb2e173
37 changed files with 14 additions and 1379 deletions

View File

@ -406,44 +406,6 @@ cxxExchComp::multiply(LDBLE extensive)
this->phase_proportion *= extensive;
}
#ifdef USE_MPI_SKIP
void
cxxExchComp::mpi_pack(std::vector < int >&ints,
std::vector < LDBLE >&doubles)
{
extern cxxDictionary dictionary;
ints.push_back(dictionary.string2int(this->formula));
doubles.push_back(this->moles);
this->formula_totals.mpi_pack(ints, doubles);
this->totals.mpi_pack(ints, doubles);
doubles.push_back(this->la);
doubles.push_back(this->charge_balance);
ints.push_back(dictionary.string2int(this->phase_name));
doubles.push_back(this->phase_proportion);
ints.push_back(dictionary.string2int(this->rate_name));
doubles.push_back(this->formula_z);
}
void
cxxExchComp::mpi_unpack(int *ints, int *ii, LDBLE *doubles, int *dd)
{
extern cxxDictionary dictionary;
int i = *ii;
int d = *dd;
this->formula = dictionary.int2stdstring(ints[i++]);
this->moles = doubles[d++];
this->formula_totals.mpi_unpack(ints, &i, doubles, &d);
this->totals.mpi_unpack(ints, &i, doubles, &d);
this->la = doubles[d++];
this->charge_balance = doubles[d++];
this->phase_name = dictionary.int2stdstring(ints[i++]);
this->phase_proportion = doubles[d++];
this->rate_name = dictionary.int2stdstring(ints[i++]);
this->formula_z = doubles[d++];
*ii = i;
*dd = d;
}
#endif
const std::vector< std::string >::value_type temp_vopts[] = {
std::vector< std::string >::value_type("formula"), // 0
std::vector< std::string >::value_type("moles"), // 1

View File

@ -105,11 +105,6 @@ class cxxExchComp: public PHRQ_base
void add(const cxxExchComp & comp, LDBLE extensive);
void multiply(LDBLE extensive);
#ifdef USE_MPI_SKIP
void mpi_pack(std::vector < int >&ints, std::vector < LDBLE >&doubles);
void mpi_unpack(int *ints, int *ii, LDBLE *doubles, int *dd);
#endif
protected:
std::string formula;
// EXCHANGE_MODIFY candidates

View File

@ -375,52 +375,6 @@ cxxExchange::add(const cxxExchange & addee, LDBLE extensive)
}
this->pitzer_exchange_gammas = addee.pitzer_exchange_gammas;
}
#ifdef USE_MPI_SKIP
/* ---------------------------------------------------------------------- */
void
cxxExchange::mpi_pack(std::vector < int >&ints,
std::vector < LDBLE >&doubles)
/* ---------------------------------------------------------------------- */
{
/* int n_user; */
ints.push_back(this->n_user);
ints.push_back((int) this->pitzer_exchange_gammas);
ints.push_back((int) this->exchComps.size());
for (std::map < std::string, cxxExchComp >::iterator it = this->exchComps.begin();
it != this->exchComps.end(); it++)
{
(*it).second.mpi_pack(ints, doubles);
}
}
/* ---------------------------------------------------------------------- */
void
cxxExchange::mpi_unpack(int *ints, int *ii, LDBLE *doubles, int *dd)
/* ---------------------------------------------------------------------- */
{
int i = *ii;
int d = *dd;
/* int n_user; */
this->n_user = ints[i++];
this->n_user_end = this->n_user;
this->description = " ";
this->pitzer_exchange_gammas = (ints[i++] == TRUE);
int count = ints[i++];
this->exchComps.clear();
for (int n = 0; n < count; n++)
{
cxxExchComp ec;
ec.mpi_unpack(ints, &i, doubles, &d);
std::string str(ec.get_formula());
this->exchComps[str] = ec;
}
*ii = i;
*dd = d;
}
#endif
void
cxxExchange::totalize()
{

View File

@ -47,10 +47,6 @@ public:
const cxxNameDouble & Get_totals() const;
#ifdef USE_MPI_SKIP
void mpi_pack(std::vector < int >&ints, std::vector < LDBLE >&doubles);
void mpi_unpack(int *ints, int *ii, LDBLE *doubles, int *dd);
#endif
protected:
void add(const cxxExchange & addee, LDBLE extensive);
// not written

View File

@ -520,54 +520,6 @@ cxxGasPhase::read_raw(CParser & parser, bool check)
}
}
#ifdef USE_MPI_SKIP
void
cxxGasPhase::mpi_pack(std::vector < int >&ints,
std::vector < LDBLE >&doubles)
{
ints.push_back(this->n_user);
this->gasPhaseComps.mpi_pack(ints, doubles);
if (this->type == cxxGasPhase::GP_PRESSURE)
{
ints.push_back(0);
}
else
{
ints.push_back(1);
}
doubles.push_back(this->total_p);
doubles.push_back(this->volume);
doubles.push_back(this->v_m);
ints.push_back((pr_in) ? 1 : 0);
}
void
cxxGasPhase::mpi_unpack(int *ints, int *ii, LDBLE *doubles, int *dd)
{
int i = *ii;
int d = *dd;
this->n_user = ints[i++];
this->n_user_end = this->n_user;
this->description = " ";
this->gasPhaseComps.mpi_unpack(ints, &i, doubles, &d);
int n = ints[i++];
if (n == 0)
{
this->type = cxxGasPhase::GP_PRESSURE;
}
else
{
this->type = cxxGasPhase::GP_VOLUME;
}
this->total_p = doubles[d++];
this->volume = doubles[d++];
this->v_m = doubles[d++];
n = ints[i++];
this->pr_in = (n == 1) ? true : false;
*ii = i;
*dd = d;
}
#endif
void
cxxGasPhase::totalize(Phreeqc * phreeqc_ptr)
{

View File

@ -33,11 +33,6 @@ class cxxGasPhase:public cxxNumKeyword
void read_raw(CParser & parser, bool check = true);
#ifdef USE_MPI_SKIP
void mpi_pack(std::vector < int >&ints, std::vector < LDBLE >&doubles);
void mpi_unpack(int *ints, int *ii, LDBLE *doubles, int *dd);
#endif
void totalize(Phreeqc * phreeqc_ptr);
const cxxNameDouble & Get_totals() const

View File

@ -282,47 +282,6 @@ cxxKineticsComp::read_raw(CParser & parser, bool check)
}
}
#ifdef USE_MPI_SKIP
void
cxxKineticsComp::mpi_pack(std::vector < int >&ints,
std::vector < LDBLE >&doubles)
{
extern cxxDictionary dictionary;
ints.push_back(dictionary.string2int(this->rate_name));
this->namecoef.mpi_pack(ints, doubles);
doubles.push_back(this->tol);
doubles.push_back(this->m);
doubles.push_back(this->m0);
doubles.push_back(this->moles);
ints.push_back((int) this->d_params.size());
for (std::vector < LDBLE >::iterator it = this->d_params.begin();
it != this->d_params.end(); it++)
{
doubles.push_back(*it);
}
}
void
cxxKineticsComp::mpi_unpack(int *ints, int *ii, LDBLE *doubles, int *dd)
{
extern cxxDictionary dictionary;
int i = *ii;
int d = *dd;
this->rate_name = dictionary.int2stdstring(ints[i++]);
this->namecoef.mpi_unpack(ints, &i, doubles, &d);
this->tol = doubles[d++];
this->m = doubles[d++];
this->m0 = doubles[d++];
this->moles = doubles[d++];
int n = ints[i++];
this->d_params.clear();
for (int j = 0; j < n; j++)
{
this->d_params.push_back(doubles[d++]);
}
*ii = i;
*dd = d;
}
#endif
void
cxxKineticsComp::add(const cxxKineticsComp & addee, LDBLE extensive)
{

View File

@ -52,10 +52,6 @@ public:
const std::vector < LDBLE > &Get_d_params(void)const {return d_params;};
std::vector < std::string > &Get_c_params(void) {return c_params;};
#ifdef USE_MPI_SKIP
void mpi_unpack(int *ints, int *ii, LDBLE *doubles, int *dd);
void mpi_pack(std::vector < int >&ints, std::vector < LDBLE >&doubles);
#endif
void add(const cxxKineticsComp & comp, LDBLE extensive);
void multiply(LDBLE extensive);

View File

@ -589,62 +589,4 @@ cxxNameDouble::sort_second(void)
return myvec;
}
#ifdef USE_MPI_SKIP
void
cxxNameDouble::mpi_pack(std::vector < int >&ints,
std::vector < LDBLE >&doubles)
{
extern cxxDictionary dictionary;
ints.push_back((int) (*this).size());
for (const_iterator it = (*this).begin(); it != (*this).end(); it++)
{
int n = dictionary.string2int(it->first);
ints.push_back(n);
doubles.push_back(it->second);
}
}
void
cxxNameDouble::mpi_pack(int *ints, int *ii, LDBLE *doubles, int *dd)
{
int i = *ii;
int d = *dd;
extern cxxDictionary dictionary;
//ints.push_back( (*this).size() );
ints[i++] = (int) this->size();
for (const_iterator it = this->begin(); it != this->end(); it++)
{
int n = dictionary.string2int(it->first);
if (n < 0)
{
std::cerr << it->first << "\n";
error_msg("Name in NameDouble was not defined in dictionary?\n",
STOP);
}
ints[i++] = n;
doubles[d++] = it->second;
}
*ii = i;
*dd = d;
}
void
cxxNameDouble::mpi_unpack(int *ints, int *ii, LDBLE *doubles, int *dd)
{
int i = *ii;
int d = *dd;
extern cxxDictionary dictionary;
this->clear();
int count = ints[i++];
for (int j = 0; j < count; j++)
{
int n = ints[i++];
assert(n >= 0);
std::string str = dictionary.int2stdstring(n);
if (str.size() != 0)
{
(*this)[str] = doubles[d++];
}
}
*ii = i;
*dd = d;
}
#endif

View File

@ -54,11 +54,6 @@ class cxxNameDouble:public
{
(*this)[str] = d;
}
#ifdef USE_MPI_SKIP
void mpi_pack(std::vector < int >&ints, std::vector < LDBLE >&doubles);
void mpi_pack(int *ints, int *ii, LDBLE *doubles, int *dd);
void mpi_unpack(int *ints, int *ii, LDBLE *doubles, int *dd);
#endif
enum ND_TYPE type;

View File

@ -234,51 +234,6 @@ cxxPPassemblage::read_raw(CParser & parser, bool check)
}
}
#ifdef USE_MPI_SKIP
/* ---------------------------------------------------------------------- */
void
cxxPPassemblage::mpi_pack(std::vector < int >&ints,
std::vector < LDBLE >&doubles)
/* ---------------------------------------------------------------------- */
{
/* int n_user; */
ints.push_back(this->n_user);
ints.push_back((int) this->ppAssemblageComps.size());
for (std::map < std::string, cxxPPassemblageComp >::iterator it =
this->ppAssemblageComps.begin(); it != this->ppAssemblageComps.end();
it++)
{
(*it).second.mpi_pack(ints, doubles);
}
this->eltList.mpi_pack(ints, doubles);
}
/* ---------------------------------------------------------------------- */
void
cxxPPassemblage::mpi_unpack(int *ints, int *ii, LDBLE *doubles, int *dd)
/* ---------------------------------------------------------------------- */
{
int i = *ii;
int d = *dd;
/* int n_user; */
this->n_user = ints[i++];
this->n_user_end = this->n_user;
this->description = " ";
int count = ints[i++];
this->ppAssemblageComps.clear();
for (int n = 0; n < count; n++)
{
cxxPPassemblageComp ppc;
ppc.mpi_unpack(ints, &i, doubles, &d);
std::string str(ppc.get_name());
this->ppAssemblageComps[str] = ppc;
}
this->eltList.mpi_unpack(ints, &i, doubles, &d);
*ii = i;
*dd = d;
}
#endif
void
cxxPPassemblage::totalize(Phreeqc * phreeqc_ptr)
{

View File

@ -49,10 +49,6 @@ class cxxPPassemblage:public cxxNumKeyword
void Set_new_def(bool tf) {this->new_def = tf;}
cxxPPassemblageComp *Find(const std::string name);
#ifdef USE_MPI_SKIP
void mpi_pack(std::vector < int >&ints, std::vector < LDBLE >&doubles);
void mpi_unpack(int *ints, int *ii, LDBLE *doubles, int *dd);
#endif
void totalize(Phreeqc * phreeqc_ptr);

View File

@ -312,46 +312,6 @@ cxxPPassemblageComp::read_raw(CParser & parser, bool check)
}
}
#ifdef USE_MPI_SKIP
void
cxxPPassemblageComp::mpi_pack(std::vector < int >&ints,
std::vector < LDBLE >&doubles)
{
extern cxxDictionary dictionary;
ints.push_back(dictionary.string2int(this->name));
ints.push_back(dictionary.string2int(this->add_formula));
doubles.push_back(this->si);
doubles.push_back(this->si_org);
doubles.push_back(this->moles);
doubles.push_back(this->delta);
doubles.push_back(this->initial_moles);
ints.push_back((int) this->force_equality);
ints.push_back((int) this->dissolve_only);
ints.push_back((int) this->precipitate_only);
}
void
cxxPPassemblageComp::mpi_unpack(int *ints, int *ii, LDBLE *doubles, int *dd)
{
extern cxxDictionary dictionary;
int i = *ii;
int d = *dd;
this->name = dictionary.int2stdstring(ints[i++]);
this->add_formula = dictionary.int2stdstring(ints[i++]);
this->si = doubles[d++];
this->si_org = doubles[d++];
this->moles = doubles[d++];
this->delta = doubles[d++];
this->initial_moles = doubles[d++];
this->force_equality = (ints[i++] != 0);
this->dissolve_only = (ints[i++] != 0);
this->precipitate_only = (ints[i++] != 0);
*ii = i;
*dd = d;
}
#endif
void
cxxPPassemblageComp::totalize(Phreeqc * phreeqc_ptr)
{

View File

@ -58,14 +58,9 @@ class cxxPPassemblageComp: public PHRQ_base
bool Get_precipitate_only() const {return this->precipitate_only;}
void Set_precipitate_only(bool tf) {this->precipitate_only = tf;}
void add(const cxxPPassemblageComp & comp, LDBLE extensive);
void multiply(LDBLE extensive);
#ifdef USE_MPI_SKIP
void mpi_pack(std::vector < int >&ints, std::vector < LDBLE >&doubles);
void mpi_unpack(int *ints, int *ii, LDBLE *doubles, int *dd);
#endif
protected:
std::string name;
std::string add_formula;

View File

@ -931,9 +931,7 @@ public:
static int surface_compare_int(const void *ptr1, const void *ptr2);
static int rxn_token_temp_compare(const void *ptr1, const void *ptr2);
int trxn_multiply(LDBLE coef);
#if defined(USE_MPI_SKIP) && defined(HDF5_CREATE) && defined(MERGE_FILES)
void MergeFinalize(void);
#endif
struct elt_list * cxxNameDouble2elt_list(const cxxNameDouble * nd);
struct name_coef * cxxNameDouble2name_coef(const cxxNameDouble * nd);
struct master_activity * cxxNameDouble2master_activity(const cxxNameDouble * nd);

36
SS.cxx
View File

@ -443,42 +443,6 @@ cxxSS::read_raw(CParser & parser, bool check)
}
}
#ifdef USE_MPI_SKIP
void
cxxSS::mpi_pack(std::vector < int >&ints,
std::vector < LDBLE >&doubles)
{
extern cxxDictionary dictionary;
ints.push_back(dictionary.string2int(this->name));
this->comps.mpi_pack(ints, doubles);
doubles.push_back(this->a0);
doubles.push_back(this->a1);
doubles.push_back(this->ag0);
doubles.push_back(this->ag1);
ints.push_back((int) this->miscibility);
doubles.push_back(this->xb1);
doubles.push_back(this->xb2);
}
void
cxxSS::mpi_unpack(int *ints, int *ii, LDBLE *doubles, int *dd)
{
extern cxxDictionary dictionary;
int i = *ii;
int d = *dd;
this->name = dictionary.int2stdstring(ints[i++]);
this->comps.mpi_unpack(ints, &i, doubles, &d);
this->a0 = doubles[d++];
this->a1 = doubles[d++];
this->ag0 = doubles[d++];
this->ag1 = doubles[d++];
this->miscibility = (ints[i++] != 0);
this->xb1 = doubles[d++];
this->xb2 = doubles[d++];
*ii = i;
*dd = d;
}
#endif
void
cxxSS::totalize(Phreeqc * phreeqc_ptr)
{

4
SS.h
View File

@ -58,10 +58,6 @@ class cxxSS: public PHRQ_base
return (this->totals);
};
#ifdef USE_MPI_SKIP
void mpi_pack(std::vector < int >&ints, std::vector < LDBLE >&doubles);
void mpi_unpack(int *ints, int *ii, LDBLE *doubles, int *dd);
#endif
cxxSScomp * Find(const char * comp_name);
void add(const cxxSS & comp, LDBLE extensive);

View File

@ -223,49 +223,6 @@ cxxSSassemblage::read_raw(CParser & parser, bool check)
break;
}
}
#ifdef USE_MPI_SKIP
/* ---------------------------------------------------------------------- */
void
cxxSSassemblage::mpi_pack(std::vector < int >&ints,
std::vector < LDBLE >&doubles)
/* ---------------------------------------------------------------------- */
{
/* int n_user; */
ints.push_back(this->n_user);
ints.push_back((int) this->SSs.size());
for (std::map < std::string, cxxSS >::iterator it =
this->SSs.begin(); it != this->SSs.end();
it++)
{
(*it).second.mpi_pack(ints, doubles);
}
}
/* ---------------------------------------------------------------------- */
void
cxxSSassemblage::mpi_unpack(int *ints, int *ii, LDBLE *doubles, int *dd)
/* ---------------------------------------------------------------------- */
{
int i = *ii;
int d = *dd;
/* int n_user; */
this->n_user = ints[i++];
this->n_user_end = this->n_user;
this->description = " ";
int count = ints[i++];
this->SSs.clear();
for (int n = 0; n < count; n++)
{
cxxSS ssc;
ssc.mpi_unpack(ints, &i, doubles, &d);
std::string str(ssc.get_name());
this->SSs[str] = ssc;
}
*ii = i;
*dd = d;
}
#endif
void
cxxSSassemblage::totalize(Phreeqc * phreeqc_ptr)

View File

@ -32,10 +32,6 @@ public:
void read_raw(CParser & parser, bool check = true);
#ifdef USE_MPI_SKIP
void mpi_pack(std::vector < int >&ints, std::vector < LDBLE >&doubles);
void mpi_unpack(int *ints, int *ii, LDBLE *doubles, int *dd);
#endif
void totalize(Phreeqc * phreeqc_ptr);
const cxxNameDouble & Get_totals() const {return this->totals;}

View File

@ -247,45 +247,6 @@ cxxSScomp::read_raw(CParser & parser, bool check)
}
}
#ifdef USE_MPI_SKIP
void
cxxSScomp::mpi_pack(std::vector < int >&ints,
std::vector < double >&doubles)
{
extern cxxDictionary dictionary;
ints.push_back(dictionary.string2int(this->name));
ints.push_back(dictionary.string2int(this->add_formula));
doubles.push_back(this->si);
doubles.push_back(this->si_org);
doubles.push_back(this->moles);
doubles.push_back(this->delta);
doubles.push_back(this->initial_moles);
ints.push_back((int) this->force_equality);
ints.push_back((int) this->dissolve_only);
ints.push_back((int) this->precipitate_only);
}
void
cxxSScomp::mpi_unpack(int *ints, int *ii, double *doubles, int *dd)
{
extern cxxDictionary dictionary;
int i = *ii;
int d = *dd;
this->name = dictionary.int2stdstring(ints[i++]);
this->add_formula = dictionary.int2stdstring(ints[i++]);
this->si = doubles[d++];
this->si_org = doubles[d++];
this->moles = doubles[d++];
this->delta = doubles[d++];
this->initial_moles = doubles[d++];
this->force_equality = (ints[i++] != 0);
this->dissolve_only = (ints[i++] != 0);
this->precipitate_only = (ints[i++] != 0);
*ii = i;
*dd = d;
}
#endif
#ifdef SKIP
void
cxxSScomp::totalize(Phreeqc * phreeqc_ptr)

View File

@ -45,10 +45,6 @@ class cxxSScomp: public PHRQ_base
void multiply(double extensive);
#ifdef USE_MPI_SKIP
void mpi_pack(std::vector < int >&ints, std::vector < double >&doubles);
void mpi_unpack(int *ints, int *ii, double *doubles, int *dd);
#endif
protected:
std::string name;
// SOLID_SOLUTION_MODIFY candidate identifier

View File

@ -5,11 +5,6 @@
#pragma warning(disable : 4786) // disable truncation warning (Only used by debugger)
#endif
#ifdef USE_MPI_SKIP
//MPICH seems to require mpi.h to be first
#include <mpi.h>
#endif
#include <set>
#include <cassert> // assert
#include <algorithm> // std::sort
@ -1327,283 +1322,6 @@ cxxSolution::Get_master_activity(char *string) const
}
}
#ifdef USE_MPI_SKIP
/* ---------------------------------------------------------------------- */
void
cxxSolution::mpi_pack(std::vector < int >&ints,
std::vector < LDBLE >&doubles)
/* ---------------------------------------------------------------------- */
{
/*
* Make list of list of ints and doubles from solution structure
* This list is not the complete structure, but only enough
* for batch-reaction, advection, and transport calculations
*/
ints.push_back(this->n_user);
doubles.push_back(this->tc);
doubles.push_back(this->ph);
doubles.push_back(this->pe);
doubles.push_back(this->mu);
doubles.push_back(this->ah2o);
doubles.push_back(this->total_h);
doubles.push_back(this->total_o);
doubles.push_back(this->cb);
doubles.push_back(this->mass_water);
doubles.push_back(this->total_alkalinity);
/*
* struct conc *totals;
*/
this->totals.mpi_pack(ints, doubles);
/*
* struct master_activity *master_activity;
*/
this->master_activity.mpi_pack(ints, doubles);
/*
* struct master_activity *species_gamma
*/
this->species_gamma.mpi_pack(ints, doubles);
/*
position = 0;
int i = ints.size();
int int_array[i];
int d = doubles.size();
LDBLE double_array[d];
for (int j = 0; j < i; j++) {
int_array[j] = ints[j];
}
for (int j = 0; j < d; j++) {
double_array[j] = ints[j];
}
MPI_Send(&max_size, 1, MPI_INT, task_number, 0, MPI_COMM_WORLD);
MPI_Pack(&i, 1, MPI_INT, buffer, max_size, &position, MPI_COMM_WORLD);
MPI_Pack(&int_array, i, MPI_INT, buffer, max_size, &position, MPI_COMM_WORLD);
MPI_Pack(&d, 1, MPI_INT, buffer, max_size, &position, MPI_COMM_WORLD);
MPI_Pack(&double_array, d, MPI_DOUBLE, buffer, max_size, &position, MPI_COMM_WORLD);
MPI_Send(buffer, position, MPI_PACKED, task_number, 0, MPI_COMM_WORLD);
buffer = (void *) free_check_null(buffer);
*/
}
/* ---------------------------------------------------------------------- */
void
cxxSolution::mpi_unpack(int *ints, int *ii, LDBLE *doubles, int *dd)
/* ---------------------------------------------------------------------- */
{
int i = *ii;
int d = *dd;
this->n_user = ints[i++];
this->n_user_end = this->n_user;
this->description = " ";
this->tc = doubles[d++];
this->ph = doubles[d++];
this->pe = doubles[d++];
this->mu = doubles[d++];
this->ah2o = doubles[d++];
this->total_h = doubles[d++];
this->total_o = doubles[d++];
this->cb = doubles[d++];
this->mass_water = doubles[d++];
this->total_alkalinity = doubles[d++];
/*
* struct conc *totals;
*/
this->totals.mpi_unpack(ints, &i, doubles, &d);
/*
* struct master_activity *master_activity;
*/
this->master_activity.mpi_unpack(ints, &i, doubles, &d);
/*
* struct master_activity *species_gamma;
*/
this->species_gamma.mpi_unpack(ints, &i, doubles, &d);
*ii = i;
*dd = d;
}
/* ---------------------------------------------------------------------- */
void
cxxSolution::mpi_send(int task_number)
/* ---------------------------------------------------------------------- */
{
//int count_totals, count_totals_position, count_activity, count_activity_position;
int max_size, member_size, position;
//int ints[MESSAGE_MAX_NUMBERS];
//LDBLE doubles[MESSAGE_MAX_NUMBERS];
void *buffer;
std::vector < int >ints;
std::vector < LDBLE >doubles;
/*
* Make list of list of ints and doubles from solution structure
* This list is not the complete structure, but only enough
* for batch-reaction, advection, and transport calculations
*/
ints.push_back(this->n_user);
/* int n_user_end; */
/* char *description; */
doubles.push_back(this->tc);
doubles.push_back(this->ph);
doubles.push_back(this->pe);
doubles.push_back(this->mu);
doubles.push_back(this->ah2o);
doubles.push_back(this->total_h);
doubles.push_back(this->total_o);
doubles.push_back(this->cb);
doubles.push_back(this->mass_water);
doubles.push_back(this->total_alkalinity);
/*
* struct conc *totals;
*/
this->totals.mpi_pack(ints, doubles);
/*
* struct master_activity *master_activity;
*/
this->master_activity.mpi_pack(ints, doubles);
/*
* struct master_activity *species_gamma
*/
this->species_gamma.mpi_pack(ints, doubles);
/* int count_isotopes; */
/* struct isotope *isotopes; */
if (phreeqc_ptr-> input_error > 0)
{
std::string errstr("Stopping due to errors\n");
error_msg(errstr.c_str(), STOP);
}
/*
* Malloc space for a buffer
*/
max_size = 0;
//MPI_Pack_size(MESSAGE_MAX_NUMBERS, MPI_INT, MPI_COMM_WORLD, &member_size);
MPI_Pack_size((int) ints.size(), MPI_INT, MPI_COMM_WORLD, &member_size);
max_size += member_size;
//MPI_Pack_size(MESSAGE_MAX_NUMBERS, MPI_DOUBLE, MPI_COMM_WORLD, &member_size);
MPI_Pack_size((int) doubles.size(), MPI_DOUBLE, MPI_COMM_WORLD,
&member_size);
max_size += member_size + 10;
buffer = phreeqc_ptr-> PHRQ_malloc(max_size);
if (buffer == NULL)
malloc_error();
/*
* Send message to processor
*/
position = 0;
int i = (int) ints.size();
int *int_array = new int[i];
int d = (int) doubles.size();
LDBLE *double_array = new LDBLE[d];
for (int j = 0; j < i; j++)
{
int_array[j] = ints[j];
}
for (int j = 0; j < d; j++)
{
double_array[j] = doubles[j];
}
MPI_Send(&max_size, 1, MPI_INT, task_number, 0, MPI_COMM_WORLD);
MPI_Pack(&i, 1, MPI_INT, buffer, max_size, &position, MPI_COMM_WORLD);
MPI_Pack(&int_array, i, MPI_INT, buffer, max_size, &position,
MPI_COMM_WORLD);
MPI_Pack(&d, 1, MPI_INT, buffer, max_size, &position, MPI_COMM_WORLD);
MPI_Pack(&double_array, d, MPI_DOUBLE, buffer, max_size, &position,
MPI_COMM_WORLD);
MPI_Send(buffer, position, MPI_PACKED, task_number, 0, MPI_COMM_WORLD);
buffer = (void *) free_check_null(buffer);
delete[]int_array;
delete[]double_array;
}
/* ---------------------------------------------------------------------- */
void
cxxSolution::mpi_recv(int task_number)
/* ---------------------------------------------------------------------- */
{
MPI_Status mpi_status;
/*
* Malloc space for a buffer
*/
int max_size;
// buffer size
MPI_Recv(&max_size, 1, MPI_INT, task_number, 0, MPI_COMM_WORLD,
&mpi_status);
void *buffer = phreeqc_ptr-> PHRQ_malloc(max_size);
if (buffer == NULL)
malloc_error();
/*
* Recieve solution
*/
MPI_Recv(buffer, max_size, MPI_PACKED, task_number, 0, MPI_COMM_WORLD,
&mpi_status);
int position = 0;
int msg_size;
MPI_Get_count(&mpi_status, MPI_PACKED, &msg_size);
/* Unpack ints */
int count_ints;
MPI_Unpack(buffer, msg_size, &position, &count_ints, 1, MPI_INT,
MPI_COMM_WORLD);
int *ints = new int[count_ints];
MPI_Unpack(buffer, msg_size, &position, ints, count_ints, MPI_INT,
MPI_COMM_WORLD);
/* Unpack doubles */
int count_doubles;
MPI_Unpack(buffer, msg_size, &position, &count_doubles, 1, MPI_INT,
MPI_COMM_WORLD);
LDBLE *doubles = new LDBLE[count_doubles];
MPI_Unpack(buffer, msg_size, &position, doubles, count_doubles,
MPI_DOUBLE, MPI_COMM_WORLD);
buffer = free_check_null(buffer);
/*
* Make list of list of ints and doubles from solution structure
* This list is not the complete structure, but only enough
* for batch-reaction, advection, and transport calculations
*/
int i = 0;
int d = 0;
/* int new_def; */
/* solution_ptr->new_def = FALSE; */
/* int n_user; */
this->n_user = ints[i++];
/* int n_user_end; */
this->n_user_end = this->n_user;
/*debugging */
//this->description = (char *) free_check_null(this->description);
//this->description = string_duplicate(" ");
this->description = " ";
this->tc = doubles[d++];
this->ph = doubles[d++];
this->pe = doubles[d++];
this->mu = doubles[d++];
this->ah2o = doubles[d++];
this->total_h = doubles[d++];
this->total_o = doubles[d++];
this->cb = doubles[d++];
this->mass_water = doubles[d++];
this->total_alkalinity = 0;
/*
* struct conc *totals;
*/
this->totals.mpi_unpack(ints, &i, doubles, &d);
/*
* struct master_activity *master_activity;
*/
this->master_activity.mpi_unpack(ints, &i, doubles, &d);
/*
* struct master_activity *species_gamma;
*/
this->species_gamma.mpi_unpack(ints, &i, doubles, &d);
delete[]ints;
delete[]doubles;
}
#endif
void
cxxSolution::Set_master_activity(char *string, LDBLE d)
{

View File

@ -106,13 +106,6 @@ class cxxSolution:public cxxNumKeyword
void Update(LDBLE h_tot, LDBLE o_tot, LDBLE charge, const cxxNameDouble &nd);
void Update_activities(const cxxNameDouble &original_tot);
#ifdef USE_MPI_SKIP
void mpi_pack(std::vector < int >&ints, std::vector < LDBLE >&doubles);
void mpi_unpack(int *ints, int *ii, LDBLE *doubles, int *dd);
void mpi_send(int task_number);
void mpi_recv(int task_number);
#endif
protected:
bool new_def;
LDBLE patm;

View File

@ -4,10 +4,6 @@
#ifdef _DEBUG
#pragma warning(disable : 4786) // disable truncation warning (Only used by debugger)
#endif
#ifdef USE_MPI_SKIP
//MPICH seems to require mpi.h to be first
#include <mpi.h>
#endif
#include <fstream>
#include <iostream> // std::cout std::cerr
#include <cassert> // assert
@ -998,267 +994,6 @@ cxxStorageBin::cxxStorageBin2system(Phreeqc * phreeqc_ptr, int n)
}
#endif
#ifdef USE_MPI_SKIP
void
cxxStorageBin::mpi_send(int n, int task_number)
{
//
// Send data for system n to task_number
//
std::vector < int >ints;
std::vector < LDBLE >doubles;
// Solution
if (this->getSolution(n) != NULL)
{
ints.push_back(1);
this->getSolution(n)->mpi_pack(ints, doubles);
}
else
{
ints.push_back(0);
}
//std::cerr << "Packed Solution" << "\n";
// Exchanger
if (this->getExchange(n) != NULL)
{
ints.push_back(1);
this->getExchange(n)->mpi_pack(ints, doubles);
}
else
{
ints.push_back(0);
}
//std::cerr << "Packed Exchange" << "\n";
// GasPhase
if (this->getGasPhase(n) != NULL)
{
ints.push_back(1);
this->getGasPhase(n)->mpi_pack(ints, doubles);
}
else
{
ints.push_back(0);
}
//std::cerr << "Packed GasPhase" << "\n";
// Kinetics
if (this->getKinetics(n) != NULL)
{
ints.push_back(1);
this->getKinetics(n)->mpi_pack(ints, doubles);
}
else
{
ints.push_back(0);
}
//std::cerr << "Packed Kinetics" << "\n";
// PPassemblages
if (this->getPPassemblage(n) != NULL)
{
ints.push_back(1);
this->getPPassemblage(n)->mpi_pack(ints, doubles);
}
else
{
ints.push_back(0);
}
//std::cerr << "Packed PPassemblage" << "\n";
// SSassemblages
if (this->getSSassemblage(n) != NULL)
{
ints.push_back(1);
this->getSSassemblage(n)->mpi_pack(ints, doubles);
}
else
{
ints.push_back(0);
}
//std::cerr << "Packed SSassemblage" << "\n";
// Surfaces
if (this->getSurface(n) != NULL)
{
ints.push_back(1);
this->getSurface(n)->mpi_pack(ints, doubles);
}
else
{
ints.push_back(0);
}
//std::cerr << "Packed Surface" << "\n";
// Pack data
int max_size = 0;
int member_size = 0;
MPI_Pack_size((int) ints.size() + 10, MPI_INT, MPI_COMM_WORLD,
&member_size);
max_size += member_size;
MPI_Pack_size((int) doubles.size(), MPI_DOUBLE, MPI_COMM_WORLD,
&member_size);
max_size += member_size + 10;
void *buffer = phreeqc_ptr-> PHRQ_malloc(max_size);
if (buffer == NULL)
malloc_error();
// Convert to arrays
int i = (int) ints.size();
//int int_array[i];
int d = (int) doubles.size();
//LDBLE double_array[d];
/*
for (int j = 0; j < i; j++) {
int_array[j] = ints[j];
//std::cerr << "Sending ints " << j << " value " << ints[j] << "\n";
}
for (int j = 0; j < d; j++) {
double_array[j] = doubles[j];
//std::cerr << "Sending doubles " << j << " value " << doubles[j] << "\n";
}
*/
/*
* Send message to processor
*/
int position = 0;
MPI_Send(&max_size, 1, MPI_INT, task_number, 0, MPI_COMM_WORLD);
MPI_Pack(&i, 1, MPI_INT, buffer, max_size, &position, MPI_COMM_WORLD);
MPI_Pack(&(ints.front()), i, MPI_INT, buffer, max_size, &position,
MPI_COMM_WORLD);
MPI_Pack(&d, 1, MPI_INT, buffer, max_size, &position, MPI_COMM_WORLD);
if (d > 0)
{
MPI_Pack(&(doubles.front()), d, MPI_DOUBLE, buffer, max_size,
&position, MPI_COMM_WORLD);
}
MPI_Send(buffer, position, MPI_PACKED, task_number, 0, MPI_COMM_WORLD);
buffer = (void *) free_check_null(buffer);
}
/* ---------------------------------------------------------------------- */
void
cxxStorageBin::mpi_recv(int task_number)
/* ---------------------------------------------------------------------- */
{
MPI_Status mpi_status;
/*
* Malloc space for a buffer
*/
int max_size;
// buffer size
MPI_Recv(&max_size, 1, MPI_INT, task_number, 0, MPI_COMM_WORLD,
&mpi_status);
void *buffer = phreeqc_ptr-> PHRQ_malloc(max_size);
if (buffer == NULL)
malloc_error();
/*
* Recieve system
*/
MPI_Recv(buffer, max_size, MPI_PACKED, task_number, 0, MPI_COMM_WORLD,
&mpi_status);
int position = 0;
int msg_size;
MPI_Get_count(&mpi_status, MPI_PACKED, &msg_size);
/* Unpack ints */
int count_ints;
MPI_Unpack(buffer, msg_size, &position, &count_ints, 1, MPI_INT,
MPI_COMM_WORLD);
int *ints = new int[count_ints];
MPI_Unpack(buffer, msg_size, &position, ints, count_ints, MPI_INT,
MPI_COMM_WORLD);
/* Unpack doubles */
int count_doubles;
MPI_Unpack(buffer, msg_size, &position, &count_doubles, 1, MPI_INT,
MPI_COMM_WORLD);
LDBLE *doubles = new LDBLE[count_doubles];
if (count_doubles > 0)
{
MPI_Unpack(buffer, msg_size, &position, doubles, count_doubles,
MPI_DOUBLE, MPI_COMM_WORLD);
}
buffer = free_check_null(buffer);
/*
* Make list of list of ints and doubles from solution structure
* This list is not the complete structure, but only enough
* for batch-reaction, advection, and transport calculations
*/
int i = 0;
int d = 0;
// Solution
if (ints[i++] != 0)
{
cxxSolution entity;
entity.mpi_unpack(ints, &i, doubles, &d);
this->setSolution(entity.Get_n_user(), &entity);
}
//std::cerr << "Unpacked Solution" << "\n";
// Exchanger
if (ints[i++] != 0)
{
cxxExchange entity;
entity.mpi_unpack(ints, &i, doubles, &d);
this->setExchange(entity.Get_n_user(), &entity);
}
//std::cerr << "Unpacked Exchange" << "\n";
// GasPhase
if (ints[i++] != 0)
{
cxxGasPhase entity;
entity.mpi_unpack(ints, &i, doubles, &d);
this->setGasPhase(entity.Get_n_user(), &entity);
}
//std::cerr << "Unpacked GasPhase" << "\n";
// Kinetics
if (ints[i++] != 0)
{
cxxKinetics entity;
entity.mpi_unpack(ints, &i, doubles, &d);
this->setKinetics(entity.Get_n_user(), &entity);
}
//std::cerr << "Unpacked Kinetics" << "\n";
// PPassemblage
if (ints[i++] != 0)
{
cxxPPassemblage entity;
entity.mpi_unpack(ints, &i, doubles, &d);
this->setPPassemblage(entity.Get_n_user(), &entity);
}
//std::cerr << "Unpacked PPassemblage" << "\n";
// SSassemblage
if (ints[i++] != 0)
{
cxxSSassemblage entity;
entity.mpi_unpack(ints, &i, doubles, &d);
this->setSSassemblage(entity.Get_n_user(), &entity);
}
//std::cerr << "Unpacked SSassemblage" << "\n";
// Surfaces
if (ints[i++] != 0)
{
cxxSurface entity;
entity.mpi_unpack(ints, &i, doubles, &d);
this->setSurface(entity.Get_n_user(), &entity);
}
//std::cerr << "Unpacked Surface" << "\n";
delete[]ints;
delete[]doubles;
}
#endif
#ifdef SKIP
cxxExchange *
cxxStorageBin::mix_cxxExchange(cxxMix & mixmap)
@ -1581,83 +1316,3 @@ cxxStorageBin::Set_System(int i)
this->system.Set_Pressure(Utilities::Rxn_find(this->Pressures, i));
}
}
#ifdef USE_MPI_SKIP
void
cxxStorageBin::mpi_send(int n, int task_number)
{
//
// Send data for system n to task_number
//
std::ostringstream raw_stream;
// Solution
if (this->Get_Solution(n) != NULL)
{
this->Get_Solution(n)->dump_raw(raw_stream, 0);
}
// Exchanger
if (this->Get_Exchange(n) != NULL)
{
this->Get_Exchange(n)->dump_raw(raw_stream, 0);
}
// GasPhase
if (this->Get_GasPhase(n) != NULL)
{
this->Get_GasPhase(n)->dump_raw(raw_stream, 0);
}
// Kinetics
if (this->Get_Kinetics(n) != NULL)
{
this->Get_Kinetics(n)->dump_raw(raw_stream, 0);
}
// PPassemblages
if (this->Get_PPassemblage(n) != NULL)
{
this->Get_PPassemblage(n)->dump_raw(raw_stream, 0);
}
// SSassemblages
if (this->Get_SSassemblage(n) != NULL)
{
this->Get_SSassemblage(n)->dump_raw(raw_stream, 0);
}
// Surfaces
if (this->Get_Surface(n) != NULL)
{
this->Get_Surface(n)->dump_raw(raw_stream, 0);
}
// Send string
int size = raw_stream.str().size();
MPI_Send(&size, 1, MPI_INT, task_number, 0, MPI_COMM_WORLD);
MPI_Send((void *) raw_stream.str().c_str(), size, MPI_CHARACTER, task_number, 0, MPI_COMM_WORLD);
}
void
cxxStorageBin::mpi_recv(int task_number)
{
//
// Recieve raw data from task_number
//
MPI_Status mpi_status;
int size;
MPI_Recv(&size, 1, MPI_INT, task_number, 0, MPI_COMM_WORLD, &mpi_status);
std::vector<char> raw_buffer;
raw_buffer.resize(size + 1);
MPI_Recv((void *) raw_buffer.data(), size, MPI_CHARACTER, task_number, 0, MPI_COMM_WORLD, &mpi_status);
raw_buffer[size] = '\0';
std::istringstream raw_stream(raw_buffer.data());
CParser parser(raw_stream);
parser.set_echo_file(CParser::EO_NONE);
parser.set_echo_stream(CParser::EO_NONE);
this->read_raw(parser);
}
#endif

View File

@ -114,10 +114,7 @@ class cxxStorageBin: public PHRQ_base
std::map < int, cxxPressure > &Get_Pressures();
cxxSystem & Get_system(void) {return system;};
#ifdef USE_MPI_SKIP
void mpi_send(int n, int task_number);
void mpi_recv(int task_number);
#endif
protected:
// Tidied classes
std::map < int, cxxSolution > Solutions;

View File

@ -584,81 +584,6 @@ cxxSurface::read_raw(CParser & parser, bool check)
this->Sort_comps();
}
#ifdef USE_MPI_SKIP
/* ---------------------------------------------------------------------- */
void
cxxSurface::mpi_pack(std::vector < int >&ints, std::vector < LDBLE >&doubles)
/* ---------------------------------------------------------------------- */
{
/* int n_user; */
ints.push_back(this->n_user);
ints.push_back((int) this->surfaceComps.size());
for (std::map < std::string, cxxSurfaceComp >::iterator it =
this->surfaceComps.begin(); it != this->surfaceComps.end(); it++)
{
(*it).second.mpi_pack(ints, doubles);
}
ints.push_back((int) this->surface_charges.size());
for (std::map < std::string, cxxSurfaceCharge >::iterator it =
this->surface_charges.begin(); it != this->surface_charges.end(); it++)
{
(*it).second.mpi_pack(ints, doubles);
}
ints.push_back((int) this->type);
ints.push_back((int) this->dl_type);
ints.push_back((int) this->sites_units);
ints.push_back((int) this->only_counter_ions);
doubles.push_back(this->thickness);
doubles.push_back(this->debye_lengths);
doubles.push_back(this->DDL_viscosity);
doubles.push_back(this->DDL_limit);
ints.push_back((int) this->transport);
}
/* ---------------------------------------------------------------------- */
void
cxxSurface::mpi_unpack(int *ints, int *ii, LDBLE *doubles, int *dd)
/* ---------------------------------------------------------------------- */
{
int i = *ii;
int d = *dd;
this->n_user = ints[i++];
this->n_user_end = this->n_user;
this->description = " ";
int count = ints[i++];
this->surfaceComps.clear();
for (int n = 0; n < count; n++)
{
cxxSurfaceComp sc;
sc.mpi_unpack(ints, &i, doubles, &d);
std::string str(sc.get_formula());
this->surfaceComps[str] = sc;
}
count = ints[i++];
this->surface_charges.clear();
for (int n = 0; n < count; n++)
{
cxxSurfaceCharge sc;
sc.mpi_unpack(ints, &i, doubles, &d);
std::string str(sc.get_name());
this->surface_charges[str] = sc;
}
this->type = (SURFACE_TYPE) ints[i++];
this->dl_type = (DIFFUSE_LAYER_TYPE) ints[i++];
this->sites_units = (SITES_UNITS) ints[i++];
this->only_counter_ions = (ints[i++] == TRUE);
this->thickness = doubles[d++];
this->debye_lengths = doubles[d++];
this->DDL_viscosity = doubles[d++];
this->DDL_limit = doubles[d++];
this->transport = (ints[i++] == TRUE);
*ii = i;
*dd = d;
}
#endif
void
cxxSurface::totalize()
{

View File

@ -39,11 +39,6 @@ public:
const cxxSurfaceCharge *Find_charge(const std::string str)const;
void Sort_comps();
#ifdef USE_MPI_SKIP
void mpi_pack(std::vector < int >&ints, std::vector < LDBLE >&doubles);
void mpi_unpack(int *ints, int *ii, LDBLE *doubles, int *dd);
#endif
void add(const cxxSurface & addee, LDBLE extensive);
void multiply(LDBLE extensive);

View File

@ -374,47 +374,6 @@ cxxSurfaceCharge::read_raw(CParser & parser, bool check)
}
}
#ifdef USE_MPI_SKIP
void
cxxSurfaceCharge::mpi_pack(std::vector < int >&ints,
std::vector < LDBLE >&doubles)
{
extern cxxDictionary dictionary;
ints.push_back(dictionary.string2int(this->name));
doubles.push_back(this->specific_area);
doubles.push_back(this->grams);
doubles.push_back(this->charge_balance);
doubles.push_back(this->mass_water);
doubles.push_back(this->la_psi);
doubles.push_back(this->la_psi1);
doubles.push_back(this->la_psi2);
doubles.push_back(this->capacitance[0]);
doubles.push_back(this->capacitance[1]);
this->diffuse_layer_totals.mpi_pack(ints, doubles);
}
void
cxxSurfaceCharge::mpi_unpack(int *ints, int *ii, LDBLE *doubles, int *dd)
{
extern cxxDictionary dictionary;
int i = *ii;
int d = *dd;
this->name = dictionary.int2stdstring(ints[i++]);
this->specific_area = doubles[d++];
this->grams = doubles[d++];
this->charge_balance = doubles[d++];
this->mass_water = doubles[d++];
this->la_psi = doubles[d++];
this->la_psi1 = doubles[d++];
this->la_psi2 = doubles[d++];
this->capacitance[0] = doubles[d++];
this->capacitance[1] = doubles[d++];
this->diffuse_layer_totals.mpi_unpack(ints, &i, doubles, &d);
*ii = i;
*dd = d;
}
#endif
void
cxxSurfaceCharge::add(const cxxSurfaceCharge & addee, LDBLE extensive)
{

View File

@ -75,11 +75,6 @@ public:
void add(const cxxSurfaceCharge & comp, LDBLE extensive);
void multiply(LDBLE extensive);
#ifdef USE_MPI_SKIP
void mpi_pack(std::vector < int >&ints, std::vector < LDBLE >&doubles);
void mpi_unpack(int *ints, int *ii, LDBLE *doubles, int *dd);
#endif
const std::string &Get_name() const {return this->name;}
void Set_name(const char * f) {this->name = f ? f : "";}
LDBLE Get_specific_area() const {return this->specific_area;}

View File

@ -356,47 +356,6 @@ cxxSurfaceComp::read_raw(CParser & parser, bool check)
}
}
#ifdef USE_MPI_SKIP
void
cxxSurfaceComp::mpi_pack(std::vector < int >&ints,
std::vector < LDBLE >&doubles)
{
extern cxxDictionary dictionary;
ints.push_back(dictionary.string2int(this->formula));
doubles.push_back(this->formula_z);
this->formula_totals.mpi_pack(ints, doubles);
doubles.push_back(this->moles);
this->totals.mpi_pack(ints, doubles);
doubles.push_back(this->la);
doubles.push_back(this->charge_balance);
ints.push_back(dictionary.string2int(this->phase_name));
doubles.push_back(this->phase_proportion);
ints.push_back(dictionary.string2int(this->rate_name));
doubles.push_back(this->Dw);
}
void
cxxSurfaceComp::mpi_unpack(int *ints, int *ii, LDBLE *doubles, int *dd)
{
extern cxxDictionary dictionary;
int i = *ii;
int d = *dd;
this->formula = dictionary.int2stdstring(ints[i++]);
this->formula_z = doubles[d++];
this->formula_totals.mpi_unpack(ints, &i, doubles, &d);
this->moles = doubles[d++];
this->totals.mpi_unpack(ints, &i, doubles, &d);
this->la = doubles[d++];
this->charge_balance = doubles[d++];
this->phase_name = dictionary.int2stdstring(ints[i++]);
this->phase_proportion = doubles[d++];
this->rate_name = dictionary.int2stdstring(ints[i++]);
this->Dw = doubles[d++];
*ii = i;
*dd = d;
}
#endif
void
cxxSurfaceComp::add(const cxxSurfaceComp & addee, LDBLE extensive)
{

View File

@ -47,11 +47,6 @@ public:
const std::string &Get_master_element() const {return this->master_element;}
void Set_master_element(const char * f) {this->master_element = f ? f : "";}
#ifdef USE_MPI_SKIP
void mpi_pack(std::vector < int >&ints, std::vector < LDBLE >&doubles);
void mpi_unpack(int *ints, int *ii, LDBLE *doubles, int *dd);
#endif
protected:
std::string formula;
LDBLE formula_z;

View File

@ -447,74 +447,6 @@ cxxKinetics::read_raw(CParser & parser, bool check)
}
}
}
#ifdef USE_MPI_SKIP
void
cxxKinetics::mpi_pack(std::vector < int >&ints,
std::vector < LDBLE >&doubles)
{
ints.push_back(this->n_user);
ints.push_back((int) this->kineticsComps.size());
std::list < cxxKineticsComp >::iterator it;
for (it = this->kineticsComps.begin(); it != this->kineticsComps.end(); it++)
{
(*it).mpi_pack(ints, doubles);
}
/*
for (std::map < std::string, cxxKineticsComp >::iterator it =
this->kineticsComps.begin(); it != this->kineticsComps.end(); it++)
{
(*it).second.mpi_pack(ints, doubles);
}
*/
ints.push_back((int) this->steps.size());
for (std::vector < LDBLE >::iterator it = this->steps.begin();
it != this->steps.end(); it++)
{
doubles.push_back(*it);
}
doubles.push_back(this->step_divide);
ints.push_back(this->rk);
ints.push_back(this->bad_step_max);
ints.push_back(this->use_cvode);
ints.push_back(this->cvode_steps);
ints.push_back(this->cvode_order);
ints.push_back(this->equal_steps);
}
void
cxxKinetics::mpi_unpack(int *ints, int *ii, LDBLE *doubles, int *dd)
{
int i = *ii;
int d = *dd;
this->n_user = ints[i++];
this->n_user_end = this->n_user;
this->description = " ";
int n = ints[i++];
this->kineticsComps.clear();
for (int j = 0; j < n; j++)
{
cxxKineticsComp kc;
kc.mpi_unpack(ints, &i, doubles, &d);
this->kineticsComps.push_back(kc);
}
n = ints[i++];
this->steps.clear();
for (int j = 0; j < n; j++)
{
this->steps.push_back(doubles[d++]);
}
this->step_divide = doubles[d++];
this->rk = ints[i++];
this->bad_step_max = ints[i++];
this->use_cvode = (ints[i++] == TRUE);
this->cvode_steps = ints[i++];
this->cvode_order = ints[i++];
this->equal_steps = ints[i++];
*ii = i;
*dd = d;
}
#endif
void
cxxKinetics::add(const cxxKinetics & addee, LDBLE extensive)
//

View File

@ -53,10 +53,6 @@ class cxxKinetics:public cxxNumKeyword
cxxKineticsComp * Find(const std::string &str);
LDBLE Current_step(const bool incremental_reactions, const int reaction_step) const;
#ifdef USE_MPI_SKIP
void mpi_unpack(int *ints, int *ii, LDBLE *doubles, int *dd);
void mpi_pack(std::vector < int >&ints, std::vector < LDBLE >&doubles);
#endif
protected:
void add(const cxxKinetics & addee, LDBLE extensive);

View File

@ -107,7 +107,7 @@ get_line(void)
size_t l = (l1 > l2) ? l1 : l2;
if (l >= (size_t) max_line)
{
max_line = l * 2;
max_line = (int) l * 2;
line_save = (char *) PHRQ_realloc(line_save,
(size_t) max_line * sizeof(char));
if (line_save == NULL)

View File

@ -134,7 +134,7 @@ inverse_models(void)
}
}
user_punch_count_headings = old_headings.size();
user_punch_count_headings = (int) old_headings.size();
user_punch_headings = (const char **) PHRQ_realloc(user_punch_headings,
(size_t) (user_punch_count_headings + 1) * sizeof(char *));
if (user_punch_headings == NULL)
@ -2125,7 +2125,7 @@ punch_model_heading(struct inverse *inv_ptr)
size_t j;
user_punch_count_headings = heading_names.size();
user_punch_count_headings = (int) heading_names.size();
user_punch_headings = (const char **) PHRQ_realloc(user_punch_headings,
(size_t) (user_punch_count_headings + 1) * sizeof(char *));
if (user_punch_headings == NULL)

View File

@ -3954,7 +3954,7 @@ calc_PR(std::vector<struct phase *> phase_ptrs, LDBLE P, LDBLE TK, LDBLE V_m)
pr_si_f = log10(phi_i) - Delta_V_i * (P - 1) / (2.303 * R * TK);
*/
{
int i, i1, n_g = phase_ptrs.size();
int i, i1, n_g = (int) phase_ptrs.size();
LDBLE T_c, P_c;
LDBLE A, B, B_r, /*b2,*/ kk, oo, a_aa, T_r;
LDBLE m_sum, /*b_sum, a_aa_sum,*/ a_aa_sum2;
@ -4746,11 +4746,11 @@ setup_unknowns(void)
*/
if (solution_ptr->Get_initial_data())
{
max_unknowns += solution_ptr->Get_initial_data()->Get_comps().size();
max_unknowns += (int) solution_ptr->Get_initial_data()->Get_comps().size();
}
else
{
max_unknowns += solution_ptr->Get_totals().size();
max_unknowns += (int) solution_ptr->Get_totals().size();
}
/*
* Add 5 for ionic strength, activity of water, charge balance, total H, total O
@ -4804,8 +4804,8 @@ setup_unknowns(void)
}
else
{
max_unknowns += use.Get_surface_ptr()->Get_surface_comps().size() +
4 * (int) use.Get_surface_ptr()->Get_surface_charges().size();
max_unknowns += (int) (use.Get_surface_ptr()->Get_surface_comps().size() +
4 * (int) use.Get_surface_ptr()->Get_surface_charges().size());
}
}
/*
@ -4817,7 +4817,7 @@ setup_unknowns(void)
if (gas_phase_ptr->Get_type() == cxxGasPhase::GP_VOLUME &&
(gas_phase_ptr->Get_pr_in() || force_numerical_fixed_volume) && numerical_fixed_volume)
{
max_unknowns += gas_phase_ptr->Get_gas_comps().size();
max_unknowns += (int) gas_phase_ptr->Get_gas_comps().size();
}
else
{
@ -4832,7 +4832,7 @@ setup_unknowns(void)
std::vector<cxxSS *> ss_ptrs = use.Get_ss_assemblage_ptr()->Vectorize();
for (size_t i = 0; i < ss_ptrs.size(); i++)
{
max_unknowns += ss_ptrs[i]->Get_ss_comps().size();
max_unknowns += (int) ss_ptrs[i]->Get_ss_comps().size();
}
}
/*
@ -6011,7 +6011,7 @@ save_model(void)
if (use.Get_ss_assemblage_ptr() != NULL)
{
size_t count_ss = use.Get_ss_assemblage_ptr()->Get_SSs().size();
last_model.count_ss_assemblage = count_ss;
last_model.count_ss_assemblage = (int) count_ss;
last_model.ss_assemblage =
(const char **) PHRQ_malloc(count_ss * sizeof(char *));
if (last_model.ss_assemblage == NULL)

View File

@ -346,10 +346,6 @@ clean_up(void)
#endif
title_x = (char *) free_check_null(title_x);
#if defined(USE_MPI_SKIP) && defined(HDF5_CREATE) && defined(MERGE_FILES)
MergeFinalize();
#endif
count_elements = 0;
count_master = 0;
count_phases = 0;