Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dynamic spline core #62

Merged
merged 228 commits into from
Nov 23, 2022
Merged
Show file tree
Hide file tree
Changes from 224 commits
Commits
Show all changes
228 commits
Select commit Hold shift + click to select a range
9d97b17
tmp pyspline as corespline
j042 Sep 28, 2022
ec97432
add base and start extending nurbs
j042 Sep 28, 2022
818972b
add rawptr based grid points
j042 Sep 28, 2022
5925e61
py_spline, dynamic spline
j042 Sep 28, 2022
d414d0e
start migrating helpers
j042 Sep 28, 2022
07bf63c
currentproperties
j042 Sep 28, 2022
c878832
ext rawptr wrapper
j042 Sep 28, 2022
9eae2d9
add more type alias
j042 Sep 28, 2022
c4bdbfa
name change
j042 Sep 28, 2022
efbf7ed
ext wip
j042 Sep 29, 2022
0604eed
format
j042 Sep 29, 2022
52efd3b
rm const
j042 Sep 29, 2022
4800539
add basic functions
j042 Sep 29, 2022
810a8fd
separate non universal operations
j042 Sep 29, 2022
e953317
add alias
j042 Sep 29, 2022
935d8e8
interface ext wip
j042 Sep 29, 2022
fc0cf72
add dynamic init of bspline
j042 Sep 30, 2022
d6e45c1
format
j042 Sep 30, 2022
d2c386a
update error message
j042 Sep 30, 2022
f7a3a26
ext whatami
j042 Sep 30, 2022
630a6d6
enable bezier init
j042 Sep 30, 2022
7ab6c4d
rational bezier rough draft
j042 Sep 30, 2022
e14ce11
format
j042 Sep 30, 2022
ac5e472
fix typo
j042 Sep 30, 2022
d4d4673
add more base interface
j042 Oct 3, 2022
fb7ebe6
extend abstract funcs
j042 Oct 3, 2022
ec5ea99
rename member and add CoreSpline based ctor
j042 Oct 3, 2022
e9e4cd9
format
j042 Oct 3, 2022
cf8495f
add const
j042 Oct 3, 2022
52782a8
add add and compose
j042 Oct 3, 2022
7c9f61a
base copy ctor
j042 Oct 3, 2022
85eeaf2
ext rational bezier
j042 Oct 3, 2022
9c48f12
add add and compose
j042 Oct 3, 2022
b1c2f34
more abstract fn
j042 Oct 3, 2022
eb54a1f
impl split der bez_patch_extr
j042 Oct 3, 2022
a98e7c8
edited extraction
j042 Oct 3, 2022
bf576f4
name change
j042 Oct 3, 2022
f134c64
add bez patches extraction
j042 Oct 3, 2022
8d66978
update available functions
j042 Oct 3, 2022
faec769
offset, of course
j042 Oct 3, 2022
8a83bd0
compiling proximity
j042 Oct 3, 2022
981b386
update splinelib
j042 Oct 4, 2022
b17cf9d
add NSuppoer
j042 Oct 4, 2022
325e73d
add nsupport helper
j042 Oct 4, 2022
6a2a166
ext connections
j042 Oct 4, 2022
9979560
format
j042 Oct 4, 2022
7b3f49e
basis and support
j042 Oct 4, 2022
cd7f3c7
format
j042 Oct 4, 2022
0fe58e8
basis and support
j042 Oct 4, 2022
5c496e6
format
j042 Oct 4, 2022
323d437
return value
j042 Oct 4, 2022
ae92292
add basis and support
j042 Oct 4, 2022
19b0182
include include
j042 Oct 5, 2022
80a580e
constants
j042 Oct 5, 2022
50262ea
constants and constexpr
j042 Oct 5, 2022
88fd1f5
add verbose query
j042 Oct 5, 2022
a2f8764
verbose proximity
j042 Oct 5, 2022
f76b683
add verbose query, enum as int
j042 Oct 5, 2022
2f327f4
para bounds for splines w/o kvs is [0,1]
j042 Oct 5, 2022
656ac99
add kdtree planting
j042 Oct 5, 2022
8d1aa93
add kdtree planting and verbose query
j042 Oct 5, 2022
0444b89
abstract kdt planting and verbose q
j042 Oct 5, 2022
b8f26b1
if constexpr to support bezman
j042 Oct 5, 2022
b3227d6
ext proximity
j042 Oct 5, 2022
c739707
init proximity
j042 Oct 5, 2022
55e865a
adjustments to support bezman types
j042 Oct 5, 2022
f17f17a
add proximities
j042 Oct 5, 2022
973aa80
update napf
j042 Oct 5, 2022
56ce595
make core unique_ptr
j042 Oct 6, 2022
0aec6fd
rm typenaem
j042 Oct 6, 2022
9bcbb5b
format
j042 Oct 6, 2022
a11a645
input dim check
j042 Oct 6, 2022
31e7ac0
switch
j042 Oct 6, 2022
777a552
bezier full switches
j042 Oct 6, 2022
8033cf9
full switches
j042 Oct 6, 2022
f8310be
full switch
j042 Oct 6, 2022
a07b50b
full writch
j042 Oct 6, 2022
06ba1dd
format
j042 Oct 6, 2022
e9accab
fixtypo
j042 Oct 6, 2022
7c9ede5
make compiler happy
j042 Oct 6, 2022
5f2d28c
extend extract dim and composition derivative
j042 Oct 6, 2022
b1786ec
bind extractdim compositionderivative
j042 Oct 6, 2022
8dcea09
Compiler warnings and slight changes to CMakeLists
jzwar Oct 17, 2022
ed0da28
rm .swp
j042 Oct 24, 2022
38462da
rm splinepy_more
j042 Oct 24, 2022
d56d9d2
Merge pull request #64 from tataratat/lets-inherit-compiler-warnings
j042 Oct 24, 2022
ec601a2
resolution should be >2
j042 Oct 24, 2022
4aa150e
rm unused
j042 Oct 24, 2022
cc35e6f
Apply suggestions from code review
j042 Oct 24, 2022
c859606
Merge branch 'lets-inherit' of github.com:tataratat/splinepy into let…
j042 Oct 24, 2022
b525774
prepend splinepy
j042 Oct 24, 2022
117820a
append Type
j042 Oct 24, 2022
e365181
rm unused
j042 Oct 24, 2022
60baacb
avoid splinelib specific types
j042 Oct 24, 2022
f507a2e
separate createbez
j042 Oct 24, 2022
955240e
separate create
j042 Oct 24, 2022
2ffd66a
fix comments and rm unused
j042 Oct 24, 2022
b6f91ce
tmp cmake fix
j042 Oct 24, 2022
4f2c743
add config template
j042 Oct 24, 2022
14e59be
add config
j042 Oct 24, 2022
97134e4
prepare to export
j042 Oct 24, 2022
f11eba5
enable standalone
j042 Oct 24, 2022
2f633a7
new core begins
j042 Oct 24, 2022
2265d6e
rename rawptr
j042 Oct 24, 2022
e10b4cd
edit compile options
j042 Oct 24, 2022
b82f4af
add bezman using add_subd
j042 Oct 24, 2022
35456ae
edit vars
j042 Oct 24, 2022
498a57e
link splinepy
j042 Oct 24, 2022
74abb0e
c++20 because of virtual constexpr
j042 Oct 24, 2022
761380e
add namespace
j042 Oct 24, 2022
82c703c
format
j042 Oct 25, 2022
df5dd2a
mv and edit
j042 Oct 25, 2022
0c18651
add Core() and current_identities
j042 Nov 8, 2022
f30c60f
add and edit
j042 Nov 8, 2022
256377d
add preprendlog
j042 Nov 8, 2022
b3468ab
fix typo
j042 Nov 8, 2022
48e25eb
add const version of Core()
j042 Nov 8, 2022
0a6c3fe
update to newcore structure
j042 Nov 8, 2022
25ab4ff
temporary mv
j042 Nov 8, 2022
c32962c
fixtypo
j042 Nov 8, 2022
69d70a9
rm old
j042 Nov 8, 2022
74dd4e3
add abs_fname
j042 Nov 8, 2022
15cdf9a
update to ioutils
j042 Nov 8, 2022
8dc91ea
update - importable without error
j042 Nov 8, 2022
91e645a
add data.py
j042 Nov 8, 2022
5396708
fix path
j042 Nov 8, 2022
519e5f4
add copy=False
j042 Nov 14, 2022
e7968ff
WIP use more super and add helpers
j042 Nov 14, 2022
b7729fe
rm sync
j042 Nov 14, 2022
610f3bf
fix typo
j042 Nov 14, 2022
3bcaf57
add properties and helpers
j042 Nov 14, 2022
5b9417a
update WIP
j042 Nov 15, 2022
e8dd4eb
none remover
j042 Nov 15, 2022
8172810
add settings
j042 Nov 16, 2022
4e1c2f0
edit uniq and further updates
j042 Nov 16, 2022
3361094
less
j042 Nov 16, 2022
f25a2e7
add input check and format
j042 Nov 16, 2022
a5da7b6
rm funcs and update existing
j042 Nov 16, 2022
3a68728
add default_data
j042 Nov 16, 2022
30686de
default nthreads
j042 Nov 16, 2022
ff3c62f
norml2 is always positive
j042 Nov 16, 2022
ca6d2dd
add input check, move ctor, pickle support
j042 Nov 16, 2022
0e5464d
update WIP
j042 Nov 16, 2022
290cbd9
fix typos and exception for pure Spline
j042 Nov 16, 2022
f12b216
missing import
j042 Nov 17, 2022
b362e46
add SameSplineWithKnotVectors
j042 Nov 18, 2022
0105a60
format, add inline, add list to vec
j042 Nov 18, 2022
f6db62c
support multiple spline export
j042 Nov 18, 2022
8222417
add to init
j042 Nov 18, 2022
1bc4c3d
format
j042 Nov 18, 2022
cd2cf75
bind splinelib multiple spline export
j042 Nov 18, 2022
ecad50e
mv and edit general spline functions
j042 Nov 18, 2022
895f5fa
add putmote para dim as separate func
j042 Nov 18, 2022
2524fd4
add sync_from_core
j042 Nov 18, 2022
b223a64
add namespace
j042 Nov 18, 2022
7aeed4d
17 for nested namespace
j042 Nov 18, 2022
1d57b83
lots of const
j042 Nov 18, 2022
1e50117
add separate fitting
j042 Nov 18, 2022
5e0781d
add yapf config
j042 Nov 18, 2022
026e499
add docs and NAME_TO_TYPE
j042 Nov 18, 2022
5d10298
edit/update bspline
j042 Nov 18, 2022
eced40c
some workaround to provide conversion sheet
j042 Nov 18, 2022
4746f6d
to singular
j042 Nov 18, 2022
3ed4dbc
change WIP
j042 Nov 18, 2022
d348266
fitting as classmethod and updats
j042 Nov 18, 2022
d0e8d15
fix typos
j042 Nov 18, 2022
21a7ef1
add splinepy to common
j042 Nov 18, 2022
e65ddeb
nurbs inherit from bsplinebase
j042 Nov 19, 2022
59c4e3d
add bezierbase
j042 Nov 19, 2022
2c8930c
update rb
j042 Nov 19, 2022
aaacf3a
bind bindings
j042 Nov 19, 2022
37304db
add more info
j042 Nov 19, 2022
872bcf9
fix typo
j042 Nov 19, 2022
fba147c
add composition derivative
j042 Nov 19, 2022
da545f3
thank you so much, good bye
j042 Nov 19, 2022
19c6dd9
thank you so much, good bye for now
j042 Nov 19, 2022
4b6acf8
fix
j042 Nov 21, 2022
f538ae9
init takes cps, not wcps
j042 Nov 21, 2022
0e84af7
update reference answers and new function name
j042 Nov 21, 2022
21c2f38
gather shortcuts and deprecated in one place
j042 Nov 21, 2022
440a60d
rm unnecessary imports
j042 Nov 21, 2022
de75204
format run
j042 Nov 21, 2022
f975000
thanks flake8
j042 Nov 21, 2022
931dba9
flake8
j042 Nov 21, 2022
f58bba5
write a new one
j042 Nov 21, 2022
b1d80ba
flake and import names
j042 Nov 21, 2022
6d92b32
Merge pull request #67 from tataratat/format
j042 Nov 21, 2022
998aee6
format info
j042 Nov 21, 2022
b0c7fab
format and error fix
j042 Nov 21, 2022
b484faa
edit degrees type, add base init
j042 Nov 21, 2022
c98d963
degrees are int
j042 Nov 21, 2022
1150113
degrees are int
j042 Nov 21, 2022
48a669b
edit degrees type, add base init
j042 Nov 21, 2022
56af2f6
edit degrees type and add base init
j042 Nov 21, 2022
1510d00
edit degrees types and add base init
j042 Nov 21, 2022
a2b9012
change degree types
j042 Nov 21, 2022
458c609
close and same are different
j042 Nov 21, 2022
b9116d2
use compare func from common
j042 Nov 21, 2022
85741ef
use close
j042 Nov 21, 2022
81cf2f1
enforce int
j042 Nov 21, 2022
380c601
fix typo
j042 Nov 21, 2022
7924888
use common
j042 Nov 21, 2022
b8f01ca
use common
j042 Nov 21, 2022
8b1cf91
use common
j042 Nov 21, 2022
bac7975
copy log shortcuts manually
j042 Nov 21, 2022
20f6f70
edit according to new impl
j042 Nov 21, 2022
fd5bc03
fix resize
j042 Nov 21, 2022
4afe209
add missing proximities
j042 Nov 21, 2022
b6b1e5c
edit docs
j042 Nov 21, 2022
a364fb1
update and use common
j042 Nov 21, 2022
983f8ed
format
j042 Nov 21, 2022
235e7c6
format
j042 Nov 21, 2022
61ff7d1
bye
j042 Nov 21, 2022
cf21edc
utils first
j042 Nov 21, 2022
2edf2ae
utils in setup.py
j042 Nov 21, 2022
75cfc5d
Merge pull request #66 from tataratat/ext_cmake
j042 Nov 21, 2022
036bee1
log shortcut to at creation / update examples
j042 Nov 21, 2022
2933a5c
add slots
j042 Nov 21, 2022
8cd3c2f
update examples
j042 Nov 21, 2022
a3fadef
tschuess c++20
j042 Nov 21, 2022
18679ee
tschuess warnings
j042 Nov 21, 2022
f07cc34
update setup.py
j042 Nov 23, 2022
6b1fde0
format
j042 Nov 23, 2022
cafd49f
Apply suggestions from code review
j042 Nov 23, 2022
e68661d
rm prints
j042 Nov 23, 2022
d7b9b68
minimal for push and full for PR
j042 Nov 23, 2022
a049a3e
Merge branch 'lets-inherit' of github.com:tataratat/splinepy into let…
j042 Nov 23, 2022
5b0d4a0
v up
j042 Nov 23, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 14 additions & 35 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,18 @@
### First Step
- Assign Labels : Type of PR (Bug/Feature), Scope (tiny, small,... huge)
- Request a reviewer or assign tasks
- Then start to fill the following form:
# Overview
Description

