2020namespace 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 ();
0 commit comments