Skip to content

Commit 92d8df5

Browse files
committed
Merge branch 'master' of github.com:scharlton2/iriclib
2 parents 1c7b4e6 + 407b1a5 commit 92d8df5

16 files changed

+383
-70
lines changed

appveyor.yml

+97-20
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
version: '{branch}-{build}'
22

3+
skip_tags: true
4+
5+
# To create: login to AppVeyor profile and select Account->Encrypt YAML
6+
environment:
7+
scharlton2_access_token:
8+
secure: dZo8X7uIxkv0RAieGg6J4zNyILq/3RxgzrI3rf4y3CY4rRHKHasO6FxpKI5USzs9
9+
iric_access_token:
10+
secure: jCnsDz8WNLsiCXa3BhIfDU8A5kRMruC9eUedcWKW7lOKhGGiHZYdRhaaN2cl5UNg
11+
312
image:
413
- Visual Studio 2013
514
- Visual Studio 2017
@@ -17,9 +26,10 @@ init:
1726
- set BUILD_TOOLS=OFF
1827
- FOR /F "tokens=3 delims= " %%i in ('echo %APPVEYOR_BUILD_WORKER_IMAGE%') do set YEAR=%%i
1928
- echo %YEAR%
29+
- ps: $UploadRelease = (($env:Configuration -eq "Release") -AND ($env:APPVEYOR_REPO_BRANCH -eq "master") -AND (!$env:APPVEYOR_PULL_REQUEST_NUMBER) -AND ($env:SGEN -eq "vs2013-x64"))
2030

2131
# doesn't seem to be able to use environmental vars
22-
clone_folder: C:\iricdev\lib\src\iriclib
32+
clone_folder: C:\iricdev\lib\src\iriclib-git
2333

2434
configuration:
2535
- Debug
@@ -40,6 +50,7 @@ before_build:
4050
- 7z e master.zip
4151
- rd iricdev-master
4252
- del master.zip
53+
- REM master.zip files have unix file endings
4354
- unix2dos *
4455
- copy appveyor_programs.prop programs.prop
4556
- call versions.cmd
@@ -48,27 +59,93 @@ before_build:
4859

4960
# build using cmake tools
5061
build_script:
51-
- cd %APPVEYOR_BUILD_FOLDER%
52-
- mkdir _build
53-
- cd _build
54-
- set CMAKE_PREFIX_PATH=c:\iricdev\lib\install\hdf5-%HDF5_VER%\%config%\cmake\hdf5;c:\iricdev\lib\install\cgnslib-%CGNSLIB_VER%\%config%
55-
- cmake -G %GENERATOR% -DCMAKE_INSTALL_PREFIX:PATH=%CD%/INSTALL ..
56-
- msbuild iriclib.sln /p:Configuration=%Configuration%
57-
58-
test_script:
59-
- cd %APPVEYOR_BUILD_FOLDER%\_build
60-
- set path=c:\iricdev\lib\install\hdf5-%HDF5_VER%\%config%\bin;c:\iricdev\lib\install\cgnslib-%CGNSLIB_VER%\%config%\bin;%PATH%
61-
- ctest -C %Configuration%
62-
63-
after_test:
64-
- cd %APPVEYOR_BUILD_FOLDER%\_build
65-
- msbuild INSTALL.vcxproj /p:Configuration=%Configuration%
66-
67-
# must be relative to APPVEYOR_BUILD_FOLDER
68-
artifacts:
69-
- path: _build\INSTALL
62+
- cd C:\iricdev
63+
- if "%Configuration%"=="Debug" ( msbuild /nologo /target:iriclib-git-build-%config% iricdev.proj )
64+
- if "%Configuration%"=="Release" ( msbuild /nologo /target:appveyor-iriclib-artifacts iricdev.proj )
65+
66+
after_build:
67+
- if "%Configuration%"=="Release" ( appveyor PushArtifact C:\iricdev\lib\src\iriclib-git\_artifacts\libs.zip )
7068

