diff --git a/CMakeLists.txt b/CMakeLists.txt index f4b8343..c68a43a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,352 +1,424 @@ +#################################################### +# # +# SpecMiCP : CMakeLists.txt # +# # +#################################################### + project(specmicp) cmake_minimum_required(VERSION 2.8.8) -# Options : -# - SPECMICP_USE_OPENMP : bool : use openmp to parallelize code -# -# +# For an explanation of the options see the INSTALL file + +# External Package +######################################################################### -####################### External Package ##################################### set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake/") + +# Boost +# ----- find_package(Boost REQUIRED) include_directories(${Boost_INCLUDE_DIR}) + +# Eigen +# ----- find_package(Eigen3 REQUIRED) # This module comes from the Eigen3 Package include_directories(${EIGEN3_INCLUDE_DIR}) - +# Eigen unsuported +# GMRES.h is really the file we are using/looking for +# If it doesn't exist then the solver will not be included in the list of the parse solvers if(EXISTS "${EIGEN3_INCLUDE_DIR}/unsupported/Eigen/src/IterativeSolvers/GMRES.h") add_definitions(-DEIGEN_UNSUPPORTED_FOUND) INCLUDE_DIRECTORIES("${EIGEN3_INCLUDE_DIR}/unsupported/") endif() -######################## Compilation flags ################################# + +# Compilation flags +######################################################################### + if(UNIX) + # Generic options SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -std=c++11 -fuse-ld=gold") SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -pedantic") SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -DNDEBUG") + # OpenMP if(SPECMICP_USE_OPENMP) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp") add_definitions(-DSPECMICP_USE_OPENMP) endif() message(STATUS "c++ flags ${CMAKE_CXX_FLAGS}") else() message(WARNING "not tested !") endif() +# Activate this option to use finite difference jacobian +# add_definitions(-DSPECMICP_DEBUG_EQUATION_FD_JACOBIAN) + + +# Directories +######################################################################### -################ Directories ##################### # 3rd party +# ========= + +# JsonCPP +# ------- set(JSONCPP_DIR ${PROJECT_SOURCE_DIR}/3rdparty/jsoncpp/) add_custom_target(3rdparty_header SOURCES ${JSONCPP_DIR}/json/json.h ${JSONCPP_DIR}/json/json-forwards.h ) include_directories(${PROJECT_SOURCE_DIR}/3rdparty/jsoncpp/) +# Source +# ======= + set(PROJECT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src) -# include + +# Includes +# ========= + include_directories(${PROJECT_SOURCE_DIR}) add_custom_target(common SOURCES ${PROJECT_SOURCE_DIR}/common.hpp ${PROJECT_SOURCE_DIR}/database.hpp ) -################ Modules ########################## +# Modules +######################################################################### + -# -------- MiCPSolver ---------------- +# MiCPSolver +# ============== + +# Mixed complementarity Solver +# include only module set(MICPSOLVER_DIR ${PROJECT_SOURCE_DIR}/micpsolver) -add_custom_target(specmisolver_inc SOURCES +add_custom_target(micpsolver_inc SOURCES ${MICPSOLVER_DIR}/micpsolver_base.hpp ${MICPSOLVER_DIR}/micpsolver_base.inl ${MICPSOLVER_DIR}/micpsolver.hpp ${MICPSOLVER_DIR}/micpsolver.inl ${MICPSOLVER_DIR}/micpsolver_min.hpp ${MICPSOLVER_DIR}/micpsolver_min.inl ${MICPSOLVER_DIR}/micpsolverold.hpp ${MICPSOLVER_DIR}/micpsolverold.inl ${MICPSOLVER_DIR}/micpsolver_structs.hpp ${MICPSOLVER_DIR}/micpprog.hpp ${MICPSOLVER_DIR}/ncp_function.hpp ${MICPSOLVER_DIR}/estimate_cond_number.hpp ) -# ------- SpecMiCP --------------- +# SpecMiCP +# ============ + +# The speciation solver set(SPECMICP_DIR ${PROJECT_SOURCE_DIR}/specmicp) set(KINETICS_DIR ${SPECMICP_DIR}/kinetics) set(ADIMENSIONAL_DIR ${SPECMICP_DIR}/adimensional) set(PROBLEM_SOLVER_DIR ${SPECMICP_DIR}/problem_solver) +# headers only module add_custom_target(specmic_inc SOURCES - #${SPECMICP_DIR}/.hpp ${SPECMICP_DIR}/simulation_box.hpp ${SPECMICP_DIR}/reduced_system_structs.hpp ${SPECMICP_DIR}/reduced_system_solver_structs.hpp ${ADIMENSIONAL_DIR}/adimensional_system_structs.hpp ${ADIMENSIONAL_DIR}/adimensional_system_solution.hpp ${ADIMENSIONAL_DIR}/adimensional_system_solver_structs.hpp ${PROBLEM_SOLVER_DIR}/formulation.hpp ${KINETICS_DIR}/kinetic_model.hpp ${KINETICS_DIR}/kinetic_variables.hpp ${KINETICS_DIR}/kinetic_system_solver_structs.hpp ) +# Source for the library set(SPECMICP_LIBFILE ${SPECMICP_DIR}/equilibrium_data.cpp ${SPECMICP_DIR}/reduced_system.cpp ${SPECMICP_DIR}/reduced_system_solver.cpp ${SPECMICP_DIR}/reaction_path.cpp - #${SPECMICP_DIR}/speciation_solver.cpp - #${SPECMICP_DIR}/simple_composition.cpp ${ADIMENSIONAL_DIR}/adimensional_system.cpp ${ADIMENSIONAL_DIR}/adimensional_system_solver.cpp ${ADIMENSIONAL_DIR}/adimensional_system_solution_extractor.cpp ${ADIMENSIONAL_DIR}/equilibrium_curve.cpp ${PROBLEM_SOLVER_DIR}/dissolver.cpp # kinetic ${KINETICS_DIR}/kinetic_system.cpp ${KINETICS_DIR}/kinetic_system_solver.cpp ) add_library(specmicp ${SPECMICP_LIBFILE}) -# -------- Database ---------------- + +# Database +# ============ set(DATABASE_DIR ${PROJECT_SOURCE_DIR}/database) set(DATABASE_LIBFILE ${DATABASE_DIR}/data_container.cpp ${DATABASE_DIR}/database.cpp ${DATABASE_DIR}/reader.cpp ${DATABASE_DIR}/selector.cpp ${DATABASE_DIR}/mineral_selector.cpp ${DATABASE_DIR}/canonicalizer.cpp ${DATABASE_DIR}/switch_basis.cpp ${JSONCPP_DIR}/jsoncpp.cpp ) add_custom_target(data_incl SOURCES ${DATABASE_DIR}/common_def.hpp ${DATABASE_DIR}/module.hpp ) add_library(specmicp_database ${DATABASE_LIBFILE}) -# --------- ODE int ------------------ +# ODEint +# ========== + +# ODE integration, headers-only set(ODEINT_DIR ${PROJECT_SOURCE_DIR}/odeint) add_custom_target(odeint_incl SOURCES ${ODEINT_DIR}/odeint_types.hpp ${ODEINT_DIR}/butcher_tableau.hpp ${ODEINT_DIR}/runge_kutta_step.hpp ${ODEINT_DIR}/runge_kutta_step.inl ${ODEINT_DIR}/runge_kutta_step_structs.hpp ) -# --------- DFPMSolver ----------------- +# DFPMSolver +# ============== + +## Parabolic solver for finite element problem, header only set(DFPMSOLVER_DIR ${PROJECT_SOURCE_DIR}/dfpmsolver) add_custom_target(dfpmsolver_incl SOURCES ${DFPMSOLVER_DIR}/driver.hpp ${DFPMSOLVER_DIR}/driver.inl ${DFPMSOLVER_DIR}/driver_structs.hpp ${DFPMSOLVER_DIR}/dfpm_program.hpp # # Parabolic solver ${DFPMSOLVER_DIR}/parabolic_driver.hpp ${DFPMSOLVER_DIR}/parabolic_driver.inl ${DFPMSOLVER_DIR}/parabolic_program.hpp ${DFPMSOLVER_DIR}/parabolic_structs.hpp ) -# -------- DFPM ------------------------ +# DFPM +# ======== + +# Dynaflow+- , Finite element solver, mostly headers set (DFPM_DIR ${PROJECT_SOURCE_DIR}/dfpm) add_custom_target(dfpm_incl SOURCES ${DFPM_DIR}/types.hpp ${DFPM_DIR}/1dtransport/diffusion_parameters.hpp ${DFPM_DIR}/mesh.hpp ${DFPM_DIR}/meshes/mesh1dfwd.hpp ${DFPM_DIR}/meshes/mesh1d.hpp ${DFPM_DIR}/meshes/uniform_mesh1d.hpp ${DFPM_DIR}/meshes/axisymmetric_uniform_mesh1d.hpp ) set(DFPMLIB ${DFPM_DIR}/1dtransport/diffusion.cpp - ) add_library(dfpm ${DFPMLIB}) -# --------- ReactMiCP ----------------- +# ReactMiCP +# ============= + +# Reactive transport solver set(REACTMICP_DIR ${PROJECT_SOURCE_DIR}/reactmicp) set(REACTMICP_SOLVER_DIR ${REACTMICP_DIR}/solver/) set(REACTMICP_SYSTEMS_DIR ${REACTMICP_DIR}/systems/) add_custom_target(reactmicp_incl SOURCES ${REACTMICP_DIR}/common.hpp # - ${REACTMICP_DIR}/micpsolvers/parabolicprogram.hpp - ${REACTMICP_DIR}/micpsolvers/micpsolver_structs.hpp - ${REACTMICP_DIR}/micpsolvers/micpsolver.hpp - ${REACTMICP_DIR}/micpsolvers/micpsolver.inl + ${REACTMICP_DIR}/micpsolvers/parabolicprogram.hpp ## remove or fix + ${REACTMICP_DIR}/micpsolvers/micpsolver_structs.hpp ## remove or fix + ${REACTMICP_DIR}/micpsolvers/micpsolver.hpp ## remove or fix + ${REACTMICP_DIR}/micpsolvers/micpsolver.inl ## remove or fix # ${REACTMICP_DIR}/systems/secondary_variables/secondary.hpp ${REACTMICP_DIR}/systems/secondary_variables/secondary.inl ${REACTMICP_DIR}/systems/saturated_diffusion/reactive_transport_solver_structs.hpp ${REACTMICP_DIR}/systems/saturated_diffusion/transport_parameters.hpp ${REACTMICP_DIR}/systems/saturated_diffusion/transport_parameters_base.hpp ${REACTMICP_DIR}/systems/saturated_diffusion/transport_neutrality_parameters.hpp ${REACTMICP_DIR}/systems/saturated_diffusion/boundary_conditions.hpp - # Flexible reactive tranport solver # --------------------------------- ${REACTMICP_SOLVER_DIR}/reactive_transport_solver_structs.hpp ${REACTMICP_SOLVER_DIR}/staggers_base/variables_base.hpp ${REACTMICP_SOLVER_DIR}/staggers_base/transport_stagger_base.hpp ${REACTMICP_SOLVER_DIR}/staggers_base/chemistry_stagger_base.hpp ${REACTMICP_SOLVER_DIR}/staggers_base/upscaling_stagger_base.hpp ${REACTMICP_SOLVER_DIR}/staggers_base/stagger_structs.hpp ${REACTMICP_SOLVER_DIR}/staggers_base/decl.inl ${REACTMICP_SOLVER_DIR}/staggers_base/staggers_base.hpp ${REACTMICP_SYSTEMS_DIR}/saturated_react/variablesfwd.hpp ${REACTMICP_SYSTEMS_DIR}/saturated_react/input_data.hpp ) set(REACTMICP_LIBFILES - #${REACTMICP_DIR}/systems/diffusion/diffusion.cpp - #${REACTMICP_DIR}/systems/diffusion/diffusion_numbering.cpp - #${REACTMICP_DIR}/systems/diffusion/diffusion_secondary.cpp ${REACTMICP_DIR}/systems/saturated_diffusion/reactive_transport_solver.cpp ${REACTMICP_DIR}/systems/saturated_diffusion/reactive_transport_neutrality_solver.cpp ${REACTMICP_DIR}/systems/saturated_diffusion/transport_program.cpp ${REACTMICP_DIR}/systems/saturated_diffusion/transport_neutrality_program.cpp ${REACTMICP_DIR}/systems/saturated_diffusion/transport_neutrality_variables.cpp ${REACTMICP_DIR}/systems/saturated_diffusion/variables.cpp - ${REACTMICP_DIR}/equilibrium_curve/chemistry.cpp ${REACTMICP_DIR}/equilibrium_curve/eqcurve_extractor.cpp ${REACTMICP_DIR}/equilibrium_curve/eqcurve_coupler.cpp ${REACTMICP_DIR}/equilibrium_curve/eqcurve_solid_transport.cpp # Flexible reactive transport solver # ---------------------------------- ${REACTMICP_SOLVER_DIR}/reactive_transport_solver.cpp # ${REACTMICP_SYSTEMS_DIR}/saturated_react/variables.cpp ${REACTMICP_SYSTEMS_DIR}/saturated_react/transport_program.cpp ${REACTMICP_SYSTEMS_DIR}/saturated_react/transport_stagger.cpp ${REACTMICP_SYSTEMS_DIR}/saturated_react/equilibrium_stagger.cpp ${REACTMICP_SYSTEMS_DIR}/saturated_react/react_solver.cpp ${REACTMICP_SYSTEMS_DIR}/saturated_react/init_variables.cpp ) add_library(reactmicp ${REACTMICP_LIBFILES}) -# ------- Utils ------------------ +# Utils +# ========= + +# Stuff that may be used by the other modules + set(UTILS_DIR ${PROJECT_SOURCE_DIR}/utils) add_custom_target(utils_inc SOURCES ${UTILS_DIR}/log.hpp ${UTILS_DIR}/sparse_solver.hpp ${UTILS_DIR}/sparse_solver_structs.hpp ${UTILS_DIR}/options_handler.hpp ${UTILS_DIR}/perfs_handler.hpp ${UTILS_DIR}/moving_average.hpp ) -# ------- Physics ---------------- +# Physics +# =========== + +# Stuff that may be used by the other modules, but is related to physics set(PHYSICS_DIR ${PROJECT_SOURCE_DIR}/physics) add_custom_target(physics_inc SOURCES ${PHYSICS_DIR}/constants.hpp ${PHYSICS_DIR}/laws.hpp ${PHYSICS_DIR}/units.hpp ) -# ------- Data ------------------- +# Database +######################################################################### + + +# Not code, just necessary data set(DATA_DIR ${CMAKE_CURRENT_SOURCE_DIR}/data) set(DATABASE_LIST ${DATA_DIR}/specmicp_database.js ${DATA_DIR}/cemdata_specmicp.js ) add_custom_target(data SOURCES ${DATABASE_LIST}) file(INSTALL ${DATABASE_LIST} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/data/) -# ------ Documentation ----------- +# Documentation +######################################################################### +# "common" documentation +# ----------------------- set( DOCS_LIST ${CMAKE_CURRENT_SOURCE_DIR}/README.md ${CMAKE_CURRENT_SOURCE_DIR}/INSTALL ${CMAKE_CURRENT_SOURCE_DIR}/TODO ${CMAKE_CURRENT_SOURCE_DIR}/COPYING ) add_custom_target(docs SOURCES ${DOCS_LIST}) +# Doxygen documentation +# --------------------- + # add a target to generate API documentation with Doxygen find_package(Doxygen) + if(DOXYGEN_FOUND) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doc/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/doc/Doxyfile @ONLY) -add_custom_target(doc -${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doc/Doxyfile -WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} -COMMENT "Generating API documentation with Doxygen" VERBATIM -) -add_custom_target(citations SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/doc/citations.bib) -file(INSTALL ${CMAKE_CURRENT_SOURCE_DIR}/doc/citations.bib - DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/doc/) + # Configure doxygen + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doc/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/doc/Doxyfile @ONLY) + # Citations for the documentations + add_custom_target(citations SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/doc/citations.bib) + file(INSTALL ${CMAKE_CURRENT_SOURCE_DIR}/doc/citations.bib + DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/doc/) + # Target to build the documentations + add_custom_target(doc + ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doc/Doxyfile + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMENT "Generating API documentation with Doxygen" VERBATIM + ) endif(DOXYGEN_FOUND) -# --------- Python interface ---------- - -add_subdirectory( cython ) +# The following modules have their own CMakeLists.txt -# --------- Test ---------------------- +# Python interface +######################################################################### +add_subdirectory( cython ) +# Tests +######################################################################### add_subdirectory( tests ) -# --------- Examples ------------------ - +# Examples +######################################################################### add_subdirectory( examples ) diff --git a/INSTALL b/INSTALL index 44cf1a9..3859c73 100644 --- a/INSTALL +++ b/INSTALL @@ -1,16 +1,53 @@ Building SpecMiCP ----------------- SpecMiCP uses CMAKE as build system, to build it, in the specmicp directory, run : cmake . make -To customize build, see the cmake documentation. - -Requirements ------------- -- C++11 compliant compiler (recommended gcc4.8) -- Eigen (>= 3.2) -- JsonCPP -- Cxxtests (optional, for the test) +To customize build, see the cmake documentation and the following informations : + + +Requirements : +============== + + - C++11 compiler (tested with gcc 4.8) + - Boost (tested with boost 1.55) + - Eigen (>=3.2) + + +Requirements for the test : +--------------------------- + - CXXtest : will be changed to move everything to catch + +Requirements for the documentation : +------------------------------------ + - Doxygen + +Configuration Options : +======================= + + These options are used by CMake to configure the project + + - SPECMICP_USE_OPENMP + - bool + - Use the OpenMP library to allow multithreading + +Compilation Options : +===================== + + These options are used by the c++ preprocessor + + - SPECMICP_NO_DEBUG + - bool + - if true, remove assert used in specmicp + + - SPECMICP_USE_OPENMP : + - bool + - use openmp to parallelize code + + - SPECMICP_DEBUG_EQUATION_FD_JACOBIAN + - bool + - use a finite difference jacobian in specmicp +