Skip to content

Commit 74f04be

Browse files
committed
Add sources
1 parent f54063b commit 74f04be

101 files changed

Lines changed: 28541 additions & 1 deletion

File tree

Some content is hidden

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

.github/workflows/build.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
tags: [ 'v*' ]
7+
pull_request:
8+
branches: [ main ]
9+
10+
jobs:
11+
build:
12+
strategy:
13+
matrix:
14+
include:
15+
- name: win64
16+
image: windows-2022
17+
cmake-args: -G "Visual Studio 17 2022" -A x64
18+
- name: win32
19+
image: windows-2022
20+
cmake-args: -G "Visual Studio 17 2022" -A Win32
21+
- name: linux64
22+
image: ubuntu-20.04
23+
cmake-args: -G "Unix Makefiles"
24+
- name: darwin64
25+
image: macos-11
26+
cmake-args: -G "Unix Makefiles" -D CMAKE_OSX_ARCHITECTURES=x86_64
27+
runs-on: ${{ matrix.image }}
28+
steps:
29+
- uses: actions/checkout@v4.1.1
30+
with:
31+
submodules: recursive
32+
- run: |
33+
cmake ${{ matrix.cmake-args }} -D BUILD_SHARED_LIBS=OFF -D BUILD_TESTING=OFF -D HDF5_BUILD_CPP_LIB=OFF -D HDF5_BUILD_EXAMPLES=OFF -D HDF5_BUILD_TOOLS=OFF -D HDF5_BUILD_UTILS=OFF -D CMAKE_INSTALL_PREFIX=ThirdParty/hdf5-${{ matrix.name }}/install -D CMAKE_POLICY_DEFAULT_CMP0091=NEW -D CMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -B ThirdParty/hdf5-${{ matrix.name }}/build ThirdParty/hdf5
34+
cmake --build ./ThirdParty/hdf5-${{ matrix.name }}/build --config Release --target install
35+
- run: |
36+
cmake ${{ matrix.cmake-args }} -D CMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -D MATIO_MAT73=OFF -D MATIO_SHARED=OFF -D MATIO_WITH_HDF5=OFF -D MATIO_WITH_ZLIB=OFF -D CMAKE_INSTALL_PREFIX=ThirdParty/matio-${{ matrix.name }}/install -D CMAKE_POLICY_DEFAULT_CMP0091=NEW -B ThirdParty/matio-${{ matrix.name }}/build ThirdParty/matio
37+
cmake --build ./ThirdParty/matio-${{ matrix.name }}/build --config Release --target install
38+
- run: |
39+
cmake ${{ matrix.cmake-args }} -B ${{ matrix.name }} .
40+
cmake --build ${{ matrix.name }} --config Release
41+
ctest --test-dir ${{ matrix.name }} --build-config Release
42+
- uses: actions/upload-artifact@v4.3.1
43+
with:
44+
name: ${{ matrix.name }}
45+
path: SDF
46+
if-no-files-found: error
47+
merge:
48+
runs-on: ubuntu-20.04
49+
needs: [build]
50+
steps:
51+
- uses: actions/checkout@v4.1.1
52+
- uses: actions/download-artifact@v4.1.2
53+
with:
54+
name: win64
55+
path: SDF
56+
- uses: actions/download-artifact@v4.1.2
57+
with:
58+
name: win32
59+
path: SDF
60+
- uses: actions/download-artifact@v4.1.2
61+
with:
62+
name: linux64
63+
path: SDF
64+
- uses: actions/download-artifact@v4.1.2
65+
with:
66+
name: darwin64
67+
path: SDF
68+
- run: find -type f -name .gitignore -delete
69+
- uses: actions/upload-artifact@v4.3.1
70+
with:
71+
name: SDF-Modelica
72+
path: |
73+
SDF
74+
LICENSE.txt
75+
README.md
76+
if-no-files-found: error

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.idea/
2+
ThirdParty/hdf5-x86_64-windows
3+
ThirdParty/matio-x86_64-windows
4+
ThirdParty/hdf5-x86_64-linux
5+
ThirdParty/matio-x86_64-linux
6+
ThirdParty/hdf5-aarch64-linux
7+
ThirdParty/matio-aarch64-linux
8+
x86_64-windows
9+
x86_64-linux