7169
# ??? doesn't seem to be able to use environmental vars ???
7270
# - '%LocalAppData%\NuGet\Cache' # NuGet < v3
7371
cache:
7472
- C:\iricdev\lib\install
73+
74+
on_success:
75+
- ps: |
76+
if ($UploadRelease) {
77+
# /repos/:owner/:repo/releases
78+
#
79+
$releases_url_iric = "https://api.github.com/repos/i-RIC/iriclib/releases"
80+
$releases_url_scharlton2 = "https://api.github.com/repos/scharlton2/iriclib/releases"
81+
82+
if ($env:APPVEYOR_REPO_NAME -eq "i-RIC/iriclib") {
83+
$releases_url = $releases_url_iric
84+
$access_token = $env:iric_access_token
85+
}
86+
if ($env:APPVEYOR_REPO_NAME -eq "scharlton2/iriclib") {
87+
$releases_url = $releases_url_scharlton2
88+
$access_token = $env:scharlton2_access_token
89+
}
90+
91+
# create headers dictionary
92+
$h = @{"Authorization" = "token $access_token"}
93+
94+
# get latest release tag
95+
# GET /repos/:owner/:repo/releases/latest
96+
# see https://developer.github.com/v3/repos/releases/#get-the-latest-release
97+
#
98+
$latest = (Invoke-WebRequest -Uri "$releases_url/latest" -Headers $h -Method GET).Content | ConvertFrom-Json
99+
if (! ($latest.tag_name -match "^v(?<major>0|[1-9]\d*)\.(?<minor>[0|1-9]\d*)\.(?<patch>[0|1-9]\d*)$") ) {
100+
# partially based on https://semver.org/
101+
# must be v + major.minor.patch
102+
throw "Bad tag"
103+
}
104+
105+
# Note: draft is set to true so that no notifications are sent yet
106+
107+
# create release
108+
# POST /repos/:owner/:repo/releases
109+
# see https://developer.github.com/v3/repos/releases/#create-a-release
110+
#
111+
$patch = 1 + $matches["patch"]
112+
$create = @{
113+
"tag_name" = "v" + $matches["major"] + "." + $matches["minor"] + "." + $patch;
114+
"target_commitish" = "$env:APPVEYOR_REPO_COMMIT";
115+
"name" = "iriclib " + $matches["major"] + "." + $matches["minor"] + "." + $patch
116+
"draft" = $true
117+
}
118+
$create_json = $create | ConvertTo-Json
119+
$release = Invoke-WebRequest -Uri "$releases_url" -Headers $h -Method POST -Body $create_json
120+
121+
# upload artifact (asset)
122+
# POST :server/repos/:owner/:repo/releases/:release_id/assets{?name,label}
123+
# see https://developer.github.com/v3/repos/releases/#upload-a-release-asset
124+
#
125+
$upload_uri = ($release.Content | ConvertFrom-Json).upload_url
126+
if (! ($upload_uri -match "(.*)\{\?name,label\}") ) {
127+
# expecting URI{?name,label}
128+
# ie https://uploads.github.com/repos/scharlton2/iriclib/releases/24058628/assets{?name,label}
129+
throw "Bad upload_url"
130+
}
131+
$upload_uri = $matches[1] + "?name=libs.zip"
132+
$h["Content-type"] = "application/zip"
133+
$bytes = [System.IO.File]::ReadAllBytes("$env:APPVEYOR_BUILD_FOLDER\_artifacts\libs.zip")
134+
$upload = Invoke-WebRequest -Uri $upload_uri -Headers $h -Method POST -Body $bytes
135+
136+
# Note: draft is now set to false so that notifications are sent with the correct list of assets
137+
138+
# update release
139+
# PATCH /repos/:owner/:repo/releases/:release_id
140+
# see https://developer.github.com/v3/repos/releases/#edit-a-release
141+
#
142+
$release_id = ($release.Content | ConvertFrom-Json).id
143+
$h.Remove("Content-type")
144+
$update = @{ "draft" = $false }
145+
$update_json = $update | ConvertTo-Json
146+
$release = Invoke-WebRequest -Uri "$releases_url/$release_id" -Headers $h -Method PATCH -Body $update_json
147+
148+
# display download url
149+
Write-Output "$((($release.Content | ConvertFrom-Json).assets).browser_download_url)"
150+
Get-FileHash "$env:APPVEYOR_BUILD_FOLDER\_artifacts\libs.zip"
151+
}

