diff --git a/triangle_ccm_timeevol_plots.m b/triangle_ccm_timeevol_plots.m index fbdee3c7622fddbb0c8ce4bcc4664ee86345f213..ef8317a0b3e1fd581f8243f0c33146f9f9f18aa3 100644 --- a/triangle_ccm_timeevol_plots.m +++ b/triangle_ccm_timeevol_plots.m @@ -117,31 +117,58 @@ Export[NotebookDirectory[]<>"plots/timeevol_ccm_log.pdf",plot1log] (*New code with CPU time*) -getCombinedTimeData[run_]:=Module[{maxTime,skipPts,hhData,ccm1Data,ccm2Data}, +getCombinedTimeData[run_]:=Module[{maxTime,skipPts,avg,hhData,ccm1Data,ccm2Data,hhSlowData,line1,line2,line3,line4,lineAvg}, maxTime=Length[run[[3]]]; skipPts=Max[1,Round[maxTime/500]]; - -hhData= {{0,run[[3,1,2]]}}~Join~run[[3,1;;-1;;skipPts]]; -ccm1Data={{0,run[[4,2,1,2]]}}~Join~run[[4,2,1;;-1;;skipPts]]; -ccm2Data={{0,run[[5,2,1,2]]}}~Join~run[[5,2,1;;-1;;skipPts]]; - -{Legended[hhData,"\[Tau] = "<>ToString[run[[1,2]]]],ccm1Data,ccm2Data} +avg=Mean[run[[3,Floor[(1/2)*Length[run[[3]]]];;-1,2]]]; + +hhData= run[[3,1;;-1;;skipPts]]; +(*ccm1Data=run[[4,2,1;;-1;;skipPts]];*) +ccm2Data=run[[5,2,1;;-1;;skipPts]]; +hhSlowData=run[[6,1;;-1;;skipPts]]; +line1={{0,run[[3,1,2]]},run[[3,1]]}; +line2={{0,run[[4,2,1,2]]},run[[4,2,1]]}; +line3={{0,run[[5,2,1,2]]},run[[5,2,1]]}; +line4={{0,run[[6,1,2]]},run[[6,1]]}; +lineAvg={{0,avg},{3*run[[3,-1,1]],avg}}; + +{Legended[hhData,"\[Tau] = "<>ToString[run[[1,2]]]], +(*ccm1Data,*) +ccm2Data, +hhSlowData, +line1, +(*line2,*) +line3, +line4, +lineAvg} ] -dataSets=Map[getCombinedTimeData,gdata,{3}]; - - -dataSetsFlattened=Flatten[dataSets,3]; -colorList=Table[ColorData[97,"ColorList"][[1+Floor[i/3]]],{i,0,Length[dataSetsFlattened]-1}]; - - -ListPlot[dataSetsFlattened[[1;;3]],Joined->True,PlotRange->All] - +getStartPoints[run_]:={run[[3,1]],run[[5,2,1]],run[[6,1]]}; +getLogScaleStartPoints[run_]:={{run[[3,1,1]],Log[run[[3,1,2]]]},{run[[5,2,1,1]],Log[run[[5,2,1,2]]]},{run[[6,1,1]],Log[run[[6,1,2]]]}}; -z2 - - -plot1=ListPlot[dataSetsFlattened,Joined->True,PlotRange->{All,All},PlotStyle->colorList,ImageSize->300,PlotLabel->nlabels[[1]],Frame->True,FrameLabel->{"seconds","number of triangles"}] +dataSets=Map[getCombinedTimeData,gdata,{3}]; +startPoints=Map[getStartPoints,gdata,{3}]; +logScaleStartPoints=Map[getLogScaleStartPoints,gdata,{3}]; + + +dataSetsFlattened=Flatten[dataSets,2]; +styleList=Table[{ +Directive[Dashing[None],ColorData[97,"ColorList"][[i]]], +Directive[Dashing[None],ColorData[97,"ColorList"][[i]]], +Directive[Dashing[None],ColorData[97,"ColorList"][[i]]], +Directive[Dashed,ColorData[97,"ColorList"][[i]]], +Directive[Dashed,ColorData[97,"ColorList"][[i]]], +Directive[Dashed,ColorData[97,"ColorList"][[i]]], +Directive[Dashing[None],Black,Thin] +},{i,1,Length[dataSetsFlattened]}]; +dataSetsFlattened=Flatten[dataSetsFlattened,1]; +styleList=Flatten[styleList,1]; +pointList={Red,PointSize[Medium],Point[Flatten[startPoints,3]]}; +logPointList={Red,PointSize[Medium],Point[Flatten[logScaleStartPoints,3]]}; + + +plot1=ListPlot[dataSetsFlattened,Joined->True,PlotRange->{{0,0.55},All},PlotStyle->styleList,Epilog->pointList,ImageSize->300,PlotLabel->nlabels[[1]],Frame->True,FrameLabel->{"seconds","number of triangles"}] +plot1log=ListLogPlot[dataSetsFlattened,Joined->True,PlotRange->{{0,0.55},All},PlotStyle->styleList,Epilog->logPointList,ImageSize->300,PlotLabel->nlabels[[1]],Frame->True,FrameLabel->{"seconds","number of triangles"}] Export[NotebookDirectory[]<>"plots/timeevol_ccm.pdf",plot1]