36 segment(istream& m_stream)
40 nec_float diff(
const segment& other)
const
43 ret += std::fabs(x - other.x);
44 ret += std::fabs(y - other.y);
45 ret += std::fabs(z - other.z);
46 ret += std::fabs(length - other.length);
47 ret += std::abs(current - other.current);
52class CurrentInput :
public BaseInput
55 vector<segment> segments;
59 CurrentInput(std::string& filename)
64 string searchString(
"CURRENTS AND LOCATION");
65 while (m_stream.good())
67 string line = readline();
69 if (line.find(searchString,0) != string::npos)
72 while (line.find(
"PHASE",0) == string::npos)
79 stringstream ss(line);
82 segments.push_back(s);
87 cout <<
"Currents and Location: " << n_items <<
" lines" << endl;
92 bool equalto(
const CurrentInput& ai)
94 if (difference(ai) > 1e-5)
100 nec_float difference(
const CurrentInput& ai)
104 if (n_items != ai.n_items)
107 for (
long i=0; i < n_items;i++)
111 ret += segments[i].diff(ai.segments[i]);
113 catch (
string message)
115 cout <<
"Diff at segment [" << i <<
"] : " << message << endl;