Skip to content

Commit 2be6936

Browse files
authored
Merge pull request DGtal-team#1185 from rolanddenis/pr_RealFFT
Real-data in-place Fast Fourier Transform using FFTW3.
2 parents a8f43a3 + 8ab38e9 commit 2be6936

File tree

10 files changed

+1851
-10
lines changed

10 files changed

+1851
-10
lines changed

.travis.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ notifications:
2020
# - one build for the documentation on macosx (clang) and only for commits on
2121
# DGtal-team repo (no pull request). Encrypted var. required.
2222
# - No gcc on macos
23-
# - clang build of dgtaltools in linux only. In this case, some dependencies are considerd in DGtal (GMP, QGLViewer, CAIRO, HDF5)
23+
# - clang build of dgtaltools in linux only. In this case, some dependencies are considerd in DGtal (GMP, QGLViewer, CAIRO, HDF5, FFTW3)
2424
# - Otherwise, 2 os x 2 configs
2525
#
2626
########
2727
env:
28-
- CONFIG="Debug,Magick,GMP,ITK"
28+
- CONFIG="Debug,Magick,GMP,ITK,FFTW3"
2929
- CONFIG="Debug,Cairo,QGLviewer,HDF5"
3030
- CONFIG="Documentation"
3131
- CONFIG="DGtalTools"
@@ -66,6 +66,7 @@ addons:
6666
- libinsighttoolkit3-dev
6767
- g++-4.8
6868
- gcc-4.8
69+
- libfftw3-dev
6970

7071

7172
before_install:
@@ -75,7 +76,7 @@ before_install:
7576
- NEEDCORE="true";
7677
- NEEDEXAMPLESANDTESTS="true";
7778
- if [ $CONFIG == "Documentation" ]; then NEEDEXAMPLESANDTESTS="false"; NEEDCORE="false"; BUILD_DOC="true"; if [ $OriginalRepo == "true" ]; then if [ $TRAVIS_PULL_REQUEST == "false" ]; then UPLOAD_DOC="true"; fi; fi; fi
78-
- if [ $CONFIG == "Debug,Magick,GMP,ITK" ]; then BTYPE="-DCMAKE_BUILD_TYPE=Debug -DWITH_MAGICK=true -DWITH_GMP=true -DBUILD_TESTING=ON -DWARNING_AS_ERROR=ON"; fi
79+
- if [ $CONFIG == "Debug,Magick,GMP,ITK,FFTW3" ]; then BTYPE="-DCMAKE_BUILD_TYPE=Debug -DWITH_MAGICK=true -DWITH_GMP=true -DWITH_FFTW3=true -DBUILD_TESTING=ON -DWARNING_AS_ERROR=ON"; fi
7980
- if [ $CONFIG == "Debug,Cairo,QGLviewer,HDF5" ]; then BTYPE="-DCMAKE_BUILD_TYPE=Debug -DWITH_HDF5=true -DWITH_CAIRO=true -DWITH_QGLVIEWER=true -DBUILD_TESTING=ON -DWARNING_AS_ERROR=OFF"; fi
8081
- if [ $CONFIG == "DGtalTools" ]; then NEEDEXAMPLESANDTESTS="false"; BTYPE="-DCMAKE_BUILD_TYPE=Debug -DWITH_MAGICK=true -DWITH_GMP=true -DWITH_HDF5=true -DWITH_CAIRO=true -DWITH_QGLVIEWER=true -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=off"; fi
8182
- if [ $UPLOAD_DOC == "true" ]; then openssl aes-256-cbc -K $encrypted_47769ec71275_key -iv $encrypted_47769ec71275_iv -in .travis/dgtal_rsa.enc -out .travis/dgtal_rsa -d; chmod 600 .travis/dgtal_rsa; BUILD_DOC="true"; fi
@@ -87,7 +88,7 @@ before_install:
8788
########
8889
before_script:
8990
- if [ $TRAVIS_OS_NAME == linux ]; then echo "All done."; fi
90-
- if [ $TRAVIS_OS_NAME == osx ]; then brew update; brew install boost doxygen homebrew/science/hdf5 graphviz graphicsmagick gmp libqglviewer; echo "done";fi
91+
- if [ $TRAVIS_OS_NAME == osx ]; then brew update; brew install boost doxygen homebrew/science/hdf5 graphviz graphicsmagick gmp libqglviewer fftw; echo "done";fi
9192

