Skip to content

Commit

Permalink
Merge pull request #4394 from akva2/janitoring
Browse files Browse the repository at this point in the history
Some janitoring
  • Loading branch information
bska authored Dec 23, 2024
2 parents 332a08e + 3b5f508 commit f0342ac
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 49 deletions.
2 changes: 2 additions & 0 deletions external/resinsight/LibCore/cvfArrayWrapperConst.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@

#pragma once

#include <cstddef>

namespace external {
namespace cvf {

Expand Down
18 changes: 3 additions & 15 deletions opm/common/utility/numeric/VectorUtil.hpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
#ifndef VECTORUTIL_H
#define VECTORUTIL_H

#include <tuple>
#include <vector>
#include <functional>
#include <stdexcept>
#include <algorithm>
#include <array>
#include <stdexcept>
#include <tuple>

#include <vector>

namespace VectorUtil {

Expand Down Expand Up @@ -97,16 +95,6 @@ auto callMethodForEachInputOnObjectXYZ(const T& obj, Method mtd, const std::vect
return splitXYZ<X>(result);
}

template <typename T>
void test(std::vector<T> vec){
std::size_t index = 1;
for (T el : vec){
index++;
}
}



// Example for other utilities...

} // namespace VectorUtil
Expand Down
16 changes: 10 additions & 6 deletions opm/input/eclipse/EclipseState/Grid/EclipseGrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2107,9 +2107,12 @@ std::vector<double> EclipseGrid::createDVector(const std::array<int,3>& dims, st
int EclipseGrid::initializeLGRObjectIndices(int num){
lgr_level = num;
num++;
for (std::size_t index :m_print_order_lgr_cells) {
num = lgr_children_cells[index].initializeLGRObjectIndices(num);
}
std::accumulate(m_print_order_lgr_cells.begin(),
m_print_order_lgr_cells.end(), num,
[this](int n, const auto& it)
{
return lgr_children_cells[it].initializeLGRObjectIndices(n);
});
return num;
}

Expand Down Expand Up @@ -2191,9 +2194,10 @@ std::vector<double> EclipseGrid::createDVector(const std::array<int,3>& dims, st
});

lgr_children_labels.reserve(lgr_children_cells.size());
for (auto lgr_cell : lgr_children_cells) {
lgr_children_labels.emplace_back(lgr_cell.lgr_label);
}
std::transform(lgr_children_cells.begin(),
lgr_children_cells.end(),
std::back_inserter(lgr_children_labels),
[](const auto& it) { return it.lgr_label; });
lgr_active_index.resize(lgr_children_cells.size(),0);
}

Expand Down
4 changes: 2 additions & 2 deletions opm/input/eclipse/EclipseState/Grid/EclipseGrid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,8 +391,8 @@ namespace Opm {
std::string father_label;
// references global on the father label
vec_size_t father_global;
std::array<int,3> low_fahterIJK;
std::array<int,3> up_fahterIJK;
std::array<int,3> low_fahterIJK{};
std::array<int,3> up_fahterIJK{};
std::vector<int> m_hostnum;
};

Expand Down
3 changes: 2 additions & 1 deletion opm/input/eclipse/Schedule/ResCoup/GrupSlav.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ void checkValidSlaveGroupName(const std::string& name, HandlerContext& handlerCo
}
}

