-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
680 lines (554 loc) · 28.1 KB
/
index.html
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta charset="UTF-8">
<title>Generate Circuits</title>
<link rel="stylesheet" href="styles.css">
<script src="visualisation/Chart.min.js"></script>
<script src="visualisation/PalerDownload.js"></script>
<script src="gui/generatorparameters.js"></script>
<script src="gui/echocommands.js"></script>
<script src="gui/reorderwires.js"></script>
<script src="toolparameters.js"></script>
<script src="circuits/wireutils.js"></script>
<script src="circuits/placegate.js"></script>
<script src="circuits/template.js"></script>
<script src="circuits/gatestring.js"></script>
<script src="circuits/tgatesprocess.js"></script>
<script src="circuits/chemcircuit.js"></script>
<script src="circuits/addercircuit.js"></script>
<script src="circuits/qrom.js"></script>
<script src="circuits/qftadder.js"></script>
<script src="circuits/cuccaroadder.js"></script>
<script src="gui/tabs.js"></script>
<script src="gui/visualisationoptions.js"></script>
<script src="astateconsume.js"></script>
<script src="binarytools.js"></script>
<script src="quirklink.js"></script>
<script src="gatesslider.js"></script>
<script src="circuitanalysis.js"></script>
<!-- From the WebGL Visualisation part -->
<script src="localscript.js"></script>
<script src="helperfunctions.js"></script>
<script src="visualisation/libs/jquery-1.12.0.min.js"></script>
<script src="visualisation/libs/three.js"></script>
<script src="visualisation/libs/SVGRenderer.js"></script>
<script src="visualisation/libs/Projector.js"></script>
<script src="visualisation/libs/CanvasRenderer.js"></script>
<script src="visualisation/libs/Detector.js"></script>
<script src="visualisation/libs/BoxGeometry.js"></script>
<script src="visualisation/libs/TrackballControls.js"></script>
<script src="visualisation/libs/PalerBoxBufferGeometry.js"></script>
<script src="visualisation/libs/stats.js"></script>
<script src="visualisation/webglvisualiser.js"></script>
<script src="gui/visualisationoptions.js"></script>
<script>
function createModule() {
/*
The emscripten module used to load the compiler
*/
var Module = {
preRun: [],
postRun: [],
print: (function () {
var element = document.getElementById('output');
return function (text) {
element.value += text + "\n";
};
})(),
/*
The first visualisation() is called only after the module has finished loading
*/
onRuntimeInitialized: function () {
//pressGenerate();
CompilationHelpers.startCompiled('circuitnew');
startVisualisation();
},
printErr: function (text) {
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
if (0) {
dump(text + '\n');
}
},
canvas: (function () {
var canvas = document.getElementById('canvas');
return canvas;
})(),
noInitialRun: true//,
//noExitRuntime: true
};
return Module;
}
var Module = createModule();
</script>
<!--
<script id="scripthello" src="emscripten/convertft.js">
</script>
-->
<script>
/*
The visualisation objects
*/
var visualisationDefects = new WebGLVisualiser();
var visualisationPlumb = new WebGLVisualiser();
/*
Visualisation menues
*/
var menuDefects = new VisualisationOptions();
menuDefects.addOptionAndCheckbox("drawBoxes", "menuDefectBoxesChk", [visualisationDefects.boxesGeometry]);
menuDefects.addOptionAndCheckbox("drawPrimals", "menuDefectPrimalChk", [visualisationDefects.primalGeometry, visualisationDefects.primalGeometry2]);
menuDefects.addOptionAndCheckbox("drawDuals", "menuDefectDualChk", [visualisationDefects.dualGeometry, visualisationDefects.dualGeometry2]);
var menuPlumb = new VisualisationOptions();
menuPlumb.addOptionAndCheckbox("drawUnitsPlumb", "plUnitsChk", [visualisationPlumb.plumbingUnits]);
menuPlumb.addOptionAndCheckbox("drawPrimalsPlumb", "plPrimalChk", [visualisationPlumb.plumbingPrimals]);
menuPlumb.addOptionAndCheckbox("drawDualsPlumb", "plDualChk", [visualisationPlumb.plumbingDuals]);
var menuVisualisation = new VisualisationOptions();
menuVisualisation.addOptionAndCheckbox("enableQuirkView", "visQuirkBox");
menuVisualisation.addOptionAndCheckbox("enableDefectView", "visDefectBox");
menuVisualisation.addOptionAndCheckbox("enablePlumbView", "visPlumbBox");
/*
Circuit generator objects
*/
var currentGenerator = null;//should this object still look global?
var echoCommands = new EchoCommands(toolParameters);
var wireOrder = new WireOrder();
var csvAnalysis = "";
function reloadEmscriptenModule() {
Module = createModule();
var x = document.getElementById("scripthello");
if (x != undefined)
x.parentNode.removeChild(x);
var nx = document.createElement("script");
nx.src = "emscripten/convertft.js?cachebuster=" + new Date().getTime();
nx.id = "scripthello";
document.getElementsByTagName('head')[0].appendChild(nx);
}
function startVisualisation() {
var currentVisOptions = menuVisualisation.collectValues();
var currentView = Tabs.getOpenTabButton("view");
if (currentVisOptions["enableDefectView"].visible) {
document.getElementById("viewTabDefect").click();
visualisationDefects.start_defect_view(CompilationHelpers.graph1,
CompilationHelpers.graph2,
CompilationHelpers.graph3,
CompilationHelpers.graph4,
CompilationHelpers.boxes);
}
if (currentVisOptions["enablePlumbView"].visible) {
document.getElementById("viewTabPlumb").click();
visualisationPlumb.start_plumbing_view();
}
document.getElementById(currentView).click();
/*
menu options
*/
visualisationDefects.checkboxClick(menuDefects);
visualisationPlumb.checkboxClick(menuPlumb);
}
function otherCircuitSelected() {
currentGenerator = null;
pressGenerate();
}
function pressGenerate() {
var genParam = new GeneratorParameters();
readToolParameters();
/*
Check which visualisations are enabled
*/
var currentVisualisationOptions = menuVisualisation.collectValues();
echoCommands.echo(undefined, "stats");
echoCommands.echo("computing...", "stats");
var aNewGeneratorWasSelected = (currentGenerator == null);
if (currentGenerator == null) {
switch (toolParameters.circuitGenerator) {
case "majorana":
//generateMajoranaCircuit();
// currentGenerator = new QROMGenerator();
break;
case "qrom":
// generateQROMCircuit();
// generateQROM2Circuit();
currentGenerator = new QROMGenerator();
break;
case "adder":
currentGenerator = new GidneyAdderGenerator();
break;
case "qftadder":
currentGenerator = new QFTAdderGenerator();
break;
case "cuccaro":
currentGenerator = new CuccaroAdderGenerator();
break;
}
//write the HTML for the parameters
document.getElementById("paramsDiv").innerHTML = genParam.generateHTML(currentGenerator.getParameters());
}
var paramValues = genParam.readHTMLValues(currentGenerator.getParameters());
var gateList = currentGenerator.generateCircuit(paramValues, toolParameters);
//mai exista un resetdata in astatesconsume
//resetAnalysisData();
var ngatelist = [];
if (toolParameters.oneTGatePerTimestep) {
ngatelist = oneTGatePerTimeStep(gateList);
}
else {
ngatelist = gateList;
}
//The following three are button actions
if (wireOrder.resetFlag) {
wireOrder.resetOrder(ngatelist);
}
else if (wireOrder.reorderFlag) {
wireOrder.computeFirstWireUsage(ngatelist);
}
else if (wireOrder.swapFlag) {
//swap
wireOrder.swapQubits();
}
else {
//The default is to reset
wireOrder.resetOrder(ngatelist);
}
wireOrder.resetAllFlags();
//write the HTML for the wires swapper and configuration
var buttonNodes = wireOrder.generateButtonsHTML(pressSwap);
var buttonsContainer = document.getElementById("wireswapperdiv");
buttonsContainer.innerHTML = "";//clean all children
for (var ib = 0; ib < buttonNodes.length; ib++) {
buttonsContainer.appendChild(buttonNodes[ib]);
}
/*
The wire ordering is changed at this point where
the circuit was decomposed....for the moment.
*/
var schedlist = arrangeDecomposedCircuit(ngatelist, wireOrder);
if (toolParameters.distillAndConsumeTStates) {
// make a first analysis to know how many T states need to be distilled
var nrTGates = analyseCircuit(schedlist, 0/*no look ahead*/).nrTGates;
schedlist = scheduleGateList(schedlist, nrTGates);
}
//unrolled the single qubit gates
echoCommands.clear("circuitnew");
for (var y = 0; y < schedlist.length; y++) {
echoCommands.echo(schedlist[y], "circuitnew");
}
/*
analyse the circuit and plot the data resulting from the analysis
*/
var analysisData = analyseCircuit(schedlist, toolParameters.lookAhead);
if (!toolParameters.noVisualisation || currentVisualisationOptions["enableQuirkView"].visible) {
var obj = QuirkLink.constructQuirkLink(schedlist, analysisData, wireOrder);
echoCommands.clear("quirkLink");
echoCommands.echo(obj.link, "quirkLink");
var currentViewTabButton = Tabs.getOpenTabButton("view");
document.getElementById("viewTabQuirk").click();
document.getElementById("quirkiframe").src = obj.link;
document.getElementById(currentViewTabButton).click();
}
var distillationDepth = (analysisData.nrTGates * toolParameters.distillationLength);
var localNrVars = Number(gateList[0].split(" ")[1]);
echoCommands.clear("stats");
echoCommands.echo("number wires " + localNrVars, "stats");
echoCommands.echo("current gate list length " + (gateList.length - 3), "stats");
echoCommands.echo("current circuit depth " + analysisData.timesteps, "stats");
echoCommands.echo("nr T gates " + analysisData.nrTGates, "stats");
echoCommands.echo("single distillation depth " + toolParameters.distillationLength, "stats");
echoCommands.echo("total T distillations depth " + distillationDepth, "stats");
if (toolParameters.distillAndConsumeTStates)
estimateBoundingBox(analysisData, aStatesData);
document.getElementById("gateslider").min = 1;
document.getElementById("gateslider").max = gateList.length - 3;
document.getElementById("gateslider").value = 1;
chartAnalysisData(
analysisData.steps,
aStatesData.nra,//.slice(0, distillationDepth + 1),
analysisData.counts
);
csvAnalysis = returnAnalysisAsCSV(
analysisData.steps,
aStatesData.nra,//.slice(0, distillationDepth + 1),
analysisData.counts
);
resetToolParameters();
/*
Update WebGL visualisation
*/
if (currentVisualisationOptions["enableDefectView"].visible || currentVisualisationOptions["enablePlumbView"].visible) {
reloadEmscriptenModule();
// CompilationHelpers.startCompiled('circuitnew');
// startVisualisation();
}
}
function estimateBoundingBox(analysisData, aStatesData) {
var distillationHeight = 10;
var distillationDepth = 6;
var distillationWidth = 16;
var mostAvailableDistilledAStates = aStatesData.nra.reduce(function (a, b) {
return Math.max(a, b);
});
echoCommands.echo("\nEstimated bounding box (plumbing pieces):", "stats");
var totalDepth = analysisData.timesteps * 2;
echoCommands.echo("depth: " + totalDepth, "stats");
var totalWidth = Math.max(mostAvailableDistilledAStates * 2 + 1/*connection around the log qubit block*/,
distillationWidth);
echoCommands.echo("width: " + totalWidth, "stats");
var nrLogQubitsPerLine = Math.floor(distillationWidth / 2);
nrLogQubitsPerLine--;//take one out because some connections use a plumbing piece
var nrQubitLines = Math.ceil(toolParameters.nrVars / nrLogQubitsPerLine);
var totalHeight = nrQubitLines + 2 + distillationHeight;
echoCommands.echo("height: (" + (nrQubitLines + 2) + ") " + totalHeight, "stats");
var volume2 = totalHeight * totalWidth * totalDepth;
echoCommands.echo("volume_2: " + volume2, "stats");
var volume0 = (totalHeight - distillationHeight) * totalWidth * totalDepth;
echoCommands.echo("volume_0: " + volume0, "stats");
var difference = analysisData.timesteps - analysisData.nrTGates * toolParameters.distillationLength;
var unusedDistillationBlock = 2 * difference * distillationWidth * distillationHeight;
unusedDistillationBlock += analysisData.nrTGates * distillationWidth * distillationHeight;
echoCommands.echo("unused distillation volume: " + unusedDistillationBlock, "stats");
echoCommands.echo("estimated used plumbing pieces: " + (volume2 - unusedDistillationBlock), "stats");
}
/*
... 0, 1, 2 -> ... 2, 1, 0
*/
function fromQubitNrToOrderNr(qubitnr, nrLogQubits) {
return nrLogQubits - 1 - qubitnr;
}
/*
... 2, 1, 0 -> ... 0, 1, 2
*/
function fromOrderNrToQubitNr(ordernr, nrLogQubits) {
return nrLogQubits - 1 - ordernr;
}
/*
Set the visualisatino sizes
*/
function setSizeForContainer(containerName) {
var container = document.getElementById(containerName);
var d = document;
var e = d.documentElement;
var x = window.innerWidth || e.clientWidth || this.container.clientWidth;
var y = window.innerHeight || e.clientHeight || this.container.clientHeight;
var WIDTH = x;
var HEIGHT = y;
var oldstyle = container.getAttribute("style");
oldstyle += "display:block; width:" + WIDTH + "px; height:" + (HEIGHT - 20) + "px;";
container.setAttribute("style", oldstyle);
container.style.width = WIDTH + 'px';
container.style.height = (HEIGHT - 20) + 'px';
}
function downloadChartCSV() {
/*
In this version, the csv is precomputed
*/
var csvData = csvAnalysis;
downloadFile("chartanalysis.csv", csvData);
}
function pressReorderWires() {
wireOrder.reorderFlag = true;
pressGenerate();
}
function pressResetWires() {
wireOrder.resetFlag = true;
pressGenerate();
}
function pressSwap() {
wireOrder.swapFlag = true;
pressGenerate();
}
function pressDecompose() {
document.getElementById('btnParse').disabled = !document.getElementById('decomposeCheckBox').checked;
pressGenerate();
}
function pressTDelay() {
document.getElementById('onetpertime').disabled = !document.getElementById('distillandconsume').checked;
if (document.getElementById('onetpertime').disabled)
document.getElementById('onetpertime').checked = false;
pressGenerate();
}
</script>
</head>
<body>
<div style="width:40vw; height:1000vh; float:left;">
<div style="background-color: darkred">
<select id="circuitgenerator" onchange="otherCircuitSelected()">
<option value="qrom">QROM</option>
<option value="majorana">Majorana</option>
<!--<option value="chemistry2">Chemistry2</option>-->
<option value="adder" selected="selected">Gidney Adder</option>
<option value="qftadder">QFT Adder</option>
<option value="cuccaro">Cuccaro Adder</option>
</select>
Parameters:
<br>
<div id="paramsDiv"></div>
</div>
<div style="background-color: darkgreen">
Max avail. distilled A:
<input id="nrMaxAvailable" value="0" size="3" type="number" min=0 onchange="pressGenerate()">
<br>
<input checked type=checkbox id=decomposeCheckBox onclick="pressDecompose()">Decompose to Clifford+T</input>
<br>
<input checked type=checkbox id=distillandconsume onclick="pressTDelay()">Distill and consume T states</input>
<br>
<input type=checkbox id=onetpertime disabled onclick="pressGenerate()">One T gate per time step</input>
<br>
<input type=checkbox id=novisual onclick="pressGenerate()">No visualisation (faster)</input>
<br>
<!-- Tab links -->
<div class="tab">
<button id="generatorDefaultOpen" class="tablinks" onclick="Tabs.openTab(event, 'generatorConsole', 'generator')">Console</button>
<button id="generator1" class="tablinks" onclick="Tabs.openTab(event, 'generatorRaw', 'generator')">Raw Circ.</button>
<button id="generator2" class="tablinks" onclick="Tabs.openTab(event, 'generatorSched', 'generator')">Sched. Circ.</button>
<button id="generator3" class="tablinks" onclick="Tabs.openTab(event, 'generatorLink', 'generator')">Link</button>
<button id="generator4" class="tablinks" onclick="Tabs.openTab(event, 'generatorMemory', 'generator')">Memory</button>
<button id="generator5" class="tablinks" onclick="Tabs.openTab(event, 'generatorChart', 'generator')">Chart</button>
<button id="generator6" class="tablinks" onclick="Tabs.openTab(event, 'generatorWires', 'generator')">Wires</button>
</div>
<!-- Tab content -->
<div id="generatorConsole" class="tabcontent">
<textarea id="stats" cols="60" rows="20">Statistics</textarea>
</div>
<div id="generatorRaw" class="tabcontent">
<textarea id="circuit" cols="60" rows="20" readonly>nothing generated
</textarea>
</div>
<div id="generatorSched" class="tabcontent">
<input id="gateslider" value="0" size="3" type="number" onchange="selectGate()">
<br>
<textarea id="circuitnew" cols="60" rows="20" readonly>nothing generated
</textarea>
</div>
<div id="generatorLink" class="tabcontent">
Copy and paste link from Quirk to parse circuit
<br>
<textarea id="quirkLink" cols="60" rows="20">nothing copied&pasted
</textarea>
<br>
<input id=btnParse type=button value="Parse" onclick="QuirkLink.parseLink()">
<input id=btnGIF type=button value="Get From Frame" onclick="QuirkLink.getLinkFromIFrame()">
<input id=btnSave type=button value="Save To Memory" onclick="QuirkLink.saveToMemory()">
</div>
<div id="generatorMemory" class="tabcontent">
Saved Quirk Links:
<br>
<input type="button" value="Get and Save To Memory" onclick="QuirkLink.getLinkFromIFrame(); QuirkLink.saveToMemory()">
<br>
</div>
<div id="generatorChart" class="tabcontent">
Look ahead:
<input type="number" id="lookahead" min=0 onchange="pressGenerate()" value="0">
<br>
<input type="button" value="Download CSV" onclick="downloadChartCSV()">
<br>
<canvas id="analysisChart" width="200" height="100" style="background-color: white"></canvas>
</div>
<div id="generatorWires" class="tabcontent">
<input type=button id=reorderwires onclick='pressReorderWires()' value="Reorder wires based on first usage"></input>
<br>
<input type=button id=resetwires onclick='pressResetWires()' value="Reset wire order"></input>
<br> The following order is used. Change by clicking pairs to swap.
<div id="wireswapperdiv"></div>
</div>
</div>
<b>This tool is alpha version, and was prepared to present the concept of SurfBraid.</b><br>
Be sure to have a GPU for large WebGL visualisations - otherwise disable it (see checkbox below).
Configure visualisation also from the Setup tab on the right. This version includes an Emscripten compiled C++ module.
Many features of that module are not unlocked from the GUI - this is why sometimes the visualisation will not update.
Some circuit generators are not transformed into Clifford+T, because that corresponding Javascript component was not updated to handle those gate types.
</div>
<div id="contentframe" style="position:relative; top: 0px; left: 0px; float:right; width:57vw;height:100vh">
<div class="tab">
<button id="viewTabQuirk" class="tablinks" onclick="Tabs.openTab(event, 'viewQuirk', 'view')">Quirk</button>
<button id="viewTabDefect" class="tablinks" onclick="Tabs.openTab(event, 'viewDefect', 'view')">Defects</button>
<button id="viewTabPlumb" class="tablinks" onclick="Tabs.openTab(event, 'viewPlumb', 'view')">Plumbing</button>
<button id="viewTabSetup" class="tablinks" onclick="Tabs.openTab(event, 'viewSetup', 'view')">Setup</button>
</div>
<div id="viewQuirk" class="tabcontent">
<iframe id="quirkiframe" src="#" style="width:153%;height:150%;">
<!-- the css scales to 0.65 the contents of the iframe,
and this style is applied afterwards to set the width to 1/0.65 -->
</iframe>
</div>
<div id="viewDefect" class="tabcontent">
<div class=menu name=menu>
Show:
<input type=checkbox id="menuDefectBoxesChk" checked="checked" onclick="visualisationDefects.checkboxClick(menuDefects)"
autocomplete="off">Boxes</input>
<input type=checkbox id="menuDefectPrimalChk" checked="checked" onclick="visualisationDefects.checkboxClick(menuDefects)"
autocomplete="off">Primal</input>
<input type=checkbox id="menuDefectDualChk" checked="checked" onclick="visualisationDefects.checkboxClick(menuDefects)" autocomplete="off">Dual</input>
</div>
<!--where the visualisation is placed-->
<div id=container1 name=container1 style="border:4px solid green;"></div>
</div>
<div id="viewPlumb" class="tabcontent">
<div class=menu name=menu>
Show:
<input type=checkbox id="plUnitsChk" checked="checked" onclick="visualisationPlumb.checkboxClick(menuPlumb)" autocomplete="off">Units</input>
<input type=checkbox id="plPrimalChk" checked="checked" onclick="visualisationPlumb.checkboxClick(menuPlumb)" autocomplete="off">Primal</input>
<input type=checkbox id="plDualChk" checked="checked" onclick="visualisationPlumb.checkboxClick(menuPlumb)" autocomplete="off">Dual</input>
</div>
<!--where the visualisation is placed-->
<div id=container2 name=container2 style="border:4px solid blue;"></div>
</div>
<!-- Tab content -->
<div id="viewSetup" class="tabcontent">
<div class=menu name=menu>
Manual Visualisation:
<input type="button" value="Start" onclick="CompilationHelpers.startCompiled('circuitnew')">
<input type="button" value="View" onclick="startVisualisation()">
<input type="button" value="Clean" onclick="visualisationDefects.deleteAllSceneRelated(); visualisationPlumb.deleteAllSceneRelated();">
</div>
<div class=menu>
Enable Visualisation:
<input id=visQuirkBox type="checkbox" checked>Quirk</input>
<input id=visDefectBox type="checkbox" checked>Defect</input>
<input id=visPlumbBox type="checkbox" checked>Plumb</input>
</div>
<!--download links for the json files generated-->
<p id=downloadlinks name=downloadlinks>
there are no files to download
</p>
<!--where the emscripten stdout is printed-->
<textarea id="output" rows="40" cols="80">
test test
</textarea>
</div>
</div>
<script>
/*
Set the size of the visualisations
*/
setSizeForContainer("viewDefect");
setSizeForContainer("viewPlumb");
setSizeForContainer("viewQuirk");
/*
From the WebGL part.
For a reason which is unknown to me, the containers need to be visible
for the ThreeJS renderers to work. This is why, I am simulating clicks on the divs
*/
document.getElementById("viewDefect").click();
visualisationDefects.setup_visualisation("container1");
// document.getElementsByName("b4")[0].dispatchEvent(event);
document.getElementById("viewPlumb").click();
visualisationPlumb.setup_visualisation("container2");
/*
Default open tab
*/
//document.getElementById("viewTabEmscripten").click();
resetToolParameters();
document.getElementById("generatorDefaultOpen").click();
// document.getElementById("viewTabQuirk").click();
//the default is the defects tab
document.getElementById("viewTabDefect").click();
// document.getElementById("quirkiframe").onload = function () {
// //console.log("Quirk Loaded!");
// alert("Alert!");
// //document.getElementById("generatorDefaultOpen").click();
// document.getElementById("viewTabEmscripten").click();
// }
pressGenerate();
</script>
</body>
</html>