.gitmodules

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[submodule "ThirdParty/hdf5"]
2+
path = ThirdParty/hdf5
3+
url = https://github.com/HDFGroup/hdf5.git
4+
[submodule "ThirdParty/matio"]
5+
path = ThirdParty/matio
6+
url = https://github.com/tbeu/matio.git

C/include/ModelicaSDFFunctions.h

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
#ifndef MODELICAHDF5FUNCTIONS_H_
2+
#define MODELICAHDF5FUNCTIONS_H_
3+
4+
#ifndef MODELICA_SDF_API
5+
6+
#ifdef _WIN32
7+
#define MODELICA_SDF_API __declspec(dllexport)
8+
#else
9+
#define MODELICA_SDF_API
10+
#endif
11+
12+
#endif
13+
14+
15+
#ifdef __cplusplus
16+
extern "C" {
17+
#endif
18+
19+
void read_dsres(const char *filename, const int ndatasets, const char **dataset_names, const char **dataset_units, const char *scale_unit, int nsamples, double *data);
20+
21+
void get_time_series_size_dsres(const char *filename, const char **dataset_names, int *size);
22+
23+
//extern char *error_message;
24+
25+
#define MAX_MESSAGE_LENGTH 4096
26+
27+
extern char error_message[MAX_MESSAGE_LENGTH];
28+
29+
void set_error_message(const char *msg, ...);
30+
31+
32+
MODELICA_SDF_API const char * ModelicaSDF_get_table_data_size(const char *filename, const char *dataset_name, int *size);
33+
34+
MODELICA_SDF_API const char * ModelicaSDF_read_table_data(const char *filename, const char *dataset_name, const int ndims, const char *unit, const char **scale_units, double *data);
35+
36+
37+
MODELICA_SDF_API const char * ModelicaSDF_get_time_series_size(const char *filename, const char **dataset_names, int *size);
38+
39+
MODELICA_SDF_API const char * ModelicaSDF_read_time_series(const char *filename, const int ndatasets, const char **dataset_names, const char **dataset_units, const char *scale_unit, int nsamples, double *data);
40+
41+
42+
MODELICA_SDF_API const char * ModelicaSDF_create_group(const char *filename, const char *group_name, const char *comment);
43+
44+
/*! Retrieves the dimensions of a dataset
45+
*
46+
* @param [in] filename the file name
47+
* @param [in] dataset_name the dataset name
48+
* @param [out] dims an int[32] for the dimensions
49+
*
50+
* @return the error message ("" on success)
51+
*/
52+
MODELICA_SDF_API const char * ModelicaSDF_get_dataset_dims(const char *filename, const char *dataset_name, int dims[]);
53+
54+
/*! Reads the values of a double dataset
55+
*
56+
* @param [in] filename the file name
57+
* @param [in] dataset_name the dataset name
58+
* @param [in] unit the expected unit
59+
* @param [out] buffer a buffer for the values
60+
*
61+
* @return the error message ("" on success)
62+
*/
63+
MODELICA_SDF_API const char * ModelicaSDF_read_dataset_double(const char *filename, const char *dataset_name, const char *unit, double *buffer);
64+
65+
/*! Reads the values of a integer dataset
66+
*
67+
* @param [in] filename the file name
68+
* @param [in] dataset_name the dataset name
69+
* @param [in] unit the expected unit
70+
* @param [out] buffer a buffer for the values
71+
*
72+
* @return the error message ("" on success)
73+
*/
74+
MODELICA_SDF_API const char * ModelicaSDF_read_dataset_int(const char *filename, const char *dataset_name, const char *unit, int *buffer);
75+
76+
/*! Writes a double dataset with unit and comment
77+
*
78+
* @param [in] filename the file name
79+
* @param [in] dataset_name the dataset name
80+
* @param [in] ndims the number of dimensions
81+
* @param [in] dims the dimensions
82+
* @param [in] data a buffer for the values
83+
* @param [in] relative_quantity absolute if 0, otherwise relative
84+
* @param [in] unit the unit (optional)
85+
* @param [in] display_unit the display unit (optional)
86+
* @param [in] comment the comment (optional)
87+
*
88+
* @return the error message ("" on success)
89+
*/
90+
MODELICA_SDF_API const char * ModelicaSDF_make_dataset_double(
91+
const char *filename,
92+
const char *dataset_name,
93+
int ndims,
94+
const int dims[],
95+
const double *data,
96+
const char *comment,
97+
const char *display_name,
98+
const char *unit,
99+
const char *display_unit,
100+
int relative_quantity);
101+
102+
/*! Writes an integer dataset with unit and comment
103+
*
104+
* @param [in] filename the file name
105+
* @param [in] dataset_name the dataset name
106+
* @param [in] ndims the number of dimensions
107+
* @param [in] dims the dimensions
108+
* @param [in] data a buffer for the values
109+
* @param [in] relative_quantity absolute if 0, otherwise relative
110+
* @param [in] unit the unit (optional)
111+
* @param [in] display_unit the display unit (optional)
112+
* @param [in] comment the comment (optional)
113+
*
114+
* @return the error message ("" on success)
115+
*/
116+
MODELICA_SDF_API const char * ModelicaSDF_make_dataset_int(
117+
const char *filename,
118+
const char *dataset_name,
119+
int ndims,
120+
const int dims[],
121+
const int *data,
122+
const char *comment,
123+
const char *display_name,
124+
const char *unit,
125+
const char *display_unit,
126+
int relative_quantity);
127+
128+
/*! Sets a dataset as the scale for the dimension of another dataset
129+
*
130+
* @param [in] filename the file name
131+
* @param [in] dataset_name the name of the dataset
132+
* @param [in] scale_name the name of the scale dataset
133+
* @param [in] dim_name the name of the dimension
134+
* @param [in] dim the index of the dimension
135+
*
136+
* @return the error message ("" on success)
137+
*/
138+
MODELICA_SDF_API const char * ModelicaSDF_attach_scale(const char *filename, const char *dataset_name, const char *scale_name, const char *dim_name, int dim);
139+
140+
/*! Gets the length of a string attribute's value
141+
*
142+
* @param [in] filename the file name
143+
* @param [in] dataset_name the name of the dataset
144+
* @param [in] attr_name the name of the attribute
145+
* @param [out] size the length of the string attribute's value
146+
*
147+
* @return the error message ("" on success)
148+
*/
149+
MODELICA_SDF_API const char * ModelicaSDF_get_attribute_string_length(const char *filename, const char *dataset_name, const char *attr_name, int *size);
150+
151+
/*! Gets the value of a string attribute of a dataset
152+
*
153+
* @param [in] filename the file name
154+
* @param [in] dataset_name the name of the dataset
155+
* @param [in] attr_name the name of the attribute
156+
* @param [out] data the value of the attribute
157+
*
158+
* @return the error message ("" on success)
159+
*/
160+
MODELICA_SDF_API const char * ModelicaSDF_get_attribute_string(const char *filename, const char *dataset_name, const char *attr_name, char **data);
161+
162+
/*! Sets the value of a string attribute of a dataset
163+
*
164+
* @param [in] filename the file name
165+
* @param [in] dataset_name the name of the dataset
166+
* @param [in] attr_name the name of the attribute
167+
* @param [in] data the value of the attribute
168+
*
169+
* @return the error message ("" on success)
170+
*/
171+
MODELICA_SDF_API const char * ModelicaSDF_set_attribute_string(const char *filename, const char *dataset_name, const char *attr_name, const char *data);
172+
173+
174+
#ifdef __cplusplus
175+
}
176+
#endif
177+
178+
#endif /*MODELICAHDF5FUNCTIONS_H_*/

0 commit comments

Comments
 (0)