From 2a25362319d37a95e020c3f4d81250a3379a6a4d Mon Sep 17 00:00:00 2001 From: Guido Kanschat Date: Wed, 22 Mar 2006 10:54:16 +0000 Subject: [PATCH] make sure simple functions like isfinite are inlined\ give those their own header file git-svn-id: https://svn.dealii.org/trunk@12656 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/base/include/base/config.h.in | 9 --- deal.II/base/include/base/numbers.h | 64 +++++++++++++++++++++ deal.II/base/source/config.cc | 35 ----------- deal.II/configure | 2 +- deal.II/configure.in | 25 -------- 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 + 10 files changed, 70 insertions(+), 70 deletions(-) create mode 100644 deal.II/base/include/base/numbers.h delete 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 a3d01466f7..3723f02506 100644 --- a/deal.II/base/include/base/config.h.in +++ b/deal.II/base/include/base/config.h.in @@ -403,15 +403,6 @@ namespace deal_II_numbers { * 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). - */ - bool is_finite (const double x); } #endif diff --git a/deal.II/base/include/base/numbers.h b/deal.II/base/include/base/numbers.h new file mode 100644 index 0000000000..1ff30d66f4 --- /dev/null +++ b/deal.II/base/include/base/numbers.h @@ -0,0 +1,64 @@ +//--------------------------------------------------------------------------- +// $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. +// +//--------------------------------------------------------------------------- +#ifndef __deal2__numbers_h +#define __deal2__numbers_h + +#include +#include +#include + + +/** + * Namespace for the declaration of universal constants. Since the + * availability in math.h is not always guaranteed, we put + * them here. + * + * 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. + * + * 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 +{ + /** + * 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 + } +} + +#endif diff --git a/deal.II/base/source/config.cc b/deal.II/base/source/config.cc deleted file mode 100644 index 4d8ec7b70e..0000000000 --- a/deal.II/base/source/config.cc +++ /dev/null @@ -1,35 +0,0 @@ -//--------------------------------------------------------------------------- -// $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 b/deal.II/configure index 43e964224b..5065e61ac8 100755 --- a/deal.II/configure +++ b/deal.II/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 1.221 . +# From configure.in Revision: 1.222 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59 for deal.II 5.3.pre. # diff --git a/deal.II/configure.in b/deal.II/configure.in index 5db6d179c6..3fa4acd1eb 100644 --- a/deal.II/configure.in +++ b/deal.II/configure.in @@ -606,22 +606,6 @@ AH_BOTTOM( #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 @@ -690,15 +674,6 @@ namespace deal_II_numbers { * 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). - */ - bool is_finite (const double x); } #endif diff --git a/deal.II/lac/include/lac/block_matrix_base.h b/deal.II/lac/include/lac/block_matrix_base.h index 7a6348ea65..3dbc9db6ed 100644 --- a/deal.II/lac/include/lac/block_matrix_base.h +++ b/deal.II/lac/include/lac/block_matrix_base.h @@ -15,6 +15,7 @@ #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 9d14820f82..42f0c91707 100644 --- a/deal.II/lac/include/lac/full_matrix.h +++ b/deal.II/lac/include/lac/full_matrix.h @@ -15,6 +15,7 @@ #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 4c37510981..d203064586 100644 --- a/deal.II/lac/include/lac/sparse_matrix.h +++ b/deal.II/lac/include/lac/sparse_matrix.h @@ -15,6 +15,7 @@ #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 b112250626..435b0bc0e3 100644 --- a/deal.II/lac/include/lac/sparse_matrix_ez.h +++ b/deal.II/lac/include/lac/sparse_matrix_ez.h @@ -15,6 +15,7 @@ #include +#include #include #include #include diff --git a/deal.II/lac/include/lac/vector.h b/deal.II/lac/include/lac/vector.h index 4f2fcf7912..9e9b1692ed 100644 --- a/deal.II/lac/include/lac/vector.h +++ b/deal.II/lac/include/lac/vector.h @@ -15,6 +15,7 @@ #include +#include #include #include -- 2.39.5