Skip to content

Commit

Permalink
Optimize includes
Browse files Browse the repository at this point in the history
* Remove unnecessary includes
* Reduce public linking interface
  • Loading branch information
dweindl committed Oct 13, 2024
1 parent d5123a5 commit f7d5848
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 40 deletions.
12 changes: 6 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -269,23 +269,23 @@ target_link_libraries(
SUNDIALS::sunmatrixband_static
SUNDIALS::sunmatrixdense_static
SUNDIALS::sunmatrixsparse_static
SUNDIALS::sunlinsolband_static
SUNDIALS::sunlinsoldense_static
SUNDIALS::sunlinsolpcg_static
SUNDIALS::sunlinsolspbcgs_static
SUNDIALS::sunlinsolspfgmr_static
SUNDIALS::sunlinsolspgmr_static
SUNDIALS::sunlinsolsptfqmr_static
SUNDIALS::sunlinsolklu_static
SUNDIALS::sunnonlinsolnewton_static
SUNDIALS::sunnonlinsolfixedpoint_static
SUNDIALS::cvodes_static
SUNDIALS::idas_static
$<$<BOOL:${Boost_CHRONO_FOUND}>:Boost::chrono>
$<$<BOOL:${OpenMP_FOUND}>:OpenMP::OpenMP_CXX>
${CMAKE_DL_LIBS}
PRIVATE
BLAS::BLAS
SUNDIALS::sunnonlinsolnewton_static
SUNDIALS::sunnonlinsolfixedpoint_static
SUNDIALS::sunlinsolklu_static
SUNDIALS::sunlinsolband_static
SUNDIALS::sunlinsoldense_static
SUNDIALS::sunlinsolpcg_static
$<$<BOOL:${SUNDIALS_SUPERLUMT_ENABLE}>:SUNDIALS::sundials_sunlinsolsuperlumt>
)

Expand Down
4 changes: 0 additions & 4 deletions include/amici/abstract_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
#include "amici/sundials_matrix_wrapper.h"
#include "amici/vector.h"

#include <sunmatrix/sunmatrix_band.h>
#include <sunmatrix/sunmatrix_dense.h>
#include <sunmatrix/sunmatrix_sparse.h>

#include <memory>

namespace amici {
Expand Down
2 changes: 0 additions & 2 deletions include/amici/forwardproblem.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
#include "amici/misc.h"
#include "amici/model.h"
#include "amici/vector.h"
#include <amici/amici.h>

#include <sundials/sundials_direct.h>
#include <vector>

namespace amici {
Expand Down
1 change: 0 additions & 1 deletion include/amici/misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include "amici/defines.h"
#include "amici/exception.h"
#include "amici/vector.h"
#include <sunmatrix/sunmatrix_sparse.h> // SUNMatrixContent_Sparse

#include <algorithm>
#include <ctime>
Expand Down
8 changes: 2 additions & 6 deletions include/amici/model_dae.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,8 @@

#include "amici/model.h"

#include <nvector/nvector_serial.h>

#include <sunmatrix/sunmatrix_band.h>
#include <sunmatrix/sunmatrix_dense.h>
#include <sunmatrix/sunmatrix_sparse.h>

#include <sundials/sundials_nvector.h>
#include <sundials/sundials_matrix.h>
#include <numeric>
#include <vector>

Expand Down
6 changes: 1 addition & 5 deletions include/amici/model_ode.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,8 @@

#include "amici/model.h"

#include <nvector/nvector_serial.h>

#include <sundials/sundials_nvector.h>
#include <sundials/sundials_matrix.h>
#include <sunmatrix/sunmatrix_band.h>
#include <sunmatrix/sunmatrix_dense.h>
#include <sunmatrix/sunmatrix_sparse.h>

#include <vector>

Expand Down
3 changes: 2 additions & 1 deletion include/amici/newton_solver.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#ifndef amici_newton_solver_h
#define amici_newton_solver_h

#include "amici/solver.h"
#include "amici/defines.h"
#include "amici/vector.h"
#include "amici/sundials_linsol_wrapper.h"

namespace amici {

Expand Down
2 changes: 0 additions & 2 deletions include/amici/solver_cvodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
#include "amici/solver.h"
#include "amici/vector.h"

#include <sundials/sundials_matrix.h>

namespace amici {
class ExpData;
class ReturnData;
Expand Down
2 changes: 0 additions & 2 deletions include/amici/solver_idas.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

#include "amici/solver.h"

#include <sundials/sundials_matrix.h>

namespace amici {
class ExpData;
class ReturnData;
Expand Down
3 changes: 1 addition & 2 deletions include/amici/steadystateproblem.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@
#include <amici/newton_solver.h>
#include <amici/vector.h>

#include <nvector/nvector_serial.h>

#include <memory>

namespace amici {

class ExpData;
class Solver;
class Model;
class BackwardProblem;

/**
* @brief The SteadystateProblem class solves a steady-state problem using
Expand Down
11 changes: 2 additions & 9 deletions include/amici/sundials_linsol_wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,12 @@
#include "amici/vector.h"

#include <sundials/sundials_config.h>
#include <sunlinsol/sunlinsol_band.h>
#include <sunlinsol/sunlinsol_dense.h>
#include <sunlinsol/sunlinsol_klu.h>
#include <sunlinsol/sunlinsol_pcg.h>
#include <sundials/sundials_iterative.h>
#include <sunlinsol/sunlinsol_spbcgs.h>
#include <sunlinsol/sunlinsol_spfgmr.h>
#include <sunlinsol/sunlinsol_spgmr.h>
#include <sunlinsol/sunlinsol_sptfqmr.h>
#ifdef SUNDIALS_SUPERLUMT
#include <sunlinsol/sunlinsol_superlumt.h>
#endif
#include <sunnonlinsol/sunnonlinsol_fixedpoint.h>
#include <sunnonlinsol/sunnonlinsol_newton.h>
#include <sundials/sundials_nonlinearsolver.h>

namespace amici {

Expand Down
9 changes: 9 additions & 0 deletions src/sundials_linsol_wrapper.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
#include <amici/sundials_linsol_wrapper.h>

#include <amici/exception.h>
#include <sunlinsol/sunlinsol_klu.h>
#include <sunlinsol/sunlinsol_band.h>
#include <sunlinsol/sunlinsol_dense.h>
#include <sunlinsol/sunlinsol_pcg.h>
#ifdef SUNDIALS_SUPERLUMT
#include <sunlinsol/sunlinsol_superlumt.h>
#endif
#include <sunnonlinsol/sunnonlinsol_fixedpoint.h>
#include <sunnonlinsol/sunnonlinsol_newton.h>

#include <utility>

Expand Down

0 comments on commit f7d5848

Please sign in to comment.