-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1fb8f86
commit ee7c04b
Showing
8 changed files
with
245 additions
and
175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,52 @@ | ||
var addon = require("./build/Release/napi-addon-fdtd.node"); | ||
|
||
|
||
module.exports = addon; | ||
|
||
const fs = require("fs"); | ||
const path = require("path"); | ||
|
||
let data = addon.getData2D([1, 10, 1], true, [1, 1.2], 2, 0.4, [0, 0.04]); | ||
const test1D = () => { | ||
const condition = [1, 10, 1]; | ||
const eps = [1, 1.2]; | ||
const sigma = [0, 0.04]; | ||
const srcPosition = [0.4, 0.8]; | ||
|
||
for (let j = 0; j < 150; ++j) { | ||
data = addon.getData2D([1, 10, 1], false, [1, 1.2], 2, 0.4, [0, 0.04]); | ||
let data = addon.getData2D(condition, true, eps, 2, srcPosition, sigma); | ||
|
||
} | ||
for (let j = 0; j < 150; ++j) { | ||
data = addon.getData2D(condition, false, eps, 2, srcPosition, sigma); | ||
} | ||
|
||
const fs = require("fs"); | ||
const path = require("path"); | ||
fs.writeFileSync(path.resolve(__dirname, "tmp.txt"), JSON.stringify(data.dataHy), function (err) { | ||
if (err) { | ||
return console.log(err); | ||
fs.writeFileSync( | ||
path.resolve(__dirname, "tmp.txt"), | ||
JSON.stringify(data.dataHy), | ||
function (err) { | ||
if (err) { | ||
return console.log(err); | ||
} | ||
console.log("The file was saved!"); | ||
} | ||
); // Orfs.writeFileSync('/tmp/test-sync', 'Hey there!'); | ||
}; | ||
|
||
const test2D = () => { | ||
let data = addon.getData3D([1, 10], true, [1, 2, 1, 1], 2, 0); | ||
for (let j = 0; j < 150; ++j) { | ||
data = addon.getData3D([1, 10], false, [1, 2, 1, 1], 2, 0); | ||
} | ||
console.log("The file was saved!"); | ||
}); // Orfs.writeFileSync('/tmp/test-sync', 'Hey there!'); | ||
|
||
|
||
// let data = addon.getData3D([1, 10], true, [1,2,1,1], 2, 0); | ||
// for (let j = 0; j < 150; ++j) { | ||
// data = addon.getData3D([1, 10], false, [1,2,1,1], 2, 0); | ||
// } | ||
|
||
// const fs = require("fs"); | ||
// const path = require("path"); | ||
// fs.writeFileSync(path.resolve(__dirname, "tmp.txt"), JSON.stringify(data.dataY), function (err) { | ||
// if (err) { | ||
// return console.log(err); | ||
// } | ||
// console.log("The file was saved!"); | ||
// }); // Orfs.writeFileSync('/tmp/test-sync', 'Hey there!'); | ||
|
||
fs.writeFileSync( | ||
path.resolve(__dirname, "tmp.txt"), | ||
JSON.stringify(data.dataY), | ||
function (err) { | ||
if (err) { | ||
return console.log(err); | ||
} | ||
console.log("The file was saved!"); | ||
} | ||
); // Orfs.writeFileSync('/tmp/test-sync', 'Hey there!'); | ||
}; | ||
|
||
|
||
test1D(); | ||
test2D(); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "napi-addon-fdtd", | ||
"version": "3.1.2", | ||
"version": "3.1.15", | ||
"description": "Build N-API native addon with CMake and node-addon-api C++ wrapper. FDTD physics simulation", | ||
"main": "index.js", | ||
"scripts": { | ||
|
@@ -11,8 +11,8 @@ | |
"author": "maxmaxkklosd99<[email protected]>", | ||
"license": "ISC", | ||
"dependencies": { | ||
"node-addon-api": "^3.1.0", | ||
"cmake-js": "^6.2.1" | ||
"cmake-js": "^6.2.1", | ||
"napi-addon-fdtd": "^3.1.5", | ||
"node-addon-api": "^3.1.0" | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.