# Addressed issues
* the list
* of issues
* e.g. #200
## Addressed issues
* Issues addressed

# Description
A more detailed
description of your
changes goes here
## Showcase
A short / one-liner example to highlight the (new) feature
```
import splinepy

## Subsection
more details

### Subsubsection 2
more and more details

## New Feature Showcase
If applicable, a short / one-liner example to highlight the new feature


# Check list
### Test documentation
* [ ] Build `--minimal`
* [ ] Build
* [ ] Executed Tests
* [ ] Executed Examples

### Documentation of changes and theory
* [ ] I have updated the relevant documentations, as far as necessary.

### Style guide compliance
* [ ] Edited `C++` files formatted with clang-format (`14.x.x`+)
* [ ] Edited Python files formatted to style guide from PEP8
new, feature = splinepy.tataratat()
```

## Checklists
* [ ] Documentations are up-to-date.
* [ ] Added example(s)
* [ ] Added test(s)
40 changes: 33 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,36 @@ cmake_minimum_required(VERSION 3.12.0)

project(splinepy VERSION 0.0.2 LANGUAGES CXX)

# build options
option(SPLINEPY_COMPILE_SPLINELIB "Compile splinelib together." ON)
option(VERBOSE_MAKE "Verbose `make` output." OFF)
option(MINIMAL "Compile a minimal set of splines." OFF)
option(SPLINEPY_VERBOSE_MAKE
"Verbose `make` output. Alias to CMAKE_VERBOSE_MAKEFILE" OFF)
option(SPLINEPY_MORE "Compile a full set of splines." OFF)
option(SPLINEPY_BUILD_SHARED "build shared library for splinepy" OFF)
option(SPLINEPY_COMPILE_PYTHON "Compile python module." ON)
option(SPLINEPY_ENABLE_WARNINGS "Add warning flags" OFF)


