// ---------------------------------------------------------------------
//
// Copyright (C) 2012 - 2016 by the deal.II authors
//
// This file is part of the deal.II library.
//
// The deal.II library is free software; you can use it, redistribute
// it, and/or modify it under the terms of the GNU Lesser General
// Public License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
// The full text of the license can be found in the file LICENSE at
// the top level of the deal.II distribution.
//
// ---------------------------------------------------------------------

#ifndef dealii_config_h
#define dealii_config_h


/***********************************************************************
 * Information about deal.II:
 */

#define DEAL_II_PACKAGE_NAME "@DEAL_II_PACKAGE_NAME@"

#define DEAL_II_PACKAGE_VERSION "@DEAL_II_PACKAGE_VERSION@"

#define DEAL_II_VERSION_MAJOR @DEAL_II_VERSION_MAJOR@
#define DEAL_II_VERSION_MINOR @DEAL_II_VERSION_MINOR@
#define DEAL_II_VERSION_SUBMINOR @DEAL_II_VERSION_SUBMINOR@


/***********************************************************************
 * Configured deal.II features:
 */

#cmakedefine DEAL_II_WITH_64BIT_INDICES
#cmakedefine DEAL_II_WITH_ADOLC
#cmakedefine DEAL_II_WITH_ARPACK
#cmakedefine DEAL_II_WITH_ASSIMP
#cmakedefine DEAL_II_WITH_CUDA
#cmakedefine DEAL_II_WITH_CXX14
#cmakedefine DEAL_II_WITH_CXX17
#cmakedefine DEAL_II_WITH_GSL
#cmakedefine DEAL_II_WITH_GMSH
#cmakedefine DEAL_II_WITH_HDF5
#cmakedefine DEAL_II_WITH_LAPACK
#cmakedefine LAPACK_WITH_64BIT_BLAS_INDICES
#cmakedefine DEAL_II_WITH_METIS
#cmakedefine DEAL_II_WITH_MPI
#cmakedefine DEAL_II_WITH_MUPARSER
#cmakedefine DEAL_II_WITH_NANOFLANN
#cmakedefine DEAL_II_WITH_NETCDF
#cmakedefine DEAL_II_WITH_OPENCASCADE
#cmakedefine DEAL_II_WITH_P4EST
#cmakedefine DEAL_II_WITH_PETSC
#cmakedefine DEAL_II_WITH_SCALAPACK
#cmakedefine DEAL_II_WITH_SLEPC
#cmakedefine DEAL_II_WITH_SUNDIALS
#cmakedefine DEAL_II_WITH_THREADS
#cmakedefine DEAL_II_WITH_TRILINOS
#cmakedefine DEAL_II_WITH_UMFPACK
#cmakedefine DEAL_II_WITH_ZLIB

// defined for backwards compatibility with pre-C++11
#define DEAL_II_WITH_CXX11
#define DEAL_II_NOEXCEPT noexcept

/***********************************************************************
 * Compiler bugs:
 *
 * For documentation see cmake/checks/check_03_compiler_bugs.cmake
 */

#cmakedefine DEAL_II_TEMPL_SPEC_FRIEND_BUG
#cmakedefine DEAL_II_MEMBER_ARRAY_SPECIALIZATION_BUG
#cmakedefine DEAL_II_CONST_MEMBER_DEDUCTION_BUG
#cmakedefine DEAL_II_BIND_NO_CONST_OP_PARENTHESES
#cmakedefine DEAL_II_CONSTEXPR_BUG


/***********************************************************************
 * Compiler features:
 *
 * For documentation see cmake/checks/check_01_compiler_features.cmake
 */

#cmakedefine DEAL_II_COMPILER_USE_VECTOR_ARITHMETICS
#cmakedefine DEAL_II_VECTOR_ITERATOR_IS_POINTER
#cmakedefine DEAL_II_HAVE_BUILTIN_EXPECT
#cmakedefine DEAL_II_HAVE_VERBOSE_TERMINATE
#cmakedefine DEAL_II_HAVE_GLIBC_STACKTRACE
#cmakedefine DEAL_II_HAVE_LIBSTDCXX_DEMANGLER
#cmakedefine __PRETTY_FUNCTION__ @__PRETTY_FUNCTION__@
#cmakedefine DEAL_II_DEPRECATED @DEAL_II_DEPRECATED@
#cmakedefine DEAL_II_ALWAYS_INLINE @DEAL_II_ALWAYS_INLINE@
#cmakedefine DEAL_II_RESTRICT @DEAL_II_RESTRICT@
#cmakedefine DEAL_II_COMPILER_HAS_DIAGNOSTIC_PRAGMA


