Small POD class for connections loaded from restart file
This commit is contained in:
@@ -17,10 +17,13 @@
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#define BOOST_TEST_MODULE Aggregate_Connection_Data
|
||||
#include <opm/output/eclipse/AggregateMSWData.hpp>
|
||||
#include <opm/output/eclipse/AggregateConnectionData.hpp>
|
||||
#include <opm/output/eclipse/VectorItems/connection.hpp>
|
||||
#include <opm/io/eclipse/rst/header.hpp>
|
||||
#include <opm/io/eclipse/rst/connection.hpp>
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
@@ -792,6 +795,43 @@ BOOST_AUTO_TEST_CASE(InactiveCell) {
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(TestRestartIOConnection) {
|
||||
std::vector<bool> lh(1000);
|
||||
std::vector<double> dh(1000);
|
||||
auto simCase = SimulationCase{first_sim()};
|
||||
const auto rptStep = std::size_t{1};
|
||||
const auto ih = MockIH {static_cast<int>(simCase.sched.getWells(rptStep).size())};
|
||||
const Opm::data::WellRates wrc = wr();
|
||||
|
||||
Opm::RestartIO::Header header(ih.value, lh, dh);
|
||||
auto conn = Opm::RestartIO::Helpers::AggregateConnectionData{ih.value};
|
||||
conn.captureDeclaredConnData(simCase.sched,
|
||||
simCase.grid,
|
||||
simCase.es.getUnits(),
|
||||
wrc,
|
||||
rptStep
|
||||
);
|
||||
|
||||
const auto icon = conn.getIConn();
|
||||
const auto scon = conn.getSConn();
|
||||
const auto xcon = conn.getXConn();
|
||||
|
||||
std::vector<Opm::RestartIO::Connection> connections;
|
||||
for (std::size_t iw=0; iw < header.num_wells; iw++) {
|
||||
for (std::size_t ic=0; ic < header.ncwmax; ic++) {
|
||||
std::size_t icon_offset = header.niconz * (header.ncwmax * iw + ic);
|
||||
std::size_t scon_offset = header.nsconz * (header.ncwmax * iw + ic);
|
||||
std::size_t xcon_offset = header.nxconz * (header.ncwmax * iw + ic);
|
||||
|
||||
connections.emplace_back(icon.data() + icon_offset, scon.data() + scon_offset, xcon.data() + xcon_offset);
|
||||
}
|
||||
}
|
||||
const auto& conn0 = connections[0];
|
||||
BOOST_CHECK_EQUAL(conn0.insert_index, 1);
|
||||
BOOST_CHECK_EQUAL(conn0.ijk[0], 0);
|
||||
BOOST_CHECK_EQUAL(conn0.ijk[1], 4);
|
||||
BOOST_CHECK_EQUAL(conn0.ijk[2], 1);
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
Reference in New Issue
Block a user