Skip to content

Commit accfb38

Browse files
author
Martin D. Weinberg
committed
Make sure that lambda closures do not throw exceptions inside the makeFromFunction and computeQuadrature member functions
1 parent 1d62178 commit accfb38

1 file changed

Lines changed: 11 additions & 12 deletions

File tree

expui/BiorthBasis.cc

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4678,24 +4678,24 @@ namespace BasisClasses
46784678

46794679
auto x_to_r = [&](double x) -> double
46804680
{
4681-
if (x <-1.0) throw std::runtime_error("BiorthBasis::makeFromFunction: x<-1");
4682-
if (x > 1.0) throw std::runtime_error("BiorthBasis::makeFromFunction: x>+1");
4683-
46844681
return (1.0 + x)/(1.0 - x) * rmapping;
46854682
};
46864683

46874684

46884685
auto d_x_to_r = [&](double x) -> double
46894686
{
4690-
if (x <-1.0) throw std::runtime_error("BiorthBasis::makeFromFunction: x<-1");
4691-
if (x > 1.0) throw std::runtime_error("BiorthBasis::makeFromFunction: x>+1");
4692-
46934687
return 0.5*(1.0 - x)*(1.0 - x)/rmapping;
46944688
};
46954689

46964690
double ximin = r_to_x(rmin);
46974691
double ximax = r_to_x(rmax);
46984692

4693+
if (ximin <=-1.0) throw std::runtime_error("BiorthBasis::makeFromFunction: x<=-1");
4694+
if (ximin >= 1.0) throw std::runtime_error("BiorthBasis::makeFromFunction: x>=+1");
4695+
4696+
if (ximax <=-1.0) throw std::runtime_error("BiorthBasis::makeFromFunction: x<=-1");
4697+
if (ximax >= 1.0) throw std::runtime_error("BiorthBasis::makeFromFunction: x>=+1");
4698+
46994699
int Lmax = lmax;
47004700
int Nmax = nmax;
47014701

@@ -4812,24 +4812,23 @@ namespace BasisClasses
48124812

48134813
auto x_to_r = [&](double x) -> double
48144814
{
4815-
if (x<-1.0) throw std::runtime_error("BiorthBasis::computeQuadrature: x<-1");
4816-
if (x> 1.0) throw std::runtime_error("BiorthBasis::computeQuadrature: x>+1");
4817-
48184815
return (1.0 + x)/(1.0 - x) * rmapping;
48194816
};
48204817

48214818

48224819
auto d_x_to_r = [&](double x) -> double
48234820
{
4824-
if (x<-1.0) throw std::runtime_error("BiorthBasis::computeQuadrature: x<-1");
4825-
if (x> 1.0) throw std::runtime_error("BiorthBasis::computeQuadrature: x>+1");
4826-
48274821
return 0.5*(1.0 - x)*(1.0 - x)/rmapping;
48284822
};
48294823

48304824
double ximin = r_to_x(rmin);
48314825
double ximax = r_to_x(rmax);
48324826

4827+
if (ximin<=-1.0) throw std::runtime_error("BiorthBasis::computeQuadrature: x<=-1");
4828+
if (ximax>= 1.0) throw std::runtime_error("BiorthBasis::computeQuadrature: x>=+1");
4829+
if (ximax<=-1.0) throw std::runtime_error("BiorthBasis::computeQuadrature: x<=-1");
4830+
if (ximax>= 1.0) throw std::runtime_error("BiorthBasis::computeQuadrature: x>=+1");
4831+
48334832
int Lmax = lmax;
48344833
int Nmax = nmax;
48354834

0 commit comments

Comments
 (0)