Skip to content

Commit a093c24

Browse files
author
meihuisu
committed
add UWPKFCVM
1 parent 58d3c59 commit a093c24

File tree

9 files changed

+136
-1
lines changed

9 files changed

+136
-1
lines changed

configure.ac

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,12 @@ AC_ARG_ENABLE([model-uwlinca],
194194
[enable_model_uwlinca=yes],
195195
[enable_model_uwlinca=no])
196196

197+
AC_ARG_ENABLE([model-uwpkfcvm],
198+
[AS_HELP_STRING([--enable-model-uwpkfcvm],
199+
[enable model SCEC UWLINCA])],
200+
[enable_model_uwpkfcvm=yes],
201+
[enable_model_uwpkfcvm=no])
202+
197203
AC_ARG_ENABLE([model-uwsfbcvm],
198204
[AS_HELP_STRING([--enable-model-uwsfbcvm],
199205
[enable model SCEC UWSFBCVM])],
@@ -735,6 +741,23 @@ AC_ARG_WITH([uwlinca-model-path],
735741
[UWLINCA_MODEL="/usr/uwlinca/src"])
736742
fi
737743

744+
# Get SCEC UWPKFCVM library and include locations
745+
if test "x$enable_model_uwpkfcvm" = xyes; then
746+
AC_ARG_WITH([uwpkfcvm-include-path],
747+
[AS_HELP_STRING([--with-uwpkfcvm-include-path],
748+
[location of the SCEC UWPKFCVM headers])],
749+
[UWLINCA_INCL="-I$withval"],
750+
[UWLINCA_INCL="/usr/include/uwpkfcvm"])
751+
AC_ARG_WITH([uwpkfcvm-lib-path],
752+
[AS_HELP_STRING([--with-uwpkfcvm-lib-path], [location of the SCEC UWPKFCVM libraries])],
753+
[UWLINCA_LIB="-L$withval -luwpkfcvm"],
754+
[UWLINCA_LIB="-luwpkfcvm"])
755+
AC_ARG_WITH([uwpkfcvm-model-path],
756+
[AS_HELP_STRING([--with-uwpkfcvm-model-path], [location of the UWPKFCVM model files])],
757+
[UWLINCA_MODEL="$withval"],
758+
[UWLINCA_MODEL="/usr/uwpkfcvm/src"])
759+
fi
760+
738761
# Get SCEC CANVAS library and include locations
739762
if test "x$enable_model_canvas" = xyes; then
740763
AC_ARG_WITH([canvas-include-path],
@@ -1368,6 +1391,23 @@ else
13681391
AM_CONDITIONAL(UCVM_AM_ENABLE_UWLINCA, [test x"$enable_model_uwlinca" = xyes])
13691392
fi
13701393

1394+
if test "x$enable_static" = xyes; then
1395+
# Check optional SCEC UWPKFCVM installation
1396+
if test "x$enable_model_uwpkfcvm" = xyes; then
1397+
# Setup compiler/linker flags
1398+
CFLAGS="$UWPKFCVM_INCL $CFLAGS"
1399+
LDFLAGS="$UWPKFCVM_LIB $LDFLAGS"
1400+
1401+
echo "Checking for SCEC UWPKFCVM"
1402+
AC_CHECK_HEADER(uwpkfcvm.h,[],[AC_MSG_ERROR(["SCEC UWPKFCVM header not found; use --with-uwpkfcvm-include-path"])],[AC_INCLUDES_DEFAULT])
1403+
else
1404+
AM_CONDITIONAL(UCVM_AM_ENABLE_UWPKFCVM, false)
1405+
fi
1406+
else
1407+
AM_CONDITIONAL(UCVM_AM_ENABLE_UWPKFCVM, [test x"$enable_model_uwpkfcvm" = xyes])
1408+
fi
1409+
1410+
13711411
if test "x$enable_static" = xyes; then
13721412
# Check optional SCEC CANVAS installation
13731413
if test "x$enable_model_canvas" = xyes; then

examples/programs/ucvm/Makefile.am

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ bin_PROGRAMS += run_ucvm_query_uwlinca.sh
1818
run_ucvm_query_uwlinca_sh_SOURCES = run_ucvm_query_uwlinca.sh
1919
endif
2020

21+
if UCVM_AM_ENABLE_UWPKFCVM
22+
bin_PROGRAMS += run_ucvm_query_UWPKFCVM.sh
23+
run_ucvm_query_uwpkfcvm_sh_SOURCES = run_ucvm_query_uwpkfcvm.sh
24+
endif
25+
2126
if UCVM_AM_ENABLE_SJFZ
2227
bin_PROGRAMS += run_ucvm_query_sjfz.sh
2328
run_ucvm_query_sjfz_sh_SOURCES = run_ucvm_query_sjfz.sh
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
3+
if [ -z "$UCVM_INSTALL_PATH" ]; then
4+
echo "Need to set UCVM_INSTALL_PATH to run >" ${0##*/}
5+
exit
6+
fi
7+
source $UCVM_INSTALL_PATH/conf/ucvm_env.sh
8+
9+
BIN_DIR=${UCVM_INSTALL_PATH}/bin
10+
CONF_DIR=${UCVM_INSTALL_PATH}/conf
11+
TEST_DIR=${UCVM_INSTALL_PATH}/tests/inputs
12+
MODEL=uwpkfcvm
13+
14+
expect=$(mktemp) || exit 1
15+
result=$(mktemp) || (trap 'rm -f "$expect"'; exit 1)
16+
17+
${BIN_DIR}/ucvm_query -m ${MODEL} -f ${CONF_DIR}/ucvm.conf < ${TEST_DIR}/test_latlons.txt > $result 2>&1
18+
${BIN_DIR}/ucvm_query -m ${MODEL} -f ${CONF_DIR}/ucvm.conf < ${TEST_DIR}/test_latlons_uwpkfcvm_gd.txt >> $result 2>&1
19+
20+
cat > $expect << EOF_EXPECTED_RESULT
21+
EOF_EXPECTED_RESULT
22+
23+
echo "Running examples_programs_ucvm ucvm_query_uwpkfcvm"
24+
if diff $result $expect > /dev/null 2>&1
25+
then
26+
echo [SUCCESS]
27+
else
28+
echo [FAILURE]
29+
fi
30+
31+
trap 'rm -f "$expect" "$result"' exit
32+

setup/setup.list

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,20 @@
33
"Version": "25.7"
44
},
55
"models": {
6+
"UWPKFCVM": {
7+
"Version": "1.0.0",
8+
"Abbreviation": "uwpkfcvm",
9+
"Size": "8.2M",
10+
"Path": "uwpkfcvm",
11+
"URL": "https://g-3a9041.a78b8.36fe.data.globus.org/ucvm/v26_2/model/uwpkfcvm.tar.gz",
12+
"ConfigureEnv": [ "UCVM_INSTALL_PATH","UCVM_SRC_PATH"],
13+
"ConfigureFlags": "--with-proj-libdir=${UCVM_INSTALL_PATH}/lib/proj/lib --with-proj-incdir=${UCVM_INSTALL_PATH}/lib/proj/include --with-tiff-libdir=${UCVM_INSTALL_PATH}/lib/tiff/lib --with-tiff-incdir=${UCVM_INSTALL_PATH}/lib/tiff/include --with-sqlite-libdir=${UCVM_INSTALL_PATH}/lib/sqlite/lib --with-sqlite-incdir=${UCVM_INSTALL_PATH}/lib/sqlite/include",
14+
"UCVMConfigureFlags": "--enable-model-uwpkfcvm --with-uwpkfcvm-lib-path=${UCVM_INSTALL_PATH}/model/uwpkfcvm/lib --with-uwpkfcvm-include-path=${UCVM_INSTALL_PATH}/model/uwpkfcvm/include",
15+
"Ask": "yes",
16+
"Libraries": ["proj"],
17+
"md5sum": "26544214e1ca416b300faf31dbcf9b9e",
18+
"Order": 29
19+
},
620
"UWSFBCVM": {
721
"Version": "1.0",
822
"Abbreviation": "uwsfbcvm",

src/ucvm/Makefile.am

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ if UCVM_AM_ENABLE_UWLINCA
9191
AM_CFLAGS += -D_UCVM_ENABLE_UWLINCA
9292
endif
9393

94+
# UWPKFCVM includes
95+
if UCVM_AM_ENABLE_UWPKFCVM
96+
AM_CFLAGS += -D_UCVM_ENABLE_UWPKFCVM
97+
endif
98+
9499
# CANVAS includes
95100
if UCVM_AM_ENABLE_CANVAS
96101
AM_CFLAGS += -D_UCVM_ENABLE_CANVAS

src/ucvm/ucvm_dtypes.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090

9191
#define UCVM_MODEL_SFCVM "sfcvm"
9292
#define UCVM_MODEL_UWLINCA "uwlinca"
93+
#define UCVM_MODEL_UWPKFCVM "uwpkfcvm"
9394
#define UCVM_MODEL_CANVAS "canvas"
9495
#define UCVM_MODEL_UWSFBCVM "uwsfbcvm"
9596

src/ucvm/ucvm_model_plugin.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,15 @@
143143
extern int uwlinca_setparam;
144144
#endif
145145

146+
#ifdef _UCVM_ENABLE_UWPKFCVM
147+
extern int uwpkfcvm_init;
148+
extern int uwpkfcvm_query;
149+
extern int uwpkfcvm_finalize;
150+
extern int uwpkfcvm_version;
151+
extern int uwpkfcvm_config;
152+
extern int uwpkfcvm_setparam;
153+
#endif
154+
146155
#ifdef _UCVM_ENABLE_CANVAS
147156
extern int canvas_init;
148157
extern int canvas_query;
@@ -519,6 +528,20 @@ int ucvm_plugin_model_init(int id, ucvm_modelconf_t *conf) {
519528
}
520529
}
521530
#endif
531+
#ifdef _UCVM_ENABLE_UWPKFCVM
532+
if (strcmp(conf->label, UCVM_MODEL_UWPKFCVM) == 0) {
533+
pptr->model_init = &uwpkfcvm_init;
534+
pptr->model_query = &uwpkfcvm_query;
535+
pptr->model_finalize = &uwpkfcvm_finalize;
536+
pptr->model_version = &uwpkfcvm_version;
537+
pptr->model_config = &uwpkfcvm_config;
538+
pptr->model_setparam = &uwpkfcvm_setparam;
539+
if ((*pptr->model_init)(conf->config, conf->label) != 0) {
540+
fprintf(stderr, "Failed to initialize model, %s.\n", conf->label);
541+
return UCVM_CODE_ERROR;
542+
}
543+
}
544+
#endif
522545
#ifdef _UCVM_ENABLE_CANVAS
523546
if (strcmp(conf->label, UCVM_MODEL_CANVAS) == 0) {
524547
pptr->model_init = &canvas_init;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
-122.087 37.8179 0.0
2+
-122.087 37.8179 100.0
3+
-122.087 37.8179 287.734
4+
-122.087 37.8179 500.0
5+
-122.087 37.8179 1000.0
6+
-122.087 37.8179 2000.0
7+
-122.087 37.8179 5000.0
8+
-121.5435 37.572 0.0
9+
-121.5435 37.572 500.0
10+
-121.5435 37.572 790.849
11+
-121.5435 37.572 1000.0
12+
-121.5435 37.572 2000.0
13+
-121.5435 37.572 5000.0

ucvm_setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ def installConfigMakeInstall(tarname, ucvmpath, type, config_data):
236236
os.chdir(workpath + "/" + config_data["Path"])
237237
callAndRecord(["cd", workpath + "/" + config_data["Path"]], True)
238238

239-
libtoolize_list=["sfcvm","cvms5","cvmh","cs248","uwlinca"]
239+
libtoolize_list=["sfcvm","cvms5","cvmh","cs248","uwlinca","uwpkfcvm"]
240240
autoreconf_list=["sfcvm","cca","cs248"]
241241
skip_conf_list = ["openssl","netcdf"]
242242

@@ -595,6 +595,8 @@ def _addInstallNameTool_bash(modelsToInstall, librariesToInstall):
595595
str=str+"install_name_tool -change libcvmhvbn.so ${MY_UCVM_INSTALL_PATH}/model/cvmhvbn/lib/libcvmhvbn.so $1\n"
596596
if "SFCVM" in modelsToInstall:
597597
str=str+"install_name_tool -change libsfcvm.so ${MY_UCVM_INSTALL_PATH}/model/sfcvm/lib/libsfcvm.so $1\n"
598+
if "UWPKFCVM" in modelsToInstall:
599+
str=str+"install_name_tool -change libuwpkfcvm.so ${MY_UCVM_INSTALL_PATH}/model/uwpkfcvm/lib/libuwpkfcvm.so $1\n"
598600
if "UWLINCA" in modelsToInstall:
599601
str=str+"install_name_tool -change libuwlinca.so ${MY_UCVM_INSTALL_PATH}/model/uwlinca/lib/libuwlinca.so $1\n"
600602
if "CVMHSMBN" in modelsToInstall:

0 commit comments

Comments
 (0)