Skip to content

Commit dbbf2ed

Browse files
Merge pull request #181 from EXP-code/suppressclangwarnings
Assorted fixes to clean up `devel` ahead of a merge in to `main`: - change asserts to not throw clang warnings - fix `OutVel` bug - change `Basis` class compatibility in `pyEXP`
2 parents bb847a2 + c1cd3a9 commit dbbf2ed

12 files changed

Lines changed: 41 additions & 29 deletions

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.25) # Needed for CUDA, MPI, and CTest features
22

33
project(
44
EXP
5-
VERSION "7.9.1"
5+
VERSION "7.9.0"
66
HOMEPAGE_URL https://github.com/EXP-code/EXP
77
LANGUAGES C CXX Fortran)
88

expui/BiorthBasis.H

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -969,7 +969,7 @@ namespace BasisClasses
969969
int ncylodd, ncylnx, ncylny, ncylr, cmap, cmapR, cmapZ, vflag;
970970
int rnum, pnum, tnum;
971971
double rcylmin, rcylmax, acyl, hcyl;
972-
bool expcond, logarithmic, density, EVEN_M, sech2 = false;
972+
bool expcond, logarithmic, density, EVEN_M, sech2 = true;
973973

974974
std::vector<Eigen::MatrixXd> potd, dpot, dpt2, dend;
975975
std::vector<Eigen::MatrixXd> legs, dlegs, d2legs;

expui/BiorthBasis.cc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1658,9 +1658,12 @@ namespace BasisClasses
16581658
case DiskType::doubleexpon:
16591659
case DiskType::exponential:
16601660
case DiskType::diskbulge:
1661-
std::cout << "---- pyEXP uses sech^2(z/h) rather than the more common sech^2(z/(2h))" << std::endl
1662-
<< "---- Use the 'sech2: true' in your YAML config to use sech^2(z/(2h))" << std::endl
1663-
<< "---- pyEXP will assume sech^2(z/(2h)) by default in v 7.9.0 and later" << std::endl;
1661+
std::cout << "---- pyEXP assumes sech^2(z/(2h)) by default in v7.9.0 and later" << std::endl
1662+
<< "---- Use the 'sech2: true' in your YAML config to use sech^2(z/(2h))" << std::endl
1663+
<< "---- This warning will be removed in v7.10.0." << std::endl;
1664+
break;
1665+
default:
1666+
break;
16641667
}
16651668
}
16661669
}

expui/CoefStruct.cc

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,7 @@ namespace CoefClasses
110110

111111
copyfields(ret);
112112

113-
assert(("CylStruct::deepcopy dimension mismatch",
114-
(mmax+1)*nmax == store.size()));
113+
assert((mmax+1)*nmax == store.size() && "CylStruct::deepcopy dimension mismatch");
115114

116115
ret->C = C;
117116
ret->coefs = std::make_shared<coefType>(ret->store.data(), mmax+1, nmax);
@@ -128,8 +127,7 @@ namespace CoefClasses
128127

129128
copyfields(ret);
130129

131-
assert(("SphStruct::deepcopy dimension mismatch",
132-
(lmax+1)*(lmax+2)/2*nmax == store.size()));
130+
assert((lmax+1)*(lmax+2)/2*nmax == store.size() && "SphStruct::deepcopy dimension mismatch");
133131

134132
ret->C = C;
135133
ret->coefs = std::make_shared<coefType>
@@ -149,7 +147,7 @@ namespace CoefClasses
149147

150148
copyfields(ret);
151149

152-
assert(("SlabStruct::deepcopy dimension mismatch", dim == store.size()));
150+
assert((dim == store.size()) && "SlabStruct::deepcopy dimension mismatch");
153151

154152
ret->C = C;
155153
ret->coefs = std::make_shared<coefType>(ret->store.data(), nx, ny, nz);
@@ -171,7 +169,7 @@ namespace CoefClasses
171169

172170
copyfields(ret);
173171

174-
assert(("CubeStruct::deepcopy dimension mismatch", dim == store.size()));
172+
assert((dim == store.size()) && "CubeStruct::deepcopy dimension mismatch");
175173

176174
ret->C = C;
177175
ret->coefs = std::make_shared<coefType>(ret->store.data(), nx, ny, nz);
@@ -193,8 +191,7 @@ namespace CoefClasses
193191

194192
copyfields(ret);
195193

196-
assert(("TblStruct::deepcopy dimension mismatch",
197-
cols == store.size()));
194+
assert((cols == store.size()) && "TblStruct::deepcopy dimension mismatch");
198195

199196
ret->C = C;
200197
ret->coefs = std::make_shared<coefType>(ret->store.data(), cols);
@@ -209,8 +206,7 @@ namespace CoefClasses
209206

210207
copyfields(ret);
211208

212-
assert(("TrajStruct::deepcopy dimension mismatch",
213-
traj*rank == store.size()));
209+
assert((traj*rank == store.size()) && "TrajStruct::deepcopy dimension mismatch");
214210

215211
ret->C = C;
216212
ret->coefs = std::make_shared<coefType>(ret->store.data(), traj, rank);
@@ -226,8 +222,7 @@ namespace CoefClasses
226222

227223
copyfields(ret);
228224

229-
assert(("SphFldStruct::deepcopy dimension mismatch",
230-
nfld*(lmax+1)*(lmax+2)/2*nmax == store.size()));
225+
assert(nfld*(lmax+1)*(lmax+2)/2*nmax == store.size() && "SphFldStruct::deepcopy dimension mismatch");
231226