/***********************************************************************
 * CPU features:
 *
 * For documentation see cmake/checks/check_01_cpu_features.cmake
 */

#cmakedefine DEAL_II_WORDS_BIGENDIAN
#define DEAL_II_COMPILER_VECTORIZATION_LEVEL @DEAL_II_COMPILER_VECTORIZATION_LEVEL@
#define DEAL_II_OPENMP_SIMD_PRAGMA @DEAL_II_OPENMP_SIMD_PRAGMA@


/***********************************************************************
 * Language features:
 *
 * For documentation see cmake/checks/check_01_cxx_features.cmake
 */

#cmakedefine DEAL_II_HAVE_CXX11_IS_TRIVIALLY_COPYABLE
#cmakedefine DEAL_II_HAVE_FP_EXCEPTIONS
#cmakedefine DEAL_II_HAVE_COMPLEX_OPERATOR_OVERLOADS
#cmakedefine DEAL_II_FALLTHROUGH @DEAL_II_FALLTHROUGH@


/***********************************************************************
 * System features:
 *
 * For documentation see cmake/checks/check_02_system_features.cmake
 */

#cmakedefine DEAL_II_HAVE_SYS_RESOURCE_H
#cmakedefine DEAL_II_HAVE_UNISTD_H
#cmakedefine DEAL_II_HAVE_GETHOSTNAME
#cmakedefine DEAL_II_HAVE_GETPID
#cmakedefine DEAL_II_HAVE_JN

#cmakedefine DEAL_II_MSVC


/***********************************************************************
 * Feature configuration
 *
 * For documentation see cmake/configure/configure_*.cmake and
 * cmake/modules/Find*.cmake
 */

/* cmake/modules/FindADOLC.cmake */
#cmakedefine DEAL_II_ADOLC_WITH_ATRIG_ERF
#cmakedefine DEAL_II_ADOLC_WITH_ADVANCED_BRANCHING

/* cmake/modules/FindARPACK.cmake */
#cmakedefine DEAL_II_ARPACK_WITH_PARPACK

/* cmake/modules/FindPETSC.cmake */
#cmakedefine DEAL_II_PETSC_WITH_HYPRE
#cmakedefine DEAL_II_PETSC_WITH_MUMPS

/* cmake/modules/FindSUNDIALS.cmake */
#cmakedefine DEAL_II_SUNDIALS_WITH_IDAS

/* cmake/configure/configure_1_threads.cmake */
#cmakedefine DEAL_II_USE_MT_POSIX
#cmakedefine DEAL_II_USE_MT_POSIX_NO_BARRIERS

/* cmake/configure/configure_2_trilinos.cmake */
#cmakedefine DEAL_II_TRILINOS_CXX_SUPPORTS_SACADO_COMPLEX_RAD
#cmakedefine DEAL_II_TRILINOS_WITH_ROL
#cmakedefine DEAL_II_TRILINOS_WITH_ZOLTAN

/*
 * 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.
 *
 * @deprecated This macro is deprecated in favor of using the
 * <code>std::atomic</code> template class.
 */
#ifdef DEAL_II_WITH_THREADS
#  define DEAL_VOLATILE volatile
#else
#  define DEAL_VOLATILE
#endif


/***********************************************************************
 * Various macros for version number query and comparison:
 *
 * These macros are defined to make testing for specific versions within
 * the deal.II main code as simple as possible.
 */

/*
 * deal.II:
 */

#define DEAL_II_VERSION_GTE(major,minor,subminor) \
 ((DEAL_II_VERSION_MAJOR * 10000 + \
    DEAL_II_VERSION_MINOR * 100 + \
     DEAL_II_VERSION_SUBMINOR) \
    >=  \
    (major)*10000 + (minor)*100 + (subminor))


/*
 * Gmsh:
 */
#ifdef DEAL_II_WITH_GMSH
#  define DEAL_II_GMSH_EXECUTABLE_PATH "@GMSH_EXECUTABLE@"
#endif

/*
 * p4est:
 */

#ifdef DEAL_II_WITH_P4EST
#  define DEAL_II_P4EST_VERSION_MAJOR @P4EST_VERSION_MAJOR@
#  define DEAL_II_P4EST_VERSION_MINOR @P4EST_VERSION_MINOR@
#  define DEAL_II_P4EST_VERSION_SUBMINOR @P4EST_VERSION_SUBMINOR@
#  define DEAL_II_P4EST_VERSION_PATCH @P4EST_VERSION_PATCH@