# config
set(exe_dest "bin")
set(incl_dest "include")
set(lib_dest "lib")
set(cfg_dest "${lib_dest}/cmake/${PROJECT_NAME}")
set(gen_dir "${CMAKE_CURRENT_BINARY_DIR}/generated")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
set(version_config "${gen_dir}/${PROJECT_NAME}ConfigVersion.cmake")
set(project_config "${gen_dir}/${PROJECT_NAME}Config.cmake")
set(TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets")
set(namespace "${PROJECT_NAME}::")


# global flags
set(CMAKE_CXX_VISIBILITY_PRESET "hidden")
set(SPLINEPY_FLAGS -fPIC)
set(SPLINEPY_OPTIMIZATION_FLAGS -O3)
set(SPLINEPY_OPTIMIZATION_FLAGS $<$<NOT:$<CONFIG:Debug>>:-O3>)
set(SPLINEPY_DEFS)

# compiler specific flags
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
list(APPEND SPLINEPY_OPTIMIZATION_FLAGS -ffast-math)
set(SPLINEPY_WARNING_FLAGS
Expand All @@ -20,18 +41,23 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
-Wall -Wextra -Wmost -Wextra -Wpedantic -Wunreachable-code
-Wshadow -Wfloat-equal -Weffc++ -Wno-unused-parameter
-Wno-unused-variable)
else()
message(WARNING
"Unsupported compiler."
"splinepy is tested with GNU and Clang.")
endif()

if(SPLINEPY_ENABLE_WARNINGS)
set(SPLINEPY_FLAGS ${SPLINEPY_FLAGS} ${SPLINEPY_WARNING_FLAGS})
endif()

set(CMAKE_CXX_VISIBILITY_PRESET "hidden")
set(CMAKE_CXX_STANDARD 20)

if(VERBOSE_MAKE)
if(SPLINEPY_VERBOSE_MAKE)
set(CMAKE_VERBOSE_MAKEFILE ON)
endif()

if(SPLINEPY_MORE)
set(SPLINEPY_DEFS ${SPLINEPY_DEFS} SPLINEPY_MORE)
endif(SPLINEPY_MORE)

add_subdirectory(third_party)
add_subdirectory(cpp/splinepy)
13 changes: 13 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,19 @@ Followings are some preferences:

We are aware that there are inconsistency. However, it will be updated! And new implementations from now on will follow the preferences above.


### Automatic formatting / style check
gustaf uses combination of [yapf](https://github.com/google/yapf) and [autopep8](https://github.com/hhatto/autopep8) for automatic formatting. Then [flake8](https://github.com/pycqa/flake8) to double check everything.

To check the format and style of your code use the following commands:
```bash
pip install yapf autopep8 flake8
cd <splinepy-root>
yapf -i -r splinepy examples tests
autopep8 --select=W291,W292,W293,W504,E265,E501,E711,E722 -r -i --aggressive splinepy examples tests
flake8 splinepy examples tests
```

## Pull request suggessions
Followings are gentle suggestions for PRs, so that the pre-alpha phase can end as soon as possible:
- small, separable features
Expand Down
14 changes: 13 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2021 j042
Copyright (c) 2021 Jaewook Lee

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -19,3 +19,15 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


splinepy/utils/data.py:TrackedArray, make_tracked_array
The MIT License (MIT)

Copyright (c) 2019 Michael Dawson-Haggerty

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
4 changes: 4 additions & 0 deletions cmake/config.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@PACKAGE_INIT@

include("${CMAKE_CURRENT_LIST_DIR}/@TARGETS_EXPORT_NAME@.cmake")
check_required_components("@PROJECT_NAME@")
113 changes: 93 additions & 20 deletions cpp/splinepy/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,25 +1,98 @@
# build fitting first - currently very independent
add_subdirectory(fitting)


## create splinepy target - enables cpp standalone use
# define srcs
set(SPLINEPY_SRCS
${PROJECT_SOURCE_DIR}/cpp/splinepy/splines/create_bezier.cpp
${PROJECT_SOURCE_DIR}/cpp/splinepy/splines/create_rational_bezier.cpp
${PROJECT_SOURCE_DIR}/cpp/splinepy/splines/create_bspline.cpp
${PROJECT_SOURCE_DIR}/cpp/splinepy/splines/create_nurbs.cpp
)


# target
if(SPLINEPY_BUILD_SHARED)
add_library(splinepy SHARED ${SPLINEPY_SRCS})
else()
add_library(splinepy STATIC ${SPLINEPY_SRCS})
endif(SPLINEPY_BUILD_SHARED)
# alias for convenience
add_library(splinepy::splinepy ALIAS splinepy)


# include
target_include_directories(splinepy
PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/cpp>
$<INSTALL_INTERFACE:${incl_dest}>)


# link
target_link_libraries(splinepy
PUBLIC
fitting
bezman
napf
SplineLib::splines
SplineLib::input_output)


# flags
target_compile_options(splinepy
PRIVATE
${SPLINEPY_FLAGS}
${SPLINEPY_OPTIMIZATION_FLAGS})


# defs
target_compile_definitions(splinepy
PRIVATE
${SPLINEPY_DEFS})

# features
target_compile_features(splinepy
PUBLIC
cxx_std_17)

# python?
if(SPLINEPY_COMPILE_PYTHON)
add_subdirectory(py)
else()
# make Py<spline-class> available
add_library(splinepy INTERFACE)
add_library(splinepy::splinepy ALIAS splinepy)

# include
target_include_directories(splinepy
INTERFACE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/cpp>)
#$<INSTALL_INTERFACE:${incl_dest}>

# link
target_link_libraries(splinepy
INTERFACE
pybind11::headers
fitting
bezman
napf
SplineLib::splines
SplineLib::input_output)
endif()


# cmake config files
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
"${version_config}" COMPATIBILITY SameMajorVersion
)
configure_package_config_file(
"${PROJECT_SOURCE_DIR}/cmake/config.cmake.in"
"${project_config}"
INSTALL_DESTINATION "${cfg_dest}"
)


# install
install(
TARGETS splinepy
EXPORT "${TARGETS_EXPORT_NAME}"
LIBRARY DESTINATION ${lib_dest}
ARCHIVE DESTINATION ${lib_dest}
INCLUDES DESTINATION "${incl_dest}"
)
install(
FILES "${project_config}" "${version_config}"
DESTINATION "${cfg_dest}"
)
install(
EXPORT "${TARGETS_EXPORT_NAME}"
NAMESPACE "${namespace}"
DESTINATION "${cfg_dest}"
)
# .hpp files - keep tree
install(DIRECTORY "${PROJECT_SOURCE_DIR}/cpp/splinepy"
DESTINATION ${incl_dest} # target directory
FILES_MATCHING PATTERN "*.hpp"
)
17 changes: 16 additions & 1 deletion cpp/splinepy/fitting/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
set(SRCS_FITTING fitting.cpp)

add_library(fitting OBJECT ${SRCS_FITTING})
if(SPLINEPY_BUILD_SHARED)
add_library(fitting SHARED ${SRCS_FITTING})
else()
add_library(fitting STATIC ${SRCS_FITTING})
endif()
target_include_directories(fitting PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})

