Skip to content

Commit 2c74b09

Browse files
committed
Removes various minor edits.
1 parent ab71b43 commit 2c74b09

1 file changed

Lines changed: 89 additions & 79 deletions

File tree

src/opm/output/eclipse/Summary.cpp

Lines changed: 89 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,10 @@
6666
#include <vector>
6767

6868
namespace {
69-
7069
struct ParamCTorArgs
7170
{
72-
const std::string keyword;
73-
const Opm::EclIO::SummaryNode::Type type;
71+
std::string kw;
72+
Opm::EclIO::SummaryNode::Type type;
7473
};
7574

7675
using p_cmode = Opm::Group::ProductionCMode;
@@ -100,48 +99,47 @@ namespace {
10099

101100
std::vector<ParamCTorArgs> requiredRestartVectors()
102101
{
103-
using Type = Opm::EclIO::SummaryNode::Type;
102+
using Type = ::Opm::EclIO::SummaryNode::Type;
104103

105104
return {
106105
// Production
107-
{ "OPR" , Type::Rate },
108-
{ "WPR" , Type::Rate },
109-
{ "GPR" , Type::Rate },
110-
{ "VPR" , Type::Rate },
111-
{ "OPP" , Type::Rate },
112-
{ "WPP" , Type::Rate },
113-
{ "GPP" , Type::Rate },
114-
{ "OPT" , Type::Total },
115-
{ "WPT" , Type::Total },
116-
{ "GPT" , Type::Total },
117-
{ "VPT" , Type::Total },
118-
{ "OPTH", Type::Total },
119-
{ "WPTH", Type::Total },
120-
{ "GPTH", Type::Total },
106+
ParamCTorArgs{ "OPR" , Type::Rate },
107+
ParamCTorArgs{ "WPR" , Type::Rate },
108+
ParamCTorArgs{ "GPR" , Type::Rate },
109+
ParamCTorArgs{ "VPR" , Type::Rate },
110+
ParamCTorArgs{ "OPP" , Type::Rate },
111+
ParamCTorArgs{ "WPP" , Type::Rate },
112+
ParamCTorArgs{ "GPP" , Type::Rate },
113+
ParamCTorArgs{ "OPT" , Type::Total },
114+
ParamCTorArgs{ "WPT" , Type::Total },
115+
ParamCTorArgs{ "GPT" , Type::Total },
116+
ParamCTorArgs{ "VPT" , Type::Total },
117+
ParamCTorArgs{ "OPTH", Type::Total },
118+
ParamCTorArgs{ "WPTH", Type::Total },
119+
ParamCTorArgs{ "GPTH", Type::Total },
121120

122121
// Flow rate ratios (production)
123-
{ "WCT" , Type::Ratio },
124-
{ "GOR" , Type::Ratio },
122+
ParamCTorArgs{ "WCT" , Type::Ratio },
123+
ParamCTorArgs{ "GOR" , Type::Ratio },
125124

126125
// injection
127126

128-
{ "WIR" , Type::Rate },
129-
{ "GIR" , Type::Rate },
130-
{ "OPI" , Type::Rate },
131-
{ "WPI" , Type::Rate },
132-
{ "GPI" , Type::Rate },
133-
{ "WIT" , Type::Total },
134-
{ "GIT" , Type::Total },
135-
{ "WITH", Type::Total },
136-
{ "GITH", Type::Total },
127+
ParamCTorArgs{ "WIR" , Type::Rate },
128+
ParamCTorArgs{ "GIR" , Type::Rate },
129+
ParamCTorArgs{ "OPI" , Type::Rate },
130+
ParamCTorArgs{ "WPI" , Type::Rate },
131+
ParamCTorArgs{ "GPI" , Type::Rate },
132+
ParamCTorArgs{ "WIT" , Type::Total },
133+
ParamCTorArgs{ "GIT" , Type::Total },
134+
ParamCTorArgs{ "WITH", Type::Total },
135+
ParamCTorArgs{ "GITH", Type::Total }
137136
};
138137
}
139138

140139
std::vector<Opm::EclIO::SummaryNode>
141140
requiredRestartVectors(const ::Opm::Schedule& sched)
142141
{
143-
std::vector<Opm::EclIO::SummaryNode> entities {} ;
144-
const auto restartVectors { requiredRestartVectors() } ;
142+
const auto& vectors = requiredRestartVectors();
145143
static const std::vector<ParamCTorArgs> extra_well_vectors {
146144
{ "WBHP", Opm::EclIO::SummaryNode::Type::Pressure },
147145
{ "WGVIR", Opm::EclIO::SummaryNode::Type::Rate },
@@ -158,13 +156,15 @@ namespace {
158156
{ "FMCTW", Opm::EclIO::SummaryNode::Type::Mode },
159157
};
160158

161-
auto makeEntities = [&restartVectors, &entities]
159+
std::vector<Opm::EclIO::SummaryNode> entities {} ;
160+
161+
auto makeEntities = [&vectors, &entities]
162162
(const char kwpref,
163163
const Opm::EclIO::SummaryNode::Category cat,
164164
const std::string& name) -> void
165165
{
166-
for (const auto& restartVector : restartVectors) {
167-
entities.push_back({kwpref + restartVector.keyword, cat, restartVector.type, name, Opm::EclIO::SummaryNode::default_number });
166+
for (const auto& vector : vectors) {
167+
entities.push_back({kwpref + vector.kw, cat, vector.type, name, Opm::EclIO::SummaryNode::default_number });
168168
}
169169
};
170170

@@ -174,7 +174,7 @@ namespace {
174174
const std::string& wgname) -> void
175175
{
176176
for (const auto &extra_vector : extra_vectors) {
177-
entities.push_back({ extra_vector.keyword, category, extra_vector.type, wgname, Opm::EclIO::SummaryNode::default_number });
177+
entities.push_back({ extra_vector.kw, category, extra_vector.type, wgname, Opm::EclIO::SummaryNode::default_number });
178178
}
179179
};
180180

@@ -197,7 +197,7 @@ namespace {
197197
}
198198

199199
std::vector<Opm::EclIO::SummaryNode>
200-
requiredSegmentVectors(const Opm::Schedule& sched)
200+
requiredSegmentVectors(const ::Opm::Schedule& sched)
201201
{
202202
std::vector<Opm::EclIO::SummaryNode> ret {};
203203

@@ -226,9 +226,9 @@ namespace {
226226
continue;
227227
}
228228

229-
const auto nSeg { well.getSegments().size() } ;
229+
const auto nSeg = well.getSegments().size();
230230

231-
for (size_t segID { 0 } ; segID < nSeg; ++segID) {
231+
for (auto segID = 0*nSeg; segID < nSeg; ++segID) {
232232
makeVectors(wname, segID + 1); // One-based
233233
}
234234
}
@@ -1213,14 +1213,14 @@ static const std::unordered_map< std::string, Opm::UnitSystem::measure> block_un
12131213
{"BSGAS" , Opm::UnitSystem::measure::identity},
12141214
{"BGSAT" , Opm::UnitSystem::measure::identity},
12151215
{"BOSAT" , Opm::UnitSystem::measure::identity},
1216-
{"BWKR" , Opm::UnitSystem::measure::identity},
1217-
{"BOKR" , Opm::UnitSystem::measure::identity},
1218-
{"BKRO" , Opm::UnitSystem::measure::identity},
1219-
{"BGKR" , Opm::UnitSystem::measure::identity},
1220-
{"BKRG" , Opm::UnitSystem::measure::identity},
1221-
{"BKRW" , Opm::UnitSystem::measure::identity},
1222-
{"BWPC" , Opm::UnitSystem::measure::pressure},
1223-
{"BGPC" , Opm::UnitSystem::measure::pressure},
1216+
{"BWKR" , Opm::UnitSystem::measure::identity},
1217+
{"BOKR" , Opm::UnitSystem::measure::identity},
1218+
{"BKRO" , Opm::UnitSystem::measure::identity},
1219+
{"BGKR" , Opm::UnitSystem::measure::identity},
1220+
{"BKRG" , Opm::UnitSystem::measure::identity},
1221+
{"BKRW" , Opm::UnitSystem::measure::identity},
1222+
{"BWPC" , Opm::UnitSystem::measure::pressure},
1223+
{"BGPC" , Opm::UnitSystem::measure::pressure},
12241224
{"BVWAT" , Opm::UnitSystem::measure::viscosity},
12251225
{"BWVIS" , Opm::UnitSystem::measure::viscosity},
12261226
{"BVGAS" , Opm::UnitSystem::measure::viscosity},
@@ -1230,10 +1230,12 @@ static const std::unordered_map< std::string, Opm::UnitSystem::measure> block_un
12301230
};
12311231

12321232
inline std::vector<Opm::Well> find_wells( const Opm::Schedule& schedule,
1233-
const Opm::EclIO::SummaryNode& node,
1234-
const int sim_step,
1235-
const Opm::out::RegionCache& regionCache ) {
1236-
switch (node.category) {
1233+
const Opm::EclIO::SummaryNode& node,
1234+
const int sim_step,
1235+
const Opm::out::RegionCache& regionCache ) {
1236+
const auto cat = node.category;
1237+
1238+
switch (cat) {
12371239
case Opm::EclIO::SummaryNode::Category::Well: [[fallthrough]];
12381240
case Opm::EclIO::SummaryNode::Category::Connection: [[fallthrough]];
12391241
case Opm::EclIO::SummaryNode::Category::Segment: {
@@ -1276,7 +1278,6 @@ inline std::vector<Opm::Well> find_wells( const Opm::Schedule& schedule,
12761278
}
12771279

12781280
return wells;
1279-
12801281
}
12811282

12821283
case Opm::EclIO::SummaryNode::Category::Block:
@@ -1297,7 +1298,7 @@ bool need_wells(const Opm::EclIO::SummaryNode& node) {
12971298
return true;
12981299
case Opm::EclIO::SummaryNode::Category::Region:
12991300
return std::regex_match(node.keyword, region_keyword_regex);
1300-
case Opm::EclIO::SummaryNode::Category::Miscellaneous:
1301+
case Opm::EclIO::SummaryNode::Category::Miscellaneous: [[fallthrough]];
13011302
case Opm::EclIO::SummaryNode::Category::Block:
13021303
return false;
13031304
}
@@ -1361,7 +1362,8 @@ void eval_udq(const Opm::Schedule& schedule, std::size_t sim_step, Opm::SummaryS
13611362
}
13621363
}
13631364

1364-
void updateValue(const Opm::EclIO::SummaryNode& node, const double value, Opm::SummaryState& st) {
1365+
void updateValue(const Opm::EclIO::SummaryNode& node, const double value, Opm::SummaryState& st)
1366+
{
13651367
if (node.category == Opm::EclIO::SummaryNode::Category::Well)
13661368
st.update_well_var(node.wgname, node.keyword, value);
13671369

@@ -1388,16 +1390,23 @@ void updateValue(const Opm::EclIO::SummaryNode& node, const double value, Opm::S
13881390
* rates and accumulated values.
13891391
*
13901392
*/
1391-
struct EfficiencyFactor {
1393+
struct EfficiencyFactor
1394+
{
13921395
using Factor = std::pair<std::string, double>;
13931396
using FacColl = std::vector<Factor>;
13941397

1395-
FacColl factors {} ;
1398+
FacColl factors{};
13961399

13971400
void setFactors(const Opm::EclIO::SummaryNode& node,
13981401
const Opm::Schedule& schedule,
1399-
const std::vector<Opm::Well>& schedule_wells,
1400-
const int sim_step)
1402+
const std::vector<Opm::Well>& schedule_wells,
1403+
const int sim_step);
1404+
};
1405+
1406+
void EfficiencyFactor::setFactors(const Opm::EclIO::SummaryNode& node,
1407+
const Opm::Schedule& schedule,
1408+
const std::vector<Opm::Well>& schedule_wells,
1409+
const int sim_step)
14011410
{
14021411
this->factors.clear();
14031412

@@ -1409,7 +1418,7 @@ struct EfficiencyFactor {
14091418
if (!is_field && !is_group && !is_region && is_rate)
14101419
return;
14111420

1412-
for (const auto& well : schedule_wells) {
1421+
for( const auto& well : schedule_wells ) {
14131422
if (!well.hasBeenDefined(sim_step))
14141423
continue;
14151424

@@ -1434,8 +1443,6 @@ struct EfficiencyFactor {
14341443
}
14351444
}
14361445

1437-
};
1438-
14391446
namespace Evaluator {
14401447
struct InputData
14411448
{
@@ -1469,9 +1476,9 @@ namespace Evaluator {
14691476
class FunctionRelation : public Base
14701477
{
14711478
public:
1472-
explicit FunctionRelation(const Opm::EclIO::SummaryNode& node, const ofun& fcn)
1473-
: node_(node)
1474-
, fcn_ (fcn)
1479+
explicit FunctionRelation(Opm::EclIO::SummaryNode node, ofun fcn)
1480+
: node_(std::move(node))
1481+
, fcn_ (std::move(fcn))
14751482
{}
14761483

14771484
void update(const std::size_t sim_step,
@@ -1512,15 +1519,16 @@ namespace Evaluator {
15121519
}
15131520

15141521
private:
1515-
const Opm::EclIO::SummaryNode node_;
1516-
const ofun fcn_;
1522+
Opm::EclIO::SummaryNode node_;
1523+
ofun fcn_;
15171524
};
15181525

15191526
class BlockValue : public Base
15201527
{
15211528
public:
1522-
explicit BlockValue(const Opm::EclIO::SummaryNode& node, const Opm::UnitSystem::measure& m)
1523-
: node_(node)
1529+
explicit BlockValue(Opm::EclIO::SummaryNode node,
1530+
const Opm::UnitSystem::measure m)
1531+
: node_(std::move(node))
15241532
, m_ (m)
15251533
{}
15261534

@@ -1540,8 +1548,8 @@ namespace Evaluator {
15401548
}
15411549

15421550
private:
1543-
const Opm::EclIO::SummaryNode node_;
1544-
const Opm::UnitSystem::measure m_;
1551+
Opm::EclIO::SummaryNode node_;
1552+
Opm::UnitSystem::measure m_;
15451553

15461554
Opm::out::Summary::BlockValues::key_type lookupKey() const
15471555
{
@@ -1552,8 +1560,9 @@ namespace Evaluator {
15521560
class RegionValue : public Base
15531561
{
15541562
public:
1555-
explicit RegionValue(const Opm::EclIO::SummaryNode node, const Opm::UnitSystem::measure& m)
1556-
: node_(node)
1563+
explicit RegionValue(Opm::EclIO::SummaryNode node,
1564+
const Opm::UnitSystem::measure m)
1565+
: node_(std::move(node))
15571566
, m_ (m)
15581567
{}
15591568

@@ -1581,8 +1590,8 @@ namespace Evaluator {
15811590
}
15821591

15831592
private:
1584-
const Opm::EclIO::SummaryNode node_;
1585-
const Opm::UnitSystem::measure m_;
1593+
Opm::EclIO::SummaryNode node_;
1594+
Opm::UnitSystem::measure m_;
15861595

15871596
std::vector<double>::size_type index() const
15881597
{
@@ -1593,8 +1602,9 @@ namespace Evaluator {
15931602
class GlobalProcessValue : public Base
15941603
{
15951604
public:
1596-
explicit GlobalProcessValue(const Opm::EclIO::SummaryNode& node, const Opm::UnitSystem::measure& m)
1597-
: node_(node)
1605+
explicit GlobalProcessValue(Opm::EclIO::SummaryNode node,
1606+
const Opm::UnitSystem::measure m)
1607+
: node_(std::move(node))
15981608
, m_ (m)
15991609
{}
16001610

@@ -1615,8 +1625,8 @@ namespace Evaluator {
16151625
}
16161626

16171627
private:
1618-
const Opm::EclIO::SummaryNode node_;
1619-
const Opm::UnitSystem::measure m_;
1628+
Opm::EclIO::SummaryNode node_;
1629+
Opm::UnitSystem::measure m_;
16201630
};
16211631

16221632
class UserDefinedValue : public Base
@@ -2330,15 +2340,15 @@ configureSummaryInput(const EclipseState& es,
23302340
const EclipseGrid& grid,
23312341
const Schedule& sched)
23322342
{
2333-
const SummaryState st {
2343+
const auto st = SummaryState {
23342344
std::chrono::system_clock::from_time_t(sched.getStartTime())
23352345
};
23362346

23372347
Evaluator::Factory fact {
23382348
es, grid, st, sched.getUDQConfig(sched.size() - 1)
23392349
};
23402350

2341-
std::vector<SummaryConfigNode> unsuppkw {};
2351+
auto unsuppkw = std::vector<SummaryConfigNode>{};
23422352
for (const auto& node : sumcfg) {
23432353
auto prmDescr = fact.create(node);
23442354

0 commit comments

Comments
 (0)