From b0b007ca92ba9ea9b670bd424a735f68fa733a91 Mon Sep 17 00:00:00 2001 From: David L Parkhurst Date: Tue, 17 Jul 2012 17:12:50 +0000 Subject: [PATCH] const static vopts git-svn-id: svn://136.177.114.72/svn_GW/phreeqc3/trunk@6793 1feff8c3-07ed-0310-ac33-dd36852eb9cd --- ChartObject.cpp | 51 ++++++++++++++++----------------- ChartObject.h | 1 + ExchComp.cxx | 33 +++++++++------------ ExchComp.h | 2 +- Exchange.cxx | 27 +++++++----------- Exchange.h | 1 + GasComp.cxx | 23 ++++++--------- GasComp.h | 1 + GasPhase.cxx | 40 +++++++++++--------------- GasPhase.h | 1 + KineticsComp.cxx | 28 +++++++----------- KineticsComp.h | 2 +- PPassemblage.cxx | 22 ++++++-------- PPassemblage.h | 2 +- PPassemblageComp.cxx | 35 +++++++++-------------- PPassemblageComp.h | 2 +- Pressure.cxx | 20 +++++-------- Pressure.h | 2 +- Reaction.cxx | 26 +++++++---------- Reaction.h | 2 +- SS.cxx | 49 ++++++++++++++----------------- SS.h | 1 + SSassemblage.cxx | 20 +++++-------- SSassemblage.h | 1 + SScomp.cxx | 35 +++++++++-------------- SScomp.h | 1 + Solution.cxx | 58 +++++++++++++++++-------------------- Solution.h | 1 + SolutionIsotope.cxx | 29 +++++++------------ SolutionIsotope.h | 1 + StorageBinList.cpp | 50 ++++++++++++++------------------ StorageBinList.h | 1 + Surface.cxx | 49 ++++++++++++++----------------- Surface.h | 1 + SurfaceCharge.cxx | 44 +++++++++++++--------------- SurfaceCharge.h | 1 + SurfaceComp.cxx | 41 +++++++++++--------------- SurfaceComp.h | 1 + Temperature.cxx | 19 ++++--------- Temperature.h | 2 +- cxxKinetics.cxx | 37 +++++++++++------------- cxxKinetics.h | 1 + cxxMix.cxx | 12 ++------ cxxMix.h | 1 + dumper.cpp | 68 ++++++++++++++++++++------------------------ dumper.h | 1 + runner.cpp | 26 +++++++---------- runner.h | 1 + 48 files changed, 369 insertions(+), 504 deletions(-) diff --git a/ChartObject.cpp b/ChartObject.cpp index 7f64ccb6..e244169c 100644 --- a/ChartObject.cpp +++ b/ChartObject.cpp @@ -243,34 +243,7 @@ ChartObject::Set_axis_scale(CParser & parser) bool ChartObject::Read(CParser & parser) { -#if defined(NO_STATIC_VOPTS) - std::vector < std::string > vopts; -#else - static std::vector < std::string > vopts; -#endif - if (vopts.empty()) - { - vopts.reserve(20); - vopts.push_back("start"); // 0 - vopts.push_back("end"); // 1 - vopts.push_back("heading"); // 2 - vopts.push_back("headings"); // 3 - vopts.push_back("chart_title"); // 4 - vopts.push_back("axis_titles"); // 5 - vopts.push_back("axis_scale"); // 6 - vopts.push_back("initial_solutions"); // 7 - vopts.push_back("plot_concentration_vs"); // 8 - vopts.push_back("shifts_as_points"); // 9 - vopts.push_back("grid_offset"); // 10 - vopts.push_back("connect_simulations"); // 11 - vopts.push_back("plot_csv_file"); // 12 - vopts.push_back("clear"); // 13 - vopts.push_back("detach"); // 14 - vopts.push_back("active"); // 15 - vopts.push_back("batch"); // 16 - vopts.push_back("plot_tsv_file"); // 17 - } std::istream::pos_type ptr; std::istream::pos_type next_char; std::string token; @@ -1418,4 +1391,28 @@ ChartObject::dump(std::ostream & oss, unsigned int indent) bool form_started; */ } + +const std::vector< std::string >::value_type temp_vopts[] = { + std::vector< std::string >::value_type("start"), // 0 + std::vector< std::string >::value_type("end"), // 1 + std::vector< std::string >::value_type("heading"), // 2 + std::vector< std::string >::value_type("headings"), // 3 + std::vector< std::string >::value_type("chart_title"), // 4 + std::vector< std::string >::value_type("axis_titles"), // 5 + std::vector< std::string >::value_type("axis_scale"), // 6 + std::vector< std::string >::value_type("initial_solutions"), // 7 + std::vector< std::string >::value_type("plot_concentration_vs"), // 8 + std::vector< std::string >::value_type("shifts_as_points"), // 9 + std::vector< std::string >::value_type("grid_offset"), // 10 + std::vector< std::string >::value_type("connect_simulations"), // 11 + std::vector< std::string >::value_type("plot_csv_file"), // 12 + std::vector< std::string >::value_type("clear"), // 13 + std::vector< std::string >::value_type("detach"), // 14 + std::vector< std::string >::value_type("active"), // 15 + std::vector< std::string >::value_type("batch"), // 16 + std::vector< std::string >::value_type("plot_tsv_file") // 17 +}; +const std::vector< std::string > ChartObject::vopts(temp_vopts, temp_vopts + sizeof temp_vopts / sizeof temp_vopts[0]); + + #endif // MULTICHART \ No newline at end of file diff --git a/ChartObject.h b/ChartObject.h index 2bac49ba..91b530f0 100644 --- a/ChartObject.h +++ b/ChartObject.h @@ -430,6 +430,7 @@ class ChartObject:public cxxNumKeyword bool batch_background; std::string batch_fn; chart_batch_type batch; + const static std::vector < std::string > vopts; public: int usingResource; diff --git a/ExchComp.cxx b/ExchComp.cxx index 25ae0c2c..a1262519 100644 --- a/ExchComp.cxx +++ b/ExchComp.cxx @@ -179,26 +179,6 @@ cxxExchComp::read_raw(CParser & parser, bool check) { std::string str; -#if defined(NO_STATIC_VOPTS) - std::vector < std::string > vopts; -#else - static std::vector < std::string > vopts; -#endif - if (vopts.empty()) - { - vopts.reserve(10); - vopts.push_back("formula"); // 0 - vopts.push_back("moles"); // 1 - vopts.push_back("la"); // 2 - vopts.push_back("charge_balance"); // 3 - vopts.push_back("phase_name"); // 4 - vopts.push_back("rate_name"); // 5 - vopts.push_back("formula_z"); // 6 - vopts.push_back("phase_proportion"); // 7 - vopts.push_back("totals"); // 8 - vopts.push_back("formula_totals"); // 9 - } - std::istream::pos_type ptr; std::istream::pos_type next_char; std::string token; @@ -464,3 +444,16 @@ cxxExchComp::mpi_unpack(int *ints, int *ii, LDBLE *doubles, int *dd) *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 + std::vector< std::string >::value_type("la"), // 2 + std::vector< std::string >::value_type("charge_balance"), // 3 + std::vector< std::string >::value_type("phase_name"), // 4 + std::vector< std::string >::value_type("rate_name"), // 5 + std::vector< std::string >::value_type("formula_z"), // 6 + std::vector< std::string >::value_type("phase_proportion"), // 7 + std::vector< std::string >::value_type("totals"), // 8 + std::vector< std::string >::value_type("formula_totals") // 9 +}; +const std::vector< std::string > cxxExchComp::vopts(temp_vopts, temp_vopts + sizeof temp_vopts / sizeof temp_vopts[0]); \ No newline at end of file diff --git a/ExchComp.h b/ExchComp.h index 45941d0b..c2ea9494 100644 --- a/ExchComp.h +++ b/ExchComp.h @@ -120,7 +120,7 @@ class cxxExchComp: public PHRQ_base LDBLE phase_proportion; std::string rate_name; LDBLE formula_z; // charge on formula - + const static std::vector < std::string > vopts; public: }; diff --git a/Exchange.cxx b/Exchange.cxx index 06e314ff..5eea0aaf 100644 --- a/Exchange.cxx +++ b/Exchange.cxx @@ -196,23 +196,6 @@ cxxExchange::dump_raw(std::ostream & s_oss, unsigned int indent, int *n_out) con void cxxExchange::read_raw(CParser & parser, bool check) { -#if defined(NO_STATIC_VOPTS) - std::vector < std::string > vopts; -#else - static std::vector < std::string > vopts; -#endif - if (vopts.empty()) - { - vopts.reserve(15); - vopts.push_back("pitzer_exchange_gammas"); // 0 - vopts.push_back("component"); // 1 - vopts.push_back("exchange_gammas"); // 2 - vopts.push_back("new_def"); // 3 - vopts.push_back("solution_equilibria"); // 4 - vopts.push_back("n_solution"); // 5 - vopts.push_back("totals"); // 6 - } - std::istream::pos_type ptr; std::istream::pos_type next_char; std::string token; @@ -498,3 +481,13 @@ Sort_comps(void) } } } +const std::vector< std::string >::value_type temp_vopts[] = { + std::vector< std::string >::value_type("pitzer_exchange_gammas"), // 0 + std::vector< std::string >::value_type("component"), // 1 + std::vector< std::string >::value_type("exchange_gammas"), // 2 + std::vector< std::string >::value_type("new_def"), // 3 + std::vector< std::string >::value_type("solution_equilibria"), // 4 + std::vector< std::string >::value_type("n_solution"), // 5 + std::vector< std::string >::value_type("totals") // 6 +}; +const std::vector< std::string > cxxExchange::vopts(temp_vopts, temp_vopts + sizeof temp_vopts / sizeof temp_vopts[0]); \ No newline at end of file diff --git a/Exchange.h b/Exchange.h index adbf5b40..44f48f9d 100644 --- a/Exchange.h +++ b/Exchange.h @@ -68,6 +68,7 @@ protected: // exchange workspace variables cxxNameDouble totals; + const static std::vector < std::string > vopts; public: }; diff --git a/GasComp.cxx b/GasComp.cxx index c6da042b..af3973b8 100644 --- a/GasComp.cxx +++ b/GasComp.cxx @@ -62,20 +62,6 @@ cxxGasComp::read_raw(CParser & parser, bool check) { std::string str; -#if defined(NO_STATIC_VOPTS) - std::vector < std::string > vopts; -#else - static std::vector < std::string > vopts; -#endif - if (vopts.empty()) - { - vopts.reserve(10); - vopts.push_back("phase_name"); // 0 - vopts.push_back("name"); // 1 - vopts.push_back("p_read"); // 2 - vopts.push_back("moles"); // 3 - vopts.push_back("initial_moles"); // 4 - } int errors = parser.get_input_error(); std::istream::pos_type ptr; @@ -192,4 +178,11 @@ cxxGasComp::multiply(LDBLE extensive) this->moles *= extensive; this->initial_moles *= extensive; } - +const std::vector< std::string >::value_type temp_vopts[] = { + std::vector< std::string >::value_type("phase_name"), // 0 + std::vector< std::string >::value_type("name"), // 1 + std::vector< std::string >::value_type("p_read"), // 2 + std::vector< std::string >::value_type("moles"), // 3 + std::vector< std::string >::value_type("initial_moles") // 4 +}; +const std::vector< std::string > cxxGasComp::vopts(temp_vopts, temp_vopts + sizeof temp_vopts / sizeof temp_vopts[0]); diff --git a/GasComp.h b/GasComp.h index 3973d25d..e4ab7663 100644 --- a/GasComp.h +++ b/GasComp.h @@ -46,6 +46,7 @@ class cxxGasComp: public PHRQ_base LDBLE p_read; // internal workspace LDBLE initial_moles; + const static std::vector < std::string > vopts; }; #endif // !defined(GASCOMP_H_INCLUDED) diff --git a/GasPhase.cxx b/GasPhase.cxx index 8b15ad0f..5774651a 100644 --- a/GasPhase.cxx +++ b/GasPhase.cxx @@ -273,28 +273,6 @@ cxxGasPhase::read_raw(CParser & parser, bool check) { int i; -#if defined(NO_STATIC_VOPTS) - std::vector < std::string > vopts; -#else - static std::vector < std::string > vopts; -#endif - if (vopts.empty()) - { - vopts.reserve(15); - vopts.push_back("type"); //0 - vopts.push_back("total_p"); //1 - vopts.push_back("volume"); //2 - vopts.push_back("v_m"); //3 - vopts.push_back("component"); //4 - vopts.push_back("pressure"); //5 - vopts.push_back("pr_in"); //6 - vopts.push_back("new_def"); //7 - vopts.push_back("solution_equilibria"); //8 - vopts.push_back("n_solution"); //9 - vopts.push_back("total_moles"); //10 - vopts.push_back("temperature"); //11 - vopts.push_back("totals"); //12 - } std::istream::pos_type ptr; std::istream::pos_type next_char; @@ -631,4 +609,20 @@ cxxGasPhase::Find_comp(const char * comp_name) } } return NULL; -} \ No newline at end of file +} +const std::vector< std::string >::value_type temp_vopts[] = { + std::vector< std::string >::value_type("type"), //0 + std::vector< std::string >::value_type("total_p"), //1 + std::vector< std::string >::value_type("volume"), //2 + std::vector< std::string >::value_type("v_m"), //3 + std::vector< std::string >::value_type("component"), //4 + std::vector< std::string >::value_type("pressure"), //5 + std::vector< std::string >::value_type("pr_in"), //6 + std::vector< std::string >::value_type("new_def"), //7 + std::vector< std::string >::value_type("solution_equilibria"), //8 + std::vector< std::string >::value_type("n_solution"), //9 + std::vector< std::string >::value_type("total_moles"), //10 + std::vector< std::string >::value_type("temperature"), //11 + std::vector< std::string >::value_type("totals") //12 +}; +const std::vector< std::string > cxxGasPhase::vopts(temp_vopts, temp_vopts + sizeof temp_vopts / sizeof temp_vopts[0]); \ No newline at end of file diff --git a/GasPhase.h b/GasPhase.h index 7796c999..d703cfe9 100644 --- a/GasPhase.h +++ b/GasPhase.h @@ -94,6 +94,7 @@ protected: LDBLE v_m; bool pr_in; cxxNameDouble totals; + const static std::vector < std::string > vopts; }; #endif // !defined(GASPHASE_H_INCLUDED) diff --git a/KineticsComp.cxx b/KineticsComp.cxx index e7824a33..a764e5e0 100644 --- a/KineticsComp.cxx +++ b/KineticsComp.cxx @@ -134,23 +134,6 @@ cxxKineticsComp::read_raw(CParser & parser, bool check) { std::string str; -#if defined(NO_STATIC_VOPTS) - std::vector < std::string > vopts; -#else - static std::vector < std::string > vopts; -#endif - if (vopts.empty()) - { - vopts.reserve(10); - vopts.push_back("rate_name_not_used"); // 0 - vopts.push_back("tol"); // 1 - vopts.push_back("m"); // 2 - vopts.push_back("m0"); // 3 - vopts.push_back("moles"); // 4 - vopts.push_back("namecoef"); // 5 - vopts.push_back("d_params"); // 6 - vopts.push_back("initial_moles"); // 7 - } std::istream::pos_type ptr; std::istream::pos_type next_char; @@ -366,3 +349,14 @@ cxxKineticsComp::multiply(LDBLE extensive) this->m0 *= extensive; this->moles *= extensive; } +const std::vector< std::string >::value_type temp_vopts[] = { + std::vector< std::string >::value_type("rate_name_not_used"), // 0 + std::vector< std::string >::value_type("tol"), // 1 + std::vector< std::string >::value_type("m"), // 2 + std::vector< std::string >::value_type("m0"), // 3 + std::vector< std::string >::value_type("moles"), // 4 + std::vector< std::string >::value_type("namecoef"), // 5 + std::vector< std::string >::value_type("d_params"), // 6 + std::vector< std::string >::value_type("initial_moles") // 7 +}; +const std::vector< std::string > cxxKineticsComp::vopts(temp_vopts, temp_vopts + sizeof temp_vopts / sizeof temp_vopts[0]); \ No newline at end of file diff --git a/KineticsComp.h b/KineticsComp.h index 747003e5..9fdcfbad 100644 --- a/KineticsComp.h +++ b/KineticsComp.h @@ -71,7 +71,7 @@ public: // kinetics workspace variables LDBLE moles; LDBLE initial_moles; - + const static std::vector < std::string > vopts; public: }; diff --git a/PPassemblage.cxx b/PPassemblage.cxx index 05b97e11..5864cb75 100644 --- a/PPassemblage.cxx +++ b/PPassemblage.cxx @@ -125,19 +125,6 @@ cxxPPassemblage::dump_raw(std::ostream & s_oss, unsigned int indent, int *n_out) void cxxPPassemblage::read_raw(CParser & parser, bool check) { -#if defined(NO_STATIC_VOPTS) - std::vector < std::string > vopts; -#else - static std::vector < std::string > vopts; -#endif - if (vopts.empty()) - { - vopts.reserve(15); - vopts.push_back("eltlist"); // 0 - vopts.push_back("component"); // 1 - vopts.push_back("new_def"); // 2 - vopts.push_back("assemblage_totals"); // 3 - } std::istream::pos_type ptr; std::istream::pos_type next_char; @@ -359,4 +346,11 @@ Find(const std::string name_in) } } return comp; -} \ No newline at end of file +} +const std::vector< std::string >::value_type temp_vopts[] = { + std::vector< std::string >::value_type("eltlist"), // 0 + std::vector< std::string >::value_type("component"), // 1 + std::vector< std::string >::value_type("new_def"), // 2 + std::vector< std::string >::value_type("assemblage_totals") // 3 +}; +const std::vector< std::string > cxxPPassemblage::vopts(temp_vopts, temp_vopts + sizeof temp_vopts / sizeof temp_vopts[0]); \ No newline at end of file diff --git a/PPassemblage.h b/PPassemblage.h index 14738123..6e29930b 100644 --- a/PPassemblage.h +++ b/PPassemblage.h @@ -66,7 +66,7 @@ protected: std::map pp_assemblage_comps; cxxNameDouble eltList; // list of elements in phases (and alternate reactions) cxxNameDouble assemblage_totals; // after totalize, total moles of elements in the PPassemblage - + const static std::vector < std::string > vopts; }; #endif // !defined(PPASSEMBLAGE_H_INCLUDED) diff --git a/PPassemblageComp.cxx b/PPassemblageComp.cxx index 6d69f728..5dc30aec 100644 --- a/PPassemblageComp.cxx +++ b/PPassemblageComp.cxx @@ -106,27 +106,6 @@ cxxPPassemblageComp::read_raw(CParser & parser, bool check) { std::string str; -#if defined(NO_STATIC_VOPTS) - std::vector < std::string > vopts; -#else - static std::vector < std::string > vopts; -#endif - if (vopts.empty()) - { - vopts.reserve(10); - vopts.push_back("name"); // 0 - vopts.push_back("add_formula"); // 1 - vopts.push_back("si"); // 2 - vopts.push_back("moles"); // 3 - vopts.push_back("delta"); // 4 - vopts.push_back("initial_moles"); // 5 - vopts.push_back("dissolve_only"); // 6 - vopts.push_back("force_equality"); // 7 - vopts.push_back("precipitate_only"); // 8 - vopts.push_back("si_org"); // 9 - vopts.push_back("totals"); // 10 - } - std::istream::pos_type ptr; std::istream::pos_type next_char; std::string token; @@ -448,3 +427,17 @@ cxxPPassemblageComp::multiply(LDBLE extensive) this->delta *= extensive; this->initial_moles *= extensive; } +const std::vector< std::string >::value_type temp_vopts[] = { + std::vector< std::string >::value_type("name"), // 0 + std::vector< std::string >::value_type("add_formula"), // 1 + std::vector< std::string >::value_type("si"), // 2 + std::vector< std::string >::value_type("moles"), // 3 + std::vector< std::string >::value_type("delta"), // 4 + std::vector< std::string >::value_type("initial_moles"), // 5 + std::vector< std::string >::value_type("dissolve_only"), // 6 + std::vector< std::string >::value_type("force_equality"), // 7 + std::vector< std::string >::value_type("precipitate_only"), // 8 + std::vector< std::string >::value_type("si_org"), // 9 + std::vector< std::string >::value_type("totals") // 10 +}; +const std::vector< std::string > cxxPPassemblageComp::vopts(temp_vopts, temp_vopts + sizeof temp_vopts / sizeof temp_vopts[0]); \ No newline at end of file diff --git a/PPassemblageComp.h b/PPassemblageComp.h index ce68aec1..254e130e 100644 --- a/PPassemblageComp.h +++ b/PPassemblageComp.h @@ -78,7 +78,7 @@ protected: bool dissolve_only; bool precipitate_only; cxxNameDouble totals; - + const static std::vector < std::string > vopts; public: }; diff --git a/Pressure.cxx b/Pressure.cxx index 6531a994..b91249da 100644 --- a/Pressure.cxx +++ b/Pressure.cxx @@ -198,18 +198,6 @@ cxxPressure::read_raw(CParser & parser) bool cleared_once = false; LDBLE d; CParser::TOKEN_TYPE k; -#if defined(NO_STATIC_VOPTS) - std::vector < std::string > vopts; -#else - static std::vector < std::string > vopts; -#endif - if (vopts.empty()) - { - vopts.reserve(5); - vopts.push_back("pressures"); //0 - vopts.push_back("equal_increments"); //1 - vopts.push_back("count"); //2 - } std::istream::pos_type ptr; std::istream::pos_type next_char = 0; @@ -407,4 +395,10 @@ Get_count(void) const return this->count; } return (int) this->pressures.size(); -} \ No newline at end of file +} +const std::vector< std::string >::value_type temp_vopts[] = { + std::vector< std::string >::value_type("pressures"), //0 + std::vector< std::string >::value_type("equal_increments"), //1 + std::vector< std::string >::value_type("count") //2 +}; +const std::vector< std::string > cxxPressure::vopts(temp_vopts, temp_vopts + sizeof temp_vopts / sizeof temp_vopts[0]); \ No newline at end of file diff --git a/Pressure.h b/Pressure.h index da9fe36f..fc7209fe 100644 --- a/Pressure.h +++ b/Pressure.h @@ -33,7 +33,7 @@ protected: std::vector < LDBLE >pressures; int count; bool equalIncrements; - + const static std::vector < std::string > vopts; }; #endif // !defined(PRESSURE_H_INCLUDED) diff --git a/Reaction.cxx b/Reaction.cxx index 298f0074..44252814 100644 --- a/Reaction.cxx +++ b/Reaction.cxx @@ -131,21 +131,6 @@ cxxReaction::read_raw(CParser & parser, const bool check) int j; LDBLE d; CParser::TOKEN_TYPE k; -#if defined(NO_STATIC_VOPTS) - std::vector < std::string > vopts; -#else - static std::vector < std::string > vopts; -#endif - if (vopts.empty()) - { - vopts.reserve(15); - vopts.push_back("units"); //0 - vopts.push_back("reactant_list"); //1 - vopts.push_back("element_list"); //2 - vopts.push_back("steps"); //3 - vopts.push_back("equal_increments"); //4 - vopts.push_back("count_steps"); //5 - } // clear steps for modify operation, if steps are read bool cleared_once = false; @@ -315,4 +300,13 @@ Get_reaction_steps(void) const return this->countSteps; } return (int) this->steps.size(); -} \ No newline at end of file +} +const std::vector< std::string >::value_type temp_vopts[] = { + std::vector< std::string >::value_type("units"), //0 + std::vector< std::string >::value_type("reactant_list"), //1 + std::vector< std::string >::value_type("element_list"), //2 + std::vector< std::string >::value_type("steps"), //3 + std::vector< std::string >::value_type("equal_increments"), //4 + std::vector< std::string >::value_type("count_steps") //5 +}; +const std::vector< std::string > cxxReaction::vopts(temp_vopts, temp_vopts + sizeof temp_vopts / sizeof temp_vopts[0]); \ No newline at end of file diff --git a/Reaction.h b/Reaction.h index ea15340c..d03cef64 100644 --- a/Reaction.h +++ b/Reaction.h @@ -51,7 +51,7 @@ protected: int countSteps; bool equalIncrements; std::string units; - + const static std::vector < std::string > vopts; }; #endif // !defined(REACTION_H_INCLUDED) diff --git a/SS.cxx b/SS.cxx index 04e8ba1f..d692d38b 100644 --- a/SS.cxx +++ b/SS.cxx @@ -126,34 +126,6 @@ cxxSS::read_raw(CParser & parser, bool check) { std::string str; -#if defined(NO_STATIC_VOPTS) - std::vector < std::string > vopts; -#else - static std::vector < std::string > vopts; -#endif - if (vopts.empty()) - { - vopts.reserve(10); - vopts.push_back("ss_name"); // 0 - vopts.push_back("total_moles"); // 1 - vopts.push_back("a0"); // 2 - vopts.push_back("a1"); // 3 - vopts.push_back("components"); // 4 - vopts.push_back("miscibility"); // 5 - vopts.push_back("spinodal"); // 6 - vopts.push_back("tk"); // 7 - vopts.push_back("xb1"); // 8 - vopts.push_back("xb2"); // 9 - vopts.push_back("ag0"); // 10 - vopts.push_back("ag1"); // 11 - vopts.push_back("component"); // 12 - vopts.push_back("input_case"); //13 - vopts.push_back("p"); //14 - vopts.push_back("ss_in"); //15 - vopts.push_back("totals"); //16 - vopts.push_back("dn"); //17 - } - std::istream::pos_type ptr; std::istream::pos_type next_char; std::string token; @@ -596,3 +568,24 @@ cxxSS::Find(const char * comp_name) } return NULL; } +const std::vector< std::string >::value_type temp_vopts[] = { + std::vector< std::string >::value_type("ss_name"), // 0 + std::vector< std::string >::value_type("total_moles"), // 1 + std::vector< std::string >::value_type("a0"), // 2 + std::vector< std::string >::value_type("a1"), // 3 + std::vector< std::string >::value_type("components"), // 4 + std::vector< std::string >::value_type("miscibility"), // 5 + std::vector< std::string >::value_type("spinodal"), // 6 + std::vector< std::string >::value_type("tk"), // 7 + std::vector< std::string >::value_type("xb1"), // 8 + std::vector< std::string >::value_type("xb2"), // 9 + std::vector< std::string >::value_type("ag0"), // 10 + std::vector< std::string >::value_type("ag1"), // 11 + std::vector< std::string >::value_type("component"), // 12 + std::vector< std::string >::value_type("input_case"), //13 + std::vector< std::string >::value_type("p"), //14 + std::vector< std::string >::value_type("ss_in"), //15 + std::vector< std::string >::value_type("totals"), //16 + std::vector< std::string >::value_type("dn") //17 +}; +const std::vector< std::string > cxxSS::vopts(temp_vopts, temp_vopts + sizeof temp_vopts / sizeof temp_vopts[0]); \ No newline at end of file diff --git a/SS.h b/SS.h index 1896c881..24932d0d 100644 --- a/SS.h +++ b/SS.h @@ -121,6 +121,7 @@ protected: LDBLE dn; bool ss_in; cxxNameDouble totals; + const static std::vector < std::string > vopts; public: }; diff --git a/SSassemblage.cxx b/SSassemblage.cxx index 68710afe..4c554b98 100644 --- a/SSassemblage.cxx +++ b/SSassemblage.cxx @@ -126,18 +126,6 @@ cxxSSassemblage::dump_raw(std::ostream & s_oss, unsigned int indent, int *n_out) void cxxSSassemblage::read_raw(CParser & parser, bool check) { -#if defined(NO_STATIC_VOPTS) - std::vector < std::string > vopts; -#else - static std::vector < std::string > vopts; -#endif - if (vopts.empty()) - { - vopts.reserve(10); - vopts.push_back("solid_solution"); // 0 - vopts.push_back("ssassemblage_totals"); // 1 - vopts.push_back("new_def"); // 2 - } std::istream::pos_type ptr; std::istream::pos_type next_char; @@ -339,4 +327,10 @@ Find(const std::string &s) if (it != this->SSs.end()) return &(it->second); return NULL; -} \ No newline at end of file +} +const std::vector< std::string >::value_type temp_vopts[] = { + std::vector< std::string >::value_type("solid_solution"), // 0 + std::vector< std::string >::value_type("ssassemblage_totals"), // 1 + std::vector< std::string >::value_type("new_def") // 2 +}; +const std::vector< std::string > cxxSSassemblage::vopts(temp_vopts, temp_vopts + sizeof temp_vopts / sizeof temp_vopts[0]); diff --git a/SSassemblage.h b/SSassemblage.h index 58cad0b0..1a514836 100644 --- a/SSassemblage.h +++ b/SSassemblage.h @@ -55,6 +55,7 @@ protected: bool new_def; // internal variables cxxNameDouble totals; + const static std::vector < std::string > vopts; }; #endif // !defined(SSASSEMBLAGE_H_INCLUDED) diff --git a/SScomp.cxx b/SScomp.cxx index fad17289..15ec60f0 100644 --- a/SScomp.cxx +++ b/SScomp.cxx @@ -92,27 +92,6 @@ cxxSScomp::read_raw(CParser & parser, bool check) { std::string str; -#if defined(NO_STATIC_VOPTS) - std::vector < std::string > vopts; -#else - static std::vector < std::string > vopts; -#endif - if (vopts.empty()) - { - vopts.reserve(10); - vopts.push_back("name"); // 0 - vopts.push_back("initial_moles"); // 1 - vopts.push_back("moles"); // 2 - vopts.push_back("init_moles"); // 3 - vopts.push_back("delta"); // 4 - vopts.push_back("fraction_x"); // 5 - vopts.push_back("log10_lambda"); // 6 - vopts.push_back("log10_fraction_x"); // 7 - vopts.push_back("dn"); // 8 - vopts.push_back("dnc"); // 9 - vopts.push_back("dnb"); // 10 - } - std::istream::pos_type ptr; std::istream::pos_type next_char; std::string token; @@ -337,3 +316,17 @@ cxxSScomp::multiply(double extensive) this->delta *= extensive; this->initial_moles *= extensive; } +const std::vector< std::string >::value_type temp_vopts[] = { + std::vector< std::string >::value_type("name"), // 0 + std::vector< std::string >::value_type("initial_moles"), // 1 + std::vector< std::string >::value_type("moles"), // 2 + std::vector< std::string >::value_type("init_moles"), // 3 + std::vector< std::string >::value_type("delta"), // 4 + std::vector< std::string >::value_type("fraction_x"), // 5 + std::vector< std::string >::value_type("log10_lambda"), // 6 + std::vector< std::string >::value_type("log10_fraction_x"), // 7 + std::vector< std::string >::value_type("dn"), // 8 + std::vector< std::string >::value_type("dnc"), // 9 + std::vector< std::string >::value_type("dnb") // 10 +}; +const std::vector< std::string > cxxSScomp::vopts(temp_vopts, temp_vopts + sizeof temp_vopts / sizeof temp_vopts[0]); \ No newline at end of file diff --git a/SScomp.h b/SScomp.h index a26ea1d7..0b0f4b55 100644 --- a/SScomp.h +++ b/SScomp.h @@ -62,6 +62,7 @@ protected: LDBLE log10_lambda; LDBLE log10_fraction_x; LDBLE dn, dnc, dnb; + const static std::vector < std::string > vopts; }; #endif // !defined(SSCOMP_H_INCLUDED) diff --git a/Solution.cxx b/Solution.cxx index a8faa359..8deb02db 100644 --- a/Solution.cxx +++ b/Solution.cxx @@ -291,37 +291,6 @@ cxxSolution::dump_raw(std::ostream & s_oss, unsigned int indent, int *n_out) con void cxxSolution::read_raw(CParser & parser, bool check) { -#if defined(NO_STATIC_VOPTS) - std::vector < std::string > vopts; -#else - static std::vector < std::string > vopts; -#endif - if (vopts.empty()) - { - vopts.reserve(21); - vopts.push_back("totals"); // 0 - vopts.push_back("activities"); // 1 - vopts.push_back("gammas"); // 2 - vopts.push_back("isotopes"); // 3 - vopts.push_back("temp"); // 4 - vopts.push_back("tc_avoid_conflict_with_technetium"); // 5 - vopts.push_back("temperature"); // 6 - vopts.push_back("ph"); // 7 - vopts.push_back("pe"); // 8 - vopts.push_back("mu"); // 9 - vopts.push_back("ionic_strength"); // 10 - vopts.push_back("ah2o"); // 11 - vopts.push_back("activity_water"); // 12 - vopts.push_back("total_h"); // 13 - vopts.push_back("total_o"); // 14 - vopts.push_back("mass_water"); // 15 - vopts.push_back("mass_h2o"); // 16 - vopts.push_back("total_alkalinity"); // 17 - vopts.push_back("total_alk"); // 18 - vopts.push_back("cb"); // 19 - vopts.push_back("charge_balance"); // 20 - vopts.push_back("density"); // 21 - } // Used if it is modify cxxNameDouble simple_original_totals = this->totals.Simplify_redox(); @@ -1157,4 +1126,29 @@ cxxSolution::Multiply_isotopes(LDBLE extensive) total *= extensive; it->second.Set_total(total); } -} \ No newline at end of file +} +const std::vector< std::string >::value_type temp_vopts[] = { + std::vector< std::string >::value_type("totals"), // 0 + std::vector< std::string >::value_type("activities"), // 1 + std::vector< std::string >::value_type("gammas"), // 2 + std::vector< std::string >::value_type("isotopes"), // 3 + std::vector< std::string >::value_type("temp"), // 4 + std::vector< std::string >::value_type("tc_avoid_conflict_with_technetium"), // 5 + std::vector< std::string >::value_type("temperature"), // 6 + std::vector< std::string >::value_type("ph"), // 7 + std::vector< std::string >::value_type("pe"), // 8 + std::vector< std::string >::value_type("mu"), // 9 + std::vector< std::string >::value_type("ionic_strength"), // 10 + std::vector< std::string >::value_type("ah2o"), // 11 + std::vector< std::string >::value_type("activity_water"), // 12 + std::vector< std::string >::value_type("total_h"), // 13 + std::vector< std::string >::value_type("total_o"), // 14 + std::vector< std::string >::value_type("mass_water"), // 15 + std::vector< std::string >::value_type("mass_h2o"), // 16 + std::vector< std::string >::value_type("total_alkalinity"), // 17 + std::vector< std::string >::value_type("total_alk"), // 18 + std::vector< std::string >::value_type("cb"), // 19 + std::vector< std::string >::value_type("charge_balance"), // 20 + std::vector< std::string >::value_type("density") // 21 +}; +const std::vector< std::string > cxxSolution::vopts(temp_vopts, temp_vopts + sizeof temp_vopts / sizeof temp_vopts[0]); \ No newline at end of file diff --git a/Solution.h b/Solution.h index b48db4fe..74f23e0a 100644 --- a/Solution.h +++ b/Solution.h @@ -131,6 +131,7 @@ class cxxSolution:public cxxNumKeyword //cxxSolutionIsotopeList isotopes; std::map < std::string, cxxSolutionIsotope > isotopes; cxxISolution *initial_data; + const static std::vector < std::string > vopts; }; #endif // !defined(SOLUTION_H_INCLUDED) diff --git a/SolutionIsotope.cxx b/SolutionIsotope.cxx index 6d752720..4ce3dc95 100644 --- a/SolutionIsotope.cxx +++ b/SolutionIsotope.cxx @@ -95,23 +95,6 @@ cxxSolutionIsotope::dump_raw(std::ostream & s_oss, unsigned int indent) const } void cxxSolutionIsotope::read_raw(CParser & parser, bool check ) { -#if defined(NO_STATIC_VOPTS) - std::vector < std::string > vopts; -#else - static std::vector < std::string > vopts; -#endif - if (vopts.empty()) - { - vopts.reserve(21); - vopts.push_back("isotope_number"); // 0 - vopts.push_back("elt_name"); // 1 - vopts.push_back("total"); // 2 - vopts.push_back("ratio"); // 3 - vopts.push_back("ratio_uncertainty_defined"); // 4 - vopts.push_back("ratio_uncertainty"); // 5 - vopts.push_back("x_ratio_uncertainty"); // 6 - vopts.push_back("coef"); // 7 - } std::istream::pos_type ptr; std::istream::pos_type next_char; @@ -302,4 +285,14 @@ cxxSolutionIsotope::multiply(LDBLE extensive) { this->total *= extensive; } - +const std::vector< std::string >::value_type temp_vopts[] = { + std::vector< std::string >::value_type("isotope_number"), // 0 + std::vector< std::string >::value_type("elt_name"), // 1 + std::vector< std::string >::value_type("total"), // 2 + std::vector< std::string >::value_type("ratio"), // 3 + std::vector< std::string >::value_type("ratio_uncertainty_defined"), // 4 + std::vector< std::string >::value_type("ratio_uncertainty"), // 5 + std::vector< std::string >::value_type("x_ratio_uncertainty"), // 6 + std::vector< std::string >::value_type("coef") // 7 +}; +const std::vector< std::string > cxxSolutionIsotope::vopts(temp_vopts, temp_vopts + sizeof temp_vopts / sizeof temp_vopts[0]); diff --git a/SolutionIsotope.h b/SolutionIsotope.h index b8cf73ae..ff83b876 100644 --- a/SolutionIsotope.h +++ b/SolutionIsotope.h @@ -77,5 +77,6 @@ class cxxSolutionIsotope: public PHRQ_base bool ratio_uncertainty_defined; LDBLE x_ratio_uncertainty; LDBLE coef; /* coefficient of element in phase */ + const static std::vector < std::string > vopts; }; #endif // SOLUTIONISOTOPE_H_INCLUDED diff --git a/StorageBinList.cpp b/StorageBinList.cpp index 239f0660..53a37660 100644 --- a/StorageBinList.cpp +++ b/StorageBinList.cpp @@ -138,34 +138,6 @@ void StorageBinList::SetAll(bool tf) bool StorageBinList::Read(CParser & parser) { bool return_value(true); -#if defined(NO_STATIC_VOPTS) - std::vector < std::string > vopts; -#else - static std::vector < std::string > vopts; -#endif - if (vopts.empty()) - { - vopts.reserve(20); - vopts.push_back("solution"); - vopts.push_back("pp_assemblage"); - vopts.push_back("equilibrium_phases"); - vopts.push_back("exchange"); - vopts.push_back("surface"); - vopts.push_back("ss_assemblage"); - vopts.push_back("solid_solution"); - vopts.push_back("solid_solutions"); - vopts.push_back("gas_phase"); - vopts.push_back("kinetics"); - vopts.push_back("mix"); - vopts.push_back("reaction"); - vopts.push_back("temperature"); - vopts.push_back("all"); // 13 - vopts.push_back("cell"); - vopts.push_back("cells"); // 15 - vopts.push_back("reaction_temperature"); - vopts.push_back("pressure"); //17 - vopts.push_back("reaction_pressure"); //18 - } std::istream::pos_type next_char; std::string token; @@ -329,3 +301,25 @@ void StorageBinList::TransferAll(StorageBinListItem &source) this->pressure.Augment(*it); } } +const std::vector< std::string >::value_type temp_vopts[] = { + std::vector< std::string >::value_type("solution"), // 0 + std::vector< std::string >::value_type("pp_assemblage"), // 1 + std::vector< std::string >::value_type("equilibrium_phases"), // 2 + std::vector< std::string >::value_type("exchange"), // 3 + std::vector< std::string >::value_type("surface"), // 4 + std::vector< std::string >::value_type("ss_assemblage"), // 5 + std::vector< std::string >::value_type("solid_solution"), // 6 + std::vector< std::string >::value_type("solid_solutions"), // 7 + std::vector< std::string >::value_type("gas_phase"), // 8 + std::vector< std::string >::value_type("kinetics"), // 9 + std::vector< std::string >::value_type("mix"), // 10 + std::vector< std::string >::value_type("reaction"), // 11 + std::vector< std::string >::value_type("temperature"), // 12 + std::vector< std::string >::value_type("all"), // 13 + std::vector< std::string >::value_type("cell"), // 14 + std::vector< std::string >::value_type("cells"), // 15 + std::vector< std::string >::value_type("reaction_temperature"), // 16 + std::vector< std::string >::value_type("pressure"), // 17 + std::vector< std::string >::value_type("reaction_pressure") // 18 +}; +const std::vector< std::string > StorageBinList::vopts(temp_vopts, temp_vopts + sizeof temp_vopts / sizeof temp_vopts[0]); \ No newline at end of file diff --git a/StorageBinList.h b/StorageBinList.h index cf2ce771..0825bb19 100644 --- a/StorageBinList.h +++ b/StorageBinList.h @@ -56,6 +56,7 @@ protected: StorageBinListItem reaction; StorageBinListItem temperature; StorageBinListItem pressure; + const static std::vector < std::string > vopts; }; diff --git a/Surface.cxx b/Surface.cxx index 4083775e..f730d36b 100644 --- a/Surface.cxx +++ b/Surface.cxx @@ -234,35 +234,7 @@ cxxSurface::dump_raw(std::ostream & s_oss, unsigned int indent, int *n_out) cons void cxxSurface::read_raw(CParser & parser, bool check) { -#if defined(NO_STATIC_VOPTS) - std::vector < std::string > vopts; -#else - static std::vector < std::string > vopts; -#endif int i = 0; - if (vopts.empty()) - { - vopts.reserve(15); - vopts.push_back("diffuse_layer"); // 0 - vopts.push_back("edl"); // 1 - vopts.push_back("only_counter_ions"); // 2 - vopts.push_back("donnan"); // 3 - vopts.push_back("thickness"); // 4 - vopts.push_back("component"); // 5 - vopts.push_back("charge_component"); // 6 - vopts.push_back("type "); // 7 - vopts.push_back("dl_type"); // 8 - vopts.push_back("sites_units"); // 9 - vopts.push_back("debye_lengths"); // 10 - vopts.push_back("ddl_viscosity"); // 11 - vopts.push_back("ddl_limit"); // 12 - vopts.push_back("transport"); // 13 - vopts.push_back("new_def"); // 14 - vopts.push_back("solution_equilibria"); // 15 - vopts.push_back("n_solution"); // 16 - vopts.push_back("totals"); // 17 - } - std::istream::pos_type ptr; std::istream::pos_type next_char; std::string token; @@ -850,3 +822,24 @@ Sort_comps(void) } } } +const std::vector< std::string >::value_type temp_vopts[] = { + std::vector< std::string >::value_type("diffuse_layer"), // 0 + std::vector< std::string >::value_type("edl"), // 1 + std::vector< std::string >::value_type("only_counter_ions"), // 2 + std::vector< std::string >::value_type("donnan"), // 3 + std::vector< std::string >::value_type("thickness"), // 4 + std::vector< std::string >::value_type("component"), // 5 + std::vector< std::string >::value_type("charge_component"), // 6 + std::vector< std::string >::value_type("type "), // 7 + std::vector< std::string >::value_type("dl_type"), // 8 + std::vector< std::string >::value_type("sites_units"), // 9 + std::vector< std::string >::value_type("debye_lengths"), // 10 + std::vector< std::string >::value_type("ddl_viscosity"), // 11 + std::vector< std::string >::value_type("ddl_limit"), // 12 + std::vector< std::string >::value_type("transport"), // 13 + std::vector< std::string >::value_type("new_def"), // 14 + std::vector< std::string >::value_type("solution_equilibria"), // 15 + std::vector< std::string >::value_type("n_solution"), // 16 + std::vector< std::string >::value_type("totals") // 17 +}; +const std::vector< std::string > cxxSurface::vopts(temp_vopts, temp_vopts + sizeof temp_vopts / sizeof temp_vopts[0]); \ No newline at end of file diff --git a/Surface.h b/Surface.h index b2cf3c4b..08333023 100644 --- a/Surface.h +++ b/Surface.h @@ -95,6 +95,7 @@ protected: cxxNameDouble totals; bool solution_equilibria; int n_solution; + const static std::vector < std::string > vopts; }; #endif // !defined(SURFACE_H_INCLUDED) diff --git a/SurfaceCharge.cxx b/SurfaceCharge.cxx index 8203c52a..3c5dba4f 100644 --- a/SurfaceCharge.cxx +++ b/SurfaceCharge.cxx @@ -118,31 +118,6 @@ cxxSurfaceCharge::read_raw(CParser & parser, bool check) { std::string str; -#if defined(NO_STATIC_VOPTS) - std::vector < std::string > vopts; -#else - static std::vector < std::string > vopts; -#endif - if (vopts.empty()) - { - vopts.reserve(15); - vopts.push_back("name"); // 0 - vopts.push_back("specific_area"); // 1 - vopts.push_back("grams"); // 2 - vopts.push_back("charge_balance"); // 3 - vopts.push_back("mass_water"); // 4 - vopts.push_back("la_psi"); // 5 - vopts.push_back("diffuse_layer_totals"); // 6 - vopts.push_back("la_psi1"); // 7 - vopts.push_back("la_psi2"); // 8 - vopts.push_back("capacitance0"); // 9 - vopts.push_back("capacitance1"); // 10 - vopts.push_back("sigma0"); // 11 - vopts.push_back("sigma1"); // 12 - vopts.push_back("sigma2"); // 13 - vopts.push_back("sigmaddl"); // 14 - vopts.push_back("g_map"); // 14 - } std::istream::pos_type ptr; std::istream::pos_type next_char; @@ -485,3 +460,22 @@ cxxSurfaceCharge::multiply(LDBLE extensive) this->mass_water *= extensive; this->diffuse_layer_totals.multiply(extensive); } +const std::vector< std::string >::value_type temp_vopts[] = { + std::vector< std::string >::value_type("name"), // 0 + std::vector< std::string >::value_type("specific_area"), // 1 + std::vector< std::string >::value_type("grams"), // 2 + std::vector< std::string >::value_type("charge_balance"), // 3 + std::vector< std::string >::value_type("mass_water"), // 4 + std::vector< std::string >::value_type("la_psi"), // 5 + std::vector< std::string >::value_type("diffuse_layer_totals"), // 6 + std::vector< std::string >::value_type("la_psi1"), // 7 + std::vector< std::string >::value_type("la_psi2"), // 8 + std::vector< std::string >::value_type("capacitance0"), // 9 + std::vector< std::string >::value_type("capacitance1"), // 10 + std::vector< std::string >::value_type("sigma0"), // 11 + std::vector< std::string >::value_type("sigma1"), // 12 + std::vector< std::string >::value_type("sigma2"), // 13 + std::vector< std::string >::value_type("sigmaddl"), // 14 + std::vector< std::string >::value_type("g_map") // 15 +}; +const std::vector< std::string > cxxSurfaceCharge::vopts(temp_vopts, temp_vopts + sizeof temp_vopts / sizeof temp_vopts[0]); \ No newline at end of file diff --git a/SurfaceCharge.h b/SurfaceCharge.h index 6426b786..b3204267 100644 --- a/SurfaceCharge.h +++ b/SurfaceCharge.h @@ -121,6 +121,7 @@ protected: // workspace variables LDBLE sigma0, sigma1, sigma2, sigmaddl; std::map g_map; + const static std::vector < std::string > vopts; }; #endif // !defined(SURFACECHARGE_H_INCLUDED) diff --git a/SurfaceComp.cxx b/SurfaceComp.cxx index 057a4aca..8dfefb3a 100644 --- a/SurfaceComp.cxx +++ b/SurfaceComp.cxx @@ -114,29 +114,6 @@ cxxSurfaceComp::read_raw(CParser & parser, bool check) { std::string str; -#if defined(NO_STATIC_VOPTS) - std::vector < std::string > vopts; -#else - static std::vector < std::string > vopts; -#endif - if (vopts.empty()) - { - vopts.reserve(15); - vopts.push_back("formula"); // 0 - vopts.push_back("moles"); // 1 - vopts.push_back("la"); // 2 - vopts.push_back("charge_number"); // 3 - vopts.push_back("charge_balance"); // 4 - vopts.push_back("phase_name"); // 5 - vopts.push_back("rate_name"); // 6 - vopts.push_back("phase_proportion"); // 7 - vopts.push_back("totals"); // 8 - vopts.push_back("formula_z"); // 9 - vopts.push_back("formula_totals"); // 10 - vopts.push_back("dw"); // 11 - vopts.push_back("charge_name"); // 12 - vopts.push_back("master_element"); // 13 - } std::istream::pos_type ptr; std::istream::pos_type next_char; @@ -509,4 +486,20 @@ cxxSurfaceComp::multiply(LDBLE extensive) this->charge_balance *= extensive; } - +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 + std::vector< std::string >::value_type("la"), // 2 + std::vector< std::string >::value_type("charge_number"), // 3 + std::vector< std::string >::value_type("charge_balance"), // 4 + std::vector< std::string >::value_type("phase_name"), // 5 + std::vector< std::string >::value_type("rate_name"), // 6 + std::vector< std::string >::value_type("phase_proportion"), // 7 + std::vector< std::string >::value_type("totals"), // 8 + std::vector< std::string >::value_type("formula_z"), // 9 + std::vector< std::string >::value_type("formula_totals"), // 10 + std::vector< std::string >::value_type("dw"), // 11 + std::vector< std::string >::value_type("charge_name"), // 12 + std::vector< std::string >::value_type("master_element") // 13 +}; +const std::vector< std::string > cxxSurfaceComp::vopts(temp_vopts, temp_vopts + sizeof temp_vopts / sizeof temp_vopts[0]); diff --git a/SurfaceComp.h b/SurfaceComp.h index 3857592e..dc324f7e 100644 --- a/SurfaceComp.h +++ b/SurfaceComp.h @@ -65,6 +65,7 @@ protected: std::string rate_name; LDBLE Dw; std::string master_element; + const static std::vector < std::string > vopts; public: }; diff --git a/Temperature.cxx b/Temperature.cxx index 767d1a8a..bc5a5666 100644 --- a/Temperature.cxx +++ b/Temperature.cxx @@ -236,19 +236,6 @@ cxxTemperature::read_raw(CParser & parser) // clear steps for modify operation, if pressures are read bool cleared_once = false; -#if defined(NO_STATIC_VOPTS) - std::vector < std::string > vopts; -#else - static std::vector < std::string > vopts; -#endif - if (vopts.empty()) - { - vopts.reserve(15); - vopts.push_back("temps"); //0 - vopts.push_back("equal_increments"); //1 - vopts.push_back("count_temps"); //2 - } - std::istream::pos_type ptr; std::istream::pos_type next_char; std::string token; @@ -420,3 +407,9 @@ Get_countTemps(void) const } return (int) this->temps.size(); } +const std::vector< std::string >::value_type temp_vopts[] = { + std::vector< std::string >::value_type("temps"), //0 + std::vector< std::string >::value_type("equal_increments"), //1 + std::vector< std::string >::value_type("count_temps") //2 +}; +const std::vector< std::string > cxxTemperature::vopts(temp_vopts, temp_vopts + sizeof temp_vopts / sizeof temp_vopts[0]); \ No newline at end of file diff --git a/Temperature.h b/Temperature.h index 2d6c0733..f9d546c1 100644 --- a/Temperature.h +++ b/Temperature.h @@ -34,7 +34,7 @@ protected: std::vector < LDBLE >temps; int countTemps; bool equalIncrements; - + const static std::vector < std::string > vopts; }; #endif // !defined(TEMPERATURE_H_INCLUDED) diff --git a/cxxKinetics.cxx b/cxxKinetics.cxx index feecb581..369fa882 100644 --- a/cxxKinetics.cxx +++ b/cxxKinetics.cxx @@ -187,27 +187,7 @@ cxxKinetics::read_raw(CParser & parser, bool check) { LDBLE d; -#if defined(NO_STATIC_VOPTS) - std::vector < std::string > vopts; -#else - static std::vector < std::string > vopts; -#endif - if (vopts.empty()) - { - vopts.reserve(15); - vopts.push_back("step_divide"); - vopts.push_back("rk"); - vopts.push_back("bad_step_max"); - vopts.push_back("use_cvode"); - vopts.push_back("component"); - vopts.push_back("totals"); - vopts.push_back("steps"); - vopts.push_back("cvode_steps"); - vopts.push_back("cvode_order"); - vopts.push_back("equalincrements"); - vopts.push_back("count"); - vopts.push_back("equal_increments"); - } + std::istream::pos_type ptr; std::istream::pos_type next_char; @@ -656,3 +636,18 @@ Current_step(bool incremental_reactions, int reaction_step) const } return kin_time; } +const std::vector< std::string >::value_type temp_vopts[] = { + std::vector< std::string >::value_type("step_divide"), // 0 + std::vector< std::string >::value_type("rk"), // 1 + std::vector< std::string >::value_type("bad_step_max"), // 2 + std::vector< std::string >::value_type("use_cvode"), // 3 + std::vector< std::string >::value_type("component"), // 4 + std::vector< std::string >::value_type("totals"), // 5 + std::vector< std::string >::value_type("steps"), // 6 + std::vector< std::string >::value_type("cvode_steps"), // 7 + std::vector< std::string >::value_type("cvode_order"), // 8 + std::vector< std::string >::value_type("equalincrements"), // 9 + std::vector< std::string >::value_type("count"), // 10 + std::vector< std::string >::value_type("equal_increments") // 11 +}; +const std::vector< std::string > cxxKinetics::vopts(temp_vopts, temp_vopts + sizeof temp_vopts / sizeof temp_vopts[0]); diff --git a/cxxKinetics.h b/cxxKinetics.h index ce4d8c3d..bf02091c 100644 --- a/cxxKinetics.h +++ b/cxxKinetics.h @@ -74,6 +74,7 @@ class cxxKinetics:public cxxNumKeyword int cvode_order; // internal variables cxxNameDouble totals; + const static std::vector < std::string > vopts; }; #endif // !defined(CXXKINETICS_H_INCLUDED) diff --git a/cxxMix.cxx b/cxxMix.cxx index d62c1852..404f1f6d 100644 --- a/cxxMix.cxx +++ b/cxxMix.cxx @@ -95,15 +95,6 @@ cxxMix::read_raw(CParser & parser) int i; LDBLE d; -#if defined(NO_STATIC_VOPTS) - std::vector < std::string > vopts; -#else - static std::vector < std::string > vopts; -#endif - if (vopts.empty()) - { - vopts.reserve(15); - } std::istream::pos_type ptr; std::istream::pos_type next_char; @@ -186,4 +177,5 @@ void cxxMix::Vectorize(std::vector &n, std::vector &f) n.push_back(it->first); f.push_back(it->second); } -} \ No newline at end of file +} +const std::vector< std::string > cxxMix::vopts; \ No newline at end of file diff --git a/cxxMix.h b/cxxMix.h index 97871bc7..6d27a2fd 100644 --- a/cxxMix.h +++ b/cxxMix.h @@ -51,6 +51,7 @@ class cxxMix:public cxxNumKeyword protected: friend class cxxStorageBin; std::map < int, LDBLE >mixComps; + const static std::vector < std::string > vopts; }; diff --git a/dumper.cpp b/dumper.cpp index d723a5c3..2d708e43 100644 --- a/dumper.cpp +++ b/dumper.cpp @@ -33,43 +33,6 @@ void dumper::SetAll(bool tf) bool dumper::Read(CParser & parser) { bool return_value(true); -#if defined(NO_STATIC_VOPTS) - std::vector < std::string > vopts; -#else - static std::vector < std::string > vopts; -#endif - if (vopts.empty()) - { - vopts.reserve(20); - vopts.push_back("file"); // 0 - vopts.push_back("append"); // 1 - vopts.push_back("all"); // 2 - vopts.push_back("cell"); // 3 - vopts.push_back("cells"); // 4 - vopts.push_back("solution"); // 5 - vopts.push_back("solutions"); // 6 - vopts.push_back("pp_assemblage"); - vopts.push_back("pp_assemblages"); - vopts.push_back("equilibrium_phase"); - vopts.push_back("equilibrium_phases"); // 10 - vopts.push_back("exchange"); - vopts.push_back("surface"); - vopts.push_back("ss_assemblage"); - vopts.push_back("solid_solution"); - vopts.push_back("solid_solutions"); // 15 - vopts.push_back("gas_phase"); - vopts.push_back("gas_phases"); - vopts.push_back("kinetics"); // 18 - vopts.push_back("mix"); // 19 - vopts.push_back("reaction"); // 20 - vopts.push_back("reactions"); // 21 - vopts.push_back("temperature"); // 22 - vopts.push_back("reaction_temperature"); // 23 - vopts.push_back("reaction_temperatures"); // 24 - vopts.push_back("pressure"); // 25 - vopts.push_back("reaction_pressure"); // 26 - vopts.push_back("reaction_pressures"); // 27 - } std::istream::pos_type ptr; std::istream::pos_type next_char; @@ -275,3 +238,34 @@ bool dumper::Get_bool_any(void) Get_bool_pressure() ); } +const std::vector< std::string >::value_type temp_vopts[] = { + std::vector< std::string >::value_type("file"), // 0 + std::vector< std::string >::value_type("append"), // 1 + std::vector< std::string >::value_type("all"), // 2 + std::vector< std::string >::value_type("cell"), // 3 + std::vector< std::string >::value_type("cells"), // 4 + std::vector< std::string >::value_type("solution"), // 5 + std::vector< std::string >::value_type("solutions"), // 6 + std::vector< std::string >::value_type("pp_assemblage"), // 7 + std::vector< std::string >::value_type("pp_assemblages"), // 8 + std::vector< std::string >::value_type("equilibrium_phase"), // 9 + std::vector< std::string >::value_type("equilibrium_phases"), // 10 + std::vector< std::string >::value_type("exchange"), // 11 + std::vector< std::string >::value_type("surface"), // 12 + std::vector< std::string >::value_type("ss_assemblage"), // 13 + std::vector< std::string >::value_type("solid_solution"), // 14 + std::vector< std::string >::value_type("solid_solutions"), // 15 + std::vector< std::string >::value_type("gas_phase"), // 16 + std::vector< std::string >::value_type("gas_phases"), // 17 + std::vector< std::string >::value_type("kinetics"), // 18 + std::vector< std::string >::value_type("mix"), // 19 + std::vector< std::string >::value_type("reaction"), // 20 + std::vector< std::string >::value_type("reactions"), // 21 + std::vector< std::string >::value_type("temperature"), // 22 + std::vector< std::string >::value_type("reaction_temperature"), // 23 + std::vector< std::string >::value_type("reaction_temperatures"), // 24 + std::vector< std::string >::value_type("pressure"), // 25 + std::vector< std::string >::value_type("reaction_pressure"), // 26 + std::vector< std::string >::value_type("reaction_pressures") // 27 +}; +const std::vector< std::string > dumper::vopts(temp_vopts, temp_vopts + sizeof temp_vopts / sizeof temp_vopts[0]); \ No newline at end of file diff --git a/dumper.h b/dumper.h index 832e7bd5..063af4e0 100644 --- a/dumper.h +++ b/dumper.h @@ -49,6 +49,7 @@ protected: bool append; bool on; StorageBinList binList; + const static std::vector < std::string > vopts; }; #endif // !defined(DUMPER_H_INCLUDED) diff --git a/runner.cpp b/runner.cpp index e1c3319c..ddbb124b 100644 --- a/runner.cpp +++ b/runner.cpp @@ -28,22 +28,6 @@ bool runner::Read(CParser & parser) { bool return_value(true); -#if defined(NO_STATIC_VOPTS) - std::vector < std::string > vopts; -#else - static std::vector < std::string > vopts; -#endif - if (vopts.empty()) - { - vopts.reserve(20); - vopts.push_back("cell"); - vopts.push_back("cells"); - vopts.push_back("start_time"); - vopts.push_back("time_step"); - vopts.push_back("time_steps"); - vopts.push_back("step"); - vopts.push_back("steps"); - } std::istream::pos_type ptr; std::istream::pos_type next_char; @@ -155,3 +139,13 @@ bool runner::Read(CParser & parser) } return(return_value); } +const std::vector< std::string >::value_type temp_vopts[] = { + std::vector< std::string >::value_type("cell"), // 0 + std::vector< std::string >::value_type("cells"), // 1 + std::vector< std::string >::value_type("start_time"), // 2 + std::vector< std::string >::value_type("time_step"), // 3 + std::vector< std::string >::value_type("time_steps"), // 4 + std::vector< std::string >::value_type("step"), // 5 + std::vector< std::string >::value_type("steps") // 6 +}; +const std::vector< std::string > runner::vopts(temp_vopts, temp_vopts + sizeof temp_vopts / sizeof temp_vopts[0]); \ No newline at end of file diff --git a/runner.h b/runner.h index 5cc2e61b..86049879 100644 --- a/runner.h +++ b/runner.h @@ -26,5 +26,6 @@ protected: LDBLE start_time; StorageBinListItem cells; bool run_cells; + const static std::vector < std::string > vopts; }; #endif // !defined(RUNNER_H_INCLUDED)