Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libraries
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
libraries
Commits
c2772027
Commit
c2772027
authored
5 years ago
by
Neil Gershenfeld
Browse files
Options
Downloads
Patches
Plain Diff
wip
parent
18393c42
Branches
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#4724
passed
5 years ago
Stage: deploy
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
node/frep.js
+16
-8
16 additions, 8 deletions
node/frep.js
with
16 additions
and
8 deletions
node/frep
w
.js
→
node/frep.js
+
16
−
8
View file @
c2772027
#!/usr/bin/env node
//
// frep
w
.js
// functional representation solver
, worker version
// frep.js
// functional representation solver
//
// usage:
// pcb.py |
node --experimental-worker
frep
w
.js [dpi [filename]]
// pcb.py | frep.js [dpi
[workers
[filename]]
]
// with:
// https://gitlab.cba.mit.edu/pub/libraries/blob/master/python/pcb.py
//
// Neil Gershenfeld 12/9/18
// (c) Massachusetts Institute of Technology 2018
// Neil Gershenfeld 12/7/19
//
// This work may be reproduced, modified, distributed,
// performed, and displayed for any purpose, but must
...
...
@@ -49,17 +48,26 @@ function render(frep) {
}
if
(
process
.
argv
.
length
==
2
)
{
var
dpi
=
100
workers
=
os
.
cpus
().
length
var
filename
=
'
out.png
'
console
.
log
(
'
output to out.png at 100 DPI
'
)
}
else
if
(
process
.
argv
.
length
==
3
)
{
var
dpi
=
parseInt
(
process
.
argv
[
2
])
workers
=
os
.
cpus
().
length
var
filename
=
'
out.png
'
console
.
log
(
'
output to out.png at
'
+
dpi
+
'
DPI
'
)
}
else
if
(
process
.
argv
.
length
==
4
)
{
var
dpi
=
parseInt
(
process
.
argv
[
2
])
var
filename
=
process
.
argv
[
3
]
var
workers
=
parseInt
(
process
.
argv
[
3
])
var
filename
=
'
out.png
'
console
.
log
(
'
output to
'
+
filename
+
'
at
'
+
dpi
+
'
DPI
'
)
}
else
if
(
process
.
argv
.
length
==
5
)
{
var
dpi
=
parseInt
(
process
.
argv
[
2
])
var
workers
=
parseInt
(
process
.
argv
[
3
])
var
filename
=
process
.
argv
[
4
]
console
.
log
(
'
output to
'
+
filename
+
'
at
'
+
dpi
+
'
DPI
'
)
}
//
...
...
@@ -108,7 +116,6 @@ function render(frep) {
//
// start workers
//
var
workers
=
os
.
cpus
().
length
console
.
log
(
'
start
'
+
workers
+
'
workers
'
)
var
count
=
0
for
(
let
i
=
0
;
i
<
workers
;
++
i
)
{
...
...
@@ -130,7 +137,8 @@ function render(frep) {
}
})
worker
.
postMessage
({
index
:
i
,
workers
:
workers
,
delta
:
delta
,
width
:
width
,
height
:
height
,
xmin
:
frep
.
xmin
,
ymin
:
frep
.
ymin
,
z
:
frep
.
zmin
,
delta
:
delta
,
width
:
width
,
height
:
height
,
xmin
:
frep
.
xmin
,
ymin
:
frep
.
ymin
,
z
:
frep
.
layers
[
0
],
// need to handle multiple layers
buf
:
buf
,
fn
:
frep
.
function
})
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment