OPAL (Object Oriented Parallel Accelerator Library)  2021.1.99
OPAL
SumErrSq.cpp
Go to the documentation of this file.
1 #include "Expression/SumErrSq.h"
2 
3 const std::string SumErrSq::name = "SumErrSq";
4 
5 std::istream & operator>>(std::istream & stream, Measurement & measurement) {
6  stream >> measurement.spos >> measurement.measurement;
7  return stream;
8 }
9 
13 void SumErrSq::parseMeasurements(std::string measurement_filename) {
14 
15  measurements_.clear();
16 
17  std::ifstream measurements_file;
18  measurements_file.open(measurement_filename.c_str(), std::ios::in);
19  if(!measurements_file) {
20  throw OptPilotException("SumErrSq::parseMeasurements()",
21  "Error opening file " + measurement_filename);
22  }
23 
24  std::copy(std::istream_iterator<Measurement>(measurements_file),
25  std::istream_iterator<Measurement>(),
26  std::back_inserter(measurements_));
27 
28  measurements_file.close();
29 }
30 
std::istream & operator>>(std::istream &stream, Measurement &measurement)
Definition: SumErrSq.cpp:5
double spos
Definition: SumErrSq.h:46
double measurement
Definition: SumErrSq.h:47
static const std::string name
Definition: SumErrSq.h:55
std::vector< Measurement > measurements_
Definition: SumErrSq.h:102
void parseMeasurements(std::string measurement_filename)
Definition: SumErrSq.cpp:13