232227
ret->C = C;
233228
ret->coefs = std::make_shared<coefType>
@@ -246,8 +241,7 @@ namespace CoefClasses
246241

247242
copyfields(ret);
248243

249-
assert(("CylFldStruct::deepcopy dimension mismatch",
250-
nfld*(mmax+1)*nmax == store.size()));
244+
assert((nfld*(mmax+1)*nmax == store.size()) && "CylFldStruct::deepcopy dimension mismatch");
251245

252246
ret->C = C;
253247
ret->coefs = std::make_shared<coefType>

expui/Coefficients.H

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ namespace CoefClasses
120120
//! Unit validator
121121
static UnitValidator check;
122122

123+
//! Units required for HDF5
124+
virtual bool unitsRequired() { return true; }
125+
123126
public:
124127

125128
//! Constructor
@@ -849,6 +852,9 @@ namespace CoefClasses
849852
//! Write coefficient data in H5
850853
virtual unsigned WriteH5Times(HighFive::Group& group, unsigned count);
851854

855+
//! Units required for HDF5
856+
virtual bool unitsRequired() { return false; }
857+
852858
public:
853859

854860
//! Constructor
@@ -955,6 +961,9 @@ namespace CoefClasses
955961
//! Write coefficient data in H5
956962
virtual unsigned WriteH5Times(HighFive::Group& group, unsigned count);
957963

964+
//! Units required for HDF5
965+
virtual bool unitsRequired() { return false; }
966+
958967
public:
959968

960969
//! Constructor
@@ -1066,6 +1075,9 @@ namespace CoefClasses
10661075
//! Write coefficient data in H5
10671076
virtual unsigned WriteH5Times(HighFive::Group& group, unsigned count);
10681077

1078+
//! Units required for HDF5
1079+
virtual bool unitsRequired() { return false; }
1080+
10691081
public:
10701082

10711083
//! Constructor
@@ -1193,6 +1205,9 @@ namespace CoefClasses
11931205
//! Write coefficient data in H5
11941206
virtual unsigned WriteH5Times(HighFive::Group& group, unsigned count);
11951207

1208+
//! Units required for HDF5
1209+
virtual bool unitsRequired() { return false; }
1210+
11961211
public:
11971212

11981213
//! Constructor

expui/Coefficients.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ namespace CoefClasses
151151

152152
void Coefs::WriteH5Units(HighFive::File& file)
153153
{
154-
if (units.size() != 4) {
154+
if (unitsRequired() and units.size() != 4) {
155155
std::ostringstream sout;
156156
sout << "---- Coefs::WriteH5Units: Warning, expected 4 units: "
157157
<< "(length, mass, time, G) or (length, mass, velocity, G), etc. "

exputil/EmpCylSL.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ EmpCylSL::EmpCylSL(int mlim, std::string cachename)
267267
if (myid==0)
268268
std::cout << "---- EmpCylSL::ReadH5Cache: "
269269
<< "using a workaround for a HighFive HDF5 wrapper bug. "
270-
<< "this workaround will be removed in EXP 7.9.0. "
270+
<< "this workaround will be removed in EXP 7.10.0. "
271271
<< "Please consider rebuilding your cache if possible!"
272272
<< std::endl;
273273
}
@@ -7502,7 +7502,7 @@ bool EmpCylSL::ReadH5Cache()
75027502
if (myid==0)
75037503
std::cout << "---- EmpCylSL::ReadH5Cache: "
75047504
<< "using a workaround for a HighFive HDF5 wrapper bug. "
7505-
<< "this workaround will be removed in EXP 7.9.0. "
7505+
<< "this workaround will be removed in EXP 7.10.0. "
75067506
<< "Please consider rebuilding your cache if possible!" << std::endl;
75077507
}
75087508
else {

pyEXP/BasisWrappers.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -906,7 +906,7 @@ void BasisFactoryClasses(py::module &m)
906906

907907
py::class_<BasisClasses::Basis, std::shared_ptr<BasisClasses::Basis>, PyBasis>
908908
(m, "Basis")
909-
.def("factory", &BasisClasses::BiorthBasis::factory_string,
909+
.def("factory", &BasisClasses::Basis::factory_string,
910910
R"(
911911
Generate a basis from a YAML configuration supplied as a string
912912

pyEXP/CoefWrappers.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1281,7 +1281,7 @@ void CoefficientClasses(py::module &m) {
12811281
.def("WriteH5Coefs",
12821282
[](CoefClasses::Coefs& self, const std::string& filename) {
12831283
if (self.getUnits().size()!=4) {
1284-
std::cout << "Coefs::WriteH5Coefs: please set units for your coefficient set using the `setUnit()` member," << std::endl
1284+
std::cout << "Coefs::WriteH5Coefs: please set units for your coefficient set using the `setUnits()` member," << std::endl
12851285
<< " one for each unit. We suggest explicitly setting 'G', 'Length', 'Mass'," << std::endl
12861286
<< " 'Time', or optionally 'Velocity' before writing HDF5 coefficients" << std::endl;
12871287
}

src/Cylinder.H

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ class Cylinder : public Basis
127127
{
128128
private:
129129

130-
bool precond, EVEN_M, subsamp, sech2 = false;
130+
bool precond, EVEN_M, subsamp, sech2 = true;
131131
int rnum, pnum, tnum;
132132
double ashift;
133133
unsigned int vflag;

0 commit comments

Comments
 (0)