@@ -152,10 +152,12 @@ namespace CoefClasses
152152 void Coefs::WriteH5Units (HighFive::File& file)
153153 {
154154 if (units.size () != 4 ) {
155- std::cout << " ---- Coefs::WriteH5Units: Warning, expected 4 units: "
156- << " (length, mass, time, G) or (length, mass, velocity, G), etc. " << std::endl
157- << " ---- Coefs::WriteH5Units: I found " << units.size () << " units instead. Please "
158- << " provide a consistent unit set." << std::endl;
155+ std::ostringstream sout;
156+ sout << " ---- Coefs::WriteH5Units: Warning, expected 4 units: "
157+ << " (length, mass, time, G) or (length, mass, velocity, G), etc. "
158+ << " I found " << units.size () << " units instead. Please "
159+ << " provide a consistent unit set." ;
160+ throw std::runtime_error (sout.str ());
159161 }
160162
161163 HighFive::DataSet dataset = file.createDataSet (" Units" , units);
@@ -171,8 +173,10 @@ namespace CoefClasses
171173 if (file.exist (" Units" )) {
172174 HighFive::DataSet dataset = file.getDataSet (" Units" );
173175 units = dataset.read <std::vector<Unit>>();
174- std::cout << " Coefs::ReadH5Units: read units from HDF5 file:" << std::endl;
175- std::cout << units;
176+ if (verbose and myid==0 ) {
177+ std::cout << " Coefs::ReadH5Units: read units from HDF5 file:" << std::endl;
178+ std::cout << units;
179+ }
176180 }
177181 }
178182
0 commit comments