From 3adb4e4718581869285583d7be79dc7f4f925051 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Wed, 22 Jan 2020 18:37:07 -0700 Subject: [PATCH] Selectively disable complex UMFPACK instantiations if DEAL_II_WITH_COMPLEX=OFF. --- source/lac/sparse_direct.cc | 48 ++++++++++++++++++- ..._03_complex.with_complex_values=on.output} | 0 ...lex_complex.with_complex_values=on.output} | 0 ..._09_complex.with_complex_values=on.output} | 0 ...ex_nonblock.with_complex_values=on.output} | 0 5 files changed, 47 insertions(+), 1 deletion(-) rename tests/umfpack/{umfpack_03_complex.output => umfpack_03_complex.with_complex_values=on.output} (100%) rename tests/umfpack/{umfpack_03_complex_complex.output => umfpack_03_complex_complex.with_complex_values=on.output} (100%) rename tests/umfpack/{umfpack_09_complex.output => umfpack_09_complex.with_complex_values=on.output} (100%) rename tests/umfpack/{umfpack_09_complex_complex_complex_nonblock.output => umfpack_09_complex_complex_complex_nonblock.with_complex_values=on.output} (100%) diff --git a/source/lac/sparse_direct.cc b/source/lac/sparse_direct.cc index 2a0205db8a..ef46e7c30c 100644 --- a/source/lac/sparse_direct.cc +++ b/source/lac/sparse_direct.cc @@ -384,6 +384,7 @@ void SparseDirectUMFPACK::solve(Vector> &rhs_and_solution, const bool transpose /*=false*/) const { +# ifdef DEAL_II_WITH_COMPLEX_VALUES // make sure that some kind of factorize() call has happened before Assert(Ap.size() != 0, ExcNotInitialized()); Assert(Ai.size() != 0, ExcNotInitialized()); @@ -481,6 +482,16 @@ SparseDirectUMFPACK::solve(Vector> &rhs_and_solution, for (unsigned int i = 0; i < rhs.size(); ++i) rhs_and_solution(i).imag(rhs_real_or_imag(i)); } + +# else + + (void)rhs_and_solution; + (void)transpose; + Assert(false, + ExcMessage( + "This function can't be called if deal.II has been configured " + "with DEAL_II_WITH_COMPLEX_VALUES=FALSE.")); +# endif } @@ -503,6 +514,7 @@ void SparseDirectUMFPACK::solve(BlockVector> &rhs_and_solution, const bool transpose /*=false*/) const { +# ifdef DEAL_II_WITH_COMPLEX_VALUES // the UMFPACK functions want a contiguous array of elements, so // there is no way around copying data around. thus, just copy the // data into a regular vector and back @@ -510,6 +522,15 @@ SparseDirectUMFPACK::solve(BlockVector> &rhs_and_solution, tmp = rhs_and_solution; solve(tmp, transpose); rhs_and_solution = tmp; + +# else + (void)rhs_and_solution; + (void)transpose; + Assert(false, + ExcMessage( + "This function can't be called if deal.II has been configured " + "with DEAL_II_WITH_COMPLEX_VALUES=FALSE.")); +# endif } @@ -532,8 +553,20 @@ SparseDirectUMFPACK::solve(const Matrix & matrix, Vector> &rhs_and_solution, const bool transpose /*=false*/) { +# ifdef DEAL_II_WITH_COMPLEX_VALUES factorize(matrix); solve(rhs_and_solution, transpose); + +# else + + (void)matrix; + (void)rhs_and_solution; + (void)transpose; + Assert(false, + ExcMessage( + "This function can't be called if deal.II has been configured " + "with DEAL_II_WITH_COMPLEX_VALUES=FALSE.")); +# endif } @@ -556,8 +589,20 @@ SparseDirectUMFPACK::solve(const Matrix & matrix, BlockVector> &rhs_and_solution, const bool transpose /*=false*/) { +# ifdef DEAL_II_WITH_COMPLEX_VALUES factorize(matrix); solve(rhs_and_solution, transpose); + +# else + + (void)matrix; + (void)rhs_and_solution; + (void)transpose; + Assert(false, + ExcMessage( + "This function can't be called if deal.II has been configured " + "with DEAL_II_WITH_COMPLEX_VALUES=FALSE.")); +# endif } @@ -790,10 +835,11 @@ InstantiateUMFPACK(BlockSparseMatrix); InstantiateUMFPACK(BlockSparseMatrix); // Now also for complex-valued matrices +#ifdef DEAL_II_WITH_COMPLEX_VALUES InstantiateUMFPACK(SparseMatrix>); InstantiateUMFPACK(SparseMatrix>); InstantiateUMFPACK(BlockSparseMatrix>); InstantiateUMFPACK(BlockSparseMatrix>); - +#endif DEAL_II_NAMESPACE_CLOSE diff --git a/tests/umfpack/umfpack_03_complex.output b/tests/umfpack/umfpack_03_complex.with_complex_values=on.output similarity index 100% rename from tests/umfpack/umfpack_03_complex.output rename to tests/umfpack/umfpack_03_complex.with_complex_values=on.output diff --git a/tests/umfpack/umfpack_03_complex_complex.output b/tests/umfpack/umfpack_03_complex_complex.with_complex_values=on.output similarity index 100% rename from tests/umfpack/umfpack_03_complex_complex.output rename to tests/umfpack/umfpack_03_complex_complex.with_complex_values=on.output diff --git a/tests/umfpack/umfpack_09_complex.output b/tests/umfpack/umfpack_09_complex.with_complex_values=on.output similarity index 100% rename from tests/umfpack/umfpack_09_complex.output rename to tests/umfpack/umfpack_09_complex.with_complex_values=on.output diff --git a/tests/umfpack/umfpack_09_complex_complex_complex_nonblock.output b/tests/umfpack/umfpack_09_complex_complex_complex_nonblock.with_complex_values=on.output similarity index 100% rename from tests/umfpack/umfpack_09_complex_complex_complex_nonblock.output rename to tests/umfpack/umfpack_09_complex_complex_complex_nonblock.with_complex_values=on.output -- 2.39.5