From 03466f67f88e9f4c8578c47d45869a02945b173f Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Wed, 26 Sep 2018 09:01:16 +0200 Subject: [PATCH] Allow omitting std::complex instantiations --- cmake/config/template-arguments.in | 41 ++++++++++------------- cmake/setup_cached_variables.cmake | 34 +++++++++++++++++++ include/deal.II/base/config.h.in | 1 + source/base/{config.cc => numbers.cc} | 0 source/dofs/dof_tools_constraints.inst.in | 4 +++ 5 files changed, 57 insertions(+), 23 deletions(-) rename source/base/{config.cc => numbers.cc} (100%) diff --git a/cmake/config/template-arguments.in b/cmake/config/template-arguments.in index 260787b27f..551fdd08d3 100644 --- a/cmake/config/template-arguments.in +++ b/cmake/config/template-arguments.in @@ -9,14 +9,16 @@ BOOL := { true; false } REAL_SCALARS := { double; float } // complex scalar types -COMPLEX_SCALARS := { std::complex; - std::complex } +COMPLEX_SCALARS := { + @DEAL_II_EXPAND_COMPLEX_SCALARS@; + } // real scalar floating point types -REAL_AND_COMPLEX_SCALARS := { double; - float; - std::complex; - std::complex } +REAL_AND_COMPLEX_SCALARS := { + double; + float; + @DEAL_II_EXPAND_COMPLEX_SCALARS@; + } // differentiable ADOL-C scalar types DIFFERENTIABLE_ADOLC_REAL_SCALARS := { @@ -44,7 +46,9 @@ DIFFERENTIABLE_REAL_SCALARS := { // all possible scalar types ALL_SCALAR_TYPES := { - double; float ; std::complex; std::complex; + double; + float; + @DEAL_II_EXPAND_COMPLEX_SCALARS@; @DEAL_II_EXPAND_ADOLC_TYPES@; @DEAL_II_EXPAND_TRILINOS_SACADO_TYPES_FAD@; @DEAL_II_EXPAND_TRILINOS_SACADO_TYPES_RAD@; @@ -60,8 +64,8 @@ MPI_SCALARS := { int; float; double; long double; - std::complex; - std::complex } + @DEAL_II_EXPAND_COMPLEX_SCALARS@; + } // template names for serial vectors that we can instantiate as T where // S=REAL_SCALARS for example @@ -71,32 +75,23 @@ DEAL_II_VEC_TEMPLATES := { Vector; BlockVector } VECTOR_TYPES := { Vector; Vector ; - Vector >; - Vector >; - BlockVector; BlockVector; - BlockVector >; - BlockVector >; - LinearAlgebra::Vector; LinearAlgebra::Vector ; - LinearAlgebra::Vector >; - LinearAlgebra::Vector > ; - LinearAlgebra::distributed::Vector; LinearAlgebra::distributed::Vector ; - LinearAlgebra::distributed::Vector >; - LinearAlgebra::distributed::Vector > ; - LinearAlgebra::distributed::BlockVector; LinearAlgebra::distributed::BlockVector ; - LinearAlgebra::distributed::BlockVector >; - LinearAlgebra::distributed::BlockVector > ; + @DEAL_II_EXPAND_COMPLEX_VECTORS@; + @DEAL_II_EXPAND_COMPLEX_BLOCK_VECTORS@; + @DEAL_II_EXPAND_COMPLEX_LA_VECTORS@; + @DEAL_II_EXPAND_COMPLEX_LA_PARALLEL_VECTORS@; + @DEAL_II_EXPAND_COMPLEX_LA_PARALLEL_BLOCK_VECTORS@; @DEAL_II_EXPAND_TRILINOS_MPI_VECTOR@; @DEAL_II_EXPAND_EPETRA_VECTOR@; diff --git a/cmake/setup_cached_variables.cmake b/cmake/setup_cached_variables.cmake index 53f440f158..da4a4fdde0 100644 --- a/cmake/setup_cached_variables.cmake +++ b/cmake/setup_cached_variables.cmake @@ -49,6 +49,7 @@ # Components and miscellaneous options: # # DEAL_II_WITH_64BIT_INDICES +# DEAL_II_WITH_COMPLEX_VALUES # DEAL_II_DOXYGEN_USE_MATHJAX # DEAL_II_COMPILE_EXAMPLES # DEAL_II_CPACK_BUNDLE_NAME @@ -370,6 +371,39 @@ OPTION(DEAL_II_WITH_64BIT_INDICES ) LIST(APPEND DEAL_II_FEATURES 64BIT_INDICES) +OPTION(DEAL_II_WITH_COMPLEX_VALUES + "If set to OFF, the classes that take a number type are not explicitly instantiated for std::complex and std::complex. If PETSc is built with complex scalar type, this option must be ON." + ON + ) +LIST(APPEND DEAL_II_FEATURES COMPLEX_VALUES) +IF(${DEAL_II_WITH_COMPLEX_VALUES}) + SET(DEAL_II_EXPAND_COMPLEX_SCALARS + "std::complex" + "std::complex" + ) + SET(DEAL_II_EXPAND_COMPLEX_VECTORS + "Vector >" + "Vector >" + ) + SET(DEAL_II_EXPAND_COMPLEX_BLOCK_VECTORS + "BlockVector >" + "BlockVector >" + ) + SET(DEAL_II_EXPAND_COMPLEX_LA_VECTORS + "LinearAlgebra::Vector >" + "LinearAlgebra::Vector >" + ) + + SET(DEAL_II_EXPAND_COMPLEX_LA_PARALLEL_VECTORS + "LinearAlgebra::distributed::Vector >" + "LinearAlgebra::distributed::Vector >" + ) + SET(DEAL_II_EXPAND_COMPLEX_LA_PARALLEL_BLOCK_VECTORS + "LinearAlgebra::distributed::BlockVector >" + "LinearAlgebra::distributed::BlockVector >" + ) +ENDIF() + OPTION(DEAL_II_DOXYGEN_USE_MATHJAX "If set to ON, doxygen documentation is generated using mathjax" OFF diff --git a/include/deal.II/base/config.h.in b/include/deal.II/base/config.h.in index c32f0dd5b7..e9cace6977 100644 --- a/include/deal.II/base/config.h.in +++ b/include/deal.II/base/config.h.in @@ -38,6 +38,7 @@ #cmakedefine DEAL_II_WITH_ADOLC #cmakedefine DEAL_II_WITH_ARPACK #cmakedefine DEAL_II_WITH_ASSIMP +#cmakedefine DEAL_II_WITH_COMPLEX_VALUES #cmakedefine DEAL_II_WITH_CUDA #cmakedefine DEAL_II_WITH_CXX14 #cmakedefine DEAL_II_WITH_CXX17 diff --git a/source/base/config.cc b/source/base/numbers.cc similarity index 100% rename from source/base/config.cc rename to source/base/numbers.cc diff --git a/source/dofs/dof_tools_constraints.inst.in b/source/dofs/dof_tools_constraints.inst.in index 6ece9c749f..acd32f3acb 100644 --- a/source/dofs/dof_tools_constraints.inst.in +++ b/source/dofs/dof_tools_constraints.inst.in @@ -25,9 +25,11 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : DIMENSIONS) const DoFHandler &, AffineConstraints &); +# ifdef DEAL_II_WITH_COMPLEX_VALUES template void DoFTools::make_hanging_node_constraints( const DoFHandler &, AffineConstraints> &); +# endif #endif } @@ -41,9 +43,11 @@ for (DH : DOFHANDLER_TEMPLATES; deal_II_dimension : DIMENSIONS) const DH &, AffineConstraints &); +#ifdef DEAL_II_WITH_COMPLEX_VALUES template void DoFTools::make_hanging_node_constraints( const DH &, AffineConstraints> &); +#endif #if deal_II_dimension != 1 template void DoFTools::make_periodicity_constraints( -- 2.39.5