diff --git a/cxx/CMakeLists.txt b/cxx/CMakeLists.txt index 4a57beb..241d8eb 100644 --- a/cxx/CMakeLists.txt +++ b/cxx/CMakeLists.txt @@ -146,5 +146,6 @@ if (WITH_TESTS) set(FITPACK_TEST_APP fitpack_test) add_executable(${FITPACK_TEST_APP} tests/fitpack_test.cpp) target_link_libraries(${FITPACK_TEST_APP} fitpack) - # target_include_directories(${FITPACK_TEST_APP} PRIVATE fitpack) + target_include_directories(${FITPACK_TEST_APP} PRIVATE ${FITPACK_INCLUDE_DIR}) + message(STATUS "INC UP: " ${FITPACK_INCLUDE_DIR}) endif() diff --git a/cxx/fitpack/CMakeLists.txt b/cxx/fitpack/CMakeLists.txt index af78251..7afec0b 100644 --- a/cxx/fitpack/CMakeLists.txt +++ b/cxx/fitpack/CMakeLists.txt @@ -28,4 +28,4 @@ FortranCInterface_HEADER(FortranCInterface.h FortranCInterface_VERIFY(CXX) add_library(fitpack STATIC ${src_files} fitpack.h) - +set(FITPACK_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR} PARENT_SCOPE) diff --git a/cxx/fitpack/fitpack.h b/cxx/fitpack/fitpack.h index 3d52618..6c9b09c 100644 --- a/cxx/fitpack/fitpack.h +++ b/cxx/fitpack/fitpack.h @@ -1,11 +1,10 @@ #pragma once #include -#include #include #include -#include "/home/timur/PROGRAMS/C++/build-mountcontrol-Desktop-Debug/cxx/fitpack/FortranCInterface.h" +#include extern "C" { void surfit(int* iopt, diff --git a/cxx/tests/fitpack_test.cpp b/cxx/tests/fitpack_test.cpp index af5ea69..0e5c13f 100644 --- a/cxx/tests/fitpack_test.cpp +++ b/cxx/tests/fitpack_test.cpp @@ -9,8 +9,8 @@ int main() { - // size_t nt = 3, np = 5, N = nt * np, i = 1; - size_t nt = 10, np = 20, N = nt * np, i = 1; + size_t nt = 30, np = 60, N = nt * np, i = 1; + // size_t nt = 10, np = 20, N = nt * np, i = 1; double ts = std::numbers::pi / (nt + 1); double ps = 2.0 * std::numbers::pi / (np + 1); @@ -46,7 +46,8 @@ int main() k = 1; } - std::uniform_real_distribution distr{-0.1, 0.1}; + // std::uniform_real_distribution distr{-0.1, 0.1}; + std::normal_distribution distr{0.0, 1.0}; std::random_device device; std::mt19937 engine{device()}; @@ -57,7 +58,8 @@ int main() }); - size_t ntk = 3, npk = 6, nf = (ntk + 4) * (npk + 4); + int ntk = 24, npk = 29, nf = (ntk + 4) * (npk + 4); + // int ntk = 3, npk = 6, nf = (ntk + 4) * (npk + 4); std::vector tk(ntk + 8), pk(npk + 8), coeffs(nf); ts = std::numbers::pi / (ntk + 1); ps = 2.0 * std::numbers::pi / (npk + 1); @@ -74,11 +76,23 @@ int main() std::cout << "FIT EC = " << ec << "\n"; std::cout << "FIT RESI = " << rs << "\n"; + ntk += 8; + npk += 8; + std::ranges::fill(tk, -1); + std::ranges::fill(pk, -1); + ec = mcc::fitpack::fitpack_sphere_smooth(tetha, phi, func, 1.0, 56000.0, ntk, npk, tk, pk, coeffs, rs); + + std::cout << "FIT EC = " << ec << "\n"; + std::cout << "FIT RESI = " << rs << "\n"; + std::cout << "NKNOTS: " << ntk << ", " << npk << "\n"; + + print_func(coeffs, "coeffs"); // print_func(tetha, "tetha"); // print_func(phi, "phi"); print_func(tk, "tetha_knots"); + print_func(pk, "phi_knots"); print_func(func, "func"); std::cout << "\n\n";