9293

9394
############

ChangeLog.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,16 @@
88
- New "@seeDGtalTools" doxygen command to cite a DGtalTools tool in
99
DGtal documentation (David Coeurjolly,
1010
[#1179](https://github.com/DGtal-team/DGtal/pull/1179))
11-
11+
1212
- *Geometry Package*
1313
- New robust normal vector estimator using spherical accumulators and statistical
1414
voting (Boulc'h & Marlet, SGP 2012).
1515
(David Coeurjolly, [#1149](https://github.com/DGtal-team/DGtal/pull/1149))
1616

17+
- *Math Package*
18+
- New RealFFT class for in-place real-complex Fast Fourier Transform using
19+
fftw3 library.
20+
(Roland Denis, [#1185](https://github.com/DGtal-team/DGtal/pull/1185))
1721
- *Topology Package*
1822
- Adding periodic closure for KhalimskySpaceND and per-dimension closure
1923
specification.

cmake/CheckDGtalOptionalDependencies.cmake

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ OPTION(WITH_QGLVIEWER "With LibQGLViewer for 3D visualization (Qt4 required)." O
2424
OPTION(WITH_PATATE "With Patate library for geometry OFF (Eigen required)." processing)
2525
OPTION(WITH_QT5 "Using Qt5." OFF)
2626
OPTION(WITH_BENCHMARK "With Google Benchmark." OFF)
27+
OPTION(WITH_FFTW3 "With FFTW3 discrete Fourier Transform library." OFF)
2728

2829
#----------------------------------
2930
# Removing -frounding-math compile flag for clang
@@ -113,6 +114,13 @@ else (WITH_QT5)
113114
message(STATUS " WITH_QT5 false (Using of Qt5 instead of Qt4)")
114115
endif (WITH_QT5)
115116

117+
if (WITH_FFTW3)
118+
set(LIST_OPTION ${LIST_OPTION} [FFTW3]\ )
119+
message(STATUS " WITH_FFTW3 true (FFTW3 discrete Fourier transform library)")
120+
else (WITH_FFTW3)
121+
message(STATUS " WITH_FFTW3 false (FFTW3 discrete Fourier transform library)")
122+
endif (WITH_FFTW3)
123+
116124
message(STATUS "")
117125
message(STATUS "For Developpers:")
118126
IF(WITH_BENCHMARK)
@@ -455,5 +463,38 @@ IF(WITH_BENCHMARK)
455463
ENDIF(BENCHMARK_FOUND)
456464
ENDIF(WITH_BENCHMARK)
457465

466+
# -----------------------------------------------------------------------------
467+
# Look for FFTW3.
468+
# (They are not compulsory).
469+
# -----------------------------------------------------------------------------
470+
SET(FFTW3_FOUND_DGTAL 0)
471+
IF(WITH_FFTW3)
472+
FIND_PACKAGE(FFTW3 REQUIRED)
473+
IF(FFTW3_FOUND)
474+
SET(FFTW3_FOUND_DGTAL 1)
475+
ADD_DEFINITIONS("-DWITH_FFTW3 ")
476+
INCLUDE_DIRECTORIES(${FFTW3_INCLUDES})
477+
SET(DGtalLibDependencies ${DGtalLibDependencies} ${FFTW3_LIBRARIES} ${FFTW3_DEP_LIBRARIES} )
478+
message(STATUS "FFTW3 is found : ${FFTW3_LIBRARIES}.")
479+
ELSE(FFTW3_FOUND)
480+
message(FATAL_ERROR "FFTW3 is not found.")
481+
ENDIF(FFTW3_FOUND)
482+
483+
IF(FFTW3_FLOAT_FOUND)
484+
SET(FFTW3_FLOAT_FOUND_DGTAL 1)
485+
ADD_DEFINITIONS("-DWITH_FFTW3_FLOAT ")
486+
ENDIF(FFTW3_FLOAT_FOUND)
487+
488+
IF(FFTW3_DOUBLE_FOUND)
489+
SET(FFTW3_DOUBLE_FOUND_DGTAL 1)
490+
ADD_DEFINITIONS("-DWITH_FFTW3_DOUBLE ")
491+
ENDIF(FFTW3_DOUBLE_FOUND)
492+
493+
IF(FFTW3_LONG_FOUND)
494+
SET(FFTW3_LONG_FOUND_DGTAL 1)
495+
ADD_DEFINITIONS("-DWITH_FFTW3_LONG ")
496+
ENDIF(FFTW3_LONG_FOUND)
497+
498+
ENDIF(WITH_FFTW3)
458499

459500
message(STATUS "-------------------------------------------------------------------------------")

cmake/DGtalConfig.cmake.in

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,23 @@ IF(@CGAL_FOUND_DGTAL@)
157157
SET(WITH_CGAL 1)
158158
ENDIF(@CGAL_FOUND_DGTAL@)
159159

160+
IF(@FFTW3_FOUND_DGTAL@)
161+
ADD_DEFINITIONS("-DWITH_FFTW3 ")
162+
SET(WITH_FFTW3 1)
163+
164+
IF(@FFTW3_FLOAT_FOUND_DGTAL@)
165+
ADD_DEFINITIONS("-DWITH_FFTW3_FLOAT ")
166+
ENDIF(@FFTW3_FLOAT_FOUND_DGTAL@)
167+
168+
IF(@FFTW3_DOUBLE_FOUND_DGTAL@)
169+
ADD_DEFINITIONS("-DWITH_FFTW3_DOUBLE ")
170+
ENDIF(@FFTW3_DOUBLE_FOUND_DGTAL@)
171+
172+
IF(@FFTW3_LONG_FOUND_DGTAL@)
173+
ADD_DEFINITIONS("-DWITH_FFTW3_LONG ")
174+
ENDIF(@FFTW3_LONG_FOUND_DGTAL@)
175+
176+
ENDIF(@FFTW3_FOUND_DGTAL@)
160177

161178
# These are IMPORTED targets created by DGtalLibraryDepends.cmake
162179
set(DGTAL_LIBRARIES DGtal DGtalIO)

cmake/FindFFTW3.cmake

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Try to find the FFTW3 librairies
2+
# FFTW3_FOUND - True if FFTW3 is found for at least one precision.
3+
# FFTW3_FLOAT_FOUND - True if FFTW3 is found for float precision.
4+
# FFTW3_DOUBLE_FOUND - True if FFTW3 is found for double precicion.
5+
# FFTW3_LONG_FOUND - True if FFTW3 is found for long double precision.
6+
# FFTW3_INCLUDE_DIR - The FFTW3 include directory.
7+
# FFTW3_LIBRARIES - FFTW3 libraries.
8+
# FFTW3_DEP_LIBRARIES - Libraries needed by FFTW3.
9+
10+
if (FFTW3_INCLUDE_DIR AND FFTW3_LIBRARIES)
11+
# Already in cache, be silent
12+
set(FFTW3_FIND_QUIETLY TRUE)
13+
endif (FFTW3_INCLUDE_DIR AND FFTW3_LIBRARIES)
14+
15+
# Searching for all supported FFT precisions.
16+
find_path (FFTW3_INCLUDE_DIR NAMES fftw3.h )
17+
find_library (FFTW3_FLOAT_LIBRARIES NAMES fftw3f )
18+
find_library (FFTW3_FLOAT_THREADS_LIBRARIES NAMES fftw3f_threads )
19+
find_library (FFTW3_DOUBLE_LIBRARIES NAMES fftw3 )
20+
find_library (FFTW3_DOUBLE_THREADS_LIBRARIES NAMES fftw3_threads )
21+
find_library (FFTW3_LONG_LIBRARIES NAMES fftw3l )
22+
find_library (FFTW3_LONG_THREADS_LIBRARIES NAMES fftw3l_threads )
23+
24+
# Gathering FFTW3 libraries
25+
set (FFTW3_LIBRARIES ${FFTW3_FLOAT_LIBRARIES} ${FFTW3_DOUBLE_LIBRARIES} ${FFTW3_LONG_LIBRARIES})
26+
set (FFTW3_THREADS_LIBRARIES ${FFTW3_FLOAT_THREADS_LIBRARIES} ${FFTW3_DOUBLE_THREADS_LIBRARIES} ${FFTW3_LONG_THREADS_LIBRARIES})
27+
set (FFTW3_DEP_LIBRARIES m)
28+
29+
# Telling which FFT precisions are found.
30+
include(FindPackageHandleStandardArgs)
31+
FIND_PACKAGE_HANDLE_STANDARD_ARGS(FFTW3 DEFAULT_MSG FFTW3_INCLUDE_DIR FFTW3_LIBRARIES)
32+
FIND_PACKAGE_HANDLE_STANDARD_ARGS(FFTW3_FLOAT DEFAULT_MSG FFTW3_INCLUDE_DIR FFTW3_FLOAT_LIBRARIES)
33+
FIND_PACKAGE_HANDLE_STANDARD_ARGS(FFTW3_DOUBLE DEFAULT_MSG FFTW3_INCLUDE_DIR FFTW3_DOUBLE_LIBRARIES)
34+
FIND_PACKAGE_HANDLE_STANDARD_ARGS(FFTW3_LONG DEFAULT_MSG FFTW3_INCLUDE_DIR FFTW3_LONG_LIBRARIES)
35+
36+
# Adding threaded version of FFTW3
37+
if (FFTW3_THREADS_LIBRARIES)
38+
set (FFTW3_LIBRARIES ${FFTW3_LIBRARIES} ${FFTW3_THREADS_LIBRARIES})
39+
set (FFTW3_DEP_LIBRARIES ${FFTW3_DEP_LIBRARIES} pthread)
40+
endif (FFTW3_THREADS_LIBRARIES)
41+
42+
43+
mark_as_advanced(FFTW3_INCLUDE_DIR FFTW3_LIBRARIES, FFTW3_DEP_LIBRARIES)
44+
mark_as_advanced(FFTW3_FLOAT_LIBRARIES FFTW3_DOUBLE_LIBRARIES FFTW3_LONG_LIBRARIES)
45+
mark_as_advanced(FFTW3_FLOAT_THREADS_LIBRARIES FFTW3_DOUBLE_THREADS_LIBRARIES FFTW3_LONG_THREADS_LIBRARIES)

doc/doxy.config.in

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ IDL_PROPERTY_SUPPORT = YES
345345
# all members of a group must be documented explicitly.
346346
# The default value is: NO.
347347

348-
DISTRIBUTE_GROUP_DOC = NO
348+
DISTRIBUTE_GROUP_DOC = YES
349349

350350
# If one adds a struct or class to a group and this option is enabled, then also
351351
# any nested class or struct is added to the same group. By default this option
@@ -2054,8 +2054,8 @@ PREDEFINED = "BOOST_FUSION_ADAPT_STRUCT(x,y)=" \
20542054
"WITH_ITK=" \
20552055
"WITH_MAGICK=" \
20562056
"WITH_PATATE=" \
2057-
"WITH_QGLVIEWER="
2058-
2057+
"WITH_QGLVIEWER=" \
2058+
"WITH_FFTW3=" "WITH_FFTW3_FLOAT=" "WITH_FFTW3_DOUBLE" "WITH_FFTW3_LONG"
20592059

20602060
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
20612061
# tag can be used to specify a list of macro names that should be expanded. The

0 commit comments

Comments
 (0)