-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
37 lines (33 loc) · 1 KB
/
main.cpp
File metadata and controls
37 lines (33 loc) · 1 KB
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
#include "tbproto/record.h"
#include "tbproto/run.h"
#include "tbproto/types.h"
#include <cmath>
#include <iostream>
int main(int argc, char const *argv[]) {
tbproto::Run run;
tbproto::Histogram histo;
histo.bins.emplace_back(tbproto::Histogram::Bin{1.0, 2});
histo.bins.emplace_back(tbproto::Histogram::Bin{2.0, 3});
histo.bins.emplace_back(tbproto::Histogram::Bin{3.0, 1});
histo.sum_squares = std::pow(0.2, 2) + std::pow(0.3, 2) + std::pow(1.2, 2) +
std::pow(1.4, 2) + std::pow(1.8, 2) + std::pow(2.2, 2);
// first iteration (e.g.)
{
tbproto::Record rec;
rec.set_step(0);
rec.add("my/value", tbproto::Scalar{0.0});
rec.add("my/othervalue", tbproto::Scalar{1.0});
rec.add("my/histo", histo);
run.write(rec);
}
// second iteration (e.g.)
{
tbproto::Record rec;
rec.set_step(1);
rec.add("my/value", tbproto::Scalar{1.0});
rec.add("my/othervalue", tbproto::Scalar{0.8});
rec.add("my/histo", histo);
run.write(rec);
}
return 0;
}