From 50d4cf210cb8ba307f686f7e6e25b6d73c4b6e6f Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Tue, 19 May 2020 23:37:11 -0400 Subject: [PATCH] Remove unnecessary classes --- unittest/force-styles/angle_style.cpp | 12 +----------- unittest/force-styles/bond_style.cpp | 13 +------------ unittest/force-styles/test_config_reader.cpp | 10 ++++++++++ 3 files changed, 12 insertions(+), 23 deletions(-) diff --git a/unittest/force-styles/angle_style.cpp b/unittest/force-styles/angle_style.cpp index a6f18f4409..3dd7246804 100644 --- a/unittest/force-styles/angle_style.cpp +++ b/unittest/force-styles/angle_style.cpp @@ -192,22 +192,12 @@ void data_lammps(LAMMPS_NS::LAMMPS *lmp, const TestConfig &cfg) lmp->input->one("run 0 post no"); } -class AngleConfigReader : public TestConfigReader -{ -public: - AngleConfigReader(TestConfig &config) : TestConfigReader(config) { - consumers["angle_style"] = &TestConfigReader::angle_style; - consumers["angle_coeff"] = &TestConfigReader::angle_coeff; - consumers["init_energy"] = &TestConfigReader::init_energy; - consumers["run_energy"] = &TestConfigReader::run_energy; - } -}; // read/parse yaml file bool read_yaml_file(const char *infile, TestConfig &config) { - auto reader = AngleConfigReader(config); + auto reader = TestConfigReader(config); if (reader.parse_file(infile)) return false; diff --git a/unittest/force-styles/bond_style.cpp b/unittest/force-styles/bond_style.cpp index f39062b1c7..00c51a3b00 100644 --- a/unittest/force-styles/bond_style.cpp +++ b/unittest/force-styles/bond_style.cpp @@ -194,22 +194,11 @@ void data_lammps(LAMMPS_NS::LAMMPS *lmp, const TestConfig &cfg) lmp->input->one("run 0 post no"); } -class BondConfigReader : public TestConfigReader -{ -public: - BondConfigReader(TestConfig &config) : TestConfigReader(config) { - consumers["bond_style"] = &TestConfigReader::bond_style; - consumers["bond_coeff"] = &TestConfigReader::bond_coeff; - consumers["init_energy"] = &TestConfigReader::init_energy; - consumers["run_energy"] = &TestConfigReader::run_energy; - } -}; - // read/parse yaml file bool read_yaml_file(const char *infile, TestConfig &config) { - auto reader = BondConfigReader(config); + auto reader = TestConfigReader(config); if (reader.parse_file(infile)) return false; diff --git a/unittest/force-styles/test_config_reader.cpp b/unittest/force-styles/test_config_reader.cpp index e643800b18..d530c81dd1 100644 --- a/unittest/force-styles/test_config_reader.cpp +++ b/unittest/force-styles/test_config_reader.cpp @@ -40,6 +40,16 @@ TestConfigReader::TestConfigReader(TestConfig & config) consumers["run_stress"] = &TestConfigReader::run_stress; consumers["init_forces"] = &TestConfigReader::init_forces; consumers["run_forces"] = &TestConfigReader::run_forces; + + consumers["bond_style"] = &TestConfigReader::bond_style; + consumers["bond_coeff"] = &TestConfigReader::bond_coeff; + consumers["init_energy"] = &TestConfigReader::init_energy; + consumers["run_energy"] = &TestConfigReader::run_energy; + + consumers["angle_style"] = &TestConfigReader::angle_style; + consumers["angle_coeff"] = &TestConfigReader::angle_coeff; + consumers["init_energy"] = &TestConfigReader::init_energy; + consumers["run_energy"] = &TestConfigReader::run_energy; } void TestConfigReader::prerequisites(const yaml_event_t & event) {