Newer
Older
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
<!DOCTYPE html>
<html lang="en">
<head>
<title>MetaVoxel</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<!-- <link type="text/css" rel="stylesheet" href="main.css"> -->
<style>
body {
background-color: #f0f0f0;
color: #444;
}
a {
color: #08f;
}
</style>
<link rel="stylesheet" type="text/css" href="style.css" media="screen"/>
</head>
<body>
<div id="threejs">
<div class="header1">
<i> Hierarchical Simulation</i>
<!-- Three.js -->
</div>
<div id="webgl"></div>
</div>
<div id="graph">
<div class="header2">
<div class="dragbar"></div>
<i>. Detailed Simulation</i>
</div>
<div class="dragbar"></div>
<div id="webgl1"></div>
</div>
<div class="footer1">
<strong>left-click left window</strong>: orbit, <strong>right-click</strong>: zoom
</div>
<div class="footer2" id="footer2">
<!-- update change to more instructions/feedback -->
<i> Loading RhinoScript</i>
</div>
<!-- <div id="container"></div>
<div id="container"></div> -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script type="text/javascript" src="https://files.mcneel.com/rhino3dm/js/latest/rhino3dm.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@1.0.0/dist/tf.min.js"></script>
<!-- <script src="./lib/require.js"></script> -->
<script src="../lib/three.min.js"></script>
<script src="../lib/stats.js"></script>
<script src="../lib/dat.gui.js"></script>
<script src="../lib/SVGRenderer.js"></script>
<script src="../lib/DragControls.js"></script>
<script src="../lib/OrbitControls.js"></script>
<script src="../lib/TransformControls.js"></script>
<script src="../lib/js-colormaps.js"></script>
<script src="../lib/LineSegments2.js"></script>
<script src="../lib/LineSegmentsGeometry.js"></script>
<script src="../lib/Line2.js"></script>
<script src="../lib/LineMaterial.js"></script>
<script src="../lib/LineGeometry.js"></script>
<script src="../lib/GeometryUtils.js"></script>
<script src="../visualization/utils.js"></script>
<script src="../visualization/geometry.js"></script>
<!-- <script src="./beamFea.js"></script>
<script src="./geometry.js"></script> -->
<script src="../visualization/main.js"></script>
<script src="../fea/parallelFea.js"></script>
<script type="text/javascript" src="./rhino3dm.js"></script>
<!-- <script src="../visualization/draw.js"></script> -->
<script>
////////////////////////dragbar///////////////
$('.dragbar').mousedown(function(e){
e.preventDefault();
$(document).mousemove(function(e){
// $('#position').html(e.pageX +', '+ e.pageY);
$('#threejs').css("width",e.pageX+2);
$('#webgl').css("width",e.pageX+2);
$('#graph').css("left",e.pageX+2);
// $('#json').css("left",e.pageX+2);
$('.footer1').css("width",e.pageX+2);
$('.footer2').css("left",e.pageX+2);
})
onWindowResize();//todo change location
});
$(document).mouseup(function(e){
$(document).unbind('mousemove');
onWindowResize();//todo change location
});
//////////////////////////////////////////////////////////////////
/////////////////seemless mirror control/////////////////////
$('#graph').on('click mousedown touchstart', function(){
three.controls = new THREE.OrbitControls( camera, three.renderer.domElement );
})
$('#threejs').on('click mousedown touchstart', function(){
three1.controls = new THREE.OrbitControls( camera, three1.renderer.domElement );
})
var three; //todo change location
var three1; //todo change location
var setup;
var setup1;
rhino3dm().then(async m => {
console.log('Loaded rhino3dm.');
document.getElementById("footer2").innerHTML = "Loaded rhino3dm.";
_rhino3dm = m; // global
var latticeSize=4;
var voxelSize=5;
setup=JSON.parse(JSON.stringify(setupEmpty));
setup.hierarchical=false;
setup.voxelSize=voxelSize;
var material={
area:1.0,
density:0.028,
stiffness:10000000
};
latticeSetup(setup,latticeSize,voxelSize,createVoxel,{x:0,y:-400,z:0},material);
setup.viz.colorMaps=[YlGnBu,coolwarm, winter ,jet];
setup.viz.minStress=10e6;
setup.viz.maxStress=-10e6;
setup.viz.exaggeration=10e3;
setup.solve=solveParallel;
setup.numTimeSteps=100;
three= new threejs(setup,"webgl1","graph");
three.init();
////////////////////////////////////
setup1=JSON.parse(JSON.stringify(setupEmpty));
setup1.hierarchical=true;
setup1.voxelSize=voxelSize;
latticeSetup(setup1,latticeSize,voxelSize,createHierarchalVoxel,{x:0,y:-400,z:0},material);
setup1.viz.colorMaps=[YlGnBu,coolwarm, winter ,jet];
setup1.viz.minStress=10e6;
setup1.viz.maxStress=-10e6;
setup1.viz.exaggeration=10e3;
setup1.solve=solveParallel;
three1= new threejs(setup1,"webgl","threejs");
three1.init();
gui.add(three.setup,"numTimeSteps", 0, 200).listen();
gui.add(three.setup,"solve");
document.getElementById("footer2").innerHTML = "Press solve for structure simulation.";
// more stuff
});
function solveParallel(){
document.getElementById("footer2").innerHTML = "Running...";
var numTimeSteps=250;
/////////////////////////////////////////////////////
var dt=0.0251646; //?? todo change to recommended step
setTimeout(function() {
simulateParallel(setup,three.setup.numTimeSteps,dt);
simulateParallel(setup1,three.setup.numTimeSteps,dt);
}, 1);
}
</script>
</body>
</html>