# 11 is enough, but 17 allows nested namespace..
target_compile_features(fitting PUBLIC cxx_std_17)

target_compile_options(fitting PRIVATE ${SPLINEPY_FLAGS})
if(CMAKE_BUILD_TYPE MATCHES Release)
target_compile_options(fitting PRIVATE ${SPLINEPY_OPTIMIZAION_FLAGS})
endif()

install(
TARGETS fitting
EXPORT ${TARGETS_EXPORT_NAME}
LIBRARY DESTINATION ${lib_dest}
LIBRARY DESTINATION ${lib_dest}
INCLUDES DESTINATION ${incl_dest}
)
42 changes: 23 additions & 19 deletions cpp/splinepy/fitting/fitting.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#include "fitting.hpp"

double FitCurve(double* points,
int& num_points,
int& dim,
int& degree,
int& num_control_points,
bool centripetal,
namespace splinepy::fitting {

double FitCurve(const double* points,
const int& num_points,
const int& dim,
const int& degree,
const int& num_control_points,
const bool centripetal,
std::vector<double>& knot_vector,
std::vector<double>& control_points) {

Expand Down Expand Up @@ -44,14 +46,14 @@ double FitCurve(double* points,
}
}

void FitSurface(double* points,
int& num_points,
int& dim,
int& degree_u,
int& degree_v,
int& size_u,
int& size_v,
bool centripetal,
void FitSurface(const double* points,
const int& num_points,
const int& dim,
const int& degree_u,
const int& degree_v,
const int& size_u,
const int& size_v,
const bool centripetal,
std::vector<double>& knot_vector_u,
std::vector<double>& knot_vector_v,
std::vector<double>& control_points) {
Expand Down Expand Up @@ -111,11 +113,11 @@ void FitSurface(double* points,
delete[] pts_v;
}

double ApproximateCurve(double* points,
int& num_points,
int& dim,
int& degree,
int& num_control_points,
double ApproximateCurve(const double* points,
const int& num_points,
const int& dim,
const int& degree,
const int& num_control_points,
std::vector<double>& u_k,
std::vector<double>& knot_vector,
std::vector<double>& coefficient_matrix,
Expand Down Expand Up @@ -202,3 +204,5 @@ double ApproximateCurve(double* points,

return residual;
}

} // namespace splinepy::fitting
Loading