Merge pull request #948 from joakim-hove/simulatorstate-remove-unused

Simulatorstate remove unused
This commit is contained in:
Joakim Hove 2016-02-04 15:57:59 +01:00
commit 4e46bb3fa4
2 changed files with 0 additions and 107 deletions

View File

@ -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<double>& v1,
const std::vector<double>& 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)
@ -97,42 +63,3 @@ SimulatorState::registerFaceData( const std::string& name, const int components,
return pos ;
}
template <typename Props> void
SimulatorState::setFirstSat(const std::vector<int>& cells,
const Props& props,
ExtremalSat es)
{
if (cells.empty()) {
return;
}
int n = cells.size();
std::vector<double> smin(num_phases_*n);
std::vector<double> smax(num_phases_*n);
props.satRange(n, &cells[0], &smin[0], &smax[0]);
std::vector< double >& sat = saturation();
const double* svals = (es == MinSat) ? &smin[0] : &smax[0];
for (int ci = 0; ci < n; ++ci) {
const int cell = cells[ci];
sat[num_phases_*cell] = svals[num_phases_*ci];
sat[num_phases_*cell + 1] = 1.0 - sat[num_phases_*cell];
}
}
// template instantiations for all known (to this library) subclasses
// of SimulatorState that will call this method. notice that there are
// no empty angle brackets after "template" -- that would have been
// specialization instead
#include <opm/core/props/BlackoilPropertiesInterface.hpp>
#include <opm/core/props/IncompPropertiesInterface.hpp>
template void
SimulatorState::setFirstSat <IncompPropertiesInterface> (
const std::vector<int> &cells,
const IncompPropertiesInterface &props,
ExtremalSat es);
template void
SimulatorState::setFirstSat <BlackoilPropertiesInterface> (
const std::vector<int> &cells,
const BlackoilPropertiesInterface &props,
ExtremalSat es);

View File

@ -17,8 +17,6 @@ namespace Opm
virtual void init(int number_of_cells, int number_of_faces, int num_phases);
enum ExtremalSat { MinSat, MaxSat };
protected:
/// \brief pressure per cell.
static const int pressureId_ = 0;
@ -32,18 +30,6 @@ namespace Opm
/// \brief The fluxes at the faces.
static const int faceFluxId_ = 1;
/**
* Initialize the first saturation to maximum value. This method
* should be considered deprecated. Avoid to use it!
*
* \tparam Props Fluid and rock properties that pertain to this
* kind of simulation. Currently, only Blackoil-
* and IncompPropertiesInterface are supported.
*/
template <typename Props>
void setFirstSat(const std::vector<int>& cells,
const Props& props,
ExtremalSat es);
public:
int numPhases() const { return num_phases_; }
int numCells () const { return num_cells_; }
@ -61,13 +47,6 @@ namespace Opm
const std::vector<double>& faceflux () const { return faceData_[ faceFluxId_ ]; }
const std::vector<double>& 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<double> >& cellData() { return cellData_; }
const std::vector< std::vector<double> >& cellData() const { return cellData_; }
@ -94,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<double>& v1,
const std::vector<double>& v2,
double epsilon);
};
} // namespace Opm