#  define DEAL_II_P4EST_VERSION_GTE(major,minor,subminor,patch) \
 ((DEAL_II_P4EST_VERSION_MAJOR * 1000000 + \
    DEAL_II_P4EST_VERSION_MINOR * 10000 + \
     DEAL_II_P4EST_VERSION_SUBMINOR * 100 + \
      DEAL_II_P4EST_VERSION_PATCH) \
    >=  \
    (major)*1000000 + (minor)*10000 + (subminor)*100 + (patch))
#else
  // p4est up to 0.3.4.1 didn't define P4EST_VERSION_*. since
  // we didn't supports anything before 0.3.4, we assume 0.3.4
  // This means that we can't use the new features in 0.3.4.1
#  define DEAL_II_P4EST_VERSION_GTE(major,minor,subminor,patch) \
  ((0 * 1000000 + \
    3 * 10000 + \
    4 * 100 + \
    0) \
    >=  \
    (major)*1000000 + (minor)*10000 + (subminor)*100 + (patch))
#endif

 /*
  * SUNDIALS:
  *
  *  Note: The following definitions will be set in sundials_config.h,
  *        so we don't repeat them here.
  *
  *  SUNDIALS_VERSION_MAJOR
  *  SUNDIALS_VERSION_MINOR
  *  SUNDIALS_VERSION_PATCH
  */

 #define DEAL_II_SUNDIALS_VERSION_GTE(major,minor,subminor) \
   ((SUNDIALS_VERSION_MAJOR * 10000 + \
     SUNDIALS_VERSION_MINOR * 100 + \
     SUNDIALS_VERSION_SUBMINOR) \
     >=  \
     (major)*10000 + (minor)*100 + (subminor))

 #define DEAL_II_SUNDIALS_VERSION_LT(major,minor,subminor) \
   ((SUNDIALS_VERSION_MAJOR * 10000 + \
     SUNDIALS_VERSION_MINOR * 100 + \
     SUNDIALS_VERSION_SUBMINOR) \
     <  \
     (major)*10000 + (minor)*100 + (subminor))

/*
 * PETSc:
 *
 * Note: The following definitions will be set in petscconf.h and
 *       petscversion.h, so we don't repeat them here.
 *
 *  PETSC_VERSION_MAJOR
 *  PETSC_VERSION_MINOR
 *  PETSC_VERSION_SUBMINOR
 *  PETSC_VERSION_PATCH
 *  PETSC_VERSION_RELEASE
 *  PETSC_USE_COMPLEX
 */

#define DEAL_II_PETSC_VERSION_LT(major,minor,subminor) \
  ((PETSC_VERSION_MAJOR * 10000 + \
    PETSC_VERSION_MINOR * 100 + \
    PETSC_VERSION_SUBMINOR) \
    <  \
    (major)*10000 + (minor)*100 + (subminor))

#define DEAL_II_PETSC_VERSION_GTE(major,minor,subminor) \
  ((PETSC_VERSION_MAJOR * 10000 + \
    PETSC_VERSION_MINOR * 100 + \
    PETSC_VERSION_SUBMINOR) \
    >=  \
    (major)*10000 + (minor)*100 + (subminor))

/*
 * SLEPC
 * see slepcversion.h
 */
#define DEAL_II_SLEPC_VERSION_GTE(major,minor,subminor) \
  ((SLEPC_VERSION_MAJOR * 10000 + \
    SLEPC_VERSION_MINOR * 100 + \
    SLEPC_VERSION_SUBMINOR) \
    >=  \
    (major)*10000 + (minor)*100 + (subminor))

/*
 * Trilinos:
 */

#ifdef DEAL_II_WITH_TRILINOS
#  define DEAL_II_TRILINOS_VERSION_MAJOR @TRILINOS_VERSION_MAJOR@
#  define DEAL_II_TRILINOS_VERSION_MINOR @TRILINOS_VERSION_MINOR@
#  define DEAL_II_TRILINOS_VERSION_SUBMINOR @TRILINOS_VERSION_SUBMINOR@

#  define DEAL_II_TRILINOS_VERSION_GTE(major,minor,subminor) \
 ((DEAL_II_TRILINOS_VERSION_MAJOR * 10000 + \
    DEAL_II_TRILINOS_VERSION_MINOR * 100 + \
      DEAL_II_TRILINOS_VERSION_SUBMINOR) \
    >=  \
    (major)*10000 + (minor)*100 + (subminor))
#endif

/*
 * MPI
 */

#ifdef DEAL_II_WITH_MPI
#  define DEAL_II_MPI_VERSION_MAJOR @MPI_VERSION_MAJOR@
#  define DEAL_II_MPI_VERSION_MINOR @MPI_VERSION_MINOR@

