Commit c2772027 authored by Neil Gershenfeld's avatar Neil Gershenfeld

wip

parent 18393c42
Pipeline #4724 passed with stage
in 1 second
#!/usr/bin/env node
//
// frepw.js
// functional representation solver, worker version
// frep.js
// functional representation solver
//
// usage:
// pcb.py | node --experimental-worker frepw.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})
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment