44 QPainter p(
this); p.setRenderHint(QPainter::Antialiasing,
true); p.fillRect(rect(),QColor(10,14,20));
45 QFont f=font();f.setBold(
true);p.setFont(f);p.setPen(QColor(225,235,244));
46 p.drawText(QRect(12,7,width()-24,24),Qt::AlignLeft|Qt::AlignVCenter,QStringLiteral(
"Aharonov-Bohm — detector interference vs enclosed flux"));
48 p.setFont(font());p.setPen(QColor(150,166,180));
49 p.drawText(QRect(20,50,width()-40,height()-70),Qt::AlignCenter|Qt::TextWordWrap,
50 QStringLiteral(
"Load Aharonov-Bohm Effect / Magnetic Flux and press Play"));
return;
53 const int left=64,right=18,top=40,gap=34;
const int traceH=130;
54 QRect map(left,top,std::max(10,width()-left-right),std::max(100,height()-top-gap-traceH-28));
55 QRect trace(left,map.bottom()+gap,map.width(),std::max(90,height()-(map.bottom()+gap)-28));
56 p.setPen(QColor(55,72,88));p.setBrush(QColor(5,9,15));p.drawRect(map);p.drawRect(trace);
57 double vmax=1e-15,cmax=1e-15;
58 for(
const auto&s:samples){
for(
float v:s.detectorProfileY)vmax=std::max(vmax,(
double)v);cmax=std::max(cmax,s.detectorCenterSignal);}
60 for(std::size_t si=0;si<samples.size();++si){
61 const auto&s=samples[si];
62 int x0=map.left()+int((
double(si)/samples.size())*map.width());
63 int x1=map.left()+int((
double(si+1)/samples.size())*map.width());
64 int ww=std::max(1,x1-x0+1);
65 for(std::size_t yi=0;yi<ny&&yi<s.detectorProfileY.size();++yi){
66 int y1=map.bottom()-int((
double(yi)/ny)*map.height());
67 int y0=map.bottom()-int((
double(yi+1)/ny)*map.height());
68 int hh=std::max(1,y1-y0+1);
69 double a=std::sqrt(std::max(0.0,(
double)s.detectorProfileY[yi])/vmax);
70 p.fillRect(QRect(x0,y0,ww,hh),heat(a));
73 const double tmax=std::max(cfg.analysisEndTime,samples.back().time);
74 auto tx=[&](
double t){
return trace.left()+t/std::max(1e-12,tmax)*trace.width();};
75 auto cy=[&](
double v){
return trace.bottom()-v/cmax*trace.height();};
76 QPainterPath path;
for(std::size_t i=0;i<samples.size();++i){QPointF pt(tx(samples[i].time),cy(samples[i].detectorCenterSignal));
if(i==0)path.moveTo(pt);
else path.lineTo(pt);}
77 p.setPen(QPen(QColor(90,225,255),2.0));p.drawPath(path);
78 p.setPen(QColor(180,198,212));p.setFont(font());
79 p.drawText(QRect(4,map.top(),left-10,20),Qt::AlignRight|Qt::AlignVCenter,QStringLiteral(
"+y"));
80 p.drawText(QRect(4,map.bottom()-20,left-10,20),Qt::AlignRight|Qt::AlignVCenter,QStringLiteral(
"-y"));
81 p.drawText(QRect(map.left(),map.bottom()+4,map.width(),20),Qt::AlignCenter,QStringLiteral(
"time — detector density profile rho(xd,y,t)"));
82 p.drawText(QRect(trace.left(),trace.bottom()+4,trace.width(),20),Qt::AlignCenter,QStringLiteral(
"time — central fringe intensity"));
83 const auto &last=samples.back();
const double deg=360.0*cfg.fluxQuanta;
84 p.setPen(QColor(232,238,244));
85 p.drawText(QRect(trace.left()+8,trace.top()+5,trace.width()-16,22),Qt::AlignLeft|Qt::AlignVCenter,
86 QStringLiteral(
"Phi/Phi0=%1 AB phase=%2 deg center=%3 line=%4 norm=%5")
87 .arg(cfg.fluxQuanta,0,
'f',3).arg(deg,0,
'f',1).arg(last.detectorCenterSignal,0,
'g',5)
88 .arg(last.detectorSignal,0,
'g',5).arg(last.norm,0,
'f',6));
bool empty() const noexcept
Returns whether the object contains no data.
const QuantumAharonovBohm2DConfig & config() const noexcept
Returns config.
const std::vector< QuantumAharonovBohmSample2D > & samples() const noexcept
Samples s.