Skip to content

Commit

Permalink
Merge pull request #1185 from rolanddenis/pr_RealFFT
Browse files Browse the repository at this point in the history
Real-data in-place Fast Fourier Transform using FFTW3.
  • Loading branch information
dcoeurjo authored Jun 27, 2016
2 parents d6e3a41 + 7c5ccbd commit 274f297
Show file tree
Hide file tree
Showing 10 changed files with 1,851 additions and 10 deletions.
9 changes: 5 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ notifications:
# - one build for the documentation on macosx (clang) and only for commits on
# DGtal-team repo (no pull request). Encrypted var. required.
# - No gcc on macos
# - clang build of dgtaltools in linux only. In this case, some dependencies are considerd in DGtal (GMP, QGLViewer, CAIRO, HDF5)
# - clang build of dgtaltools in linux only. In this case, some dependencies are considerd in DGtal (GMP, QGLViewer, CAIRO, HDF5, FFTW3)
# - Otherwise, 2 os x 2 configs
#
########
env:
- CONFIG="Debug,Magick,GMP,ITK"
- CONFIG="Debug,Magick,GMP,ITK,FFTW3"
- CONFIG="Debug,Cairo,QGLviewer,HDF5"
- CONFIG="Documentation"
- CONFIG="DGtalTools"
Expand Down Expand Up @@ -66,6 +66,7 @@ addons:
- libinsighttoolkit3-dev
- g++-4.8
- gcc-4.8
- libfftw3-dev


before_install:
Expand All @@ -75,7 +76,7 @@ before_install:
- NEEDCORE="true";
- NEEDEXAMPLESANDTESTS="true";
- 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
- 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
- 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
- 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
- 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
- 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
Expand All @@ -87,7 +88,7 @@ before_install:
########
before_script:
- if [ $TRAVIS_OS_NAME == linux ]; then echo "All done."; fi
- if [ $TRAVIS_OS_NAME == osx ]; then brew update; brew install boost doxygen homebrew/science/hdf5 graphviz graphicsmagick gmp libqglviewer; echo "done";fi
- if [ $TRAVIS_OS_NAME == osx ]; then brew update; brew install boost doxygen homebrew/science/hdf5 graphviz graphicsmagick gmp libqglviewer fftw; echo "done";fi


