-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #175 from sbmlteam/matlab-octave-fun
Ensure Translate/OutputSBML work on Octave and Matlab
- Loading branch information
Showing
29 changed files
with
3,881 additions
and
6,544 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 |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: Octave | ||
|
||
on: [push] | ||
|
||
env: | ||
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | ||
BUILD_TYPE: Release | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest] | ||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Checkout submodules | ||
run: git submodule update --init --recursive | ||
|
||
- name: update | ||
if: matrix.os == 'ubuntu-latest' | ||
shell: bash | ||
run: | | ||
sudo apt-get update | ||
- name: add linux dependencies | ||
if: matrix.os == 'ubuntu-latest' | ||
shell: bash | ||
run: | | ||
sudo apt-get install swig liboctave-dev | ||
- name: Create Build Environment | ||
# Some projects don't allow in-source building, so create a separate build directory | ||
# We'll use this as our working directory for all subsequent commands | ||
run: cmake -E make_directory ${{runner.workspace}}/build | ||
|
||
- name: Configure | ||
# build dependencies | ||
working-directory: ${{runner.workspace}}/build | ||
shell: bash | ||
run: | | ||
cmake -DCMAKE_INSTALL_PREFIX=${{runner.workspace}}/install -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DWITH_BZIP2=ON -DWITH_CHECK=OFF -DWITH_EXPAT=ON -DWITH_LIBXML=OFF -DWITH_OCTAVE=ON $GITHUB_WORKSPACE | ||
- name: Build | ||
working-directory: ${{runner.workspace}}/build | ||
shell: bash | ||
# Execute the build. You can specify a specific target with "--target <NAME>" | ||
run: cmake --build . --config $BUILD_TYPE | ||
|
||
|
||
- name: Install Strip | ||
working-directory: ${{runner.workspace}}/build | ||
run: cmake --install . --prefix instdir --strip | ||
|
||
- name: Pack | ||
working-directory: ${{runner.workspace}}/build/instdir | ||
run: cmake -E tar cvzf ../octave_${{ matrix.os }}.tar.gz . | ||
|
||
- name: Test | ||
working-directory: ${{runner.workspace}}/build/instdir/lib/octave/site/oct/x86_64-pc-linux-gnu/test | ||
shell: bash | ||
run: LD_LIBRARY_PATH=../../../../.. octave --eval "runTests()" | ||
|
||
- name: Upload | ||
uses: actions/upload-artifact@v1 | ||
with: | ||
path: ${{runner.workspace}}/build/octave_${{ matrix.os }}.tar.gz | ||
name: octave_${{ matrix.os }}.tar.gz |
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,2 +1,7 @@ | ||
runTests.log | ||
*.mex* | ||
testout.xml | ||
mytest.m | ||
*.asv | ||
test/Out-test1/* | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
#include "CommonFunctions.h" | ||
|
||
|
||
// | ||
// report error/free memory and exit when error encountered | ||
|
||
void | ||
FreeMem(GV& gv) | ||
{ | ||
/* destroy arrays created */ | ||
mxDestroyArray(gv.modelArray); | ||
gv.modelArray = NULL; | ||
} | ||
|
||
void | ||
reportError(const std::string&id, const std::string& message, GV& gv) | ||
{ | ||
if (gv.freeMemory) | ||
{ | ||
FreeMem(gv); | ||
} | ||
|
||
mexErrMsgIdAndTxt(id.c_str(), message.c_str()); | ||
} | ||
|
||
|
||
void | ||
displayLine(const std::string& line) | ||
{ | ||
mxArray* mxErrors[1]; | ||
mxErrors[0] = mxCreateString(line.c_str()); | ||
mexCallMATLAB(0, NULL, 1, mxErrors, "disp"); | ||
mxDestroyArray(mxErrors[0]); | ||
} | ||
|
||
|
||
mxArray * | ||
CreateIntScalar (int nValue) | ||
{ | ||
mxArray * pArray; | ||
int * panData; | ||
|
||
pArray = mxCreateNumericMatrix(1,1,mxINT32_CLASS, mxREAL); | ||
panData = (int *)mxGetData(pArray); | ||
panData[0] = nValue; | ||
|
||
return pArray; | ||
} | ||
|
||
const char* FIELDTYPE_STRINGS[] = | ||
{ | ||
"bool" | ||
, "char" | ||
, "double" | ||
, "int" | ||
, "structure" | ||
, "uint" | ||
}; | ||
|
||
|
||
FieldType_t | ||
getFieldType(const char* type) | ||
{ | ||
if (type != NULL) | ||
{ | ||
const FieldType_t lo = TYPE_BOOL; | ||
const FieldType_t hi = (const FieldType_t)(TYPE_UNKNOWN - 1); | ||
|
||
return (FieldType_t)util_bsearchStringsI(FIELDTYPE_STRINGS, type, lo, hi); | ||
} | ||
else | ||
return TYPE_UNKNOWN; | ||
} | ||
|
||
// only used by OutputSBML | ||
bool getRequiredStatus(const std::string& prefix, GV& gv) | ||
{ | ||
bool required = false; | ||
|
||
if (gv.reqdPkgPrefixes.contains(prefix)) | ||
{ | ||
required = true; | ||
} | ||
|
||
return required; | ||
} | ||
|
||
void populatePackageLists(GV& gv) | ||
{ | ||
//reqdPkgPrefixes.append("comp"); | ||
//reqdPkgPrefixes.append("spatial"); | ||
|
||
gv.unreqdPkgPrefixes.append("fbc"); | ||
gv.unreqdPkgPrefixes.append("qual"); | ||
gv.unreqdPkgPrefixes.append("groups"); | ||
} | ||
|
||
// only used by OutputSBML | ||
bool | ||
isUnknownType(std::string tc) | ||
{ | ||
// TO DO | ||
if (tc == "(Unknown SBML Type)") | ||
return true; | ||
else if (tc == "(Unknown SBML Fbc Type)") | ||
return true; | ||
else if (tc == "(Unknown SBML Groups Type)") | ||
return true; | ||
else if (tc == "(Unknown SBML Qual Type)") | ||
return true; | ||
else | ||
return false; | ||
} | ||
|
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#ifndef COMMON_FUNTICONS_INCLUDED | ||
#define COMMON_FUNTICONS_INCLUDED | ||
|
||
#include <string> | ||
|
||
#include "Variables.h" | ||
|
||
void FreeMem(GV& gv); | ||
|
||
void reportError(const std::string&id, const std::string& message, GV& gv); | ||
|
||
void displayLine(const std::string& line); | ||
|
||
mxArray * CreateIntScalar (int nValue); | ||
|
||
FieldType_t getFieldType(const char* type); | ||
|
||
bool getRequiredStatus(const std::string& prefix, GV& gv); | ||
|
||
void populatePackageLists(GV& gv); | ||
|
||
bool isUnknownType(std::string tc); | ||
|
||
#endif // COMMON_FUNTICONS_INCLUDED |
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.