iric_ftoc.c

+86-16
Original file line numberDiff line numberDiff line change
@@ -681,23 +681,23 @@ void IRICLIBDLL FMNAME(cg_iric_read_grid_functional_real_cell_mul_f, CG_IRIC_REA
681681
}
682682

683683
void IRICLIBDLL FMNAME(cg_iric_writegridcoord1d_mul_f, CG_IRIC_WRITEGRIDCOORD1D_MUL_F) (int *fid, int *isize, double *x, int *ier) {
684-
int c_isize;
684+
cgsize_t c_isize;
685685
c_isize = (cgsize_t)(*isize);
686686
*ier = cg_iRIC_WriteGridCoord1d_Mul(*fid, c_isize, x);
687687
}
688688

689689
void IRICLIBDLL FMNAME(cg_iric_writegridcoord2d_mul_f, CG_IRIC_WRITEGRIDCOORD2D_MUL_F) (int *fid, int *isize, int *jsize, double *x, double *y, int *ier) {
690-
int c_isize;
691-
int c_jsize;
690+
cgsize_t c_isize;
691+
cgsize_t c_jsize;
692692
c_isize = (cgsize_t)(*isize);
693693
c_jsize = (cgsize_t)(*jsize);
694694
*ier = cg_iRIC_WriteGridCoord2d_Mul(*fid, c_isize, c_jsize, x, y);
695695
}
696696