############
Expand Down
6 changes: 5 additions & 1 deletion ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@
- New "@seeDGtalTools" doxygen command to cite a DGtalTools tool in
DGtal documentation (David Coeurjolly,
[#1179](https://github.com/DGtal-team/DGtal/pull/1179))

- *Geometry Package*
- New robust normal vector estimator using spherical accumulators and statistical
voting (Boulc'h & Marlet, SGP 2012).
(David Coeurjolly, [#1149](https://github.com/DGtal-team/DGtal/pull/1149))

- *Math Package*
- New RealFFT class for in-place real-complex Fast Fourier Transform using
fftw3 library.
(Roland Denis, [#1185](https://github.com/DGtal-team/DGtal/pull/1185))
- *Topology Package*
- Adding periodic closure for KhalimskySpaceND and per-dimension closure
specification.
Expand Down
41 changes: 41 additions & 0 deletions cmake/CheckDGtalOptionalDependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ OPTION(WITH_QGLVIEWER "With LibQGLViewer for 3D visualization (Qt4 required)." O
OPTION(WITH_PATATE "With Patate library for geometry OFF (Eigen required)." processing)
OPTION(WITH_QT5 "Using Qt5." OFF)
OPTION(WITH_BENCHMARK "With Google Benchmark." OFF)
OPTION(WITH_FFTW3 "With FFTW3 discrete Fourier Transform library." OFF)

#----------------------------------
# Removing -frounding-math compile flag for clang
Expand Down Expand Up @@ -113,6 +114,13 @@ else (WITH_QT5)
message(STATUS " WITH_QT5 false (Using of Qt5 instead of Qt4)")
endif (WITH_QT5)

if (WITH_FFTW3)
set(LIST_OPTION ${LIST_OPTION} [FFTW3]\ )
message(STATUS " WITH_FFTW3 true (FFTW3 discrete Fourier transform library)")
else (WITH_FFTW3)
message(STATUS " WITH_FFTW3 false (FFTW3 discrete Fourier transform library)")
endif (WITH_FFTW3)

message(STATUS "")
message(STATUS "For Developpers:")
IF(WITH_BENCHMARK)
Expand Down Expand Up @@ -455,5 +463,38 @@ IF(WITH_BENCHMARK)
ENDIF(BENCHMARK_FOUND)
ENDIF(WITH_BENCHMARK)

# -----------------------------------------------------------------------------
# Look for FFTW3.
# (They are not compulsory).
# -----------------------------------------------------------------------------
SET(FFTW3_FOUND_DGTAL 0)
IF(WITH_FFTW3)
FIND_PACKAGE(FFTW3 REQUIRED)
IF(FFTW3_FOUND)
SET(FFTW3_FOUND_DGTAL 1)
ADD_DEFINITIONS("-DWITH_FFTW3 ")
INCLUDE_DIRECTORIES(${FFTW3_INCLUDES})
SET(DGtalLibDependencies ${DGtalLibDependencies} ${FFTW3_LIBRARIES} ${FFTW3_DEP_LIBRARIES} )
message(STATUS "FFTW3 is found : ${FFTW3_LIBRARIES}.")
ELSE(FFTW3_FOUND)
message(FATAL_ERROR "FFTW3 is not found.")
ENDIF(FFTW3_FOUND)

IF(FFTW3_FLOAT_FOUND)
SET(FFTW3_FLOAT_FOUND_DGTAL 1)
ADD_DEFINITIONS("-DWITH_FFTW3_FLOAT ")
ENDIF(FFTW3_FLOAT_FOUND)

IF(FFTW3_DOUBLE_FOUND)
SET(FFTW3_DOUBLE_FOUND_DGTAL 1)
ADD_DEFINITIONS("-DWITH_FFTW3_DOUBLE ")
ENDIF(FFTW3_DOUBLE_FOUND)

IF(FFTW3_LONG_FOUND)
SET(FFTW3_LONG_FOUND_DGTAL 1)
ADD_DEFINITIONS("-DWITH_FFTW3_LONG ")
ENDIF(FFTW3_LONG_FOUND)

ENDIF(WITH_FFTW3)

message(STATUS "-------------------------------------------------------------------------------")
17 changes: 17 additions & 0 deletions cmake/DGtalConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,23 @@ IF(@CGAL_FOUND_DGTAL@)
SET(WITH_CGAL 1)
ENDIF(@CGAL_FOUND_DGTAL@)

IF(@FFTW3_FOUND_DGTAL@)
ADD_DEFINITIONS("-DWITH_FFTW3 ")
SET(WITH_FFTW3 1)

IF(@FFTW3_FLOAT_FOUND_DGTAL@)
ADD_DEFINITIONS("-DWITH_FFTW3_FLOAT ")
ENDIF(@FFTW3_FLOAT_FOUND_DGTAL@)

IF(@FFTW3_DOUBLE_FOUND_DGTAL@)
ADD_DEFINITIONS("-DWITH_FFTW3_DOUBLE ")
ENDIF(@FFTW3_DOUBLE_FOUND_DGTAL@)

IF(@FFTW3_LONG_FOUND_DGTAL@)
ADD_DEFINITIONS("-DWITH_FFTW3_LONG ")
ENDIF(@FFTW3_LONG_FOUND_DGTAL@)

ENDIF(@FFTW3_FOUND_DGTAL@)

# These are IMPORTED targets created by DGtalLibraryDepends.cmake
set(DGTAL_LIBRARIES DGtal DGtalIO)
45 changes: 45 additions & 0 deletions cmake/FindFFTW3.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Try to find the FFTW3 librairies
# FFTW3_FOUND - True if FFTW3 is found for at least one precision.
# FFTW3_FLOAT_FOUND - True if FFTW3 is found for float precision.
# FFTW3_DOUBLE_FOUND - True if FFTW3 is found for double precicion.
# FFTW3_LONG_FOUND - True if FFTW3 is found for long double precision.
# FFTW3_INCLUDE_DIR - The FFTW3 include directory.
# FFTW3_LIBRARIES - FFTW3 libraries.
# FFTW3_DEP_LIBRARIES - Libraries needed by FFTW3.

if (FFTW3_INCLUDE_DIR AND FFTW3_LIBRARIES)
# Already in cache, be silent
set(FFTW3_FIND_QUIETLY TRUE)
endif (FFTW3_INCLUDE_DIR AND FFTW3_LIBRARIES)

# Searching for all supported FFT precisions.
find_path (FFTW3_INCLUDE_DIR NAMES fftw3.h )
find_library (FFTW3_FLOAT_LIBRARIES NAMES fftw3f )
find_library (FFTW3_FLOAT_THREADS_LIBRARIES NAMES fftw3f_threads )
find_library (FFTW3_DOUBLE_LIBRARIES NAMES fftw3 )
find_library (FFTW3_DOUBLE_THREADS_LIBRARIES NAMES fftw3_threads )
find_library (FFTW3_LONG_LIBRARIES NAMES fftw3l )
find_library (FFTW3_LONG_THREADS_LIBRARIES NAMES fftw3l_threads )

# Gathering FFTW3 libraries
set (FFTW3_LIBRARIES ${FFTW3_FLOAT_LIBRARIES} ${FFTW3_DOUBLE_LIBRARIES} ${FFTW3_LONG_LIBRARIES})
set (FFTW3_THREADS_LIBRARIES ${FFTW3_FLOAT_THREADS_LIBRARIES} ${FFTW3_DOUBLE_THREADS_LIBRARIES} ${FFTW3_LONG_THREADS_LIBRARIES})
set (FFTW3_DEP_LIBRARIES m)

# Telling which FFT precisions are found.
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(FFTW3 DEFAULT_MSG FFTW3_INCLUDE_DIR FFTW3_LIBRARIES)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(FFTW3_FLOAT DEFAULT_MSG FFTW3_INCLUDE_DIR FFTW3_FLOAT_LIBRARIES)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(FFTW3_DOUBLE DEFAULT_MSG FFTW3_INCLUDE_DIR FFTW3_DOUBLE_LIBRARIES)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(FFTW3_LONG DEFAULT_MSG FFTW3_INCLUDE_DIR FFTW3_LONG_LIBRARIES)

# Adding threaded version of FFTW3
if (FFTW3_THREADS_LIBRARIES)
set (FFTW3_LIBRARIES ${FFTW3_LIBRARIES} ${FFTW3_THREADS_LIBRARIES})
set (FFTW3_DEP_LIBRARIES ${FFTW3_DEP_LIBRARIES} pthread)
endif (FFTW3_THREADS_LIBRARIES)


mark_as_advanced(FFTW3_INCLUDE_DIR FFTW3_LIBRARIES, FFTW3_DEP_LIBRARIES)
mark_as_advanced(FFTW3_FLOAT_LIBRARIES FFTW3_DOUBLE_LIBRARIES FFTW3_LONG_LIBRARIES)
mark_as_advanced(FFTW3_FLOAT_THREADS_LIBRARIES FFTW3_DOUBLE_THREADS_LIBRARIES FFTW3_LONG_THREADS_LIBRARIES)
6 changes: 3 additions & 3 deletions doc/doxy.config.in
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ IDL_PROPERTY_SUPPORT = YES
# all members of a group must be documented explicitly.
# The default value is: NO.

DISTRIBUTE_GROUP_DOC = NO
DISTRIBUTE_GROUP_DOC = YES

# If one adds a struct or class to a group and this option is enabled, then also
# any nested class or struct is added to the same group. By default this option
Expand Down Expand Up @@ -2054,8 +2054,8 @@ PREDEFINED = "BOOST_FUSION_ADAPT_STRUCT(x,y)=" \
"WITH_ITK=" \
"WITH_MAGICK=" \
"WITH_PATATE=" \
"WITH_QGLVIEWER="

"WITH_QGLVIEWER=" \
"WITH_FFTW3=" "WITH_FFTW3_FLOAT=" "WITH_FFTW3_DOUBLE" "WITH_FFTW3_LONG"

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

0 comments on commit 274f297

Please sign in to comment.