-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGEVPHeaders.cpp~
43 lines (37 loc) · 1.06 KB
/
GEVPHeaders.cpp~
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
* GEVP.cpp
*
* Created on: Jun 14, 2013
* Author: Thibaut Metivet
*/
#include "GEVPHeaders.hpp"
#include "boost/regex.hpp"
using namespace boost;
GEVPCorrelatorHeader::GEVPCorrelatorHeader(const std::string& s)
{
smatch sm;
regex rx("#\\s+(S|L)\\s+(S|L)\\s+(Vi|P)(Vi|P)_Peq(\\d)(pola[0-2])?\\s+0\\s+0");
regex_match(s, sm, rx);
SourceSmearing = Smearing(sm[1]);
SinkSmearing = Smearing(sm[2]);
Source = Interpolator(sm[3]);
Sink = Interpolator(sm[4]);
Peq = atoi(sm[5].str().c_str());
Pola = (!sm[6].str().empty()) ? (int)(sm[6].str()[4] - 48) : (-1);
}
bool operator== (const GEVPCorrelatorHeader::Smearing& s1, const GEVPCorrelatorHeader::Smearing& s2)
{
return s1.Sm == s2.Sm;
}
bool operator== (const GEVPCorrelatorHeader::Interpolator& i1, const GEVPCorrelatorHeader::Interpolator& i2)
{
return i1.I == i2.I;
}
bool operator== (const GEVPCorrelatorHeader& h1, const GEVPCorrelatorHeader& h2)
{
return h1.SourceSmearing == h2.SourceSmearing
&& h1.SinkSmearing == h2.SinkSmearing
&& h1.Source == h2.Source
&& h1.Sink == h2.Sink
&& h1.Peq == h2.Peq;
}