From 5ce1d84ac1390362e1d9a9536eb5350dc3469ccb Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Wed, 3 Feb 2016 05:54:24 +0100 Subject: [PATCH] Removed unused SimulatorState comparison. --- opm/core/simulator/SimulatorState.cpp | 34 --------------------------- opm/core/simulator/SimulatorState.hpp | 20 ---------------- 2 files changed, 54 deletions(-) diff --git a/opm/core/simulator/SimulatorState.cpp b/opm/core/simulator/SimulatorState.cpp index e661c24c..94d8b0fa 100644 --- a/opm/core/simulator/SimulatorState.cpp +++ b/opm/core/simulator/SimulatorState.cpp @@ -6,40 +6,6 @@ using namespace Opm; -bool -SimulatorState::equals (const SimulatorState& other, - double epsilon) const { - bool equal = (num_phases_ == other.num_phases_); - - // if we use &=, then all the tests will be run regardless - equal = equal && vectorApproxEqual( pressure() , other.pressure() , epsilon); - equal = equal && vectorApproxEqual( temperature() , other.temperature() , epsilon); - equal = equal && vectorApproxEqual( facepressure() , other.facepressure() , epsilon); - equal = equal && vectorApproxEqual( faceflux() , other.faceflux() , epsilon); - equal = equal && vectorApproxEqual( saturation() , other.saturation() , epsilon); - - return equal; -} - -bool -SimulatorState::vectorApproxEqual(const std::vector& v1, - const std::vector& v2, - double epsilon) { - if (v1.size() != v2.size()) { - return false; - } - - for (size_t i = 0; i < v1.size(); i++) { - const double diff = std::abs(v1[i] - v2[i]); - const double scale = std::abs(v1[i]) + std::abs(v2[i]); - if (diff > epsilon * scale) { - return false; - } - } - - return true; -} - void SimulatorState::init(int number_of_cells, int number_of_faces, int num_phases) diff --git a/opm/core/simulator/SimulatorState.hpp b/opm/core/simulator/SimulatorState.hpp index 41e89fc5..6748454d 100644 --- a/opm/core/simulator/SimulatorState.hpp +++ b/opm/core/simulator/SimulatorState.hpp @@ -47,13 +47,6 @@ namespace Opm const std::vector& faceflux () const { return faceData_[ faceFluxId_ ]; } const std::vector& saturation () const { return cellData_[ saturationId_ ]; } - /** - * Compare this state with another, to see if they are different - * only within a small margin. - */ - virtual bool equals(const SimulatorState& other, - double epsilon = 1e-8) const; - std::vector< std::vector >& cellData() { return cellData_; } const std::vector< std::vector >& cellData() const { return cellData_; } @@ -80,19 +73,6 @@ namespace Opm /// \brief names for the face data std::vector< std::string > faceDataNames_; - protected: - /** - * Check if two vectors are equal within a margin. - * - * @param epsilon Relative difference that is tolerated for the - * vectors to still be considered equal. - * - * @return True if every element is within the margin, false if - * there is at least one that is not. - */ - static bool vectorApproxEqual(const std::vector& v1, - const std::vector& v2, - double epsilon); }; } // namespace Opm