#  define DEAL_II_MPI_VERSION_GTE(major,minor) \
 ((DEAL_II_MPI_VERSION_MAJOR * 100 + \
    DEAL_II_MPI_VERSION_MINOR) \
    >=  \
    (major)*100 + (minor))
#endif

/***********************************************************************
 * Two macro names that we put at the top and bottom of all deal.II files
 * and that will be expanded to "namespace dealii {" and "}".
 */

#define DEAL_II_NAMESPACE_OPEN namespace dealii {
#define DEAL_II_NAMESPACE_CLOSE }

/***********************************************************************
 * Two macros to guard external header includes.
 *
 * Selectively disable diagnostics set by "-Wextra" (and similar flags) for
 * GCC and compiler accepting GCC dialects (such as clang).
 * "diagnostic push" is supported since gcc-4.6 and clang-3.3.
 */

#ifdef DEAL_II_COMPILER_HAS_DIAGNOSTIC_PRAGMA

/* keep pragmas with an exclamation mark in order.. */
#  define DEAL_II_DISABLE_EXTRA_DIAGNOSTICS                             \
_Pragma("GCC diagnostic push")                                    /*!*/ \
_Pragma("GCC diagnostic ignored \"-Wunknown-pragmas\"")           /*!*/ \
_Pragma("GCC diagnostic ignored \"-Wpragmas\"")                   /*!*/ \
_Pragma("GCC diagnostic ignored \"-Wunknown-warning-option\"")    /*!*/ \
_Pragma("GCC diagnostic ignored \"-Wunknown-warning\"")           /*!*/ \
_Pragma("GCC diagnostic ignored \"-Wextra\"")                     /*!*/ \
_Pragma("GCC diagnostic ignored \"-Waddress-of-packed-member\"")        \
_Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")         \
_Pragma("GCC diagnostic ignored \"-Wexpansion-to-defined\"")            \
_Pragma("GCC diagnostic ignored \"-Wexpansion-to-defined\"")            \
_Pragma("GCC diagnostic ignored \"-Wignored-attributes\"")              \
_Pragma("GCC diagnostic ignored \"-Wignored-qualifiers\"")              \
_Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"")            \
_Pragma("GCC diagnostic ignored \"-Winfinite-recursion\"")              \
_Pragma("GCC diagnostic ignored \"-Wint-in-bool-context\"")             \
_Pragma("GCC diagnostic ignored \"-Wmisleading-indentation\"")          \
_Pragma("GCC diagnostic ignored \"-Wmissing-field-initializers\"")      \
_Pragma("GCC diagnostic ignored \"-Wnested-anon-types\"")               \
_Pragma("GCC diagnostic ignored \"-Wnon-virtual-dtor\"")                \
_Pragma("GCC diagnostic ignored \"-Woverflow\"")                        \
_Pragma("GCC diagnostic ignored \"-Woverloaded-virtual\"")              \
_Pragma("GCC diagnostic ignored \"-Wpedantic\"")                        \
_Pragma("GCC diagnostic ignored \"-Wtautological-constant-out-of-range-compare\"") \
_Pragma("GCC diagnostic ignored \"-Wtype-limits\"")                     \
_Pragma("GCC diagnostic ignored \"-Wundef\"")                           \
_Pragma("GCC diagnostic ignored \"-Wunused-but-set-parameter\"")        \
_Pragma("GCC diagnostic ignored \"-Wunused-but-set-variable\"")         \
_Pragma("GCC diagnostic ignored \"-Wunused-function\"")                 \
_Pragma("GCC diagnostic ignored \"-Wunused-parameter\"")                \
_Pragma("GCC diagnostic ignored \"-Wunused-private-field\"")            \
_Pragma("GCC diagnostic ignored \"-Wunused-variable\"")                 \
_Pragma("GCC diagnostic warning \"-Wpragmas\"")                   /*!*/

#  define DEAL_II_ENABLE_EXTRA_DIAGNOSTICS                              \
_Pragma("GCC diagnostic pop")

#else

#  define DEAL_II_DISABLE_EXTRA_DIAGNOSTICS
#  define DEAL_II_ENABLE_EXTRA_DIAGNOSTICS

#endif


/***********************************************************************
 * Final inclusions:
 */

/*
 * Some systems require including mpi.h before stdio.h which happens in
 * types.h
 */
#if defined(DEAL_II_WITH_MPI) || defined(DEAL_II_WITH_PETSC)
#  include <mpi.h>
#endif

#include <deal.II/base/numbers.h>
#include <deal.II/base/types.h>

#endif
