From a9b8f728050e9ba889fdfc62d5442e854e967d86 Mon Sep 17 00:00:00 2001 From: maier Date: Tue, 11 Sep 2012 16:25:17 +0000 Subject: [PATCH] Modern times for #if ... git-svn-id: https://svn.dealii.org/branches/branch_cmake@26291 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/include/deal.II/base/config.h.in | 74 ++++++++----------- deal.II/include/deal.II/base/parallel.h | 18 ++--- .../deal.II/base/thread_local_storage.h | 6 +- .../include/deal.II/base/thread_management.h | 10 +-- deal.II/include/deal.II/base/work_stream.h | 6 +- .../include/deal.II/matrix_free/matrix_free.h | 8 +- .../matrix_free/matrix_free.templates.h | 4 +- deal.II/source/base/boost_threads.cc | 2 +- deal.II/source/base/multithread_info.cc | 2 +- deal.II/source/base/thread_management.cc | 2 +- 10 files changed, 60 insertions(+), 72 deletions(-) diff --git a/deal.II/include/deal.II/base/config.h.in b/deal.II/include/deal.II/base/config.h.in index 3780aa197f..ea46530a2d 100644 --- a/deal.II/include/deal.II/base/config.h.in +++ b/deal.II/include/deal.II/base/config.h.in @@ -58,7 +58,7 @@ /* Defined if deal.II is configured with an external Boost library */ -#cmakedefine DEAL_II_USE_EXTERNAL_BOOST 1 +#cmakedefine DEAL_II_USE_EXTERNAL_BOOST @@ -67,8 +67,8 @@ * Configured in configure_functionparser.cmake: */ -/* Defined to 1 if you have the `functionparser' library */ -#cmakedefine HAVE_FUNCTIONPARSER 1 +/* Defined if you have the `functionparser' library */ +#cmakedefine HAVE_FUNCTIONPARSER @@ -79,7 +79,7 @@ /* Defined if the compiler supports mpi */ -#cmakedefine DEAL_II_COMPILER_SUPPORTS_MPI 1 +#cmakedefine DEAL_II_COMPILER_SUPPORTS_MPI @@ -89,8 +89,8 @@ */ -/* Defined to 1 if you have the `NetCDF' library */ -#cmakedefine HAVE_LIBNETCDF 1 +/* Defined if you have the `NetCDF' library */ +#cmakedefine HAVE_LIBNETCDF @@ -103,7 +103,7 @@ /* Flag indicating whether the library shall be compiled for multithreaded * applications. If so, then it is set to one, otherwise to zero. */ -#cmakedefine DEAL_II_USE_MT 1 +#cmakedefine DEAL_II_USE_MT /* Defined if multi-threading is to be achieved by using the POSIX functions */ @@ -113,14 +113,14 @@ * Barriers will then not work in the library, but the other threading * functionality is available. */ -#cmakedefine DEAL_II_USE_MT_POSIX_NO_BARRIERS 1 +#cmakedefine DEAL_II_USE_MT_POSIX_NO_BARRIERS /** * Depending on the use of threads, we will have to make some variables * volatile. We do this here in a very old-fashioned C-style, but still * convenient way. */ -#if DEAL_II_USE_MT != 0 +#if DEAL_II_USE_MT # define DEAL_VOLATILE volatile #else # define DEAL_VOLATILE @@ -152,7 +152,7 @@ /* Defined if deal.II was configure with zlib support */ -#cmakedefine HAVE_LIBZ 1 +#cmakedefine HAVE_LIBZ @@ -162,53 +162,41 @@ */ -/* Defined if the compiler's library in use provides a std::iterator class - (early gcc versions did not) */ -#cmakedefine HAVE_STD_ITERATOR_CLASS 1 - -/* Defined if the compiler's library in use provides std::i/ostringstream - classes (early gcc versions did not) */ -#cmakedefine HAVE_STD_STRINGSTREAM 1 - -/* Defined if the compiler's library in use provides std::numeric_limits - classes in the appropriate header file */ -#cmakedefine HAVE_STD_NUMERIC_LIMITS 1 - /* Defined if vector iterators are just plain pointers */ -#cmakedefine DEAL_II_VECTOR_ITERATOR_IS_POINTER 1 +#cmakedefine DEAL_II_VECTOR_ITERATOR_IS_POINTER /* Defined if the compiler provides an header file */ -#cmakedefine HAVE_STD_OSTREAM_HEADER 1 +#cmakedefine HAVE_STD_OSTREAM_HEADER /* Defined if the compiler provides an header file */ -#cmakedefine HAVE_STD_IOSFWD_HEADER 1 +#cmakedefine HAVE_STD_IOSFWD_HEADER -/* Defined to 1 if you have the header file. */ -#cmakedefine HAVE_STDINT_H 1 +/* Defined if you have the header file. */ +#cmakedefine HAVE_STDINT_H -/* Defined to 1 if you have the header file. */ -#cmakedefine HAVE_STDLIB_H 1 +/* Defined if you have the header file. */ +#cmakedefine HAVE_STDLIB_H -/* Defined to 1 if you have the header file. */ -#cmakedefine HAVE_STRINGS_H 1 +/* Defined if you have the header file. */ +#cmakedefine HAVE_STRINGS_H -/* Defined to 1 if you have the header file. */ -#cmakedefine HAVE_STRING_H 1 +/* Defined if you have the header file. */ +#cmakedefine HAVE_STRING_H -/* Defined to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_STAT_H 1 +/* Defined if you have the header file. */ +#cmakedefine HAVE_SYS_STAT_H -/* Defined to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_SYSCALL_H 1 +/* Defined if you have the header file. */ +#cmakedefine HAVE_SYS_SYSCALL_H -/* Defined to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_TIMES_H 1 +/* Defined if you have the header file. */ +#cmakedefine HAVE_SYS_TIMES_H -/* Defined to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_TYPES_H 1 +/* Defined if you have the header file. */ +#cmakedefine HAVE_SYS_TYPES_H -/* Defined to 1 if you have the `strtrs_' function. */ -#cmakedefine HAVE_STRTRS_ 1 +/* Defined if you have the `strtrs_' function. */ +#cmakedefine HAVE_STRTRS_ /* TODO */ diff --git a/deal.II/include/deal.II/base/parallel.h b/deal.II/include/deal.II/base/parallel.h index 285322472f..d4f46a59aa 100644 --- a/deal.II/include/deal.II/base/parallel.h +++ b/deal.II/include/deal.II/base/parallel.h @@ -24,7 +24,7 @@ #include -#if DEAL_II_USE_MT == 1 +#if DEAL_II_USE_MT # include # include # include @@ -176,7 +176,7 @@ namespace parallel Predicate &predicate, const unsigned int grainsize) { -#if DEAL_II_USE_MT == 0 +#ifndef DEAL_II_USE_MT // make sure we don't get compiler // warnings about unused arguments (void) grainsize; @@ -244,7 +244,7 @@ namespace parallel Predicate &predicate, const unsigned int grainsize) { -#if DEAL_II_USE_MT == 0 +#ifndef DEAL_II_USE_MT // make sure we don't get compiler // warnings about unused arguments (void) grainsize; @@ -314,7 +314,7 @@ namespace parallel Predicate &predicate, const unsigned int grainsize) { -#if DEAL_II_USE_MT == 0 +#ifndef DEAL_II_USE_MT // make sure we don't get compiler // warnings about unused arguments (void) grainsize; @@ -340,7 +340,7 @@ namespace parallel namespace internal { -#if DEAL_II_USE_MT == 1 +#if DEAL_II_USE_MT /** * Take a range argument and call the * given function with its begin and end. @@ -461,7 +461,7 @@ namespace parallel const Function &f, const unsigned int grainsize) { -#if DEAL_II_USE_MT == 0 +#ifndef DEAL_II_USE_MT // make sure we don't get compiler // warnings about unused arguments (void) grainsize; @@ -546,7 +546,7 @@ namespace parallel namespace internal { -#if DEAL_II_USE_MT == 1 +#if DEAL_II_USE_MT /** * A class that conforms to the Body * requirements of the TBB @@ -741,7 +741,7 @@ namespace parallel const typename identity::type &end, const unsigned int grainsize) { -#if DEAL_II_USE_MT == 0 +#ifndef DEAL_II_USE_MT // make sure we don't get compiler // warnings about unused arguments (void) grainsize; @@ -813,7 +813,7 @@ namespace internal namespace parallel { -#if DEAL_II_USE_MT == 1 +#if DEAL_II_USE_MT namespace internal { diff --git a/deal.II/include/deal.II/base/thread_local_storage.h b/deal.II/include/deal.II/base/thread_local_storage.h index d655cbb038..210b90c80d 100644 --- a/deal.II/include/deal.II/base/thread_local_storage.h +++ b/deal.II/include/deal.II/base/thread_local_storage.h @@ -15,7 +15,7 @@ #include -#if DEAL_II_USE_MT == 1 +#if DEAL_II_USE_MT # include #endif @@ -121,7 +121,7 @@ namespace Threads ThreadLocalStorage & operator = (const T &t); private: -#if DEAL_II_USE_MT == 1 +#if DEAL_II_USE_MT /** * The data element we store. If we support threads, then this * object will be of a type that provides a separate object @@ -163,7 +163,7 @@ namespace Threads T & ThreadLocalStorage::get () { -#if DEAL_II_USE_MT == 1 +#if DEAL_II_USE_MT return data.local(); #else return data; diff --git a/deal.II/include/deal.II/base/thread_management.h b/deal.II/include/deal.II/base/thread_management.h index d2f83f0333..e16b39078f 100644 --- a/deal.II/include/deal.II/base/thread_management.h +++ b/deal.II/include/deal.II/base/thread_management.h @@ -21,7 +21,7 @@ #include #include -#if (DEAL_II_USE_MT == 1) +#if DEAL_II_USE_MT # include # include # include @@ -33,7 +33,7 @@ #include -#if DEAL_II_USE_MT == 1 +#if DEAL_II_USE_MT # if defined(DEAL_II_USE_MT_POSIX) # include # endif @@ -273,7 +273,7 @@ namespace Threads }; -#if DEAL_II_USE_MT == 1 +#if DEAL_II_USE_MT /** * Class implementing a @@ -1229,7 +1229,7 @@ namespace Threads namespace internal { -#if (DEAL_II_USE_MT == 1) +#if DEAL_II_USE_MT /** * A class that represents threads. For @@ -3735,7 +3735,7 @@ namespace Threads namespace internal { -#if (DEAL_II_USE_MT == 1) +#if DEAL_II_USE_MT template struct TaskDescriptor; diff --git a/deal.II/include/deal.II/base/work_stream.h b/deal.II/include/deal.II/base/work_stream.h index dd6fd8a93c..f70eb9afd4 100644 --- a/deal.II/include/deal.II/base/work_stream.h +++ b/deal.II/include/deal.II/base/work_stream.h @@ -19,7 +19,7 @@ #include #include -#if DEAL_II_USE_MT == 1 +#if DEAL_II_USE_MT # include # include #endif @@ -125,7 +125,7 @@ DEAL_II_NAMESPACE_OPEN namespace WorkStream { -#if DEAL_II_USE_MT == 1 +#if DEAL_II_USE_MT namespace internal @@ -527,7 +527,7 @@ namespace WorkStream if (!(begin != end)) return; -#if DEAL_II_USE_MT == 1 +#if DEAL_II_USE_MT // create the three stages of the // pipeline internal::IteratorRangeToItemStream diff --git a/deal.II/include/deal.II/matrix_free/matrix_free.h b/deal.II/include/deal.II/matrix_free/matrix_free.h index 266a77f58e..b9e75d5117 100644 --- a/deal.II/include/deal.II/matrix_free/matrix_free.h +++ b/deal.II/include/deal.II/matrix_free/matrix_free.h @@ -33,7 +33,7 @@ #include #include -#if DEAL_II_USE_MT==1 +#if DEAL_II_USE_MT #include #include #include @@ -2101,7 +2101,7 @@ namespace internal } -#if DEAL_II_USE_MT==1 +#if DEAL_II_USE_MT // This defines the TBB data structures that // are needed to schedule the @@ -2353,7 +2353,7 @@ namespace internal VectorStruct &dst; }; -#endif // #if DEAL_II_USE_MT==1 +#endif // #if DEAL_II_USE_MT } // end of namespace internal @@ -2372,7 +2372,7 @@ MatrixFree::cell_loop OutVector &dst, const InVector &src) const { -#if DEAL_II_USE_MT==1 +#if DEAL_II_USE_MT // Use multithreading if so requested and if // there is enough work to do in parallel (the diff --git a/deal.II/include/deal.II/matrix_free/matrix_free.templates.h b/deal.II/include/deal.II/matrix_free/matrix_free.templates.h index 1fc7d26320..77a4f07592 100644 --- a/deal.II/include/deal.II/matrix_free/matrix_free.templates.h +++ b/deal.II/include/deal.II/matrix_free/matrix_free.templates.h @@ -139,7 +139,7 @@ internal_reinit(const Mapping &mapping, // initialize the basic multithreading // information that needs to be passed to the // DoFInfo structure -#if DEAL_II_USE_MT == 1 +#if DEAL_II_USE_MT if (additional_data.tasks_parallel_scheme != AdditionalData::none) { task_info.use_multithreading = true; @@ -242,7 +242,7 @@ internal_reinit(const Mapping &mapping, // initialize the basic multithreading // information that needs to be passed to the // DoFInfo structure -#if DEAL_II_USE_MT == 1 +#if DEAL_II_USE_MT if (additional_data.tasks_parallel_scheme != AdditionalData::none) { task_info.use_multithreading = true; diff --git a/deal.II/source/base/boost_threads.cc b/deal.II/source/base/boost_threads.cc index e07f70ee1f..7c14d74918 100644 --- a/deal.II/source/base/boost_threads.cc +++ b/deal.II/source/base/boost_threads.cc @@ -13,7 +13,7 @@ #include -#if (DEAL_II_USE_MT == 1) && !defined(DEAL_II_CAN_USE_CXX1X) && !defined(DEAL_II_USE_EXTERNAL_BOOST) +#if DEAL_II_USE_MT && !defined(DEAL_II_CAN_USE_CXX1X) && !defined(DEAL_II_USE_EXTERNAL_BOOST) // if the C++ compiler doesn't completely support the C++1x standard (and // consequently we can't use std::thread, std::mutex, etc), then include all diff --git a/deal.II/source/base/multithread_info.cc b/deal.II/source/base/multithread_info.cc index e60f66f28d..421f4a4474 100644 --- a/deal.II/source/base/multithread_info.cc +++ b/deal.II/source/base/multithread_info.cc @@ -36,7 +36,7 @@ DEAL_II_NAMESPACE_OPEN -#if DEAL_II_USE_MT == 1 +#if DEAL_II_USE_MT /* Detecting how many processors a given machine has is something that varies greatly between operating systems. For a few operating diff --git a/deal.II/source/base/thread_management.cc b/deal.II/source/base/thread_management.cc index 7549689b48..2400d2765d 100644 --- a/deal.II/source/base/thread_management.cc +++ b/deal.II/source/base/thread_management.cc @@ -164,7 +164,7 @@ namespace Threads -#if DEAL_II_USE_MT != 1 +#ifndef DEAL_II_USE_MT DummyBarrier::DummyBarrier (const unsigned int count, const char *, void *) -- 2.39.5