From 7c0fb65b72bc02f5c9497ff5ada41278e7f3d12d Mon Sep 17 00:00:00 2001 From: David Parkhurst Date: Sun, 5 Aug 2018 15:01:51 -0600 Subject: [PATCH] [phreeqc3] needed to check gas phase type for same model, added test case --- GasPhase.h | 3 ++- Phreeqc.cpp | 1 + global_structures.h | 2 ++ prep.cpp | 4 ++++ tidy.cpp | 1 + 5 files changed, 10 insertions(+), 1 deletion(-) diff --git a/GasPhase.h b/GasPhase.h index 7dde49d1..5741f10c 100644 --- a/GasPhase.h +++ b/GasPhase.h @@ -24,7 +24,8 @@ class cxxGasPhase:public cxxNumKeyword enum GP_TYPE { GP_PRESSURE = 0, - GP_VOLUME = 1 + GP_VOLUME = 1, + GP_UNKNOWN = 2 }; //void dump_xml(std::ostream& os, unsigned int indent = 0)const; diff --git a/Phreeqc.cpp b/Phreeqc.cpp index c001300b..f50a0dbd 100644 --- a/Phreeqc.cpp +++ b/Phreeqc.cpp @@ -213,6 +213,7 @@ void Phreeqc::init(void) last_model.count_kinetics = -1; last_model.kinetics = NULL; last_model.count_gas_phase = -1; + last_model.gas_phase_type = cxxGasPhase::GP_UNKNOWN; last_model.gas_phase = NULL; last_model.count_ss_assemblage = -1; last_model.ss_assemblage = NULL; diff --git a/global_structures.h b/global_structures.h index aec2ab56..90cb786d 100644 --- a/global_structures.h +++ b/global_structures.h @@ -1,6 +1,7 @@ #ifndef _INC_GLOBAL_STRUCTURES_H #define _INC_GLOBAL_STRUCTURES_H #include "Surface.h" +#include "GasPhase.h" /* ---------------------------------------------------------------------- * #define DEFINITIONS * ---------------------------------------------------------------------- */ @@ -246,6 +247,7 @@ struct model struct kinetics *kinetics; int count_gas_phase; + cxxGasPhase::GP_TYPE gas_phase_type; struct phase **gas_phase; int count_ss_assemblage; diff --git a/prep.cpp b/prep.cpp index e565aea6..8deef0a1 100644 --- a/prep.cpp +++ b/prep.cpp @@ -5860,6 +5860,7 @@ save_model(void) { cxxGasPhase * gas_phase_ptr = use.Get_gas_phase_ptr(); last_model.count_gas_phase = (int) gas_phase_ptr->Get_gas_comps().size(); + last_model.gas_phase_type = gas_phase_ptr->Get_type(); last_model.gas_phase = (struct phase **) PHRQ_malloc((size_t) last_model.count_gas_phase * sizeof(struct phase *)); @@ -5877,6 +5878,7 @@ save_model(void) else { last_model.count_gas_phase = 0; + last_model.gas_phase_type = cxxGasPhase::GP_UNKNOWN; last_model.gas_phase = NULL; } /* @@ -6059,6 +6061,8 @@ check_same_model(void) return (FALSE); if (last_model.count_gas_phase != (int) gas_phase_ptr->Get_gas_comps().size()) return (FALSE); + if (last_model.gas_phase_type != gas_phase_ptr->Get_type()) + return (FALSE); for (i = 0; i < (int) gas_phase_ptr->Get_gas_comps().size(); i++) { cxxGasComp *gc_ptr = &(gas_phase_ptr->Get_gas_comps()[i]); diff --git a/tidy.cpp b/tidy.cpp index d953910d..865f01c9 100644 --- a/tidy.cpp +++ b/tidy.cpp @@ -5471,6 +5471,7 @@ reset_last_model(void) last_model.exchange = (struct master **) free_check_null(last_model.exchange); last_model.count_gas_phase = 0; + last_model.gas_phase_type = cxxGasPhase::GP_UNKNOWN; last_model.gas_phase = (struct phase **) free_check_null(last_model.gas_phase); last_model.count_ss_assemblage = 0;