-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
57 lines (50 loc) · 2.47 KB
/
main.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include "easydiag.h"
#include <vector>
#include <gnuplot-iostream.h>
void Context::Hdiag() {
Gnuplot hdiag;
hdiag << "set key noautotitle;\n set offsets 1, 1, 1, 1" << std::endl;
hdiag << "plot" << hdiag.file1d(std::make_pair(std::vector<double>{0,beam.length},std::vector<double>{0,0})) << "with lines notitle lw 1.2 lc rgb 'red'," << hdiag.file1d(std::make_pair(getHpair().first,getHpair().second)) << "with lines title 'Normal force' lw 3 lc rgb 'black'," << std::endl;
hdiag << "pause mouse close;" << std::endl;
#ifdef _WIN32
// For Windows, prompt for a keystroke before the Gnuplot object goes out of scope so that
// the gnuplot window doesn't get closed.
std::cout << "Press enter to exit." << std::endl;
std::cin.get();
#endif
}
void Context::Vdiag() {
Gnuplot vdiag;
vdiag << "set key noautotitle;\n set offsets 1, 1, 1, 1" << std::endl;
vdiag << "plot" << vdiag.file1d(std::make_pair(std::vector<double>{0,beam.length},std::vector<double>{0,0})) << "with lines notitle lw 1.2 lc rgb 'red'," << vdiag.file1d(std::make_pair(getTpair().first,getTpair().second)) << "with lines title 'Shear force' lw 3 lc rgb 'black'," << std::endl;
vdiag << "pause mouse close;" << std::endl;
#ifdef _WIN32
// For Windows, prompt for a keystroke before the Gnuplot object goes out of scope so that
// the gnuplot window doesn't get closed.
std::cout << "Press enter to exit." << std::endl;
std::cin.get();
#endif
}
void Context::Mdiag() {
Gnuplot mdiag;
mdiag << "set key noautotitle; \nset offsets 1, 1, 1, 1" << std::endl;
mdiag << "plot" << mdiag.file1d(std::make_pair(std::vector<double>{0,beam.length},std::vector<double>{0,0})) << "with lines notitle lw 1.2 lc rgb 'red'," << mdiag.file1d(std::make_pair(getMpair().first,getMpair().second)) << "with lines title 'Bending moment' lw 3 lc rgb 'black'," << std::endl;
mdiag << "pause mouse close;" << std::endl;
#ifdef _WIN32
// For Windows, prompt for a keystroke before the Gnuplot object goes out of scope so that
// the gnuplot window doesn't get closed.
std::cout << "Press enter to exit." << std::endl;
std::cin.get();
#endif
}
int main() {
Beam b(5);
std::vector<PointLoad> v {PointLoad(1290,0),PointLoad(1290,5)};
std::vector<PointLoad> h {};
std::vector<DistributedLoad> q {DistributedLoad(-516,-516,0,5)};
std::vector<PointMoment> m {};
Context ctx(b,v,h,q,m);
ctx.Hdiag();
ctx.Vdiag();
ctx.Mdiag();
}