mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Addressing review comments.
This commit is contained in:
parent
7a0074f0e9
commit
7fc9a2eef3
@ -38,37 +38,9 @@ function(add_test_runSimulator)
|
|||||||
-n ${PARAM_PROCS}
|
-n ${PARAM_PROCS}
|
||||||
TEST_ARGS ${TEST_ARGS}
|
TEST_ARGS ${TEST_ARGS}
|
||||||
CONFIGURATION ${PARAM_CONFIGURATION})
|
CONFIGURATION ${PARAM_CONFIGURATION})
|
||||||
|
set_tests_properties(runSimulator/${PARAM_CASENAME} PROPERTIES PROCESSORS ${PARAM_PROCS})
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
###########################################################################
|
|
||||||
# TEST: runSimulatorAlways - Run as default test (not only with the EXTRA conf)
|
|
||||||
###########################################################################
|
|
||||||
|
|
||||||
# Input:
|
|
||||||
# - casename: basename (no extension)
|
|
||||||
#
|
|
||||||
# Details:
|
|
||||||
# - This test class simply runs a simulation
|
|
||||||
function(add_test_runSimulatorAlways)
|
|
||||||
set(oneValueArgs CASENAME FILENAME SIMULATOR DIR DIR_PREFIX PROCS)
|
|
||||||
set(multiValueArgs TEST_ARGS)
|
|
||||||
cmake_parse_arguments(PARAM "$" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
|
|
||||||
if(NOT PARAM_DIR)
|
|
||||||
set(PARAM_DIR ${PARAM_CASENAME})
|
|
||||||
endif()
|
|
||||||
set(RESULT_PATH ${BASE_RESULT_PATH}${PARAM_DIR_PREFIX}/${PARAM_SIMULATOR}+${PARAM_CASENAME})
|
|
||||||
set(TEST_ARGS ${PARAM_TEST_ARGS})
|
|
||||||
opm_add_test(runSimulator/${PARAM_CASENAME} NO_COMPILE
|
|
||||||
EXE_NAME ${PARAM_SIMULATOR}
|
|
||||||
DRIVER_ARGS -i ${OPM_TESTS_ROOT}/${PARAM_DIR}
|
|
||||||
-r ${RESULT_PATH}
|
|
||||||
-b ${PROJECT_BINARY_DIR}/bin
|
|
||||||
-f ${PARAM_FILENAME}
|
|
||||||
-n ${PARAM_PROCS}
|
|
||||||
TEST_ARGS ${TEST_ARGS})
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
|
|
||||||
###########################################################################
|
###########################################################################
|
||||||
# TEST: compareECLFiles
|
# TEST: compareECLFiles
|
||||||
###########################################################################
|
###########################################################################
|
||||||
|
@ -44,7 +44,7 @@ struct Column : public std::vector<std::string> {
|
|||||||
const auto& conv_func = [](const std::string& strval) {
|
const auto& conv_func = [](const std::string& strval) {
|
||||||
int ival;
|
int ival;
|
||||||
try {
|
try {
|
||||||
ival = static_cast<int>(std::stod(strval));
|
ival = std::stoi(strval);
|
||||||
} catch (std::invalid_argument& exc) {
|
} catch (std::invalid_argument& exc) {
|
||||||
ival = std::numeric_limits<int>::min();
|
ival = std::numeric_limits<int>::min();
|
||||||
}
|
}
|
||||||
@ -88,7 +88,7 @@ struct ColumnData {
|
|||||||
raw_columns[i].push_back(colname);
|
raw_columns[i].push_back(colname);
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
if (i > num_columns) {
|
if (i >= num_columns && iss >> colname) {
|
||||||
std::cout << "Warning: Ignoring extra column(s) on line " << lineno << std::endl;
|
std::cout << "Warning: Ignoring extra column(s) on line " << lineno << std::endl;
|
||||||
}
|
}
|
||||||
++lineno;
|
++lineno;
|
||||||
@ -96,10 +96,10 @@ struct ColumnData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get data vectors of different types
|
// Get data vectors of different types
|
||||||
std::vector<double> get_dvector(const std::string& colname) { return columns[colname]->dvalues(); }
|
std::vector<double> get_dvector(const std::string& colname) const { return columns.at(colname)->dvalues(); }
|
||||||
std::vector<int> get_ivector(const std::string& colname) { return columns[colname]->ivalues(); }
|
std::vector<int> get_ivector(const std::string& colname) const { return columns.at(colname)->ivalues(); }
|
||||||
// Default is to return double values
|
// Default is to return double values
|
||||||
std::vector<double> operator[](const std::string& colname) { return columns[colname]->dvalues(); }
|
std::vector<double> operator[](const std::string& colname) const { return columns.at(colname)->dvalues(); }
|
||||||
|
|
||||||
std::vector<std::string> column_names;
|
std::vector<std::string> column_names;
|
||||||
std::vector<Column> raw_columns;
|
std::vector<Column> raw_columns;
|
||||||
@ -142,11 +142,11 @@ BOOST_AUTO_TEST_CASE(CheckMassBalanceWithinXXXMBE)
|
|||||||
}
|
}
|
||||||
max_mb.push_back( std::max({mbo.back(), mbw.back(), mbg.back(), max_mb_step}) );
|
max_mb.push_back( std::max({mbo.back(), mbw.back(), mbg.back(), max_mb_step}) );
|
||||||
|
|
||||||
std::cout << "---------------------------------------------------------------------------" << std::endl;
|
BOOST_TEST_MESSAGE("---------------------------------------------------------------------------");
|
||||||
std::cout << "Found the following converged max mass balance error (per report step):" << std::endl;
|
BOOST_TEST_MESSAGE("Found the following converged max mass balance error (per report step):");
|
||||||
for (auto& val : max_mb)
|
for (auto& val : max_mb)
|
||||||
std::cout << val << std::endl;
|
BOOST_TEST_MESSAGE(val);
|
||||||
std::cout << "---------------------------------------------------------------------------" << std::endl;
|
BOOST_TEST_MESSAGE("---------------------------------------------------------------------------");
|
||||||
|
|
||||||
|
|
||||||
BOOST_CHECK( max_mb[0] < 1.0e-6 );
|
BOOST_CHECK( max_mb[0] < 1.0e-6 );
|
||||||
|
Loading…
Reference in New Issue
Block a user