]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Allow omitting std::complex instantiations
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Wed, 26 Sep 2018 07:01:16 +0000 (09:01 +0200)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Fri, 5 Oct 2018 03:17:23 +0000 (05:17 +0200)
cmake/config/template-arguments.in
cmake/setup_cached_variables.cmake
include/deal.II/base/config.h.in
source/base/numbers.cc [moved from source/base/config.cc with 100% similarity]
source/dofs/dof_tools_constraints.inst.in

index 260787b27fbe5e12662540b9c34ed0845294d22e..551fdd08d3cc8ca8b1fd0ea962526bd74997eea0 100644 (file)
@@ -9,14 +9,16 @@ BOOL            := { true; false }
 REAL_SCALARS    := { double; float }
 
 // complex scalar types
-COMPLEX_SCALARS := { std::complex<double>;
-                     std::complex<float> }
+COMPLEX_SCALARS := { 
+    @DEAL_II_EXPAND_COMPLEX_SCALARS@;
+    }
 
 // real scalar floating point types
-REAL_AND_COMPLEX_SCALARS    := { double;
-                                 float; 
-                                 std::complex<double>;
-                                 std::complex<float> }
+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<double>; std::complex<float>;
+    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<double>;
-                     std::complex<float> }
+                     @DEAL_II_EXPAND_COMPLEX_SCALARS@;
+                   }
 
 // template names for serial vectors that we can instantiate as T<S> where
 // S=REAL_SCALARS for example
@@ -71,32 +75,23 @@ DEAL_II_VEC_TEMPLATES := { Vector; BlockVector }
 VECTOR_TYPES := {   Vector<double>;
                     Vector<float> ;
 
-                    Vector<std::complex<double> >;
-                    Vector<std::complex<float> >;
-
                     BlockVector<double>;
                     BlockVector<float>;
 
-                    BlockVector<std::complex<double> >;
-                    BlockVector<std::complex<float> >;
-
                     LinearAlgebra::Vector<double>;
                     LinearAlgebra::Vector<float> ;
 
-                    LinearAlgebra::Vector<std::complex<double> >;
-                    LinearAlgebra::Vector<std::complex<float> > ;
-
                     LinearAlgebra::distributed::Vector<double>;
                     LinearAlgebra::distributed::Vector<float> ;
 
-                    LinearAlgebra::distributed::Vector<std::complex<double> >;
-                    LinearAlgebra::distributed::Vector<std::complex<float> > ;
-
                     LinearAlgebra::distributed::BlockVector<double>;
                     LinearAlgebra::distributed::BlockVector<float> ;
 
-                    LinearAlgebra::distributed::BlockVector<std::complex<double> >;
-                    LinearAlgebra::distributed::BlockVector<std::complex<float> > ;
+                    @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@;
index 53f440f1583c7190faa052ce05a71de3cdfdac36..da4a4fdde07145352a952bc9eed217d9a4482545 100644 (file)
@@ -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<float> and std::complex<double>. 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<double>"
+      "std::complex<float>"
+     )  
+  SET(DEAL_II_EXPAND_COMPLEX_VECTORS 
+      "Vector<std::complex<double> >"
+      "Vector<std::complex<float> >"
+     )
+  SET(DEAL_II_EXPAND_COMPLEX_BLOCK_VECTORS
+      "BlockVector<std::complex<double> >"
+      "BlockVector<std::complex<float> >"
+     )
+  SET(DEAL_II_EXPAND_COMPLEX_LA_VECTORS
+      "LinearAlgebra::Vector<std::complex<double> >"
+      "LinearAlgebra::Vector<std::complex<float> >"
+     )
+  SET(DEAL_II_EXPAND_COMPLEX_LA_PARALLEL_VECTORS
+      "LinearAlgebra::distributed::Vector<std::complex<double> >"
+      "LinearAlgebra::distributed::Vector<std::complex<float> >"
+     )
+  SET(DEAL_II_EXPAND_COMPLEX_LA_PARALLEL_BLOCK_VECTORS
+      "LinearAlgebra::distributed::BlockVector<std::complex<double> >"
+      "LinearAlgebra::distributed::BlockVector<std::complex<float> >"
+     )
+ENDIF()
+
 OPTION(DEAL_II_DOXYGEN_USE_MATHJAX
   "If set to ON, doxygen documentation is generated using mathjax"
   OFF
index c32f0dd5b7ae7f74ed01f3ce7cb2e8f24692246a..e9cace69778176bc85b0e1deb80410439782670d 100644 (file)
@@ -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
similarity index 100%
rename from source/base/config.cc
rename to source/base/numbers.cc
index 6ece9c749f848ad063fdbb14fe239c8796341318..acd32f3acb4e7719104535d00747c6ca9c258de1 100644 (file)
@@ -25,9 +25,11 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : DIMENSIONS)
       const DoFHandler<deal_II_dimension, deal_II_space_dimension> &,
       AffineConstraints<float> &);
 
+#  ifdef DEAL_II_WITH_COMPLEX_VALUES
     template void DoFTools::make_hanging_node_constraints(
       const DoFHandler<deal_II_dimension, deal_II_space_dimension> &,
       AffineConstraints<std::complex<double>> &);
+#  endif
 #endif
   }
 
@@ -41,9 +43,11 @@ for (DH : DOFHANDLER_TEMPLATES; deal_II_dimension : DIMENSIONS)
       const DH<deal_II_dimension, deal_II_dimension> &,
       AffineConstraints<float> &);
 
+#ifdef DEAL_II_WITH_COMPLEX_VALUES
     template void DoFTools::make_hanging_node_constraints(
       const DH<deal_II_dimension, deal_II_dimension> &,
       AffineConstraints<std::complex<double>> &);
+#endif
 
 #if deal_II_dimension != 1
     template void DoFTools::make_periodicity_constraints(

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.