Skip to content

Commit 192c74d

Browse files
committed
Initial commit
0 parents  commit 192c74d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+2360
-0
lines changed

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
node_modules
2+
build
3+
npm-debug.log
4+
5+
*.OUT/
6+
OUT/
7+
8+
*.tgz
9+
.env
10+
.DS_Store
11+
.*
12+
!.gitignore

CMakeLists.txt

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
CMAKE_MINIMUM_REQUIRED(VERSION 3.0)
2+
3+
4+
PROJECT(OpenFLUIDjs)
5+
6+
7+
FIND_PACKAGE(OpenFLUIDHelpers REQUIRED)
8+
9+
IF(COMMAND OPENFLUID_DETECT_CXX11)
10+
OPENFLUID_DETECT_CXX11()
11+
ENDIF()
12+
13+
FIND_PACKAGE(Qt5 COMPONENTS Core REQUIRED)
14+
FIND_PACKAGE(OpenFLUID REQUIRED core base ware machine tools fluidx)
15+
16+
17+
INCLUDE_DIRECTORIES(${OpenFLUID_INCLUDE_DIRS} ${CMAKE_JS_INC}
18+
${CMAKE_SOURCE_DIR}/node_modules/node-addon-api
19+
${CMAKE_SOURCE_DIR}/../node-addon-api
20+
)
21+
22+
SET(OpenFLUIDjs_CPP_HPP src/OpenFLUIDjsWrapper.cpp)
23+
24+
ADD_LIBRARY(OpenFLUIDjs SHARED ${OpenFLUIDjs_CPP_HPP})
25+
26+
SET_TARGET_PROPERTIES(OpenFLUIDjs PROPERTIES PREFIX "lib" SUFFIX ".node")
27+
28+
TARGET_LINK_LIBRARIES(OpenFLUIDjs ${OpenFLUID_LIBRARIES}
29+
Qt5::Core
30+
${CMAKE_JS_LIB}
31+
)

LICENSE

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
OpenFLUID
2+
Copyright (c) 2007 INRA - Montpellier SupAgro
3+
Inter Deposit Digital Number : IDDN.FR.001.360006.000.R.P.2009.000.30100
4+
5+
6+
== GNU General Public License Usage ==
7+
8+
OpenFLUID is free software: you can redistribute it and/or modify
9+
it under the terms of the GNU General Public License as published by
10+
the Free Software Foundation, either version 3 of the License, or
11+
(at your option) any later version.
12+
13+
OpenFLUID is distributed in the hope that it will be useful,
14+
but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
GNU General Public License for more details.
17+
18+
You should have received a copy of the GNU General Public License
19+
along with OpenFLUID. If not, see <http://www.gnu.org/licenses/>.
20+
21+
22+
== Other Usage ==
23+
24+
Other Usage means a use of OpenFLUID that is inconsistent with the GPL
25+
license, and requires a written agreement between You and INRA.
26+
Licensees for Other Usage of OpenFLUID may use this file in accordance
27+
with the terms contained in the written agreement between You and INRA.
28+
29+
30+
===========================================================================
31+
32+
33+
OpenFLUID relies on third party libraries and content, under the following licensing terms:
34+
- Boost: http://www.boost.org/users/license.html (Boost license)
35+
- Qt: http://qt-project.org/doc/qt-5/opensourcelicense.html (LGPL)
36+
- OGR/GDAL: http://trac.osgeo.org/gdal/wiki/FAQGeneral#WhatlicensedoesGDALOGRuse (X11/MIT)
37+
- GEOS: http://trac.osgeo.org/geos/ (LGPL)
38+
- RapidJSON: http://rapidjson.org (MIT)
39+
- Material design icons: https://material.io/icons/ (Apache 2.0) and https://materialdesignicons.com/ (OFL-1.1)
40+
41+
42+

README.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
## Overview
2+
3+
This module allows to load, parameterize, run and analyze OpenFLUID simulations from Node.js scripts.
4+
5+
It is compatible with Node.js 10.x and requires that the [OpenFLUID platform](https://www.openfluid-project.org/) and the [CMake tool](https://www.cmake.org) are already installed.
6+
7+
See the `package.json` file for Node.js dependencies.
8+
9+
*Currently, this package is in early development stage and has only be tested on Linux system*
10+
11+
12+
## Installation
13+
14+
### From GitHub
15+
16+
Run the followind npm command
17+
```
18+
npm install OpenFLUID/openfluidjs
19+
```
20+
21+
### As a dependency for another module
22+
23+
Add OpenFLUIDjs GitHub repository as a dependency in the `package.json` file
24+
```
25+
{
26+
"name": "my-module",
27+
"version": "1.0.0",
28+
"dependencies": {
29+
"OpenFLUIDjs": "https://github.com/OpenFLUID/openfluidjs"
30+
}
31+
}
32+
```
33+
34+
## Development
35+
36+
Run the following commands from the root of the sources tree.
37+
38+
39+
### Build
40+
41+
Thi command will install dependencies and build the module
42+
```
43+
npm install
44+
```
45+
46+
47+
### Test
48+
49+
This command will run the tests
50+
```
51+
npm test
52+
```
53+
54+
55+
### Packaging
56+
57+
This command will create a .tgz archive
58+
```
59+
npm pack
60+
```
61+
62+
63+
## Misc resources
64+
65+
* https://nodejs.org/docs/latest/api/n-api.html
66+
* https://github.com/nodejs/node-addon-api
67+
* https://www.npmjs.com/package/cmake-js
68+
* https://github.com/cmake-js/cmake-js-tut-01-module

index.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
var libOpenFLUID = require("bindings")("libOpenFLUIDjs");
2+
3+
module.exports = {
4+
5+
getVersion: function() {
6+
return libOpenFLUID.getVersion()
7+
},
8+
9+
newBlob: function() {
10+
return libOpenFLUID.newBlob();
11+
},
12+
13+
deleteBlob: function(blob) {
14+
libOpenFLUID.deleteBlob(blob);
15+
},
16+
17+
printSimulationInfo: function(blob) {
18+
libOpenFLUID.printSimulationInfo(blob);
19+
},
20+
21+
openDataset: function(path) {
22+
return libOpenFLUID.openDataset(path);
23+
},
24+
25+
openProject: function(path) {
26+
return libOpenFLUID.openProject(path);
27+
},
28+
29+
setCurrentOutputDir: function(path) {
30+
libOpenFLUID.setCurrentOutputDir(path);
31+
},
32+
33+
runSimulation: function(blob,verbose=false) {
34+
libOpenFLUID.runSimulation(blob,Boolean(verbose));
35+
},
36+
37+
};

0 commit comments

Comments
 (0)