Merge pull request #308 from rolk/308_agmg
Resurrect support for AGMG library This is an interim milestone that may serve as point from which to resurrect the AGMG suppert fully if the AGMG author ever decides to re-release the software under an open licence.
This commit is contained in:
commit
c50b62fe5a
@ -46,13 +46,6 @@ macro (prereqs_hook)
|
||||
endmacro (prereqs_hook)
|
||||
|
||||
macro (sources_hook)
|
||||
# Algebraic Multigrid must be compiled together with our program;
|
||||
# if it is not available, then remove our corresponding component
|
||||
find_package (AGMG)
|
||||
if (AGMG_FOUND)
|
||||
list (APPEND ${project}_SOURCES ${AGMG_SOURCES})
|
||||
endif (AGMG_FOUND)
|
||||
|
||||
# these solvers are only compiled in if their dependency is found
|
||||
if (NOT AGMG_FOUND)
|
||||
list (REMOVE_ITEM opm-core_SOURCES
|
||||
|
@ -15,14 +15,49 @@
|
||||
# Use define_fc_func from UseFortranWrappers to write FC_FUNC to your
|
||||
# own config.h, and declare the function dagmg using this macro.
|
||||
|
||||
# USE_MPI is an option that must be declared in the program
|
||||
# if this is enabled, then we use the parallel version of MUMPS
|
||||
# in package "libmumps-dev"; otherwise use serial version in
|
||||
# "libmumps-seq-dev"
|
||||
|
||||
# use the same options when searching for MPI
|
||||
if (AGMG_FIND_REQUIRED)
|
||||
set (_required "REQUIRED")
|
||||
endif ()
|
||||
if (AGMG_FIND_QUIETLY)
|
||||
set (_quiet "QUIET")
|
||||
endif ()
|
||||
|
||||
# use different version of library depending on MPI or not
|
||||
if (USE_MPI)
|
||||
set (_seq "")
|
||||
set (_par "_par")
|
||||
find_package (MPI ${_required} ${_quiet})
|
||||
set (_mpi_found "MPI_FOUND")
|
||||
else ()
|
||||
set (_seq "_seq")
|
||||
set (_par "")
|
||||
set (_mpi_found "")
|
||||
endif ()
|
||||
|
||||
find_file (AGMG_SOURCES
|
||||
dagmg.f90
|
||||
dagmg${_par}.f90
|
||||
PATHS ${AGMG_ROOT}
|
||||
PATH_SUFFIXES SRC
|
||||
DOC "Yvan Notay's Algebraic Multigrid Solver, Double Precision version"
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
# AGMG is dependent on having the MUMPS library present
|
||||
find_path (MUMPS_INCLUDE_DIR
|
||||
dmumps_struc.h
|
||||
PATH_SUFFIXES include
|
||||
)
|
||||
find_library (MUMPS_LIBRARY
|
||||
NAMES dmumps${_seq}
|
||||
DOC "MUltifrontal Massive Parallel sparse direct Solver"
|
||||
)
|
||||
|
||||
# make sure that we can compile Fortran code
|
||||
if (AGMG_SOURCES)
|
||||
enable_language (Fortran)
|
||||
@ -32,7 +67,7 @@ endif (AGMG_SOURCES)
|
||||
if (AGMG_SOURCES)
|
||||
set (HAVE_AGMG 1 CACHE INT "Is AGMG present?")
|
||||
else (AGMG_SOURCES)
|
||||
set (HAVE_AGMG "" CACHE INT "Is AGMG present?")
|
||||
unset (HAVE_AGMG CACHE)
|
||||
endif (AGMG_SOURCES)
|
||||
|
||||
# handle REQUIRED and QUIET standard options
|
||||
@ -40,5 +75,20 @@ include (FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args (AGMG
|
||||
DEFAULT_MSG
|
||||
AGMG_SOURCES
|
||||
MUMPS_INCLUDE_DIR
|
||||
MUMPS_LIBRARY
|
||||
CMAKE_Fortran_COMPILER_SUPPORTS_F90
|
||||
${_mpi_found}
|
||||
)
|
||||
|
||||
# add our own compatibility routine to link with system MUMPS
|
||||
if (AGMG_SOURCES)
|
||||
list (APPEND AGMG_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Templates/dagmg_mumps.f90")
|
||||
list (APPEND AGMG_INCLUDE_DIRS "${MUMPS_INCLUDE_DIR}")
|
||||
list (APPEND AGMG_LIBRARIES "${MUMPS_LIBRARY}")
|
||||
endif ()
|
||||
|
||||
if (USE_MPI AND MPI_FOUND)
|
||||
list (APPEND AGMG_INCLUDE_DIRS "${MPI_Fortran_INCLUDE_PATH}")
|
||||
list (APPEND AGMG_LIBRARIES "${MPI_Fortran_LIBRARIES}")
|
||||
endif ()
|
||||
|
@ -36,6 +36,7 @@ include (Duplicates)
|
||||
|
||||
# list of suffixes for all the project variables
|
||||
set (_opm_proj_vars
|
||||
SOURCES
|
||||
LINKER_FLAGS
|
||||
LIBRARIES
|
||||
DEFINITIONS
|
||||
|
@ -28,6 +28,8 @@ set (opm-core_DEPS
|
||||
"SuiteSparse COMPONENTS umfpack"
|
||||
# solver
|
||||
"SuperLU"
|
||||
# Algebraic Multigrid
|
||||
"AGMG"
|
||||
# xml processing (for config parsing)
|
||||
"TinyXML"
|
||||
# Ensembles-based Reservoir Tools (ERT)
|
||||
|
11
cmake/Templates/dagmg_mumps.f90
Normal file
11
cmake/Templates/dagmg_mumps.f90
Normal file
@ -0,0 +1,11 @@
|
||||
! AGMG expects an interface to MUMPS named like this
|
||||
subroutine DAGMG_MUMPS (id)
|
||||
|
||||
! In here are the official defines for the parameter passed to
|
||||
! MUMPS. These must match the corresponding ones in dagmg.f90
|
||||
include 'dmumps_struc.h'
|
||||
type (DMUMPS_STRUC) :: id
|
||||
|
||||
! Let the system library do all the heavy lifting
|
||||
call DMUMPS (id)
|
||||
end subroutine DAGMG_MUMPS
|
@ -38,7 +38,11 @@
|
||||
// Note that both the matrix entries and column indices are writable.
|
||||
// The solver may permute the matrix entries within each row during
|
||||
// the setup phase.
|
||||
#ifdef HAVE_MPI
|
||||
#define DAGMG_ FC_FUNC(dagmgpar, DAGMGPAR)
|
||||
#else
|
||||
#define DAGMG_ FC_FUNC(dagmg, DAGMG)
|
||||
#endif
|
||||
|
||||
extern "C"
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user