Skip to content

Commit aef851a

Browse files
author
Martin D. Weinberg
committed
Some fixes for Mike's suggested code changes
1 parent a46897a commit aef851a

3 files changed

Lines changed: 16 additions & 25 deletions

File tree

expui/Coefficients.H

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@ namespace CoefClasses
5454
//! Verbose debugging output
5555
bool verbose;
5656

57-
//! Backward compatibility flag for HighFive
58-
static bool H5BackCompat;
59-
6057
//! Time vector
6158
std::vector<double> times;
6259

@@ -201,9 +198,6 @@ namespace CoefClasses
201198
//! Set maximum grid interpolation offset
202199
void setDeltaT(double dT) { deltaT = dT; }
203200

204-
//! Override backward compatibility for HighFive
205-
static void setNewH5() { H5BackCompat = false; }
206-
207201
class CoefsError : public std::runtime_error
208202
{
209203
public:

expui/Coefficients.cc

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
namespace CoefClasses
2121
{
2222

23-
bool Coefs::H5BackCompat = true;
24-
2523
void Coefs::copyfields(std::shared_ptr<Coefs> p)
2624
{
2725
// These variables will copy data, not pointers
@@ -93,8 +91,11 @@ namespace CoefClasses
9391
file.getAttribute("geometry").read(geometry);
9492
file.getAttribute("forceID" ).read(forceID );
9593

94+
// Look for Coef output version to toggle backward compatibility
95+
// with legacy storage order
96+
//
9697
bool H5back = true;
97-
if (file.hasAttribute("Version")) H5back = false;
98+
if (file.hasAttribute("CoefficientOutputVersion")) H5back = false;
9899

99100
// Open the snapshot group
100101
//
@@ -121,7 +122,10 @@ namespace CoefClasses
121122

122123
auto in = stanza.getDataSet("coefficients").read<Eigen::MatrixXcd>();
123124

124-
if (H5back and H5BackCompat) {
125+
// If we have a legacy set of coefficients, re-order the
126+
// coefficients to match the new HighFive/Eigen ordering
127+
//
128+
if (H5back) {
125129

126130
auto in2 = stanza.getDataSet("coefficients").read<Eigen::MatrixXcd>();
127131
in2.transposeInPlace();
@@ -794,6 +798,9 @@ namespace CoefClasses
794798
file.getAttribute("config" ).read(config);
795799
file.getDataSet ("count" ).read(count );
796800

801+
// Look for Coef output version to toggle backward compatibility
802+
// with legacy storage order
803+
//
797804
bool H5back = true;
798805
if (file.hasAttribute("CoefficientOutputVersion")) H5back = false;
799806

@@ -821,8 +828,11 @@ namespace CoefClasses
821828
if (Time < Tmin or Time > Tmax) continue;
822829

823830
auto in = stanza.getDataSet("coefficients").read<Eigen::MatrixXcd>();
824-
// If an older version of the coefficients and backwards compatibility is desired, re-order the coefficients to match the cache.
825-
if (H5back and H5BackCompat) {
831+
832+
// If we have a legacy set of coefficients, re-order the
833+
// coefficients to match the new HighFive/Eigen ordering
834+
//
835+
if (H5back) {
826836

827837
auto in2 = stanza.getDataSet("coefficients").read<Eigen::MatrixXcd>();
828838
in2.transposeInPlace();

pyEXP/CoefWrappers.cc

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -867,19 +867,6 @@ void CoefficientClasses(py::module &m) {
867867
are found at the requested time
868868
)",
869869
py::arg("time"))
870-
.def("newH5",
871-
&CoefClasses::Coefs::setNewH5,
872-
R"(
873-
Override backwards compatibility flag for HighFive API change
874-
875-
Parameters
876-
----------
877-
None
878-
879-
Returns
880-
-------
881-
None
882-
)")
883870
.def("setData",
884871
&CoefClasses::Coefs::setData,
885872
R"(

0 commit comments

Comments
 (0)