浏览代码

Boost can now be turned off, but gaussian quadrature won't work in that case.

submodule
Trevor Irons 7 年前
父节点
当前提交
0f54063425

+ 18
- 0
CMakeLists.txt 查看文件

@@ -171,6 +171,24 @@ if ( KIHA_EM1D )
171 171
 endif()
172 172
 
173 173
 ####################
174
+# Look for Boost
175
+####################
176
+option (LEMMA_USE_BOOST "Boost is required by gaussian quadrature classes" OFF)
177
+if (LEMMA_USE_BOOST)
178
+	find_package(Boost
179
+  		1.58.0                         # Minimum or EXACT version e.g. 1.36.0
180
+  		COMPONENTS math                # Boost libraries by their canonical name
181
+	)  
182
+	if(Boost_FOUND)
183
+  		include_directories(${Boost_INCLUDE_DIRS})
184
+	endif()
185
+	find_path( HAVE_BOOST_SPECIAL_FUNCTIONS "boost/math/special_functions.hpp" ) 
186
+	if(HAVE_BOOST_SPECIAL_FUNCTIONS)
187
+		add_compile_options(-DHAVE_BOOST_SPECIAL_FUNCTIONS)
188
+	endif()
189
+endif()
190
+
191
+####################
174 192
 # Magic rpath flag
175 193
 ####################
176 194
 SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)

+ 3
- 2
Modules/FDEM1D/include/GQChave.h 查看文件

@@ -14,9 +14,10 @@
14 14
 
15 15
 #include "HankelTransform.h"
16 16
 #include "KernelEM1DBase.h"
17
-//#include <cmath>
18
-#include "boost/math/special_functions.hpp"
19 17
 
18
+#ifdef HAVE_BOOST_SPECIAL_FUNCTIONS
19
+#include "boost/math/special_functions.hpp"
20
+#endif
20 21
 
21 22
 namespace Lemma {
22 23
 

+ 3
- 0
Modules/FDEM1D/include/QWEKey.h 查看文件

@@ -22,8 +22,11 @@
22 22
 #include "HankelTransform.h"
23 23
 
24 24
 #include <Eigen/Eigenvalues>
25
+
26
+#ifdef HAVE_BOOST_SPECIAL_FUNCTIONS
25 27
 #include "boost/math/special_functions.hpp"
26 28
 #include "boost/math/special_functions/bessel.hpp"
29
+#endif
27 30
 
28 31
 namespace Lemma {
29 32
 

+ 1
- 0
Modules/FDEM1D/src/CMakeLists.txt 查看文件

@@ -18,6 +18,7 @@ set (FDEM1DSOURCE
18 18
 	${CMAKE_CURRENT_SOURCE_DIR}/FHTKey201.cpp
19 19
 	${CMAKE_CURRENT_SOURCE_DIR}/FHTKey101.cpp
20 20
 	${CMAKE_CURRENT_SOURCE_DIR}/FHTKey51.cpp
21
+
21 22
 	${CMAKE_CURRENT_SOURCE_DIR}/GQChave.cpp
22 23
 	${CMAKE_CURRENT_SOURCE_DIR}/QWEKey.cpp
23 24
 	

+ 6
- 1
Modules/FDEM1D/src/GQChave.cpp 查看文件

@@ -1117,6 +1117,7 @@ namespace Lemma{
1117 1117
 
1118 1118
     /////////////////////////////////////////////////////////////
1119 1119
     //
1120
+#ifdef HAVE_BOOST_SPECIAL_FUNCTIONS
1120 1121
     Real GQChave::Jbess(const Real &x, const int &IORDER) {
1121 1122
         switch (IORDER) {
1122 1123
             case 0:
@@ -1131,7 +1132,11 @@ namespace Lemma{
1131 1132
                 throw std::runtime_error("Non 0 or 1 Bessel argument specified in GQChave");
1132 1133
         }
1133 1134
     }
1134
-
1135
+#else
1136
+    Real GQChave::Jbess(const Real &x, const int &IORDER) {
1137
+        std::cerr << "GQChave requires boost special functions module";
1138
+    }
1139
+#endif
1135 1140
     //////////////////////////////////////////////////////
1136 1141
     // Exception classes
1137 1142
 

+ 7
- 1
Modules/FDEM1D/src/QWEKey.cpp 查看文件

@@ -169,6 +169,8 @@ namespace Lemma {
169 169
     //       Class:  QWEKey
170 170
     //      Method:  BesselWeights
171 171
     //--------------------------------------------------------------------------------------
172
+
173
+#ifdef HAVE_BOOST_SPECIAL_FUNCTIONS
172 174
     void QWEKey::BesselWeights ( const sZeroType& sType ) {
173 175
         GaussQuadWeights(nQuad); // TODO should this be moved out of initializer?
174 176
         std::vector<Real> bz;
@@ -207,7 +209,11 @@ namespace Lemma {
207 209
         }
208 210
         return ;
209 211
     }		// -----  end of method QWEKey::BesselWeights  -----
210
-
212
+#else
213
+    void QWEKey::BesselWeights ( const sZeroType& sType ) {
214
+        std::cerr <<  "QWEKey requires boost special functions";
215
+    }
216
+#endif
211 217
 
212 218
     //--------------------------------------------------------------------------------------
213 219
     //       Class:  QWEKey

正在加载...
取消
保存