Fixed conditional compilation issues with UMFPACK.
This should fix the issue reported in #208 introduced in #203.
This commit is contained in:
parent
36b3f46e93
commit
9a2f2c48fd
@ -169,14 +169,12 @@ if (NOT SuiteSparse_FOUND)
|
||||
${PROJECT_SOURCE_DIR}/tutorials/tutorial2.cpp
|
||||
${PROJECT_SOURCE_DIR}/tutorials/tutorial3.cpp
|
||||
${PROJECT_SOURCE_DIR}/tutorials/tutorial4.cpp
|
||||
${PROJECT_SOURCE_DIR}/examples/spu_2p.cpp
|
||||
)
|
||||
endif (NOT SuiteSparse_FOUND)
|
||||
|
||||
# these files are provided in source control, but can only compile with Matlab
|
||||
# available; we are not supposed to include the TinyXML test prog. regardless
|
||||
list (REMOVE_ITEM opm-core_SOURCES
|
||||
${PROJECT_SOURCE_DIR}/${opm-core_DIR}/core/grid/cpgpreprocess/mxgrdecl.c
|
||||
${PROJECT_SOURCE_DIR}/${opm-core_DIR}/core/grid/cpgpreprocess/processgrid.c
|
||||
${PROJECT_SOURCE_DIR}/${opm-core_DIR}/core/utility/parameters/tinyxml/xmltest.cpp
|
||||
)
|
||||
|
@ -78,6 +78,19 @@ main(int argc, char** argv)
|
||||
parameter::ParameterGroup param(argc, argv, false);
|
||||
std::cout << "--------------- Reading parameters ---------------" << std::endl;
|
||||
|
||||
#ifndef HAVE_SUITESPARSE_UMFPACK_H
|
||||
// This is an extra check to intercept a potentially invalid request for the
|
||||
// implicit transport solver as early as possible for the user.
|
||||
{
|
||||
const bool use_reorder = param.getDefault("use_reorder", true);
|
||||
if (!use_reorder) {
|
||||
THROW("Cannot use implicit transport solver without UMFPACK. "
|
||||
"Either reconfigure opm-core with SuiteSparse/UMFPACK support and recompile, "
|
||||
"or use the reordering solver (use_reorder=true).");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// If we have a "deck_filename", grid and props will be read from that.
|
||||
bool use_deck = param.has("deck_filename");
|
||||
boost::scoped_ptr<EclipseGridParser> deck;
|
||||
|
@ -1079,7 +1079,7 @@ void EclipseGridParser::saveEGRID_INIT( const std::string& output_dir , const st
|
||||
void EclipseGridParser::saveEGRID( const std::string & filename) const
|
||||
{
|
||||
static_cast<void>(filename); // Suppress "unused variable" warning.
|
||||
THROW("Cannot write EGRID format without ert library support. Reconfigure opm-core with --with-ert and recompile.");
|
||||
THROW("Cannot write EGRID format without ERT library support. Reconfigure opm-core with ERT support and recompile.";)
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -1143,7 +1143,7 @@ void EclipseGridParser::getNumericErtFields(const string& filename)
|
||||
ecl_file_close(ecl_file);
|
||||
#else
|
||||
static_cast<void>(filename); // Suppress "unused variable" warning.
|
||||
THROW("Cannot use IMPORT keyword without ert library support. Reconfigure opm-core with --with-ert and recompile.");
|
||||
THROW("Cannot use IMPORT keyword without ERT library support. Reconfigure opm-core with ERT support and recompile.");
|
||||
#endif // HAVE_ERT
|
||||
}
|
||||
|
||||
|
@ -162,7 +162,7 @@ namespace Opm
|
||||
const std::string&,
|
||||
const std::string&)
|
||||
{
|
||||
THROW("Cannot call writeECLData() without ert library support. Reconfigure opm-core with --with-ert and recompile.");
|
||||
THROW("Cannot call writeECLData() without ERT library support. Reconfigure opm-core with ERT support and recompile.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,32 +37,51 @@
|
||||
#define OPM_CSRMATRIXUMFPACKSOLVER_HPP_HEADER
|
||||
|
||||
#include <opm/core/linalg/call_umfpack.h>
|
||||
#include <opm/core/utility/ErrorMacros.hpp>
|
||||
|
||||
namespace Opm {
|
||||
namespace ImplicitTransportLinAlgSupport {
|
||||
class CSRMatrixUmfpackSolver {
|
||||
namespace Opm
|
||||
{
|
||||
namespace ImplicitTransportLinAlgSupport
|
||||
{
|
||||
|
||||
class CSRMatrixUmfpackSolver
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
template <class Vector>
|
||||
void
|
||||
solve(const struct CSRMatrix* A,
|
||||
const Vector b,
|
||||
Vector x) {
|
||||
|
||||
call_UMFPACK(const_cast<CSRMatrix*>(A),
|
||||
b, x);
|
||||
Vector x)
|
||||
{
|
||||
#ifdef HAVE_SUITESPARSE_UMFPACK_H
|
||||
call_UMFPACK(const_cast<CSRMatrix*>(A), b, x);
|
||||
#else
|
||||
THROW("Cannot use implicit transport solver without UMFPACK. "
|
||||
"Reconfigure opm-core with SuiteSparse/UMFPACK support and recompile.");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
template <class Vector>
|
||||
void
|
||||
solve(const struct CSRMatrix& A,
|
||||
const Vector& b,
|
||||
Vector& x) {
|
||||
|
||||
call_UMFPACK(const_cast<CSRMatrix*>(&A),
|
||||
&b[0], &x[0]);
|
||||
Vector& x)
|
||||
{
|
||||
#ifdef HAVE_SUITESPARSE_UMFPACK_H
|
||||
call_UMFPACK(const_cast<CSRMatrix*>(&A), &b[0], &x[0]);
|
||||
#else
|
||||
THROW("Cannot use implicit transport solver without UMFPACK. "
|
||||
"Reconfigure opm-core with SuiteSparse/UMFPACK support and recompile.");
|
||||
#endif
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}; // class CSRMatrixUmfpackSolver
|
||||
|
||||
} // namespace ImplicitTransportLinAlgSupport
|
||||
} // namespace Opm
|
||||
|
||||
#endif /* OPM_CSRMATRIXUMFPACKSOLVER_HPP_HEADER */
|
||||
|
Loading…
Reference in New Issue
Block a user