mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-16 08:38:23 +01:00
copier and dash
This commit is contained in:
parent
48e6b939d2
commit
6d67e22e0c
23
Phreeqc.cpp
23
Phreeqc.cpp
@ -491,29 +491,6 @@ void Phreeqc::init(void)
|
||||
*---------------------------------------------------------------------- */
|
||||
save_init(-1); // set initial save values
|
||||
|
||||
// copier structures
|
||||
copy_solution.n_user = copy_solution.start = copy_solution.end = 0;
|
||||
copy_solution.count = copy_solution.max = 0;
|
||||
copy_pp_assemblage.n_user = copy_pp_assemblage.start = copy_pp_assemblage.end = 0;
|
||||
copy_pp_assemblage.count = copy_pp_assemblage.max = 0;
|
||||
copy_exchange.n_user = copy_exchange.start = copy_exchange.end = 0;
|
||||
copy_exchange.count = copy_exchange.max = 0;
|
||||
copy_surface.n_user = copy_surface.start = copy_surface.end = 0;
|
||||
copy_surface.count = copy_surface.max = 0;
|
||||
copy_ss_assemblage.n_user = copy_ss_assemblage.start = copy_ss_assemblage.end = 0;
|
||||
copy_ss_assemblage.count = copy_ss_assemblage.max = 0;
|
||||
copy_gas_phase.n_user = copy_gas_phase.start = copy_gas_phase.end = 0;
|
||||
copy_gas_phase.count = copy_gas_phase.max = 0;
|
||||
copy_kinetics.n_user = copy_kinetics.start = copy_kinetics.end = 0;
|
||||
copy_kinetics.count = copy_kinetics.max = 0;
|
||||
copy_mix.n_user = copy_mix.start = copy_mix.end = 0;
|
||||
copy_mix.count = copy_mix.max = 0;
|
||||
copy_reaction.n_user = copy_reaction.start = copy_reaction.end = 0;
|
||||
copy_reaction.count = copy_reaction.max = 0;
|
||||
copy_temperature.n_user = copy_temperature.start = copy_temperature.end = 0;
|
||||
copy_temperature.count = copy_temperature.max = 0;
|
||||
copy_pressure.n_user = copy_pressure.start = copy_pressure.end = 0;
|
||||
copy_pressure.count = copy_pressure.max = 0;
|
||||
/*----------------------------------------------------------------------
|
||||
* Inverse
|
||||
*---------------------------------------------------------------------- */
|
||||
|
||||
@ -847,8 +847,7 @@ public:
|
||||
int clean_up(void);
|
||||
int reinitialize(void);
|
||||
int copier_add(struct copier *copier_ptr, int n_user, int start, int end);
|
||||
int copier_free(struct copier *copier_ptr);
|
||||
int copier_init(struct copier *copier_ptr);
|
||||
int copier_clear(struct copier* copier_ptr);
|
||||
static int element_compare(const void *ptr1, const void *ptr2);
|
||||
public:
|
||||
struct element *element_store(const char *element);
|
||||
|
||||
@ -300,11 +300,7 @@ struct save
|
||||
*---------------------------------------------------------------------- */
|
||||
struct copier
|
||||
{
|
||||
int count;
|
||||
int max;
|
||||
int *n_user;
|
||||
int *start;
|
||||
int *end;
|
||||
std::vector<int> n_user, start, end;
|
||||
};
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
|
||||
340
mainsubs.cpp
340
mainsubs.cpp
@ -92,18 +92,6 @@ initialize(void)
|
||||
g_spread_sheet.defaults.iso = NULL;
|
||||
g_spread_sheet.defaults.redox = NULL;
|
||||
#endif
|
||||
// allocate space for copier
|
||||
copier_init(©_solution);
|
||||
copier_init(©_pp_assemblage);
|
||||
copier_init(©_exchange);
|
||||
copier_init(©_surface);
|
||||
copier_init(©_ss_assemblage);
|
||||
copier_init(©_gas_phase);
|
||||
copier_init(©_kinetics);
|
||||
copier_init(©_mix);
|
||||
copier_init(©_reaction);
|
||||
copier_init(©_temperature);
|
||||
copier_init(©_pressure);
|
||||
|
||||
// Initialize cvode
|
||||
cvode_init();
|
||||
@ -1862,286 +1850,164 @@ int Phreeqc::
|
||||
copy_entities(void)
|
||||
/* ---------------------------------------------------------------------- */
|
||||
{
|
||||
int i, j, return_value;
|
||||
int verbose;
|
||||
|
||||
verbose = FALSE;
|
||||
int return_value;
|
||||
return_value = OK;
|
||||
if (copy_solution.count > 0)
|
||||
for (size_t j = 0; j < copy_solution.n_user.size(); j++)
|
||||
{
|
||||
for (j = 0; j < copy_solution.count; j++)
|
||||
if (Utilities::Rxn_find(Rxn_solution_map, copy_solution.n_user[j]) != NULL)
|
||||
{
|
||||
if (Utilities::Rxn_find(Rxn_solution_map, copy_solution.n_user[j]) != NULL)
|
||||
for (size_t i = copy_solution.start[j]; i <= copy_solution.end[j]; i++)
|
||||
{
|
||||
for (i = copy_solution.start[j]; i <= copy_solution.end[j];
|
||||
i++)
|
||||
{
|
||||
if (i == copy_solution.n_user[j])
|
||||
continue;
|
||||
Utilities::Rxn_copy(Rxn_solution_map, copy_solution.n_user[j], i);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (verbose == TRUE)
|
||||
{
|
||||
warning_msg("SOLUTION to copy not found.");
|
||||
return_value = ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (copy_pp_assemblage.count > 0)
|
||||
{
|
||||
for (j = 0; j < copy_pp_assemblage.count; j++)
|
||||
{
|
||||
if (Utilities::Rxn_find(Rxn_pp_assemblage_map, copy_pp_assemblage.n_user[j]) != NULL)
|
||||
{
|
||||
for (i = copy_pp_assemblage.start[j];
|
||||
i <= copy_pp_assemblage.end[j]; i++)
|
||||
{
|
||||
if (i == copy_pp_assemblage.n_user[j])
|
||||
continue;
|
||||
Utilities::Rxn_copy(Rxn_pp_assemblage_map, copy_pp_assemblage.n_user[j], i);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (verbose == TRUE)
|
||||
{
|
||||
warning_msg("EQUILIBRIUM_PHASES to copy not found.");
|
||||
return_value = ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (copy_reaction.count > 0)
|
||||
{
|
||||
for (j = 0; j < copy_reaction.count; j++)
|
||||
{
|
||||
if (Utilities::Rxn_find(Rxn_reaction_map, copy_reaction.n_user[j]) != NULL)
|
||||
{
|
||||
for (i = copy_reaction.start[j]; i <= copy_reaction.end[j]; i++)
|
||||
{
|
||||
if (i == copy_reaction.n_user[j])
|
||||
continue;
|
||||
Utilities::Rxn_copy(Rxn_reaction_map, copy_reaction.n_user[j], i);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (verbose == TRUE)
|
||||
{
|
||||
warning_msg("REACTION to copy not found.");
|
||||
return_value = ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (copy_mix.count > 0)
|
||||
{
|
||||
for (j = 0; j < copy_mix.count; j++)
|
||||
{
|
||||
if (Utilities::Rxn_find(Rxn_mix_map, copy_mix.n_user[j]) != NULL)
|
||||
{
|
||||
for (i = copy_mix.start[j]; i <= copy_mix.end[j]; i++)
|
||||
{
|
||||
if (i != copy_mix.n_user[j])
|
||||
{
|
||||
Utilities::Rxn_copy(Rxn_mix_map, copy_mix.n_user[j], i);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (verbose == TRUE)
|
||||
{
|
||||
warning_msg("Mix to copy not found.");
|
||||
return_value = ERROR;
|
||||
}
|
||||
if (i == copy_solution.n_user[j])
|
||||
continue;
|
||||
Utilities::Rxn_copy(Rxn_solution_map, copy_solution.n_user[j], (int)i);
|
||||
}
|
||||
}
|
||||
}
|
||||
copier_clear(©_solution);
|
||||
|
||||
if (copy_exchange.count > 0)
|
||||
for (size_t j = 0; j < copy_pp_assemblage.n_user.size(); j++)
|
||||
{
|
||||
for (j = 0; j < copy_exchange.count; j++)
|
||||
if (Utilities::Rxn_find(Rxn_pp_assemblage_map, copy_pp_assemblage.n_user[j]) != NULL)
|
||||
{
|
||||
if (Utilities::Rxn_find(Rxn_exchange_map, copy_exchange.n_user[j]) != NULL)
|
||||
for (size_t i = copy_pp_assemblage.start[j]; i <= copy_pp_assemblage.end[j]; i++)
|
||||
{
|
||||
for (i = copy_exchange.start[j]; i <= copy_exchange.end[j];
|
||||
i++)
|
||||
{
|
||||
if (i == copy_exchange.n_user[j])
|
||||
continue;
|
||||
Utilities::Rxn_copy(Rxn_exchange_map, copy_exchange.n_user[j], i);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (verbose == TRUE)
|
||||
{
|
||||
warning_msg("EXCHANGE to copy not found.");
|
||||
return_value = ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (copy_surface.count > 0)
|
||||
{
|
||||
for (j = 0; j < copy_surface.count; j++)
|
||||
{
|
||||
if (Utilities::Rxn_find(Rxn_surface_map, copy_surface.n_user[j]) != NULL)
|
||||
{
|
||||
for (i = copy_surface.start[j]; i <= copy_surface.end[j]; i++)
|
||||
{
|
||||
if (i == copy_surface.n_user[j])
|
||||
continue;
|
||||
Utilities::Rxn_copy(Rxn_surface_map, copy_surface.n_user[j], i);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (verbose == TRUE)
|
||||
{
|
||||
warning_msg("SURFACE to copy not found.");
|
||||
return_value = ERROR;
|
||||
}
|
||||
if (i == copy_pp_assemblage.n_user[j])
|
||||
continue;
|
||||
Utilities::Rxn_copy(Rxn_pp_assemblage_map, copy_pp_assemblage.n_user[j], (int)i);
|
||||
}
|
||||
}
|
||||
}
|
||||
copier_clear(©_pp_assemblage);
|
||||
|
||||
if (copy_temperature.count > 0)
|
||||
for (size_t j = 0; j < copy_reaction.n_user.size(); j++)
|
||||
{
|
||||
for (j = 0; j < copy_temperature.count; j++)
|
||||
if (Utilities::Rxn_find(Rxn_reaction_map, copy_reaction.n_user[j]) != NULL)
|
||||
{
|
||||
if (Utilities::Rxn_find(Rxn_temperature_map, copy_temperature.n_user[j]) != NULL)
|
||||
for (size_t i = copy_reaction.start[j]; i <= copy_reaction.end[j]; i++)
|
||||
{
|
||||
for (i = copy_temperature.start[j]; i <= copy_temperature.end[j]; i++)
|
||||
{
|
||||
if (i != copy_temperature.n_user[j])
|
||||
{
|
||||
Utilities::Rxn_copy(Rxn_temperature_map, copy_temperature.n_user[j], i);
|
||||
}
|
||||
}
|
||||
if (i == copy_reaction.n_user[j])
|
||||
continue;
|
||||
Utilities::Rxn_copy(Rxn_reaction_map, copy_reaction.n_user[j], (int)i);
|
||||
}
|
||||
else
|
||||
}
|
||||
}
|
||||
copier_clear(©_reaction);
|
||||
|
||||
for (size_t j = 0; j < copy_mix.n_user.size(); j++)
|
||||
{
|
||||
if (Utilities::Rxn_find(Rxn_mix_map, copy_mix.n_user[j]) != NULL)
|
||||
{
|
||||
for (size_t i = copy_mix.start[j]; i <= copy_mix.end[j]; i++)
|
||||
{
|
||||
if (verbose == TRUE)
|
||||
if (i != copy_mix.n_user[j])
|
||||
{
|
||||
warning_msg("temperature to copy not found.");
|
||||
return_value = ERROR;
|
||||
Utilities::Rxn_copy(Rxn_mix_map, copy_mix.n_user[j], (int)i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (copy_pressure.count > 0)
|
||||
copier_clear(©_mix);
|
||||
|
||||
for (size_t j = 0; j < copy_exchange.n_user.size(); j++)
|
||||
{
|
||||
for (j = 0; j < copy_pressure.count; j++)
|
||||
if (Utilities::Rxn_find(Rxn_exchange_map, copy_exchange.n_user[j]) != NULL)
|
||||
{
|
||||
if (Utilities::Rxn_find(Rxn_pressure_map, copy_pressure.n_user[j]) != NULL)
|
||||
for (size_t i = copy_exchange.start[j]; i <= copy_exchange.end[j]; i++)
|
||||
{
|
||||
for (i = copy_pressure.start[j]; i <= copy_pressure.end[j]; i++)
|
||||
{
|
||||
if (i != copy_pressure.n_user[j])
|
||||
{
|
||||
Utilities::Rxn_copy(Rxn_pressure_map, copy_pressure.n_user[j], i);
|
||||
}
|
||||
}
|
||||
if (i == copy_exchange.n_user[j]) continue;
|
||||
Utilities::Rxn_copy(Rxn_exchange_map, copy_exchange.n_user[j], (int)i);
|
||||
}
|
||||
else
|
||||
}
|
||||
}
|
||||
copier_clear(©_exchange);
|
||||
|
||||
for (size_t j = 0; j < copy_surface.n_user.size(); j++)
|
||||
{
|
||||
if (Utilities::Rxn_find(Rxn_surface_map, copy_surface.n_user[j]) != NULL)
|
||||
{
|
||||
for (size_t i = copy_surface.start[j]; i <= copy_surface.end[j]; i++)
|
||||
{
|
||||
if (verbose == TRUE)
|
||||
if (i == copy_surface.n_user[j])
|
||||
continue;
|
||||
Utilities::Rxn_copy(Rxn_surface_map, copy_surface.n_user[j], (int)i);
|
||||
}
|
||||
}
|
||||
}
|
||||
copier_clear(©_surface);
|
||||
|
||||
for (size_t j = 0; j < copy_temperature.n_user.size(); j++)
|
||||
{
|
||||
if (Utilities::Rxn_find(Rxn_temperature_map, copy_temperature.n_user[j]) != NULL)
|
||||
{
|
||||
for (size_t i = copy_temperature.start[j]; i <= copy_temperature.end[j]; i++)
|
||||
{
|
||||
if (i != copy_temperature.n_user[j])
|
||||
{
|
||||
warning_msg("pressure to copy not found.");
|
||||
return_value = ERROR;
|
||||
Utilities::Rxn_copy(Rxn_temperature_map, copy_temperature.n_user[j], (int)i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (copy_gas_phase.count > 0)
|
||||
copier_clear(©_temperature);
|
||||
|
||||
for (size_t j = 0; j < copy_pressure.n_user.size(); j++)
|
||||
{
|
||||
for (j = 0; j < copy_gas_phase.count; j++)
|
||||
if (Utilities::Rxn_find(Rxn_pressure_map, copy_pressure.n_user[j]) != NULL)
|
||||
{
|
||||
if (Utilities::Rxn_find(Rxn_gas_phase_map, copy_gas_phase.n_user[j]) != NULL)
|
||||
for (size_t i = copy_pressure.start[j]; i <= copy_pressure.end[j]; i++)
|
||||
{
|
||||
for (i = copy_gas_phase.start[j]; i <= copy_gas_phase.end[j];
|
||||
i++)
|
||||
if (i != copy_pressure.n_user[j])
|
||||
{
|
||||
if (i == copy_gas_phase.n_user[j])
|
||||
continue;
|
||||
Utilities::Rxn_copy(Rxn_gas_phase_map, copy_gas_phase.n_user[j], i);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (verbose == TRUE)
|
||||
{
|
||||
warning_msg("EXCHANGE to copy not found.");
|
||||
return_value = ERROR;
|
||||
Utilities::Rxn_copy(Rxn_pressure_map, copy_pressure.n_user[j], (int)i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (copy_kinetics.count > 0)
|
||||
copier_clear(©_pressure);
|
||||
|
||||
for (size_t j = 0; j < copy_gas_phase.n_user.size(); j++)
|
||||
{
|
||||
for (j = 0; j < copy_kinetics.count; j++)
|
||||
if (Utilities::Rxn_find(Rxn_gas_phase_map, copy_gas_phase.n_user[j]) != NULL)
|
||||
{
|
||||
if (Utilities::Rxn_find(Rxn_kinetics_map, copy_kinetics.n_user[j]) != NULL)
|
||||
for (size_t i = copy_gas_phase.start[j]; i <= copy_gas_phase.end[j]; i++)
|
||||
{
|
||||
for (i = copy_kinetics.start[j]; i <= copy_kinetics.end[j];
|
||||
i++)
|
||||
{
|
||||
if (i == copy_kinetics.n_user[j])
|
||||
continue;
|
||||
Utilities::Rxn_copy(Rxn_kinetics_map, copy_kinetics.n_user[j], i);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (verbose == TRUE)
|
||||
{
|
||||
warning_msg("KINETICS to copy not found.");
|
||||
return_value = ERROR;
|
||||
}
|
||||
if (i == copy_gas_phase.n_user[j])
|
||||
continue;
|
||||
Utilities::Rxn_copy(Rxn_gas_phase_map, copy_gas_phase.n_user[j], (int)i);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (copy_ss_assemblage.count > 0)
|
||||
copier_clear(©_gas_phase);
|
||||
|
||||
for (size_t j = 0; j < copy_kinetics.n_user.size(); j++)
|
||||
{
|
||||
for (j = 0; j < copy_ss_assemblage.count; j++)
|
||||
if (Utilities::Rxn_find(Rxn_kinetics_map, copy_kinetics.n_user[j]) != NULL)
|
||||
{
|
||||
if (Utilities::Rxn_find(Rxn_ss_assemblage_map, copy_ss_assemblage.n_user[j]) != NULL)
|
||||
for (size_t i = copy_kinetics.start[j]; i <= copy_kinetics.end[j]; i++)
|
||||
{
|
||||
for (i = copy_ss_assemblage.start[j];
|
||||
i <= copy_ss_assemblage.end[j]; i++)
|
||||
{
|
||||
if (i == copy_ss_assemblage.n_user[j])
|
||||
continue;
|
||||
Utilities::Rxn_copy(Rxn_ss_assemblage_map, copy_ss_assemblage.n_user[j], i);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (verbose == TRUE)
|
||||
{
|
||||
warning_msg("SOLID_SOLUTIONS to copy not found.");
|
||||
return_value = ERROR;
|
||||
}
|
||||
if (i == copy_kinetics.n_user[j])
|
||||
continue;
|
||||
Utilities::Rxn_copy(Rxn_kinetics_map, copy_kinetics.n_user[j], (int)i);
|
||||
}
|
||||
}
|
||||
}
|
||||
copy_solution.count = 0;
|
||||
copy_pp_assemblage.count = 0;
|
||||
copy_exchange.count = 0;
|
||||
copy_surface.count = 0;
|
||||
copy_ss_assemblage.count = 0;
|
||||
copy_gas_phase.count = 0;
|
||||
copy_kinetics.count = 0;
|
||||
copy_mix.count = 0;
|
||||
copy_reaction.count = 0;
|
||||
copy_temperature.count = 0;
|
||||
copy_pressure.count = 0;
|
||||
copier_clear(©_kinetics);
|
||||
|
||||
for (size_t j = 0; j < copy_ss_assemblage.n_user.size(); j++)
|
||||
{
|
||||
if (Utilities::Rxn_find(Rxn_ss_assemblage_map, copy_ss_assemblage.n_user[j]) != NULL)
|
||||
{
|
||||
for (size_t i = copy_ss_assemblage.start[j]; i <= copy_ss_assemblage.end[j]; i++)
|
||||
{
|
||||
if (i == copy_ss_assemblage.n_user[j])
|
||||
continue;
|
||||
Utilities::Rxn_copy(Rxn_ss_assemblage_map, copy_ss_assemblage.n_user[j], (int)i);
|
||||
}
|
||||
}
|
||||
}
|
||||
copier_clear(©_ss_assemblage);
|
||||
|
||||
new_copy = FALSE;
|
||||
return return_value;
|
||||
}
|
||||
|
||||
@ -166,20 +166,6 @@ clean_up(void)
|
||||
llnl_bdh.clear();
|
||||
llnl_bdot.clear();
|
||||
llnl_co2_coefs.clear();
|
||||
/*
|
||||
* Copier space
|
||||
*/
|
||||
copier_free(©_solution);
|
||||
copier_free(©_pp_assemblage);
|
||||
copier_free(©_exchange);
|
||||
copier_free(©_surface);
|
||||
copier_free(©_ss_assemblage);
|
||||
copier_free(©_gas_phase);
|
||||
copier_free(©_kinetics);
|
||||
copier_free(©_mix);
|
||||
copier_free(©_reaction);
|
||||
copier_free(©_temperature);
|
||||
copier_free(©_pressure);
|
||||
/* master_isotope */
|
||||
for (i = 0; i < (int)master_isotope.size(); i++)
|
||||
{
|
||||
@ -3333,79 +3319,31 @@ copier_add(struct copier *copier_ptr, int n_user, int start, int end)
|
||||
* add new set of copy instructions
|
||||
*/
|
||||
{
|
||||
|
||||
if (copier_ptr->count >= copier_ptr->max)
|
||||
{
|
||||
copier_ptr->max = copier_ptr->count * 2;
|
||||
copier_ptr->n_user =
|
||||
(int *) PHRQ_realloc(copier_ptr->n_user,
|
||||
(size_t) (copier_ptr->max * sizeof(int)));
|
||||
if (copier_ptr->n_user == NULL)
|
||||
{
|
||||
malloc_error();
|
||||
return (OK);
|
||||
}
|
||||
copier_ptr->start =
|
||||
(int *) PHRQ_realloc(copier_ptr->start,
|
||||
(size_t) (copier_ptr->max * sizeof(int)));
|
||||
if (copier_ptr->start == NULL)
|
||||
{
|
||||
malloc_error();
|
||||
return (OK);
|
||||
}
|
||||
copier_ptr->end =
|
||||
(int *) PHRQ_realloc(copier_ptr->end,
|
||||
(size_t) (copier_ptr->max * sizeof(int)));
|
||||
if (copier_ptr->end == NULL)
|
||||
{
|
||||
malloc_error();
|
||||
return (OK);
|
||||
}
|
||||
}
|
||||
copier_ptr->n_user[copier_ptr->count] = n_user;
|
||||
copier_ptr->start[copier_ptr->count] = start;
|
||||
copier_ptr->end[copier_ptr->count] = end;
|
||||
copier_ptr->count++;
|
||||
copier_ptr->n_user.push_back(n_user);
|
||||
copier_ptr->start.push_back(start);
|
||||
copier_ptr->end.push_back(end);
|
||||
return (OK);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
int Phreeqc::
|
||||
copier_free(struct copier *copier_ptr)
|
||||
copier_clear(struct copier* copier_ptr)
|
||||
/* ---------------------------------------------------------------------- */
|
||||
/*
|
||||
* initialize copier structure
|
||||
* clear copier
|
||||
*/
|
||||
{
|
||||
|
||||
copier_ptr->n_user = (int *) free_check_null(copier_ptr->n_user);
|
||||
copier_ptr->start = (int *) free_check_null(copier_ptr->start);
|
||||
copier_ptr->end = (int *) free_check_null(copier_ptr->end);
|
||||
copier_ptr->n_user.clear();
|
||||
copier_ptr->start.clear();
|
||||
copier_ptr->end.clear();
|
||||
return (OK);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
int Phreeqc::
|
||||
copier_init(struct copier *copier_ptr)
|
||||
/* ---------------------------------------------------------------------- */
|
||||
/*
|
||||
* initialize copier structure
|
||||
*/
|
||||
{
|
||||
|
||||
copier_ptr->count = 0;
|
||||
copier_ptr->max = 10;
|
||||
copier_ptr->n_user = (int *) PHRQ_malloc(
|
||||
(size_t)copier_ptr->max * sizeof(int));
|
||||
copier_ptr->start = (int *) PHRQ_malloc(
|
||||
(size_t)copier_ptr->max * sizeof(int));
|
||||
copier_ptr->end =(int *) PHRQ_malloc((size_t)copier_ptr->max * sizeof(int));
|
||||
return (OK);
|
||||
}
|
||||
#include "StorageBin.h"
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
void Phreeqc::
|
||||
Use2cxxStorageBin(cxxStorageBin & sb)
|
||||
/* ---------------------------------------------------------------------- */
|
||||
{
|
||||
//Add everything from use structure to storagebin sb
|
||||
|
||||
|
||||
@ -572,31 +572,24 @@ dup_print(const char *ptr, int emphasis)
|
||||
* a row of dashes before and after the character string.
|
||||
*
|
||||
*/
|
||||
int l, i;
|
||||
char *dash;
|
||||
int l;
|
||||
|
||||
if (pr.headings == FALSE)
|
||||
return (OK);
|
||||
std::string save_in(ptr);
|
||||
l = (int) strlen(ptr);
|
||||
dash = (char *) PHRQ_malloc(((size_t)l + 2) * sizeof(char));
|
||||
if (dash == NULL)
|
||||
malloc_error();
|
||||
if (emphasis == TRUE)
|
||||
{
|
||||
for (i = 0; i < l; i++)
|
||||
dash[i] = '-';
|
||||
dash[i] = '\0';
|
||||
output_msg(sformatf("%s\n%s\n%s\n\n", dash, save_in.c_str(), dash));
|
||||
log_msg(sformatf("%s\n%s\n%s\n\n", dash, save_in.c_str(), dash));
|
||||
std::string dash;
|
||||
dash.resize(l, '-');
|
||||
output_msg(sformatf("%s\n%s\n%s\n\n", dash.c_str(), save_in.c_str(), dash));
|
||||
log_msg(sformatf("%s\n%s\n%s\n\n", dash.c_str(), save_in.c_str(), dash));
|
||||
}
|
||||
else
|
||||
{
|
||||
output_msg(sformatf("%s\n\n", save_in.c_str()));
|
||||
log_msg(sformatf("%s\n\n", save_in.c_str()));
|
||||
}
|
||||
dash = (char *) free_check_null(dash);
|
||||
|
||||
return (OK);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user