@@ -49,6 +49,23 @@ struct Fixture
4949
5050BOOST_GLOBAL_FIXTURE (Fixture);
5151
52+ void checkReadFromDeckValues (const Opm::Deck& deck,
53+ const std::array<int ,3 >& expected_nxnynz,
54+ double expected_option)
55+ {
56+ const auto & autoref_keyword = deck[" AUTOREF" ][0 ];
57+
58+ Opm::AutoRefManager autoRefManager{};
59+
60+ Opm::readKeywordAutoRef (autoref_keyword.getRecord (0 ), autoRefManager);
61+ const auto autoRef = autoRefManager.getAutoRef ();
62+
63+ BOOST_CHECK_EQUAL ( autoRef.NX (), expected_nxnynz[0 ]);
64+ BOOST_CHECK_EQUAL ( autoRef.NY (), expected_nxnynz[1 ]);
65+ BOOST_CHECK_EQUAL ( autoRef.NZ (), expected_nxnynz[2 ]);
66+ BOOST_CHECK_EQUAL ( autoRef.OPTION_TRANS_MULT (), expected_option);
67+ }
68+
5269void checkGridAfterAutoRefinement (const Dune::CpGrid& grid,
5370 const std::array<int ,3 >& nxnynz)
5471{
@@ -131,17 +148,9 @@ PORO
131148 Opm::Parser parser;
132149 Opm::Deck deck = parser.parseString (deck_string);
133150
134- const auto & autoref_keyword = deck[" AUTOREF" ][0 ];
135-
136- Opm::AutoRefManager autoRefManager{};
137-
138- Opm::readKeywordAutoRef (autoref_keyword.getRecord (0 ), autoRefManager);
139- const auto autoRef = autoRefManager.getAutoRef ();
140-
141- BOOST_CHECK_EQUAL ( autoRef.NX (), 3 );
142- BOOST_CHECK_EQUAL ( autoRef.NY (), 3 );
143- BOOST_CHECK_EQUAL ( autoRef.NZ (), 1 );
144- BOOST_CHECK_EQUAL ( autoRef.OPTION_TRANS_MULT (), 0 .);
151+ checkReadFromDeckValues (deck,
152+ {3 ,3 ,1 }, // expected_nxnynz
153+ 0 .); // expected_option_trans_mult
145154
146155 Opm::EclipseState ecl_state (deck);
147156 Opm::EclipseGrid ecl_grid = ecl_state.getInputGrid ();
154163 }
155164
156165 // nxnynz represents the refinement factors in x-,y-,and z-direction.
157- grid.autoRefine (/* nxnynz = */ { autoRef. NX (), autoRef. NY (), autoRef. NZ () });
166+ grid.autoRefine (/* nxnynz = */ {3 , 3 , 1 });
158167
159- checkGridAfterAutoRefinement (grid, {autoRef. NX (), autoRef. NY (), autoRef. NZ () });
168+ checkGridAfterAutoRefinement (grid, /* nxnynz = */ { 3 , 3 , 1 });
160169}
161170
162171BOOST_AUTO_TEST_CASE (firstAutoRefineSecondGlobalRefine_serial) {
@@ -183,17 +192,9 @@ PORO
183192 Opm::Parser parser;
184193 Opm::Deck deck = parser.parseString (deck_string);
185194
186- const auto & autoref_keyword = deck[" AUTOREF" ][0 ];
187-
188- Opm::AutoRefManager autoRefManager{};
189-
190- Opm::readKeywordAutoRef (autoref_keyword.getRecord (0 ), autoRefManager);
191- const auto autoRef = autoRefManager.getAutoRef ();
192-
193- BOOST_CHECK_EQUAL ( autoRef.NX (), 3 );
194- BOOST_CHECK_EQUAL ( autoRef.NY (), 3 );
195- BOOST_CHECK_EQUAL ( autoRef.NZ (), 1 );
196- BOOST_CHECK_EQUAL ( autoRef.OPTION_TRANS_MULT (), 0 .);
195+ checkReadFromDeckValues (deck,
196+ {3 ,3 ,1 }, // expected_nxnynz
197+ 0 .); // expected_option_trans_mult
197198
198199 Opm::EclipseState ecl_state (deck);
199200 Opm::EclipseGrid ecl_grid = ecl_state.getInputGrid ();
204205 if (grid.comm ().size () == 1 ) { // serial
205206
206207 // nxnynz represents the refinement factors in x-,y-,and z-direction.
207- grid.autoRefine (/* nxnynz = */ { autoRef. NX (), autoRef. NY (), autoRef. NZ () });
208+ grid.autoRefine (/* nxnynz = */ {3 , 3 , 1 });
208209
209- checkGridAfterAutoRefinement (grid, {autoRef. NX (), autoRef. NY (), autoRef. NZ () });
210+ checkGridAfterAutoRefinement (grid, /* nxnynz = */ { 3 , 3 , 1 });
210211
211212 grid.globalRefine (2 );
212213 }
@@ -237,17 +238,9 @@ PORO
237238 Opm::Parser parser;
238239 Opm::Deck deck = parser.parseString (deck_string);
239240
240- const auto & autoref_keyword = deck[" AUTOREF" ][0 ];
241-
242- Opm::AutoRefManager autoRefManager{};
243-
244- Opm::readKeywordAutoRef (autoref_keyword.getRecord (0 ), autoRefManager);
245- const auto autoRef = autoRefManager.getAutoRef ();
246-
247- BOOST_CHECK_EQUAL ( autoRef.NX (), 3 );
248- BOOST_CHECK_EQUAL ( autoRef.NY (), 3 );
249- BOOST_CHECK_EQUAL ( autoRef.NZ (), 1 );
250- BOOST_CHECK_EQUAL ( autoRef.OPTION_TRANS_MULT (), 0 .);
241+ checkReadFromDeckValues (deck,
242+ {3 ,3 ,1 }, // expected_nxnynz
243+ 0 .); // expected_option_trans_mult
251244
252245 Opm::EclipseState ecl_state (deck);
253246 Opm::EclipseGrid ecl_grid = ecl_state.getInputGrid ();
258251 if (grid.comm ().size () == 1 ) { // serial
259252
260253 // nxnynz represents the refinement factors in x-,y-,and z-direction.
261- grid.autoRefine (/* nxnynz = */ { autoRef. NX (), autoRef. NY (), autoRef. NZ () });
254+ grid.autoRefine (/* nxnynz = */ {3 , 3 , 1 });
262255
263- checkGridAfterAutoRefinement (grid, {autoRef. NX (), autoRef. NY (), autoRef. NZ () });
256+ checkGridAfterAutoRefinement (grid, /* nxnynz = */ { 3 , 3 , 1 });
264257
265258 for (const auto & element : Dune::elements (grid.leafGridView ())) {
266259 grid.mark (1 , element);
0 commit comments