ReservoirCoupling::GrupSlav::FilterFlag getFilterFlag(const DeckItem& keyword, HandlerContext& handlerContext)
ReservoirCoupling::GrupSlav::FilterFlag
getFilterFlag(const DeckItem& keyword, const HandlerContext& handlerContext)
{
try {
return ReservoirCoupling::GrupSlav::filterFlagFromString(keyword.getTrimmedString(0));
Expand Down
18 changes: 9 additions & 9 deletions opm/input/eclipse/Schedule/ResCoup/GrupSlav.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,15 @@ class GrupSlav {
}
}
private:
std::string m_name;
std::string m_master_group_name;
FilterFlag m_oil_prod_flag;
FilterFlag m_liquid_prod_flag;
FilterFlag m_gas_prod_flag;
FilterFlag m_fluid_volume_prod_flag;
FilterFlag m_oil_inj_flag;
FilterFlag m_water_inj_flag;
FilterFlag m_gas_inj_flag;
std::string m_name{};
std::string m_master_group_name{};
FilterFlag m_oil_prod_flag{FilterFlag::BOTH};
FilterFlag m_liquid_prod_flag{FilterFlag::BOTH};
FilterFlag m_gas_prod_flag{FilterFlag::BOTH};
FilterFlag m_fluid_volume_prod_flag{FilterFlag::BOTH};
FilterFlag m_oil_inj_flag{FilterFlag::BOTH};
FilterFlag m_water_inj_flag{FilterFlag::BOTH};
FilterFlag m_gas_inj_flag{FilterFlag::BOTH};
};

// NOTE: This operator is needed by Boost.Test, See tests/parser/ReservoirCouplingTests.cpp
Expand Down
8 changes: 4 additions & 4 deletions opm/input/eclipse/Schedule/ResCoup/MasterGroup.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ class MasterGroup {
}

private:
std::string m_name;
std::string m_slave_name;
std::string m_slave_group_name;
double m_flow_limit_fraction;
std::string m_name{};
std::string m_slave_name{};
std::string m_slave_group_name{};
double m_flow_limit_fraction{};
};


Expand Down
8 changes: 4 additions & 4 deletions opm/input/eclipse/Schedule/ResCoup/Slaves.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ class Slave {
serializer(m_numprocs);
}
private:
std::string m_name;
std::string m_data_filename;
std::string m_directory_path;
unsigned int m_numprocs;
std::string m_name{};
std::string m_data_filename{};
std::string m_directory_path{};
unsigned int m_numprocs{};
};

} // namespace ReservoirCoupling
Expand Down
3 changes: 1 addition & 2 deletions tests/parser/LgrOutputTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -434,8 +434,7 @@ SCHEDULE
Opm::UnitSystem units(1);
std::vector<Opm::NNCdata> vecNNC;
std::array<int,3> global_grid_dim = {3,3,1};
std::vector<double> coord_g, zcorn_g, coord_l1, zcorn_l1, coord_l2, zcorn_l2,
coord_g_opm, zcorn_g_opm, coord_l1_opm, zcorn_l1_opm, coord_l2_opm, zcorn_l2_opm;
std::vector<double> coord_g, zcorn_g, coord_l1, zcorn_l1, coord_l2, zcorn_l2;
// Intialize LgrCollection from string.
LgrCollection lgr_col = read_lgr(deck_string,global_grid_dim[0],global_grid_dim[1],global_grid_dim[2]);
// Read global COORD and ZCORN from reference simulator output.
Expand Down
2 changes: 1 addition & 1 deletion tests/parser/ReservoirCouplingTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ void assertRaisesInputErrorException(const std::string& schedule_string, bool sl
}

void checkLastLineStringBuffer(
std::ostringstream& stream_buffer,
const std::ostringstream& stream_buffer,
const std::string& expected,
size_t offset // Line offset from the end of the string
) {
Expand Down
10 changes: 5 additions & 5 deletions tests/test_Restart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,11 +412,11 @@ struct Setup
};

RestartValue
first_sim(const Setup& setup,
Action::State& action_state,
SummaryState& st,
UDQState& udq_state,
bool write_double)
first_sim(const Setup& setup,
const Action::State& action_state,
SummaryState& st,
UDQState& udq_state,
bool write_double)
{
WellTestState wtest_state;
EclipseIO eclWriter(setup.es, setup.grid, setup.schedule, setup.summary_config);
Expand Down

0 comments on commit f0342ac

Please sign in to comment.