forked from radiasoft/rshellweg
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathOptimizerResults.cpp
More file actions
120 lines (108 loc) · 3.37 KB
/
OptimizerResults.cpp
File metadata and controls
120 lines (108 loc) · 3.37 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "OptimizerResults.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TOptForm *OptForm;
//---------------------------------------------------------------------------
__fastcall TOptForm::TOptForm(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TOptForm::CloseButtonClick(TObject *Sender)
{
Close();
}
//---------------------------------------------------------------------------
void TOptForm::ClearChart()
{
LineSeries->Clear();
AddSeries->Clear();
AnsiString S;
if (Optimizer.Type==BUNCHER)
MainChart->BottomAxis->Title->Caption="E,Ohm^-1/2";
else if (Optimizer.Type==BUNCHER)
MainChart->BottomAxis->Title->Caption="N";
}
//---------------------------------------------------------------------------
void TOptForm::DrawEnergy()
{
ClearChart();
int N=Optimizer.ResultsPushed();
MainChart->Title->Caption="Energy";
MainChart->LeftAxis->Title->Caption="W,MeV";
for (int i=0;i<N;i++){
TOptResult Structure;
Structure=Optimizer.GetResult(i);
LineSeries->AddXY(Structure.x,Structure.Result.AverageEnergy);
AddSeries->AddXY(Structure.x,Structure.Result.MaximumEnergy);
}
}
//---------------------------------------------------------------------------
void TOptForm::DrawCapture()
{
ClearChart();
int N=Optimizer.ResultsPushed();
MainChart->Title->Caption="Capture";
MainChart->LeftAxis->Title->Caption="k, %";
for (int i=0;i<N;i++){
TOptResult Structure;
Structure=Optimizer.GetResult(i);
LineSeries->AddXY(Structure.x,Structure.Result.Captured);
}
}
//---------------------------------------------------------------------------
void TOptForm::DrawSpectrum()
{
ClearChart();
int N=Optimizer.ResultsPushed();
MainChart->Title->Caption="Energy Spectrum";
MainChart->LeftAxis->Title->Caption="dW,%";
for (int i=0;i<N;i++){
TOptResult Structure;
Structure=Optimizer.GetResult(i);
LineSeries->AddXY(Structure.x,Structure.Result.EnergySpectrum);
}
}
//---------------------------------------------------------------------------
void TOptForm::DrawPhase()
{
ClearChart();
int N=Optimizer.ResultsPushed();
MainChart->Title->Caption="Phase Length";
MainChart->LeftAxis->Title->Caption="Phi,deg";
for (int i=0;i<N;i++){
TOptResult Structure;
Structure=Optimizer.GetResult(i);
LineSeries->AddXY(Structure.x,Structure.Result.PhaseLength);
}
}
//---------------------------------------------------------------------------
void __fastcall TOptForm::EnergyButtonClick(TObject *Sender)
{
DrawEnergy();
}
//---------------------------------------------------------------------------
void __fastcall TOptForm::CaptureButtonClick(TObject *Sender)
{
DrawCapture();
}
//---------------------------------------------------------------------------
void __fastcall TOptForm::SpectrumButtonClick(TObject *Sender)
{
DrawSpectrum();
}
//---------------------------------------------------------------------------
void __fastcall TOptForm::PhaseButtonClick(TObject *Sender)
{
DrawPhase();
}
//---------------------------------------------------------------------------
void __fastcall TOptForm::FormShow(TObject *Sender)
{
DrawCapture();
}
//---------------------------------------------------------------------------