697697
void IRICLIBDLL FMNAME(cg_iric_writegridcoord3d_mul_f, CG_IRIC_WRITEGRIDCOORD3D_MUL_F) (int *fid, int *isize, int *jsize, int *ksize, double *x, double *y, double *z, int *ier) {
698-
int c_isize;
699-
int c_jsize;
700-
int c_ksize;
698+
cgsize_t c_isize;
699+
cgsize_t c_jsize;
700+
cgsize_t c_ksize;
701701
c_isize = (cgsize_t)(*isize);
702702
c_jsize = (cgsize_t)(*jsize);
703703
c_ksize = (cgsize_t)(*ksize);
@@ -774,6 +774,28 @@ void IRICLIBDLL FMNAME(cg_iric_read_sol_baseiterative_real_mul_f, CG_IRIC_READ_S
774774
*ier = cg_iRIC_Read_Sol_BaseIterative_Real_Mul(*fid, *step, c_name, value);
775775
}
776776

777+
void IRICLIBDLL FMNAME(cg_iric_read_sol_baseiterative_stringlen_mul_f, CG_IRIC_READ_SOL_BASEITERATIVE_STRINGLEN_MUL_F) (int *fid, int *step, STR_PSTR(name), int *length, int *ier STR_PLEN(name)) {
778+
char c_name[CGIO_MAX_NAME_LENGTH+1];
779+
string_2_C_string(STR_PTR(name), STR_LEN(name),
780+
c_name, CGIO_MAX_NAME_LENGTH, ier);
781+
if (*ier) return;
782+
783+
*ier = cg_iRIC_Read_Sol_BaseIterative_StringLen_Mul(*fid, *step, c_name, length);
784+
}
785+
786+
void IRICLIBDLL FMNAME(cg_iric_read_sol_baseiterative_string_mul_f, CG_IRIC_READ_SOL_BASEITERATIVE_STRING_MUL_F) (int *fid, int *step, STR_PSTR(name), STR_PSTR(strvalue), int *ier STR_PLEN(name) STR_PLEN(strvalue)) {
787+
char c_name[CGIO_MAX_NAME_LENGTH+1];
788+
char c_strvalue[STRINGMAXLEN+1];
789+
string_2_C_string(STR_PTR(name), STR_LEN(name),
790+
c_name, CGIO_MAX_NAME_LENGTH, ier);
791+
if (*ier) return;
792+
793+
*ier = cg_iRIC_Read_Sol_BaseIterative_String_Mul(*fid, *step, c_name, c_strvalue);
794+
795+
if (*ier) return;
796+
string_2_F_string(c_strvalue, STR_PTR(strvalue), STR_LEN(strvalue), ier);
797+
}
798+
777799
void IRICLIBDLL FMNAME(cg_iric_read_sol_gridcoord2d_mul_f, CG_IRIC_READ_SOL_GRIDCOORD2D_MUL_F) (int *fid, int *step, double *x, double *y, int *ier) {
778800
*ier = cg_iRIC_Read_Sol_GridCoord2d_Mul(*fid, *step, x, y);
779801
}
@@ -880,6 +902,19 @@ void IRICLIBDLL FMNAME(cg_iric_write_sol_baseiterative_real_mul_f, CG_IRIC_WRITE
880902
*ier = cg_iRIC_Write_Sol_BaseIterative_Real_Mul(*fid, c_name, *value);
881903
}
882904

905+
void IRICLIBDLL FMNAME(cg_iric_write_sol_baseiterative_string_mul_f, CG_IRIC_WRITE_SOL_BASEITERATIVE_STRING_MUL_F) (int *fid, STR_PSTR(name), STR_PSTR(strvalue), int *ier STR_PLEN(name) STR_PLEN(strvalue)) {
906+
char c_name[CGIO_MAX_NAME_LENGTH+1];
907+
char c_strvalue[CGIO_MAX_NAME_LENGTH+1];
908+
string_2_C_string(STR_PTR(name), STR_LEN(name),
909+
c_name, CGIO_MAX_NAME_LENGTH, ier);
910+
if (*ier) return;
911+
string_2_C_string(STR_PTR(strvalue), STR_LEN(strvalue),
912+
c_strvalue, CGIO_MAX_NAME_LENGTH, ier);
913+
if (*ier) return;
914+
915+
*ier = cg_iRIC_Write_Sol_BaseIterative_String_Mul(*fid, c_name, c_strvalue);
916+
}
917+
883918
void IRICLIBDLL FMNAME(cg_iric_write_sol_gridcoord2d_mul_f, CG_IRIC_WRITE_SOL_GRIDCOORD2D_MUL_F) (int *fid, double *x, double *y, int *ier) {
884919
*ier = cg_iRIC_Write_Sol_GridCoord2d_Mul(*fid, x, y);
885920
}
@@ -1200,13 +1235,13 @@ void IRICLIBDLL FMNAME(cg_iric_write_bc_functionalwithname_string_mul_f, CG_IRIC
12001235
}
12011236

12021237
void IRICLIBDLL FMNAME(cg_iric_write_sol_particle_pos2d_mul_f, CG_IRIC_WRITE_SOL_PARTICLE_POS2D_MUL_F) (int *fid, int *count, double *x, double *y, int *ier) {
1203-
int c_count;
1238+
cgsize_t c_count;
12041239
c_count = (cgsize_t)(*count);
12051240
*ier = cg_iRIC_Write_Sol_Particle_Pos2d_Mul(*fid, c_count, x, y);
12061241
}
12071242

12081243
void IRICLIBDLL FMNAME(cg_iric_write_sol_particle_pos3d_mul_f, CG_IRIC_WRITE_SOL_PARTICLE_POS3D_MUL_F) (int *fid, int *count, double *x, double *y, double *z, int *ier) {
1209-
int c_count;
1244+
cgsize_t c_count;
12101245
c_count = (cgsize_t)(*count);
12111246
*ier = cg_iRIC_Write_Sol_Particle_Pos3d_Mul(*fid, c_count, x, y, z);
12121247
}
@@ -1980,23 +2015,23 @@ void IRICLIBDLL FMNAME(cg_iric_read_grid_functional_real_cell_f, CG_IRIC_READ_GR
19802015
}
19812016

19822017
void IRICLIBDLL FMNAME(cg_iric_writegridcoord1d_f, CG_IRIC_WRITEGRIDCOORD1D_F) (int *isize, double *x, int *ier) {
1983-
int c_isize;
2018+
cgsize_t c_isize;
19842019
c_isize = (cgsize_t)(*isize);
19852020
*ier = cg_iRIC_WriteGridCoord1d(c_isize, x);
19862021
}
19872022

19882023
void IRICLIBDLL FMNAME(cg_iric_writegridcoord2d_f, CG_IRIC_WRITEGRIDCOORD2D_F) (int *isize, int *jsize, double *x, double *y, int *ier) {
1989-
int c_isize;
1990-
int c_jsize;
2024+
cgsize_t c_isize;
2025+
cgsize_t c_jsize;
19912026
c_isize = (cgsize_t)(*isize);
19922027
c_jsize = (cgsize_t)(*jsize);
19932028
*ier = cg_iRIC_WriteGridCoord2d(c_isize, c_jsize, x, y);
19942029
}
19952030

19962031
void IRICLIBDLL FMNAME(cg_iric_writegridcoord3d_f, CG_IRIC_WRITEGRIDCOORD3D_F) (int *isize, int *jsize, int *ksize, double *x, double *y, double *z, int *ier) {
1997-
int c_isize;
1998-
int c_jsize;
1999-
int c_ksize;
2032+
cgsize_t c_isize;
2033+
cgsize_t c_jsize;
2034+
cgsize_t c_ksize;
20002035
c_isize = (cgsize_t)(*isize);
20012036
c_jsize = (cgsize_t)(*jsize);
20022037
c_ksize = (cgsize_t)(*ksize);
@@ -2073,6 +2108,28 @@ void IRICLIBDLL FMNAME(cg_iric_read_sol_baseiterative_real_f, CG_IRIC_READ_SOL_B
20732108
*ier = cg_iRIC_Read_Sol_BaseIterative_Real(*step, c_name, value);
20742109
}
20752110

2111+
void IRICLIBDLL FMNAME(cg_iric_read_sol_baseiterative_stringlen_f, CG_IRIC_READ_SOL_BASEITERATIVE_STRINGLEN_F) (int *step, STR_PSTR(name), int *length, int *ier STR_PLEN(name)) {
2112+
char c_name[CGIO_MAX_NAME_LENGTH+1];
2113+
string_2_C_string(STR_PTR(name), STR_LEN(name),
2114+
c_name, CGIO_MAX_NAME_LENGTH, ier);
2115+
if (*ier) return;
2116+
2117+
*ier = cg_iRIC_Read_Sol_BaseIterative_StringLen(*step, c_name, length);
2118+
}
2119+
2120+
void IRICLIBDLL FMNAME(cg_iric_read_sol_baseiterative_string_f, CG_IRIC_READ_SOL_BASEITERATIVE_STRING_F) (int *step, STR_PSTR(name), STR_PSTR(strvalue), int *ier STR_PLEN(name) STR_PLEN(strvalue)) {
2121+
char c_name[CGIO_MAX_NAME_LENGTH+1];
2122+
char c_strvalue[STRINGMAXLEN+1];
2123+
string_2_C_string(STR_PTR(name), STR_LEN(name),
2124+
c_name, CGIO_MAX_NAME_LENGTH, ier);
2125+
if (*ier) return;
2126+
2127+
*ier = cg_iRIC_Read_Sol_BaseIterative_String(*step, c_name, c_strvalue);
2128+
2129+
if (*ier) return;
2130+
string_2_F_string(c_strvalue, STR_PTR(strvalue), STR_LEN(strvalue), ier);
2131+
}
2132+
20762133
void IRICLIBDLL FMNAME(cg_iric_read_sol_gridcoord2d_f, CG_IRIC_READ_SOL_GRIDCOORD2D_F) (int *step, double *x, double *y, int *ier) {
20772134
*ier = cg_iRIC_Read_Sol_GridCoord2d(*step, x, y);
20782135
}
@@ -2179,6 +2236,19 @@ void IRICLIBDLL FMNAME(cg_iric_write_sol_baseiterative_real_f, CG_IRIC_WRITE_SOL
21792236
*ier = cg_iRIC_Write_Sol_BaseIterative_Real(c_name, *value);
21802237
}
21812238

2239+
void IRICLIBDLL FMNAME(cg_iric_write_sol_baseiterative_string_f, CG_IRIC_WRITE_SOL_BASEITERATIVE_STRING_F) (STR_PSTR(name), STR_PSTR(strvalue), int *ier STR_PLEN(name) STR_PLEN(strvalue)) {
2240+
char c_name[CGIO_MAX_NAME_LENGTH+1];
2241+
char c_strvalue[CGIO_MAX_NAME_LENGTH+1];
2242+
string_2_C_string(STR_PTR(name), STR_LEN(name),
2243+
c_name, CGIO_MAX_NAME_LENGTH, ier);
2244+
if (*ier) return;
2245+
string_2_C_string(STR_PTR(strvalue), STR_LEN(strvalue),
2246+
c_strvalue, CGIO_MAX_NAME_LENGTH, ier);
2247+
if (*ier) return;
2248+
2249+
*ier = cg_iRIC_Write_Sol_BaseIterative_String(c_name, c_strvalue);
2250+
}
2251+
21822252
void IRICLIBDLL FMNAME(cg_iric_write_sol_gridcoord2d_f, CG_IRIC_WRITE_SOL_GRIDCOORD2D_F) (double *x, double *y, int *ier) {
21832253
*ier = cg_iRIC_Write_Sol_GridCoord2d(x, y);
21842254
}
@@ -2499,13 +2569,13 @@ void IRICLIBDLL FMNAME(cg_iric_write_bc_functionalwithname_string_f, CG_IRIC_WRI
24992569
}
25002570

25012571
void IRICLIBDLL FMNAME(cg_iric_write_sol_particle_pos2d_f, CG_IRIC_WRITE_SOL_PARTICLE_POS2D_F) (int *count, double *x, double *y, int *ier) {
2502-
int c_count;
2572+
cgsize_t c_count;
25032573
c_count = (cgsize_t)(*count);
25042574
*ier = cg_iRIC_Write_Sol_Particle_Pos2d(c_count, x, y);
25052575
}
25062576

25072577
void IRICLIBDLL FMNAME(cg_iric_write_sol_particle_pos3d_f, CG_IRIC_WRITE_SOL_PARTICLE_POS3D_F) (int *count, double *x, double *y, double *z, int *ier) {
2508-
int c_count;
2578+
cgsize_t c_count;
25092579
c_count = (cgsize_t)(*count);
25102580
*ier = cg_iRIC_Write_Sol_Particle_Pos3d(c_count, x, y, z);
25112581
}

iriclib.cpp

+21
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,18 @@ int cg_iRIC_Read_Sol_BaseIterative_Real_Mul(int fid, int step, const char* name,
741741
return f->Sol_Read_BaseIterative_Real(step, name, value);
742742
}
743743

744+
int cg_iRIC_Read_Sol_BaseIterative_StringLen_Mul(int fid, int step, const char* name, int* length)
745+
{
746+
GET_F(fid);
747+
return f->Sol_Read_BaseIterative_StringLen(step, name, length);
748+
}
749+
750+
int cg_iRIC_Read_Sol_BaseIterative_String_Mul(int fid, int step, const char* name, char* strvalue)
751+
{
752+
GET_F(fid);
753+
return f->Sol_Read_BaseIterative_String(step, name, strvalue);
754+
}
755+
744756
int cg_iRIC_Read_Sol_GridCoord2d_Mul(int fid, int step, double* x, double* y)
745757
{
746758
GET_F(fid);
@@ -821,6 +833,12 @@ int cg_iRIC_Write_Sol_BaseIterative_Real_Mul(int fid, const char *name, double v
821833
return f->Sol_Write_BaseIterative_Real(name, value);
822834
}
823835

836+
int cg_iRIC_Write_Sol_BaseIterative_String_Mul(int fid, const char *name, const char* strvalue)
837+
{
838+
GET_F(fid);
839+
return f->Sol_Write_BaseIterative_String(name, strvalue);
840+
}
841+
824842
int cg_iRIC_Write_Sol_GridCoord2d_Mul(int fid, double *x, double *y)
825843
{
826844
GET_F(fid);
@@ -907,6 +925,9 @@ int cg_iRIC_Read_BC_IndicesSize_Mul(int fid, const char* type, int num, cgsize_t
907925

908926
int cg_iRIC_Read_BC_Indices_Mul(int fid, const char* type, int num, cgsize_t* indices)
909927
{
928+
#if (CG_SIZEOF_SIZE != 32)
929+
#error CG_IRIC_READ_BC_INDICES_F and CG_IRIC_READ_BC_INDICES_MUL_F need to be updated!
930+
#endif
910931
GET_F(fid);
911932
return f->BC_Read_Indices(type, num, indices);
912933
}

0 commit comments

Comments
 (0)