Skip to content

Commit 52f969d

Browse files
author
Martin D. Weinberg
committed
Comment changes only [no CI]
1 parent 69da516 commit 52f969d

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

src/SphericalBasis.cc

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2368,22 +2368,29 @@ void SphericalBasis::biorthogonality_check()
23682368

23692369
void SphericalBasis::write_FIXL0_restart_data()
23702370
{
2371-
if (myid) return; // Only on root node
2371+
// Only on root node
2372+
if (myid) return;
23722373

2374+
// Constrcut the filename
23732375
std::ostringstream fname;
23742376
fname << outdir << runtag << "." << component->name << ".FIXL0";
23752377

2378+
// Open the file and write the data
23762379
try {
23772380
HighFive::File file(fname.str(),
23782381
HighFive::File::ReadWrite |
23792382
HighFive::File::Create);
23802383

2384+
// The component name
23812385
file.createAttribute<std::string>("name", HighFive::DataSpace::From(component->name)).write(component->name);
23822386

2387+
// The nmax value
23832388
file.createAttribute<int>("nmax", HighFive::DataSpace::From(nmax)).write(nmax);
23842389

2390+
// The current time for a readback check
23852391
file.createAttribute<int>("time", HighFive::DataSpace::From(tnow)).write(tnow);
23862392

2393+
// The coefficients dataset
23872394
HighFive::DataSet dataset = file.createDataSet("coefficients", C0);
23882395

23892396
} catch (HighFive::FileException& e) {
@@ -2396,22 +2403,27 @@ void SphericalBasis::write_FIXL0_restart_data()
23962403

23972404
void SphericalBasis::read_FIXL0_restart_data()
23982405
{
2406+
// The filename
23992407
std::ostringstream fname;
24002408
fname << outdir << runtag << "." << component->name << ".FIXL0";
24012409

2410+
// Open the file and read the data; all nodes do this
24022411
try {
24032412
HighFive::File file(fname.str(), HighFive::File::ReadOnly);
24042413

24052414
std::string name1;
24062415
file.getAttribute("name").read(name1);
24072416

2417+
// Check that the component name matches
24082418
if (name1 != component->name) {
24092419
throw runtime_error("SphericalBasis::read_FIXL0_restart_data: "
24102420
"component name mismatch in file " + fname.str());
24112421
}
24122422

24132423
int nmax1;
24142424
file.getAttribute("nmax").read(nmax1);
2425+
2426+
// Check that the nmax value matches
24152427
if (nmax1 != nmax) {
24162428
throw runtime_error("SphericalBasis::read_FIXL0_restart_data: "
24172429
"nmax mismatch in file " + fname.str());
@@ -2420,6 +2432,7 @@ void SphericalBasis::read_FIXL0_restart_data()
24202432
int time1;
24212433
file.getAttribute("time").read(time1);
24222434

2435+
// Check that the time is not ahead of current time
24232436
if (time1 - tnow > 1.0e-4) {
24242437
std::ostringstream ss;
24252438
ss << "SphericalBasis::read_FIXL0_restart_data: "
@@ -2428,6 +2441,7 @@ void SphericalBasis::read_FIXL0_restart_data()
24282441
throw runtime_error(ss.str());
24292442
}
24302443

2444+
// Finally, read the coefficients
24312445
file.getDataSet("coefficients").read(C0);
24322446

24332447
} catch (HighFive::FileException& e) {

0 commit comments

Comments
 (0)