Merge pull request #209 from atgeirr/fix-umfpack-conditional
Fixed conditional compilation issues with UMFPACK.
This commit is contained in:
commit
a3e949dfc3
@ -169,14 +169,12 @@ if (NOT SuiteSparse_FOUND)
|
|||||||
${PROJECT_SOURCE_DIR}/tutorials/tutorial2.cpp
|
${PROJECT_SOURCE_DIR}/tutorials/tutorial2.cpp
|
||||||
${PROJECT_SOURCE_DIR}/tutorials/tutorial3.cpp
|
${PROJECT_SOURCE_DIR}/tutorials/tutorial3.cpp
|
||||||
${PROJECT_SOURCE_DIR}/tutorials/tutorial4.cpp
|
${PROJECT_SOURCE_DIR}/tutorials/tutorial4.cpp
|
||||||
${PROJECT_SOURCE_DIR}/examples/spu_2p.cpp
|
|
||||||
)
|
)
|
||||||
endif (NOT SuiteSparse_FOUND)
|
endif (NOT SuiteSparse_FOUND)
|
||||||
|
|
||||||
# these files are provided in source control, but can only compile with Matlab
|
# 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
|
# available; we are not supposed to include the TinyXML test prog. regardless
|
||||||
list (REMOVE_ITEM opm-core_SOURCES
|
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/grid/cpgpreprocess/processgrid.c
|
||||||
${PROJECT_SOURCE_DIR}/${opm-core_DIR}/core/utility/parameters/tinyxml/xmltest.cpp
|
${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);
|
parameter::ParameterGroup param(argc, argv, false);
|
||||||
std::cout << "--------------- Reading parameters ---------------" << std::endl;
|
std::cout << "--------------- Reading parameters ---------------" << std::endl;
|
||||||
|
|
||||||
|
#if ! 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.
|
// If we have a "deck_filename", grid and props will be read from that.
|
||||||
bool use_deck = param.has("deck_filename");
|
bool use_deck = param.has("deck_filename");
|
||||||
boost::scoped_ptr<EclipseGridParser> deck;
|
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
|
void EclipseGridParser::saveEGRID( const std::string & filename) const
|
||||||
{
|
{
|
||||||
static_cast<void>(filename); // Suppress "unused variable" warning.
|
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
|
#endif
|
||||||
@ -1143,7 +1143,7 @@ void EclipseGridParser::getNumericErtFields(const string& filename)
|
|||||||
ecl_file_close(ecl_file);
|
ecl_file_close(ecl_file);
|
||||||
#else
|
#else
|
||||||
static_cast<void>(filename); // Suppress "unused variable" warning.
|
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
|
#endif // HAVE_ERT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ namespace Opm
|
|||||||
const std::string&,
|
const std::string&,
|
||||||
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
|
#define OPM_CSRMATRIXUMFPACKSOLVER_HPP_HEADER
|
||||||
|
|
||||||
#include <opm/core/linalg/call_umfpack.h>
|
#include <opm/core/linalg/call_umfpack.h>
|
||||||
|
#include <opm/core/utility/ErrorMacros.hpp>
|
||||||
|
|
||||||
namespace Opm {
|
namespace Opm
|
||||||
namespace ImplicitTransportLinAlgSupport {
|
{
|
||||||
class CSRMatrixUmfpackSolver {
|
namespace ImplicitTransportLinAlgSupport
|
||||||
|
{
|
||||||
|
|
||||||
|
class CSRMatrixUmfpackSolver
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
template <class Vector>
|
template <class Vector>
|
||||||
void
|
void
|
||||||
solve(const struct CSRMatrix* A,
|
solve(const struct CSRMatrix* A,
|
||||||
const Vector b,
|
const Vector b,
|
||||||
Vector x) {
|
Vector x)
|
||||||
|
{
|
||||||
call_UMFPACK(const_cast<CSRMatrix*>(A),
|
#if HAVE_SUITESPARSE_UMFPACK_H
|
||||||
b, x);
|
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>
|
template <class Vector>
|
||||||
void
|
void
|
||||||
solve(const struct CSRMatrix& A,
|
solve(const struct CSRMatrix& A,
|
||||||
const Vector& b,
|
const Vector& b,
|
||||||
Vector& x) {
|
Vector& x)
|
||||||
|
{
|
||||||
call_UMFPACK(const_cast<CSRMatrix*>(&A),
|
#if HAVE_SUITESPARSE_UMFPACK_H
|
||||||
&b[0], &x[0]);
|
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 */
|
#endif /* OPM_CSRMATRIXUMFPACKSOLVER_HPP_HEADER */
|
||||||
|
Loading…
Reference in New Issue
Block a user