Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AMOEBA
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Amanda Ghassaei
AMOEBA
Commits
3e869c39
Commit
3e869c39
authored
Jun 28, 2016
by
amandaghassaei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
step simulation forward
parent
a8b7bf4d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
7 deletions
+26
-7
js/menus/EmRunMenuView.js
js/menus/EmRunMenuView.js
+8
-2
js/menus/templates/EmRunMenuView.html
js/menus/templates/EmRunMenuView.html
+3
-0
js/simulation/Sim.js
js/simulation/Sim.js
+15
-5
No files found.
js/menus/EmRunMenuView.js
View file @
3e869c39
...
...
@@ -12,7 +12,8 @@ define(['jquery', 'underscore', 'menuParent', 'emSimPlist', 'emSim', 'emSimLatti
"
click #runSimulation
"
:
"
_runSimulation
"
,
"
click #pauseSimulation
"
:
"
_pauseSimulation
"
,
"
click #resetSimulation
"
:
"
_resetSimulation
"
"
click #resetSimulation
"
:
"
_resetSimulation
"
,
"
click #stepSimulation
"
:
"
_stepSimulation
"
},
_initialize
:
function
(){
...
...
@@ -27,7 +28,7 @@ define(['jquery', 'underscore', 'menuParent', 'emSimPlist', 'emSim', 'emSimLatti
_runSimulation
:
function
(
e
){
e
.
preventDefault
();
emSim
.
run
();
emSim
.
run
(
false
);
},
_pauseSimulation
:
function
(
e
){
...
...
@@ -40,6 +41,11 @@ define(['jquery', 'underscore', 'menuParent', 'emSimPlist', 'emSim', 'emSimLatti
emSim
.
reset
();
},
_stepSimulation
:
function
(
e
){
e
.
preventDefault
();
emSim
.
run
(
true
);
},
_makeTemplateJSON
:
function
(){
return
_
.
extend
(
emSim
.
toJSON
(),
emSim
.
simLattice
.
toJSON
(),
emPlist
);
...
...
js/menus/templates/EmRunMenuView.html
View file @
3e869c39
...
...
@@ -7,9 +7,12 @@
<
%
}
else
if
(
needsReset
)
{
%
>
<a
href=
"#"
id=
"runSimulation"
class=
"btn btn-halfWidth btn-lg btn-success"
>
Continue
</a>
<a
href=
"#"
id=
"resetSimulation"
class=
"btn btn-halfWidth btn-lg pull-right btn-default"
>
Reset
</a><br/><br/>
<a
href=
"#"
id=
"stepSimulation"
class=
"btn btn-block btn-lg btn-default"
>
Step Forward
</a><br/>
<
%
}
else
{
%
>
<a
href=
"#"
id=
"runSimulation"
class=
"btn btn-block btn-lg btn-success"
>
Run Simulation
</a><br/>
<a
href=
"#"
id=
"stepSimulation"
class=
"btn btn-block btn-lg btn-default"
>
Step Forward
</a><br/>
<
%
}
%
>
<!--View Mode:-->
<!--<% _.each(EMViewModes, function(EMViewMode, key){ %>-->
<!--<label class="radio">-->
...
...
js/simulation/Sim.js
View file @
3e869c39
...
...
@@ -82,17 +82,15 @@ define(['three', 'underscore', 'backbone', 'threeModel', 'appState', 'lattice'],
run
:
function
(){
run
:
function
(
singleStepMode
){
var
self
=
this
;
this
.
set
(
"
isRunning
"
,
true
);
this
.
set
(
"
needsReset
"
,
true
);
var
dt
=
this
.
get
(
"
dtSolver
"
)
/
1000000
;
//convert to sec
var
renderRate
=
this
.
get
(
"
dtRender
"
);
var
runConstants
=
this
.
_setRunConstants
();
runConstants
.
dt
=
dt
;
three
.
startAnimationLoop
(
function
(){
var
animationCallback
=
function
(){
for
(
var
i
=
0
;
i
<
renderRate
-
1
;
i
++
){
self
.
time
+=
dt
;
self
.
simLattice
.
iter
(
self
.
time
,
runConstants
,
false
);
...
...
@@ -102,7 +100,18 @@ define(['three', 'underscore', 'backbone', 'threeModel', 'appState', 'lattice'],
//if (self._getViewMode() == "translation"){
// self.calcTranslation();
//}
});
};
this
.
set
(
"
needsReset
"
,
true
);
if
(
singleStepMode
)
{
animationCallback
();
three
.
render
();
return
;
}
this
.
set
(
"
isRunning
"
,
true
);
three
.
startAnimationLoop
(
animationCallback
);
},
pause
:
function
(){
...
...
@@ -123,6 +132,7 @@ define(['three', 'underscore', 'backbone', 'threeModel', 'appState', 'lattice'],
},
fixCellAtIndex
:
function
(
index
){
var
position
=
index
.
clone
().
sub
(
lattice
.
get
(
"
cellsMin
"
));
var
fixed
=
this
.
simLattice
.
fixCellAtIndex
(
position
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment