Skip to content

Commit 490b46c

Browse files
authored
Merge pull request #202 from EXP-code/copilot/sub-pr-199-again
Add input validation for bias parameter in cylindrical basis
2 parents d227415 + 101b772 commit 490b46c

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11

22
build/*
3+
_codeql_build_dir/
34

45
Makefile
56
*.lo

expui/BiorthBasis.cc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1558,6 +1558,17 @@ namespace BasisClasses
15581558
pnum = std::max<int>(1, pnum);
15591559
tnum = std::max<int>(10, tnum);
15601560

1561+
// Validate bias parameter
1562+
//
1563+
if (!std::isfinite(bias)) {
1564+
throw std::runtime_error("Cylindrical: 'bias' parameter must be finite");
1565+
}
1566+
if (bias <= 0.0) {
1567+
std::ostringstream sout;
1568+
sout << "Cylindrical: 'bias' parameter must be positive, got " << bias;
1569+
throw std::runtime_error(sout.str());
1570+
}
1571+
15611572
EmpCylSL::RMIN = rcylmin;
15621573
EmpCylSL::RMAX = rcylmax;
15631574
EmpCylSL::NUMX = ncylnx;

0 commit comments

Comments
 (0)