Skip to content

Commit 0cc1bc5

Browse files
CopilotThe9Cat
andauthored
Fix SlabSL.ortho diagnostic gate, CoordMap safety, and bonnerebert -V option
Agent-Logs-Url: https://github.com/EXP-code/EXP/sessions/437a8908-e2a0-48c1-9224-8263a765ef4e Co-authored-by: The9Cat <25960766+The9Cat@users.noreply.github.com>
1 parent 5dbe30a commit 0cc1bc5

3 files changed

Lines changed: 18 additions & 3 deletions

File tree

src/SlabSL.cc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,11 @@ SlabSL::SlabSL(Component* c0, const YAML::Node& conf) : PotAccel(c0, conf)
9292
}
9393
}
9494

95-
// Diagnostic output for debugging
96-
if (true) {
95+
// Diagnostic output for debugging.
96+
// +--- Set to 'true' only for deep debugging; 'false' for production.
97+
// |
98+
// v
99+
if (false) {
97100
std::ofstream tmp("SlabSL.ortho");
98101
for (int kx=0, indx=0; kx<=nnmax; kx++) {
99102
for (int ky=0; ky<=kx; ky++, indx++) {

src/cudaSlabSL.cu

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,14 @@ void SlabSL::initialize_constants()
222222
{"linear", 2}
223223
};
224224

225-
int Cmap = CoordMap[cmap];
225+
auto it = CoordMap.find(cmap);
226+
if (it == CoordMap.end()) {
227+
std::ostringstream sout;
228+
sout << "cudaSlabSL: unknown coordinate map type '" << cmap
229+
<< "'. Valid values are: tanh, sech, linear";
230+
throw std::runtime_error(sout.str());
231+
}
232+
int Cmap = it->second;
226233

227234
cuda_safe_call(cudaMemcpyToSymbol(slabCmap, &Cmap, sizeof(int),
228235
size_t(0), cudaMemcpyHostToDevice),

utils/ICs/bonnerebert.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,7 @@ decode_switches (int argc, char **argv)
364364
"R:" /* runit */
365365
"N:" /* number */
366366
"S:" /* seed */
367+
"V" /* version */
367368
"h", /* help */
368369
long_options, (int *) 0)) != EOF)
369370
{
@@ -399,6 +400,10 @@ decode_switches (int argc, char **argv)
399400
case 'h':
400401
usage (0);
401402

403+
case 'V':
404+
cout << program_name << " version " << VERSION << endl;
405+
exit (0);
406+
402407
default:
403408
usage (-1);
404409
}

0 commit comments

Comments
 (0)