From 09db958a054d3c6a1808830027b72e3a952d3162 Mon Sep 17 00:00:00 2001 From: Guido Kanschat Date: Wed, 22 Mar 2006 20:20:51 +0000 Subject: [PATCH] put is_finite into config.cc again remove namespace deal_II_numbers from configure.in git-svn-id: https://svn.dealii.org/trunk@12660 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/base/include/base/config.h.in | 87 +------------------ deal.II/base/include/base/numbers.h | 95 ++++++++++++++++----- deal.II/base/source/config.cc | 35 ++++++++ deal.II/configure.in | 71 +-------------- deal.II/lac/include/lac/block_matrix_base.h | 1 - deal.II/lac/include/lac/full_matrix.h | 1 - deal.II/lac/include/lac/sparse_matrix.h | 1 - deal.II/lac/include/lac/sparse_matrix_ez.h | 1 - deal.II/lac/include/lac/vector.h | 1 - 9 files changed, 110 insertions(+), 183 deletions(-) create mode 100644 deal.II/base/source/config.cc diff --git a/deal.II/base/include/base/config.h.in b/deal.II/base/include/base/config.h.in index 3723f02506..f3a78ab426 100644 --- a/deal.II/base/include/base/config.h.in +++ b/deal.II/base/include/base/config.h.in @@ -318,92 +318,7 @@ # define DEAL_VOLATILE #endif - -/** - * Have a namespace into which we declare some numeric constants, such - * as pi. Unfortunately, these are not always available, on all systems - * or depending on compiler flags, so we duplicate their declarations - * here to make them unconditionally available to all other parts of the - * library. - * - * The constants defined here are a subset of the M_XXX constants - * sometimes declared in the system include file math.h, but without - * the prefix M_. - * - * In addition to that, we declare invalid_unsigned_int to be the - * largest unsigned integer representable; this value is widely used in - * the library as a marker for an invalid index, an invalid size of an - * array, and similar purposes. - */ -namespace deal_II_numbers { - /** - * Representation of the - * largest number that - * can be put into an - * unsigned integer. This - * value is widely used - * throughout the library - * as a marker for an - * invalid unsigned - * integer value, such as - * an invalid array - * index, an invalid - * array size, and the - * like. - */ - static const unsigned int - invalid_unsigned_int = static_cast (-1); - - /** - * e - */ - static const double E = 2.7182818284590452354; - - /** - * log_2 e - */ - static const double LOG2E = 1.4426950408889634074; - - /** - * log_10 e - */ - static const double LOG10E = 0.43429448190325182765; - - /** - * log_e 2 - */ - static const double LN2 = 0.69314718055994530942; - - /** - * log_e 10 - */ - static const double LN10 = 2.30258509299404568402; - - /** - * pi - */ - static const double PI = 3.14159265358979323846; - - /** - * pi/2 - */ - static const double PI_2 = 1.57079632679489661923; - - /** - * pi/4 - */ - static const double PI_4 = 0.78539816339744830962; - - /** - * sqrt(2) - */ - static const double SQRT2 = 1.41421356237309504880; - - /** - * 1/sqrt(2) - */ - static const double SQRT1_2 = 0.70710678118654752440; -} +#include #endif diff --git a/deal.II/base/include/base/numbers.h b/deal.II/base/include/base/numbers.h index 1ff30d66f4..fd8ce1842f 100644 --- a/deal.II/base/include/base/numbers.h +++ b/deal.II/base/include/base/numbers.h @@ -21,7 +21,8 @@ /** * Namespace for the declaration of universal constants. Since the * availability in math.h is not always guaranteed, we put - * them here. + * them here. Since this file is included by base/config.h, + * they are available to the whole library. * * The constants defined here are a subset of the M_XXX constants * sometimes declared in the system include file math.h, but without @@ -31,34 +32,84 @@ * largest unsigned integer representable; this value is widely used in * the library as a marker for an invalid index, an invalid size of an * array, and similar purposes. - * - * Most of the members of this namespace are defined in - * base/config.h. Nevertheless, the inline functions are in - * base/numbers.h. */ -namespace deal_II_numbers -{ - /** +namespace deal_II_numbers { + /** + * Representation of the + * largest number that + * can be put into an + * unsigned integer. This + * value is widely used + * throughout the library + * as a marker for an + * invalid unsigned + * integer value, such as + * an invalid array + * index, an invalid + * array size, and the + * like. + */ + static const unsigned int + invalid_unsigned_int = static_cast (-1); + + /** + * e + */ + static const double E = 2.7182818284590452354; + + /** + * log_2 e + */ + static const double LOG2E = 1.4426950408889634074; + + /** + * log_10 e + */ + static const double LOG10E = 0.43429448190325182765; + + /** + * log_e 2 + */ + static const double LN2 = 0.69314718055994530942; + + /** + * log_e 10 + */ + static const double LN10 = 2.30258509299404568402; + + /** + * pi + */ + static const double PI = 3.14159265358979323846; + + /** + * pi/2 + */ + static const double PI_2 = 1.57079632679489661923; + + /** + * pi/4 + */ + static const double PI_4 = 0.78539816339744830962; + + /** + * sqrt(2) + */ + static const double SQRT2 = 1.41421356237309504880; + + /** + * 1/sqrt(2) + */ + static const double SQRT1_2 = 0.70710678118654752440; + + /** * Return @p true if the given * value is a finite floating point * number, i.e. is neither plus or * minus infinity nor NaN (not a * number). */ - - inline bool is_finite (const double x) - { -#ifdef DEAL_II_HAVE_ISFINITE - return std::isfinite (x); -#else - // check against infinities. not - // that if x is a NaN, then both - // comparisons will be false - return ((x >= std::numeric_limits::min()) - && - (x <= std::numeric_limits::max())); -#endif - } + bool is_finite (const double x); } #endif diff --git a/deal.II/base/source/config.cc b/deal.II/base/source/config.cc new file mode 100644 index 0000000000..4d8ec7b70e --- /dev/null +++ b/deal.II/base/source/config.cc @@ -0,0 +1,35 @@ +//--------------------------------------------------------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2006 by the deal.II authors +// +// This file is subject to QPL and may not be distributed +// without copyright and license information. Please refer +// to the file deal.II/doc/license.html for the text and +// further information on this license. +// +//--------------------------------------------------------------------------- + + +#include +#include +#include + + +namespace deal_II_numbers +{ + bool is_finite (const double x) + { +#ifdef DEAL_II_HAVE_ISFINITE + return std::isfinite (x); +#else + // check against infinities. not + // that if x is a NaN, then both + // comparisons will be false + return ((x >= std::numeric_limits::min()) + && + (x <= std::numeric_limits::max())); +#endif + } +} diff --git a/deal.II/configure.in b/deal.II/configure.in index 3fa4acd1eb..89032d1d49 100644 --- a/deal.II/configure.in +++ b/deal.II/configure.in @@ -605,76 +605,7 @@ AH_BOTTOM( # define DEAL_VOLATILE #endif - -namespace deal_II_numbers { - /** - * Representation of the - * largest number that - * can be put into an - * unsigned integer. This - * value is widely used - * throughout the library - * as a marker for an - * invalid unsigned - * integer value, such as - * an invalid array - * index, an invalid - * array size, and the - * like. - */ - static const unsigned int - invalid_unsigned_int = static_cast (-1); - - /** - * e - */ - static const double E = 2.7182818284590452354; - - /** - * log_2 e - */ - static const double LOG2E = 1.4426950408889634074; - - /** - * log_10 e - */ - static const double LOG10E = 0.43429448190325182765; - - /** - * log_e 2 - */ - static const double LN2 = 0.69314718055994530942; - - /** - * log_e 10 - */ - static const double LN10 = 2.30258509299404568402; - - /** - * pi - */ - static const double PI = 3.14159265358979323846; - - /** - * pi/2 - */ - static const double PI_2 = 1.57079632679489661923; - - /** - * pi/4 - */ - static const double PI_4 = 0.78539816339744830962; - - /** - * sqrt(2) - */ - static const double SQRT2 = 1.41421356237309504880; - - /** - * 1/sqrt(2) - */ - static const double SQRT1_2 = 0.70710678118654752440; -} +#include #endif ]) diff --git a/deal.II/lac/include/lac/block_matrix_base.h b/deal.II/lac/include/lac/block_matrix_base.h index 3dbc9db6ed..7a6348ea65 100644 --- a/deal.II/lac/include/lac/block_matrix_base.h +++ b/deal.II/lac/include/lac/block_matrix_base.h @@ -15,7 +15,6 @@ #include -#include #include #include #include diff --git a/deal.II/lac/include/lac/full_matrix.h b/deal.II/lac/include/lac/full_matrix.h index 42f0c91707..9d14820f82 100644 --- a/deal.II/lac/include/lac/full_matrix.h +++ b/deal.II/lac/include/lac/full_matrix.h @@ -15,7 +15,6 @@ #include -#include #include #include diff --git a/deal.II/lac/include/lac/sparse_matrix.h b/deal.II/lac/include/lac/sparse_matrix.h index d203064586..4c37510981 100644 --- a/deal.II/lac/include/lac/sparse_matrix.h +++ b/deal.II/lac/include/lac/sparse_matrix.h @@ -15,7 +15,6 @@ #include -#include #include #include #include diff --git a/deal.II/lac/include/lac/sparse_matrix_ez.h b/deal.II/lac/include/lac/sparse_matrix_ez.h index 435b0bc0e3..b112250626 100644 --- a/deal.II/lac/include/lac/sparse_matrix_ez.h +++ b/deal.II/lac/include/lac/sparse_matrix_ez.h @@ -15,7 +15,6 @@ #include -#include #include #include #include diff --git a/deal.II/lac/include/lac/vector.h b/deal.II/lac/include/lac/vector.h index 9e9b1692ed..4f2fcf7912 100644 --- a/deal.II/lac/include/lac/vector.h +++ b/deal.II/lac/include/lac/vector.h @@ -15,7 +15,6 @@ #include -#include #include #include -- 2.39.5