Skip to content

Commit 235dbb4

Browse files
authored
Merge pull request #195 from EXP-code/copilot/sub-pr-194
[WIP] Address feedback on coefficient consistency for HDF5 files
2 parents bf4b607 + 80f0ff0 commit 235dbb4

2 files changed

Lines changed: 43 additions & 0 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,4 @@ src/exp
2525
src/user/CylindricalDisk.cc
2626
src/user/EllipsoidForce.cc
2727
src/user/SLSphere.cc
28+
_codeql_detected_source_root

expui/Coefficients.cc

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -854,6 +854,12 @@ namespace CoefClasses
854854

855855
bool SphCoefs::CheckH5Params(HighFive::File& file)
856856
{
857+
if (coefs.empty()) {
858+
if (myid==0)
859+
std::cout << "---- SphCoefs::CheckH5Params: coefs is empty" << std::endl;
860+
return false;
861+
}
862+
857863
double scale0 = coefs.begin()->second->scale, scale1;
858864
std::string forceID0(coefs.begin()->second->id), forceID1;
859865
int Lmax1, Nmax1;
@@ -1325,6 +1331,12 @@ namespace CoefClasses
13251331

13261332
bool CylCoefs::CheckH5Params(HighFive::File& file)
13271333
{
1334+
if (coefs.empty()) {
1335+
if (myid==0)
1336+
std::cout << "---- CylCoefs::CheckH5Params: coefs is empty" << std::endl;
1337+
return false;
1338+
}
1339+
13281340
std::string forceID0(coefs.begin()->second->id), forceID1;
13291341
int Mmax1, Nmax1;
13301342

@@ -1695,6 +1707,12 @@ namespace CoefClasses
16951707

16961708
bool SlabCoefs::CheckH5Params(HighFive::File& file)
16971709
{
1710+
if (coefs.empty()) {
1711+
if (myid==0)
1712+
std::cout << "---- SlabCoefs::CheckH5Params: coefs is empty" << std::endl;
1713+
return false;
1714+
}
1715+
16981716
std::string forceID0(coefs.begin()->second->id), forceID1;
16991717
int NmaxX1, NmaxY1, NmaxZ1;
17001718

@@ -2100,6 +2118,12 @@ namespace CoefClasses
21002118

21012119
bool CubeCoefs::CheckH5Params(HighFive::File& file)
21022120
{
2121+
if (coefs.empty()) {
2122+
if (myid==0)
2123+
std::cout << "---- CubeCoefs::CheckH5Params: coefs is empty" << std::endl;
2124+
return false;
2125+
}
2126+
21032127
std::string forceID0(coefs.begin()->second->id), forceID1;
21042128
int NmaxX1, NmaxY1, NmaxZ1;
21052129

@@ -2773,6 +2797,12 @@ namespace CoefClasses
27732797

27742798
file.getAttribute("cols").read(cols1 );
27752799

2800+
if (coefs.empty()) {
2801+
if (myid==0)
2802+
std::cout << "---- TableData::CheckH5Params: coefs is empty" << std::endl;
2803+
return false;
2804+
}
2805+
27762806
int cols0 = coefs.begin()->second->cols;
27772807

27782808
bool ret = true;
@@ -3425,6 +3455,12 @@ namespace CoefClasses
34253455

34263456
bool SphFldCoefs::CheckH5Params(HighFive::File& file)
34273457
{
3458+
if (coefs.empty()) {
3459+
if (myid==0)
3460+
std::cout << "---- SphFldCoefs::CheckH5Params: coefs is empty" << std::endl;
3461+
return false;
3462+
}
3463+
34283464
double scale0 = coefs.begin()->second->scale, scale1;
34293465
int nfld1, lmax1, nmax1, dof1;
34303466
file.getAttribute("nfld" ).read(nfld1 );
@@ -3606,6 +3642,12 @@ namespace CoefClasses
36063642

36073643
bool CylFldCoefs::CheckH5Params(HighFive::File& file)
36083644
{
3645+
if (coefs.empty()) {
3646+
if (myid==0)
3647+
std::cout << "---- CylFldCoefs::CheckH5Params: coefs is empty" << std::endl;
3648+
return false;
3649+
}
3650+
36093651
double scale0 = coefs.begin()->second->scale, scale1;
36103652
int nfld1, mmax1, nmax1, dof1;
36113653

0 commit comments

Comments
 (0)