Skip to content

Commit 2ef3aba

Browse files
author
Martin D. Weinberg
committed
Added automatic output of valid EmpModel types
1 parent 0c49ed0 commit 2ef3aba

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

expui/BiorthBasis.cc

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1605,19 +1605,19 @@ namespace BasisClasses
16051605
// Set EmpCylSL mtype. This is the spherical function used to
16061606
// generate the EOF basis.
16071607
//
1608-
auto itm = EmpCylSL::EmpModelMap.find(mtype);
1609-
1610-
if (itm == EmpCylSL::EmpModelMap.end()) {
1608+
try {
1609+
auto itm = EmpCylSL::EmpModelMap.find(mtype);
1610+
EmpCylSL::mtype = itm->second;
1611+
}
1612+
catch (const std::out_of_range& err) {
16111613
if (myid==0) {
1612-
std::cout << "No EmpCylSL EmpModel named <"
1613-
<< mtype << ">, valid types are: "
1614-
<< "Exponential, ExpSphere, Gaussian, Plummer, Power, Deproject "
1615-
<< "(not case sensitive)" << std::endl;
1614+
std::cout << "Cylindrical::initialize error parsing 'mtype' parameter in YAML config" << std::endl;
1615+
std::cout << "Valid options are: ";
1616+
for (auto p : EmpCylSL::EmpModelLabs) std::cout << p.second << " ";
1617+
std::cout << "(not case sensitive)" << std::endl;
16161618
}
1617-
throw std::runtime_error("Cylindrical:initialize: EmpCylSL bad parameter");
1619+
throw std::runtime_error("Cylindrical::initialize: invalid 'mtype' parameter in YAML config");
16181620
}
1619-
1620-
EmpCylSL::mtype = itm->second;
16211621

16221622
// Check for non-null cache file name. This must be specified
16231623
// to prevent recomputation and unexpected behavior.

0 commit comments

Comments
 (0)