From: Daniel Arndt Date: Mon, 30 Jul 2018 21:31:55 +0000 (+0200) Subject: Restrict wave_number in constructor of Bessel1 to nonnegative values X-Git-Tag: v9.1.0-rc1~865^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F7003%2Fhead;p=dealii.git Restrict wave_number in constructor of Bessel1 to nonnegative values --- diff --git a/include/deal.II/base/function_bessel.h b/include/deal.II/base/function_bessel.h index 933a942c85..eb8824b681 100644 --- a/include/deal.II/base/function_bessel.h +++ b/include/deal.II/base/function_bessel.h @@ -36,19 +36,26 @@ namespace Functions class Bessel1 : public Function { public: + /** + * Constructor. @p wave_number must be nonnegative. + */ Bessel1(const unsigned int order, const double wave_number, const Point center = Point()); + virtual double value(const Point & points, const unsigned int component = 0) const override; + virtual void value_list(const std::vector> &points, std::vector & values, const unsigned int component = 0) const override; + virtual Tensor<1, dim> gradient(const Point & p, const unsigned int component = 0) const override; + virtual void gradient_list(const std::vector> &points, std::vector> & gradients, diff --git a/source/base/function_lib.cc b/source/base/function_lib.cc index 465cde3112..663714a71c 100644 --- a/source/base/function_lib.cc +++ b/source/base/function_lib.cc @@ -2276,7 +2276,9 @@ namespace Functions : order(order) , wave_number(wave_number) , center(center) - {} + { + Assert(wave_number >= 0., ExcMessage("wave_number must be nonnegative!")); + } template double diff --git a/tests/base/bessel_function_values.cc b/tests/base/bessel_function_values.cc index 0a0fd4529b..db8f9da6c6 100644 --- a/tests/base/bessel_function_values.cc +++ b/tests/base/bessel_function_values.cc @@ -28,7 +28,7 @@ main() initlog(); for (unsigned int order = 0; order < 3; order += 1) - for (double wave_n = -4.0; wave_n < 4.0; wave_n += 1.5) + for (double wave_n = 0.; wave_n < 4.0; wave_n += 1.5) for (double x = 1.0; x < 2.0; x += 0.5) for (double y = 2.0; y < 3.0; y += 0.5) { diff --git a/tests/base/bessel_function_values.output b/tests/base/bessel_function_values.output index afd64b99d8..67708be4b1 100644 --- a/tests/base/bessel_function_values.output +++ b/tests/base/bessel_function_values.output @@ -1,145 +1,73 @@ -DEAL::value at (1.10000, 2.10000) = 0.921586 -DEAL::gradient at (1.10000, 2.10000) = -0.768424 -0.768424 -DEAL::value at (1.10000, 2.60000) = 0.921586 -DEAL::gradient at (1.10000, 2.60000) = -0.768424 -0.768424 -DEAL::value at (1.60000, 2.10000) = 0.921586 -DEAL::gradient at (1.60000, 2.10000) = -0.768424 -0.768424 -DEAL::value at (1.60000, 2.60000) = 0.921586 -DEAL::gradient at (1.60000, 2.60000) = -0.768424 -0.768424 -DEAL::value at (1.10000, 2.10000) = 0.968993 -DEAL::gradient at (1.10000, 2.10000) = -0.307643 -0.307643 -DEAL::value at (1.10000, 2.60000) = 0.968993 -DEAL::gradient at (1.10000, 2.60000) = -0.307643 -0.307643 -DEAL::value at (1.60000, 2.10000) = 0.968993 -DEAL::gradient at (1.60000, 2.10000) = -0.307643 -0.307643 -DEAL::value at (1.60000, 2.60000) = 0.968993 -DEAL::gradient at (1.60000, 2.60000) = -0.307643 -0.307643 -DEAL::value at (1.10000, 2.10000) = 0.995006 -DEAL::gradient at (1.10000, 2.10000) = -0.0498751 -0.0498751 -DEAL::value at (1.10000, 2.60000) = 0.995006 -DEAL::gradient at (1.10000, 2.60000) = -0.0498751 -0.0498751 -DEAL::value at (1.60000, 2.10000) = 0.995006 -DEAL::gradient at (1.60000, 2.10000) = -0.0498751 -0.0498751 -DEAL::value at (1.60000, 2.60000) = 0.995006 -DEAL::gradient at (1.60000, 2.60000) = -0.0498751 -0.0498751 -DEAL::value at (1.10000, 2.10000) = 0.998750 -DEAL::gradient at (1.10000, 2.10000) = -0.0124922 -0.0124922 -DEAL::value at (1.10000, 2.60000) = 0.998750 -DEAL::gradient at (1.10000, 2.60000) = -0.0124922 -0.0124922 -DEAL::value at (1.60000, 2.10000) = 0.998750 -DEAL::gradient at (1.60000, 2.10000) = -0.0124922 -0.0124922 -DEAL::value at (1.60000, 2.60000) = 0.998750 -DEAL::gradient at (1.60000, 2.60000) = -0.0124922 -0.0124922 -DEAL::value at (1.10000, 2.10000) = 0.980100 -DEAL::gradient at (1.10000, 2.10000) = -0.198007 -0.198007 -DEAL::value at (1.10000, 2.60000) = 0.980100 -DEAL::gradient at (1.10000, 2.60000) = -0.198007 -0.198007 -DEAL::value at (1.60000, 2.10000) = 0.980100 -DEAL::gradient at (1.60000, 2.10000) = -0.198007 -0.198007 -DEAL::value at (1.60000, 2.60000) = 0.980100 -DEAL::gradient at (1.60000, 2.60000) = -0.198007 -0.198007 -DEAL::value at (1.10000, 2.10000) = 0.939682 -DEAL::gradient at (1.10000, 2.10000) = -0.593933 -0.593933 -DEAL::value at (1.10000, 2.60000) = 0.939682 -DEAL::gradient at (1.10000, 2.60000) = -0.593933 -0.593933 -DEAL::value at (1.60000, 2.10000) = 0.939682 -DEAL::gradient at (1.60000, 2.10000) = -0.593933 -0.593933 -DEAL::value at (1.60000, 2.60000) = 0.939682 -DEAL::gradient at (1.60000, 2.60000) = -0.593933 -0.593933 -DEAL::value at (1.10000, 2.10000) = -0.271679 -DEAL::gradient at (1.10000, 2.10000) = -1.24824 -1.24824 -DEAL::value at (1.10000, 2.60000) = -0.271679 -DEAL::gradient at (1.10000, 2.60000) = -1.24824 -1.24824 -DEAL::value at (1.60000, 2.10000) = -0.271679 -DEAL::gradient at (1.60000, 2.10000) = -1.24824 -1.24824 -DEAL::value at (1.60000, 2.60000) = -0.271679 -DEAL::gradient at (1.60000, 2.60000) = -1.24824 -1.24824 -DEAL::value at (1.10000, 2.10000) = -0.174029 -DEAL::gradient at (1.10000, 2.10000) = -0.842810 -0.842810 -DEAL::value at (1.10000, 2.60000) = -0.174029 -DEAL::gradient at (1.10000, 2.60000) = -0.842810 -0.842810 -DEAL::value at (1.60000, 2.10000) = -0.174029 -DEAL::gradient at (1.60000, 2.10000) = -0.842810 -0.842810 -DEAL::value at (1.60000, 2.60000) = -0.174029 -DEAL::gradient at (1.60000, 2.60000) = -0.842810 -0.842810 -DEAL::value at (1.10000, 2.10000) = -0.0705340 -DEAL::gradient at (1.10000, 2.10000) = -0.350905 -0.350905 -DEAL::value at (1.10000, 2.60000) = -0.0705340 -DEAL::gradient at (1.10000, 2.60000) = -0.350905 -0.350905 -DEAL::value at (1.60000, 2.10000) = -0.0705340 -DEAL::gradient at (1.60000, 2.10000) = -0.350905 -0.350905 -DEAL::value at (1.60000, 2.60000) = -0.0705340 -DEAL::gradient at (1.60000, 2.60000) = -0.350905 -0.350905 -DEAL::value at (1.10000, 2.10000) = 0.0353332 -DEAL::gradient at (1.10000, 2.10000) = 0.176445 0.176445 -DEAL::value at (1.10000, 2.60000) = 0.0353332 -DEAL::gradient at (1.10000, 2.60000) = 0.176445 0.176445 -DEAL::value at (1.60000, 2.10000) = 0.0353332 -DEAL::gradient at (1.60000, 2.10000) = 0.176445 0.176445 -DEAL::value at (1.60000, 2.60000) = 0.0353332 -DEAL::gradient at (1.60000, 2.60000) = 0.176445 0.176445 -DEAL::value at (1.10000, 2.10000) = 0.140012 -DEAL::gradient at (1.10000, 2.10000) = 0.686011 0.686011 -DEAL::value at (1.10000, 2.60000) = 0.140012 -DEAL::gradient at (1.10000, 2.60000) = 0.686011 0.686011 -DEAL::value at (1.60000, 2.10000) = 0.140012 -DEAL::gradient at (1.60000, 2.10000) = 0.686011 0.686011 -DEAL::value at (1.60000, 2.60000) = 0.140012 -DEAL::gradient at (1.60000, 2.60000) = 0.686011 0.686011 -DEAL::value at (1.10000, 2.10000) = 0.239985 -DEAL::gradient at (1.10000, 2.10000) = 1.12567 1.12567 -DEAL::value at (1.10000, 2.60000) = 0.239985 -DEAL::gradient at (1.10000, 2.60000) = 1.12567 1.12567 -DEAL::value at (1.60000, 2.10000) = 0.239985 -DEAL::gradient at (1.60000, 2.10000) = 1.12567 1.12567 -DEAL::value at (1.60000, 2.60000) = 0.239985 -DEAL::gradient at (1.60000, 2.60000) = 1.12567 1.12567 -DEAL::value at (1.10000, 2.10000) = 0.0389439 -DEAL::gradient at (1.10000, 2.10000) = 0.378984 0.378984 -DEAL::value at (1.10000, 2.60000) = 0.0389439 -DEAL::gradient at (1.10000, 2.60000) = 0.378984 0.378984 -DEAL::value at (1.60000, 2.10000) = 0.0389439 -DEAL::gradient at (1.60000, 2.10000) = 0.378984 0.378984 -DEAL::value at (1.60000, 2.60000) = 0.0389439 -DEAL::gradient at (1.60000, 2.60000) = 0.378984 0.378984 -DEAL::value at (1.10000, 2.10000) = 0.0154629 -DEAL::gradient at (1.10000, 2.10000) = 0.153014 0.153014 -DEAL::value at (1.10000, 2.60000) = 0.0154629 -DEAL::gradient at (1.10000, 2.60000) = 0.153014 0.153014 -DEAL::value at (1.60000, 2.10000) = 0.0154629 -DEAL::gradient at (1.60000, 2.10000) = 0.153014 0.153014 -DEAL::value at (1.60000, 2.60000) = 0.0154629 -DEAL::gradient at (1.60000, 2.60000) = 0.153014 0.153014 -DEAL::value at (1.10000, 2.10000) = 0.00249584 -DEAL::gradient at (1.10000, 2.10000) = 0.0249167 0.0249167 -DEAL::value at (1.10000, 2.60000) = 0.00249584 -DEAL::gradient at (1.10000, 2.60000) = 0.0249167 0.0249167 -DEAL::value at (1.60000, 2.10000) = 0.00249584 -DEAL::gradient at (1.60000, 2.10000) = 0.0249167 0.0249167 -DEAL::value at (1.60000, 2.60000) = 0.00249584 -DEAL::gradient at (1.60000, 2.60000) = 0.0249167 0.0249167 -DEAL::value at (1.10000, 2.10000) = 0.000624740 -DEAL::gradient at (1.10000, 2.10000) = 0.00624479 0.00624479 -DEAL::value at (1.10000, 2.60000) = 0.000624740 -DEAL::gradient at (1.10000, 2.60000) = 0.00624479 0.00624479 -DEAL::value at (1.60000, 2.10000) = 0.000624740 -DEAL::gradient at (1.60000, 2.10000) = 0.00624479 0.00624479 -DEAL::value at (1.60000, 2.60000) = 0.000624740 -DEAL::gradient at (1.60000, 2.60000) = 0.00624479 0.00624479 -DEAL::value at (1.10000, 2.10000) = 0.00993350 -DEAL::gradient at (1.10000, 2.10000) = 0.0986717 0.0986717 -DEAL::value at (1.10000, 2.60000) = 0.00993350 -DEAL::gradient at (1.10000, 2.60000) = 0.0986717 0.0986717 -DEAL::value at (1.60000, 2.10000) = 0.00993350 -DEAL::gradient at (1.60000, 2.10000) = 0.0986717 0.0986717 -DEAL::value at (1.60000, 2.60000) = 0.00993350 -DEAL::gradient at (1.60000, 2.60000) = 0.0986717 0.0986717 -DEAL::value at (1.10000, 2.10000) = 0.0300045 -DEAL::gradient at (1.10000, 2.10000) = 0.293888 0.293888 -DEAL::value at (1.10000, 2.60000) = 0.0300045 -DEAL::gradient at (1.10000, 2.60000) = 0.293888 0.293888 -DEAL::value at (1.60000, 2.10000) = 0.0300045 -DEAL::gradient at (1.60000, 2.10000) = 0.293888 0.293888 -DEAL::value at (1.60000, 2.60000) = 0.0300045 -DEAL::gradient at (1.60000, 2.60000) = 0.293888 0.293888 +DEAL::value at (1.10000, 2.10000) = 1.00000 +DEAL::gradient at (1.10000, 2.10000) = 0.00000 0.00000 +DEAL::value at (1.10000, 2.60000) = 1.00000 +DEAL::gradient at (1.10000, 2.60000) = 0.00000 0.00000 +DEAL::value at (1.60000, 2.10000) = 1.00000 +DEAL::gradient at (1.60000, 2.10000) = 0.00000 0.00000 +DEAL::value at (1.60000, 2.60000) = 1.00000 +DEAL::gradient at (1.60000, 2.60000) = 0.00000 0.00000 +DEAL::value at (1.10000, 2.10000) = 0.988782 +DEAL::gradient at (1.10000, 2.10000) = -0.111868 -0.111868 +DEAL::value at (1.10000, 2.60000) = 0.988782 +DEAL::gradient at (1.10000, 2.60000) = -0.111868 -0.111868 +DEAL::value at (1.60000, 2.10000) = 0.988782 +DEAL::gradient at (1.60000, 2.10000) = -0.111868 -0.111868 +DEAL::value at (1.60000, 2.60000) = 0.988782 +DEAL::gradient at (1.60000, 2.60000) = -0.111868 -0.111868 +DEAL::value at (1.10000, 2.10000) = 0.955504 +DEAL::gradient at (1.10000, 2.10000) = -0.439951 -0.439951 +DEAL::value at (1.10000, 2.60000) = 0.955504 +DEAL::gradient at (1.10000, 2.60000) = -0.439951 -0.439951 +DEAL::value at (1.60000, 2.10000) = 0.955504 +DEAL::gradient at (1.60000, 2.10000) = -0.439951 -0.439951 +DEAL::value at (1.60000, 2.60000) = 0.955504 +DEAL::gradient at (1.60000, 2.60000) = -0.439951 -0.439951 +DEAL::value at (1.10000, 2.10000) = 0.00000 +DEAL::gradient at (1.10000, 2.10000) = 0.00000 0.00000 +DEAL::value at (1.10000, 2.60000) = 0.00000 +DEAL::gradient at (1.10000, 2.60000) = 0.00000 0.00000 +DEAL::value at (1.60000, 2.10000) = 0.00000 +DEAL::gradient at (1.60000, 2.10000) = 0.00000 0.00000 +DEAL::value at (1.60000, 2.60000) = 0.00000 +DEAL::gradient at (1.60000, 2.60000) = 0.00000 0.00000 +DEAL::value at (1.10000, 2.10000) = 0.105471 +DEAL::gradient at (1.10000, 2.10000) = 0.521409 0.521409 +DEAL::value at (1.10000, 2.60000) = 0.105471 +DEAL::gradient at (1.10000, 2.60000) = 0.521409 0.521409 +DEAL::value at (1.60000, 2.10000) = 0.105471 +DEAL::gradient at (1.60000, 2.10000) = 0.521409 0.521409 +DEAL::value at (1.60000, 2.60000) = 0.105471 +DEAL::gradient at (1.60000, 2.60000) = 0.521409 0.521409 +DEAL::value at (1.10000, 2.10000) = 0.207395 +DEAL::gradient at (1.10000, 2.10000) = 0.989956 0.989956 +DEAL::value at (1.10000, 2.60000) = 0.207395 +DEAL::gradient at (1.10000, 2.60000) = 0.989956 0.989956 +DEAL::value at (1.60000, 2.10000) = 0.207395 +DEAL::gradient at (1.60000, 2.10000) = 0.989956 0.989956 +DEAL::value at (1.60000, 2.60000) = 0.207395 +DEAL::gradient at (1.60000, 2.60000) = 0.989956 0.989956 +DEAL::value at (1.10000, 2.10000) = 0.00000 +DEAL::gradient at (1.10000, 2.10000) = 0.00000 0.00000 +DEAL::value at (1.10000, 2.60000) = 0.00000 +DEAL::gradient at (1.10000, 2.60000) = 0.00000 0.00000 +DEAL::value at (1.60000, 2.10000) = 0.00000 +DEAL::gradient at (1.60000, 2.10000) = 0.00000 0.00000 +DEAL::value at (1.60000, 2.60000) = 0.00000 +DEAL::gradient at (1.60000, 2.60000) = 0.00000 0.00000 +DEAL::value at (1.10000, 2.10000) = 0.00560394 +DEAL::gradient at (1.10000, 2.10000) = 0.0558290 0.0558290 +DEAL::value at (1.10000, 2.60000) = 0.00560394 +DEAL::gradient at (1.10000, 2.60000) = 0.0558290 0.0558290 +DEAL::value at (1.60000, 2.10000) = 0.00560394 +DEAL::gradient at (1.60000, 2.10000) = 0.0558290 0.0558290 +DEAL::value at (1.60000, 2.60000) = 0.00560394 +DEAL::gradient at (1.60000, 2.60000) = 0.0558290 0.0558290 +DEAL::value at (1.10000, 2.10000) = 0.0221644 +DEAL::gradient at (1.10000, 2.10000) = 0.218307 0.218307 +DEAL::value at (1.10000, 2.60000) = 0.0221644 +DEAL::gradient at (1.10000, 2.60000) = 0.218307 0.218307 +DEAL::value at (1.60000, 2.10000) = 0.0221644 +DEAL::gradient at (1.60000, 2.10000) = 0.218307 0.218307 +DEAL::value at (1.60000, 2.60000) = 0.0221644 +DEAL::gradient at (1.60000, 2.60000) = 0.218307 0.218307