Skip to content

Commit fe6c5bb

Browse files
Merge pull request #45 from jacobwilliams/develop
Develop
2 parents 445986c + cca0898 commit fe6c5bb

19 files changed

+1170
-148
lines changed

.github/workflows/CI.yml

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
uses: actions/setup-python@v1 # Use pip to install latest CMake, & FORD/Jin2For, etc.
2525
with:
2626
python-version: ${{ matrix.python-version }}
27-
27+
2828
- name: Setup Graphviz
2929
uses: ts-graphviz/setup-graphviz@v1
3030

@@ -49,23 +49,41 @@ jobs:
4949
run: |
5050
FoBiS.py build -f bspline-fortran.fobis -mode tests-gnu
5151
52-
- name: Run tests
53-
run: |
54-
./bin/bspline_test
55-
./bin/bspline_test_2
56-
./bin/bspline_extrap_test
57-
./bin/test_regrid
58-
./bin/knot_tests
59-
./bin/speed_test_oo
60-
./bin/speed_test
61-
./bin/test_integrate
62-
./bin/test_oo
52+
- name: bspline_test
53+
run: ./bin/bspline_test
54+
55+
- name: bspline_test_2
56+
run: ./bin/bspline_test_2
57+
58+
- name: bspline_extrap_test
59+
run: ./bin/bspline_extrap_test
60+
61+
- name: test_regrid
62+
run: ./bin/test_regrid
63+
64+
- name: knot_tests
65+
run: ./bin/knot_tests
66+
67+
- name: speed_test_oo
68+
run: ./bin/speed_test_oo
69+
70+
- name: speed_test
71+
run: ./bin/speed_test
72+
73+
- name: test_integrate
74+
run: ./bin/test_integrate
75+
76+
- name: test_oo
77+
run: ./bin/test_oo
78+
79+
- name: dbint4_test
80+
run: ./bin/dbint4_test
6381

6482
- name: Build documentation
6583
run: ford ./bspline-fortran.md
6684

6785
- name: Deploy Documentation
68-
if: github.ref == 'refs/heads/master'
86+
if: github.ref == 'refs/heads/master'
6987
uses: JamesIves/github-pages-deploy-action@4.1.0
7088
with:
7189
branch: gh-pages # The branch the action should deploy to.

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,10 @@ build
3333
doc
3434
lib
3535
bin
36+
install
3637

3738
# mac
3839
*.DS_Store
3940

4041
# vscode
41-
/.vscode
42+
/.vscode

CMakeLists.txt

Lines changed: 146 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,152 @@
22
# Basic CMake configuration file for bspline-fortran
33
#
44

5-
cmake_minimum_required (VERSION 2.8)
5+
cmake_minimum_required(VERSION 3.11)
66

7-
set(PROJECT_DESCRIPTION "Multidimensional B-Spline Interpolation of Data on a Regular Grid")
8-
set(PROJECT_URL "https://github.com/jacobwilliams/bspline-fortran")
7+
set( CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/install"
8+
CACHE STRING "Select where to install the library and test programs." )
99

10-
project (bspline-fortran NONE)
11-
enable_language (Fortran)
10+
project(bspline-fortran NONE)
1211

