add equality operator to Location

also put it in Opm namespace
This commit is contained in:
Arne Morten Kvarving
2020-01-03 08:20:20 +01:00
parent 5e10c94f9f
commit 3cf79037e2
2 changed files with 17 additions and 8 deletions

View File

@@ -20,6 +20,8 @@
#ifndef LOCATION_HPP
#define LOCATION_HPP
namespace Opm {
class Location {
public:
std::string filename = "<memory string>";
@@ -30,6 +32,13 @@ public:
filename(std::move(fname)),
lineno(lno)
{}
bool operator==(const Location& data) const {
return filename == data.filename &&
lineno == data.lineno;
}
};
}
#endif

View File

@@ -125,7 +125,7 @@ namespace {
const std::string& name) -> void
{
for (const auto& vector : vectors) {
entities.emplace_back(kwpref + vector.kw, cat, Location());
entities.emplace_back(kwpref + vector.kw, cat, ::Opm::Location());
entities.back().namedEntity(name)
.parameterType(vector.type);
@@ -135,15 +135,15 @@ namespace {
for (const auto& well_name : sched.wellNames()) {
makeEntities('W', SN::Category::Well, well_name);
entities.emplace_back("WBHP", SN::Category::Well, Location());
entities.emplace_back("WBHP", SN::Category::Well, ::Opm::Location());
entities.back().namedEntity(well_name)
.parameterType(SN::Type::Pressure);
entities.emplace_back("WGVIR", SN::Category::Well, Location());
entities.emplace_back("WGVIR", SN::Category::Well, ::Opm::Location());
entities.back().namedEntity(well_name)
.parameterType(SN::Type::Rate);
entities.emplace_back("WWVIR", SN::Category::Well, Location());
entities.emplace_back("WWVIR", SN::Category::Well, ::Opm::Location());
entities.back().namedEntity(well_name)
.parameterType(SN::Type::Rate);
}
@@ -164,16 +164,16 @@ namespace {
using SN = Opm::SummaryNode;
auto ret = std::vector<SN>{};
auto sofr = SN{ "SOFR", SN::Category::Segment, Location() }
auto sofr = SN{ "SOFR", SN::Category::Segment, ::Opm::Location() }
.parameterType(SN::Type::Rate);
auto sgfr = SN{ "SGFR", SN::Category::Segment, Location() }
auto sgfr = SN{ "SGFR", SN::Category::Segment, ::Opm::Location() }
.parameterType(SN::Type::Rate);
auto swfr = SN{ "SWFR", SN::Category::Segment, Location() }
auto swfr = SN{ "SWFR", SN::Category::Segment, ::Opm::Location() }
.parameterType(SN::Type::Rate);
auto spr = SN{ "SPR", SN::Category::Segment, Location() }
auto spr = SN{ "SPR", SN::Category::Segment, ::Opm::Location() }
.parameterType(SN::Type::Pressure);
auto makeVectors =