From: maier Date: Thu, 1 Nov 2012 22:40:24 +0000 (+0000) Subject: Add support for HAVE_JN X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5cfe40571aba181177f5a189cb9b897eb39689af;p=dealii-svn.git Add support for HAVE_JN git-svn-id: https://svn.dealii.org/branches/branch_cmake@27303 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/cmake/checks/check_for_system_features.cmake b/deal.II/cmake/checks/check_for_system_features.cmake index 7e61feb672..e6539db298 100644 --- a/deal.II/cmake/checks/check_for_system_features.cmake +++ b/deal.II/cmake/checks/check_for_system_features.cmake @@ -43,6 +43,20 @@ CHECK_FUNCTION_EXISTS(getpid HAVE_GETPID) CHECK_FUNCTION_EXISTS(rand_r HAVE_RAND_R) CHECK_FUNCTION_EXISTS(times HAVE_TIMES) +# +# Do we have the Bessel function jn? +# +FIND_LIBRARY(m_lib NAMES m) +MARK_AS_ADVANCED(m_lib) + +IF(NOT "${m_lib}" STREQUAL "-NOTFOUND") + SET(CMAKE_REQUIRED_LIBRARIES ${m_lib}) + CHECK_FUNCTION_EXISTS(jn HAVE_JN) + SET(CMAKE_REQUIRED_LIBRARIES) + IF(HAVE_JN) + LIST(APPEND DEAL_II_EXTERNAL_LIBRARIES ${m_lib}) + ENDIF() +ENDIF() # # Export DEAL_II_MSVC if we are on a Windows platform. diff --git a/deal.II/include/deal.II/base/config.h.in b/deal.II/include/deal.II/base/config.h.in index 0bf1afbfb5..6544f91b9e 100644 --- a/deal.II/include/deal.II/base/config.h.in +++ b/deal.II/include/deal.II/base/config.h.in @@ -493,6 +493,9 @@ /* Defined if you have the "times" function. */ #cmakedefine HAVE_TIMES +/* Defined if you have the "jn" function. */ +#cmakedefine HAVE_JN + /* Defined if deal.II was configured on a native Windows platform. */ #cmakedefine DEAL_II_MSVC diff --git a/deal.II/source/base/function_lib.cc b/deal.II/source/base/function_lib.cc index 977b4d2acd..eae8864f9f 100644 --- a/deal.II/source/base/function_lib.cc +++ b/deal.II/source/base/function_lib.cc @@ -2175,7 +2175,7 @@ namespace Functions { Assert(dim==2, ExcNotImplemented()); const double r = p.distance(center); -#ifdef HAVE_JN_ +#ifdef HAVE_JN return jn(order, r*wave_number); #else Assert(false, ExcMessage("Bessel function jn was not found by configure")); @@ -2195,7 +2195,7 @@ namespace Functions AssertDimension(points.size(), values.size()); for (unsigned int k=0;k result; result[0] = wave_number * co * dJn; result[1] = wave_number * si * dJn; -#ifdef HAVE_JN_ +#ifdef HAVE_JN return result; #else Assert(false, ExcMessage("Bessel function jn was not found by configure")); @@ -2247,7 +2247,7 @@ namespace Functions const double co = (r==0.) ? 0. : (p(0)-center(0))/r; const double si = (r==0.) ? 0. : (p(1)-center(1))/r; -#ifdef HAVE_JN_ +#ifdef HAVE_JN const double dJn = (order==0) ? (-jn(1, r*wave_number)) : (.5*(jn(order-1, wave_number*r) -jn(order+1, wave_number*r)));