13-
file(GLOB SOURCES src/*.f90)
14-
add_library(${PROJECT_NAME} ${SOURCES})
12+
# Real and Integer kinds
13+
SET(BSPLINE_REAL_KIND "REAL64" CACHE STRING "Real kind parameter")
14+
SET_PROPERTY(CACHE BSPLINE_REAL_KIND PROPERTY STRINGS REAL32 REAL64 REAL128)
15+
if(${BSPLINE_REAL_KIND} MATCHES "REAL32")
16+
add_definitions(-DREAL32)
17+
elseif(${BSPLINE_REAL_KIND} MATCHES "REAL64")
18+
add_definitions(-DREAL64)
19+
elseif(${BSPLINE_REAL_KIND} MATCHES "REAL128")
20+
add_definitions(-DREAL128)
21+
endif()
22+
SET(BSPLINE_INT_KIND "INT32" CACHE STRING "Integer kind parameter")
23+
SET_PROPERTY(CACHE BSPLINE_INT_KIND PROPERTY STRINGS INT8 INT16 INT32 INT64)
24+
if(${BSPLINE_INT_KIND} MATCHES "INT8")
25+
add_definitions(-DINT8)
26+
elseif(${BSPLINE_INT_KIND} MATCHES "INT16")
27+
add_definitions(-DINT16)
28+
elseif(${BSPLINE_INT_KIND} MATCHES "INT32")
29+
add_definitions(-DINT32)
30+
elseif(${BSPLINE_INT_KIND} MATCHES "INT64")
31+
add_definitions(-DINT64)
32+
endif()
33+
34+
# Use MSVS folders to organize projects on windows
35+
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
36+
37+
set( LIB_NAME ${CMAKE_PROJECT_NAME} )
38+
set( PROJECT_DESCRIPTION
39+
"Multidimensional B-Spline Interpolation of Data on a Regular Grid" )
40+
set( PROJECT_URL "https://github.com/jacobwilliams/bspline-fortran" )
41+
set( CMAKE_CONFIGURATION_TYPES "Debug" "Release" "MinSizeRel" "RelWithDebInfo" )
42+
set( CMAKE_BUILD_TYPE "Release"
43+
CACHE STRING "Select which configuration to build." )
44+
45+
enable_language(Fortran)
46+
47+
set( SOURCES
48+
src/bspline_kinds_module.F90
49+
src/bspline_module.f90
50+
src/bspline_oo_module.f90
51+
src/bspline_sub_module.f90 )
52+
53+
set( PYPLOT_SOURCES
54+
src/tests/pyplot-fortran/src/pyplot_module.f90 )
55+
56+
set( TEST_SOURCES src/tests/bspline_extrap_test.f90
57+
src/tests/bspline_test.f90
58+
src/tests/bspline_test_2.f90
59+
src/tests/dbint4_test.f90
60+
src/tests/knot_tests.f90
61+
src/tests/speed_test.f90
62+
src/tests/speed_test_oo.f90
63+
src/tests/test_integrate.f90
64+
src/tests/test_oo.f90
65+
src/tests/test_regrid.f90 )
66+
67+
set(INSTALL_MOD_DIR "lib")
68+
set(INSTALL_LIB_DIR "${INSTALL_MOD_DIR}")
69+
set(ABS_LIB_INSTALL_DIR "\${CMAKE_INSTALL_PREFIX}/${INSTALL_LIB_DIR}")
70+
set(MODULE_DIR "${CMAKE_BINARY_DIR}/lib")
71+
72+
if( "${CMAKE_SYSTEM_NAME}" MATCHES "Darwin" )
73+
set( ENABLE_DYLIBS_USE_RPATH TRUE CACHE BOOL
74+
"Enable @rpath install name for dylibs" )
75+
mark_as_advanced( ENABLE_DYLIBS_USE_RPATH )
76+
endif()
77+
78+
if( ENABLE_DYLIBS_USE_RPATH )
79+
set( CMAKE_MACOSX_RPATH TRUE )
80+
else()
81+
set( CMAKE_INSTALL_NAME_DIR
82+
"${ABS_LIB_INSTALL_DIR}" )
83+
endif()
84+
85+
add_library( ${LIB_NAME} SHARED ${SOURCES} )
86+
add_library( ${LIB_NAME}-static STATIC ${SOURCES} )
87+
88+
set_target_properties(${LIB_NAME}-static
89+
PROPERTIES
90+
OUTPUT_NAME "${LIB_NAME}"
91+
if(NOT MSVC_IDE)
92+
PREFIX lib
93+
endif()
94+
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
95+
Fortran_MODULE_DIRECTORY ${MODULE_DIR})
96+
97+
set_target_properties(${LIB_NAME}
98+
PROPERTIES
99+
OUTPUT_NAME "${LIB_NAME}"
100+
if(NOT MSVC_IDE)
101+
PREFIX lib
102+
endif()
103+
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
104+
Fortran_MODULE_DIRECTORY ${CMAKE_BINARY_DIR})
105+
106+
set( BSPLINE_TESTS TRUE CACHE BOOL "Enable the unit tests." )
107+
108+
if( BSPLINE_TESTS )
109+
110+
# we also need to build the pyplot-fortran library,
111+
# since that is needed by some of the tests:
112+
set( PYPLOT_LIB_NAME "pyplot-fortran" )
113+
add_library( ${PYPLOT_LIB_NAME} STATIC ${PYPLOT_SOURCES} )
114+
set_target_properties(${PYPLOT_LIB_NAME}
115+
PROPERTIES
116+
OUTPUT_NAME ${PYPLOT_LIB_NAME}
117+
if(NOT MSVC_IDE)
118+
PREFIX lib
119+
endif()
120+
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
121+
Fortran_MODULE_DIRECTORY ${MODULE_DIR})
122+
123+
# build each test program:
124+
foreach( UNIT_TEST ${TEST_SOURCES} )
125+
get_filename_component( TEST ${UNIT_TEST} NAME_WE )
126+
if(MSVC_IDE)
127+
link_directories(${CMAKE_BINARY_DIR}/lib)
128+
endif()
129+
add_executable( ${TEST} ${UNIT_TEST} )
130+
target_link_libraries( ${TEST} ${LIB_NAME}-static ${PYPLOT_LIB_NAME} )
131+
set_target_properties(${TEST}
132+
PROPERTIES
133+
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
134+
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
135+
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
136+
Fortran_MODULE_DIRECTORY ${MODULE_DIR})
137+
install(TARGETS ${TEST} ${TEST}
138+
RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
139+
endforeach()
140+
141+
endif()
142+
143+
# install library:
144+
install( TARGETS ${LIB_NAME} ${LIB_NAME}-static
145+
LIBRARY DESTINATION "${INSTALL_LIB_DIR}"
146+
ARCHIVE DESTINATION "${INSTALL_LIB_DIR}" )
147+
install( DIRECTORY "${MODULE_DIR}/" DESTINATION "${INSTALL_MOD_DIR}" )
148+
149+
# Windows settings:
150+
if(MSVC_IDE)
151+
INCLUDE_DIRECTORIES("src")
152+
SET(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fpp")
153+
endif()

LICENSE

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3333
! from the National Institute of Standards and Technology (NIST)
3434
!
3535
! The CMLIB license is given below:
36+
!
37+
!-----------------------------------------------------------------------------------------
3638

3739
The research software provided on this web site ("software") is provided by NIST as a
3840
public service. You may use, copy and distribute copies of the software in any medium,

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,11 @@ A [FoBiS](https://github.com/szaghi/FoBiS) configuration file (`bspline-fortran.
117117

118118
The full set of modes are: `static-gnu`, `static-gnu-debug`, `static-intel`, `static-intel-debug`, `shared-gnu`, `shared-gnu-debug`, `shared-intel`, `shared-intel-debug`, `tests-gnu`, `tests-gnu-debug`, `tests-intel`, `tests-intel-debug`
119119

120-
To generate the documentation using [ford](https://github.com/cmacmackin/ford), run: ```FoBis.py rule --execute makedoc -f bspline-fortran.fobis```
120+
To generate the documentation using [ford](https://github.com/Fortran-FOSS-Programmers/ford), run: ```FoBis.py rule --execute makedoc -f bspline-fortran.fobis```
121121

122122
# Documentation
123123

124-
The latest API documentation can be found [here](http://jacobwilliams.github.io/bspline-fortran/). This was generated from the source code using [FORD](https://github.com/cmacmackin/ford) (note that the build script will also generate these files).
124+
The latest API documentation can be found [here](http://jacobwilliams.github.io/bspline-fortran/). This was generated from the source code using [FORD](https://github.com/Fortran-FOSS-Programmers/ford) (note that the build script will also generate these files).
125125

126126
# License
127127

bspline-fortran.code-workspace

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"folders": [
3+
{
4+
"path": "."
5+
}
6+
],
7+
"settings": {
8+
"files.trimTrailingWhitespace": true,
9+
"editor.insertSpaces": true,
10+
"editor.tabSize": 4,
11+
"editor.trimAutoWhitespace": true
12+
}
13+
}

bspline-fortran.fobis

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ $SHARED_LIB = libbspline.so
1414
$OPTIMIZE = -O2
1515
$CSTATIC_GNU = -c -fbacktrace -Wall -Wextra -Wno-maybe-uninitialized -Wno-unused-function -pedantic -std=f2008ts
1616
$DEBUG_GNU = -O0 -g3 -Warray-bounds -Wcharacter-truncation -Wline-truncation -Wimplicit-interface -Wimplicit-procedure -Wunderflow -fcheck=all -fmodule-private -ffree-line-length-132 -fimplicit-none -fbacktrace -fdump-core -finit-real=nan -std=f2008ts -fall-intrinsics
17-
$CSTATIC_INT = -c -std15
18-
$DEBUG_INT = -O0 -debug all -check all -warn all -extend-source 132 -traceback -gen-interfaces -fpe-all=0 -fp-stack-check -fstack-protector-all -ftrapuv -no-ftz -std15
17+
$CSTATIC_INT = -c -std18 -fpp
18+
$DEBUG_INT = -O0 -debug all -check all -warn all -extend-source 132 -traceback -gen-interfaces -fpe-all=0 -fp-stack-check -fstack-protector-all -ftrapuv -no-ftz -std18
1919
$EXCLUDE_DIRS = ./src/pyplot-fortran/src/tests/
2020

2121
# modes templates

bspline-fortran.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ predocmark: <
1212
docmark_alt:
1313
docmark: !
1414
display: public
15+
private
1516
source: true
1617
graph: true
1718
exclude: pyplot_module.f90

src/bspline_kinds_module.F90

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
!*****************************************************************************************
2+
!> author: Jacob Williams
3+
! license: BSD
4+
!
5+
!### Description
6+
! Numeric kind definitions for BSpline-Fortran.
7+
8+
module bspline_kinds_module
9+
10+
use,intrinsic :: iso_fortran_env
11+
12+
implicit none
13+
14+
private
15+
16+
#ifdef REAL32
17+
integer,parameter,public :: wp = real32 !! Real working precision [4 bytes]
18+
#elif REAL64
19+
integer,parameter,public :: wp = real64 !! Real working precision [8 bytes]
20+
#elif REAL128
21+
integer,parameter,public :: wp = real128 !! Real working precision [16 bytes]
22+
#else
23+
integer,parameter,public :: wp = real64 !! Real working precision if not specified [8 bytes]
24+
#endif
25+
26+
#ifdef INT8
27+
integer,parameter,public :: ip = int8 !! Integer working precision [1 byte]
28+
#elif INT16
29+
integer,parameter,public :: ip = int16 !! Integer working precision [2 bytes]
30+
#elif INT32
31+
integer,parameter,public :: ip = int32 !! Integer working precision [4 bytes]
32+
#elif INT64
33+
integer,parameter,public :: ip = int64 !! Integer working precision [8 bytes]
34+
#else
35+
integer,parameter,public :: ip = int32 !! Integer working precision if not specified [4 bytes]
36+
#endif
37+
38+
!*****************************************************************************************
39+
end module bspline_kinds_module
40+
!*****************************************************************************************

src/bspline_kinds_module.f90

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)