From 31b8553b3944a058098ed3968def24b8b8f3c664 Mon Sep 17 00:00:00 2001 From: iasonmanolas Date: Thu, 23 Dec 2021 20:54:33 +0200 Subject: [PATCH 1/2] windows refactoring --- CMakeLists.txt | 66 +++++++++++++++++++++++++++++++------------------- polymesh.hpp | 4 +-- 2 files changed, 43 insertions(+), 27 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 88c7aab..8e68454 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,14 +10,19 @@ else() set(UPDATE_DISCONNECTED_IF_AVAILABLE "UPDATE_DISCONNECTED 1") endif() -set(EXTERNAL_DEPS_DIR "/home/iason/Coding/build/external dependencies") -if(NOT EXISTS ${EXTERNAL_DEPS_DIR}) +#set(EXTERNAL_DEPS_DIR "/home/iason/Coding/build/external dependencies") +if(NOT EXISTS EXTERNAL_DEPS_DIR) set(EXTERNAL_DEPS_DIR ${CMAKE_CURRENT_BINARY_DIR}) + message("External dependencies directory set:" ${EXTERNAL_DEPS_DIR}) endif() ##Create directory for the external libraries file(MAKE_DIRECTORY ${EXTERNAL_DEPS_DIR}) #message(${POLYSCOPE_ALREADY_COMPILED}) +if(NOT DEFINED USE_POLYSCOPE) + message(FATAL_ERROR "Use polyscope was not defined") +endif() + if(${USE_POLYSCOPE}) download_project(PROJ POLYSCOPE GIT_REPOSITORY https://github.com/nmwsharp/polyscope.git @@ -40,7 +45,6 @@ endif() # ${UPDATE_DISCONNECTED_IF_AVAILABLE} #) #add_subdirectory(${DLIB_SOURCE_DIR} ${DLIB_BINARY_DIR}) - ##vcglib devel branch download_project(PROJ vcglib_devel GIT_REPOSITORY https://github.com/IasonManolas/vcglib.git @@ -49,18 +53,25 @@ download_project(PROJ vcglib_devel ${UPDATE_DISCONNECTED_IF_AVAILABLE} ) add_subdirectory(${vcglib_devel_SOURCE_DIR} ${vcglib_devel_BINARY_DIR}) +###Eigen 3 NOTE: Eigen is required on the system the code is ran +#find_package(Eigen3 3.3 REQUIRED) +download_project(PROJ EIGEN + GIT_REPOSITORY https://gitlab.com/libeigen/eigen.git + GIT_TAG master + PREFIX ${EXTERNAL_DEPS_DIR} + ${UPDATE_DISCONNECTED_IF_AVAILABLE} +) +add_subdirectory(${EIGEN_SOURCE_DIR} ${EIGEN_BINARY_DIR}) ##threed-beam-fea download_project(PROJ threed-beam-fea - GIT_REPOSITORY https://github.com/IasonManolas/threed-beam-fea.git + GIT_REPOSITORY https://gitea-s2i2s.isti.cnr.it/manolas/threed-beam-fea.git GIT_TAG master PREFIX ${EXTERNAL_DEPS_DIR} ${UPDATE_DISCONNECTED_IF_AVAILABLE} ) add_subdirectory(${threed-beam-fea_SOURCE_DIR} ${threed-beam-fea_BINARY_DIR}) -###Eigen 3 NOTE: Eigen is required on the system the code is ran -find_package(Eigen3 3.3 REQUIRED) if(MSVC) add_compile_definitions(_HAS_STD_BYTE=0) @@ -100,13 +111,18 @@ if(USE_ENSMALLEN) ) add_subdirectory(${ENSMALLEN_SOURCE_DIR} ${ENSMALLEN_BINARY_DIR}) + download_project(PROJ ARMADILLO + GIT_REPOSITORY https://gitlab.com/conradsnicta/armadillo-code.git + GIT_TAG 10.8.x + PREFIX ${EXTERNAL_DEPS_DIR} + ${UPDATE_DISCONNECTED_IF_AVAILABLE} + ) + add_subdirectory(${ARMADILLO_SOURCE_DIR} ${ARMADILLO_BINARY_DIR}) + target_include_directories(${PROJECT_NAME} PUBLIC armadillo ) - set(ARMADILLO_SOURCE_DIR "/home/iason/Coding/Libraries/armadillo") - add_subdirectory(${ARMADILLO_SOURCE_DIR} ${EXTERNAL_DEPS_DIR}/armadillo_build) if(${MYSOURCES_STATIC_LINK}) target_link_libraries(${PROJECT_NAME} PUBLIC "-static" ensmallen ${EXTERNAL_DEPS_DIR}/armadillo_build/libarmadillo.a) else() - target_link_libraries(${PROJECT_NAME} PUBLIC) target_link_libraries(${PROJECT_NAME} PUBLIC armadillo ensmallen) endif() @@ -123,17 +139,17 @@ target_include_directories(${PROJECT_NAME} if(${MYSOURCES_STATIC_LINK} AND NOT ${USE_POLYSCOPE}) message("Linking statically") - target_link_libraries(${PROJECT_NAME} PRIVATE -static lapack blas gfortran quadmath pthread) + target_link_libraries(${PROJECT_NAME} PRIVATE -static gfortran quadmath pthread) target_link_libraries(${PROJECT_NAME} PUBLIC -static Eigen3::Eigen #[[dlib::dlib]] ThreedBeamFEA #[[${TBB_BINARY_DIR}/libtbb_static.a]]) else() + if (UNIX) + target_link_libraries(${PROJECT_NAME} PRIVATE lapack blas ) + endif() if(${USE_POLYSCOPE}) - target_link_libraries(${PROJECT_NAME} PRIVATE lapack blas gfortran quadmath pthread) - target_link_libraries(${PROJECT_NAME} PUBLIC polyscope xcb Xau) - target_include_directories(${PROJECT_NAME} - PUBLIC ${POLYSCOPE_SOURCE_DIR} - ) + target_link_libraries(${PROJECT_NAME} PUBLIC gfortran quadmath pthread ) + target_link_libraries(${PROJECT_NAME} PUBLIC polyscope xcb Xau) + target_include_directories(${PROJECT_NAME} PUBLIC ${POLYSCOPE_SOURCE_DIR}) endif() - target_link_libraries(${PROJECT_NAME} PRIVATE pthread) target_link_libraries(${PROJECT_NAME} PUBLIC Eigen3::Eigen #[[dlib::dlib]] ThreedBeamFEA matplot) endif() @@ -157,13 +173,13 @@ else() endif() #endif() -download_project(PROJ GSL - GIT_REPOSITORY https://github.com/microsoft/GSL.git - GIT_TAG master - PREFIX ${EXTERNAL_DEPS_DIR} - ${UPDATE_DISCONNECTED_IF_AVAILABLE} - ) -add_subdirectory(${GSL_SOURCE_DIR} ${GSL_BINARY_DIR}) -target_link_libraries(${PROJECT_NAME} PUBLIC GSL) -target_include_directories(${PROJECT_NAME} PUBLIC GSL) +#download_project(PROJ GSL +# GIT_REPOSITORY https://github.com/microsoft/GSL.git +# GIT_TAG master +# PREFIX ${EXTERNAL_DEPS_DIR} +# ${UPDATE_DISCONNECTED_IF_AVAILABLE} +# ) +#add_subdirectory(${GSL_SOURCE_DIR} ${GSL_BINARY_DIR}) +#target_link_libraries(${PROJECT_NAME} PUBLIC GSL) +#target_include_directories(${PROJECT_NAME} PUBLIC GSL) diff --git a/polymesh.hpp b/polymesh.hpp index aa50d47..99bfeef 100755 --- a/polymesh.hpp +++ b/polymesh.hpp @@ -128,7 +128,7 @@ public: mask |= vcg::tri::io::Mask::IOM_VERTNORMAL; mask |= vcg::tri::io::Mask::IOM_FACEINDEX; mask |= vcg::tri::io::Mask::IOM_FACECOLOR; - if (vcg::tri::io::ExporterOBJ::Save(*this, filePath.c_str(), mask) != 0) { + if (vcg::tri::io::ExporterOBJ::Save(*this, filePath.string().c_str(), mask) != 0) { return false; } return true; @@ -149,7 +149,7 @@ public: mask |= vcg::tri::io::Mask::IOM_VERTNORMAL; mask |= vcg::tri::io::Mask::IOM_FACEINDEX; mask |= vcg::tri::io::Mask::IOM_FACECOLOR; - if (vcg::tri::io::ExporterPLY::Save(*this, filePath.c_str(), mask, false) != 0) { + if (vcg::tri::io::ExporterPLY::Save(*this, filePath.string().c_str(), mask, false) != 0) { return false; } return true; From f79e0acb4f3361939cc495956b7afb52a318d02b Mon Sep 17 00:00:00 2001 From: iasonmanolas Date: Thu, 23 Dec 2021 21:29:04 +0200 Subject: [PATCH 2/2] Resolved conflicts --- CMakeLists.txt | 64 ++++++------------------------- reducedmodeloptimizer_structs.hpp | 2 +- 2 files changed, 13 insertions(+), 53 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ec08fce..4a50ebf 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,28 +9,19 @@ if (CMAKE_VERSION VERSION_LESS 3.2) else() set(UPDATE_DISCONNECTED_IF_AVAILABLE "UPDATE_DISCONNECTED 1") endif() -<<<<<<< HEAD #set(EXTERNAL_DEPS_DIR "/home/iason/Coding/build/external dependencies") if(NOT EXISTS EXTERNAL_DEPS_DIR) -======= -set(EXTERNAL_DEPS_DIR "/home/iason/Coding/build/external dependencies") -if(NOT EXISTS ${EXTERNAL_DEPS_DIR}) ->>>>>>> c9fc6ccd0877f92308795b99e51c8e5dfd1e31eb set(EXTERNAL_DEPS_DIR ${CMAKE_CURRENT_BINARY_DIR}) message("External dependencies directory set:" ${EXTERNAL_DEPS_DIR}) endif() ##Create directory for the external libraries file(MAKE_DIRECTORY ${EXTERNAL_DEPS_DIR}) -<<<<<<< HEAD #message(${POLYSCOPE_ALREADY_COMPILED}) if(NOT DEFINED USE_POLYSCOPE) message(FATAL_ERROR "Use polyscope was not defined") endif() - -======= ->>>>>>> c9fc6ccd0877f92308795b99e51c8e5dfd1e31eb if(${USE_POLYSCOPE}) set(POLYSCOPE_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/polyscope) download_project(PROJ POLYSCOPE @@ -44,21 +35,6 @@ if(${USE_POLYSCOPE}) add_compile_definitions(POLYSCOPE_DEFINED) endif() -<<<<<<< HEAD - -##dlib -#set(DLIB_BIN_DIR ${CMAKE_CURRENT_BINARY_DIR}/dlib_bin) -#file(MAKE_DIRECTORY ${DLIB_BIN_DIR}) -#download_project(PROJ DLIB -# GIT_REPOSITORY https://github.com/davisking/dlib.git -# GIT_TAG master -# BINARY_DIR ${DLIB_BIN_DIR} -# PREFIX ${EXTERNAL_DEPS_DIR} -# ${UPDATE_DISCONNECTED_IF_AVAILABLE} -#) -#add_subdirectory(${DLIB_SOURCE_DIR} ${DLIB_BINARY_DIR}) -======= ->>>>>>> c9fc6ccd0877f92308795b99e51c8e5dfd1e31eb ##vcglib devel branch download_project(PROJ vcglib_devel GIT_REPOSITORY https://github.com/IasonManolas/vcglib.git @@ -99,9 +75,6 @@ download_project(PROJ threed-beam-fea ) add_subdirectory(${threed-beam-fea_SOURCE_DIR} ${threed-beam-fea_BINARY_DIR}) -<<<<<<< HEAD - -======= ##TBB set(TBB_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/tbb) download_project(PROJ TBB @@ -114,13 +87,10 @@ download_project(PROJ TBB option(TBB_BUILD_TESTS "Build TBB tests and enable testing infrastructure" OFF) add_subdirectory(${TBB_SOURCE_DIR} ${TBB_BINARY_DIR}) link_directories(${TBB_BINARY_DIR}) -###Eigen 3 NOTE: Eigen is required on the system the code is ran -find_package(Eigen3 3.3 REQUIRED) ->>>>>>> c9fc6ccd0877f92308795b99e51c8e5dfd1e31eb + if(MSVC) add_compile_definitions(_HAS_STD_BYTE=0) endif(MSVC) -#link_directories(${CMAKE_CURRENT_LIST_DIR}/boost_graph/libs) file(GLOB MySourcesFiles ${CMAKE_CURRENT_LIST_DIR}/*.hpp ${CMAKE_CURRENT_LIST_DIR}/*.cpp) add_library(${PROJECT_NAME} ${MySourcesFiles} ${vcglib_devel_SOURCE_DIR}/wrap/ply/plylib.cpp) target_include_directories(${PROJECT_NAME} @@ -150,7 +120,6 @@ if(USE_ENSMALLEN) ${UPDATE_DISCONNECTED_IF_AVAILABLE} ) add_subdirectory(${ENSMALLEN_SOURCE_DIR} ${ENSMALLEN_BINARY_DIR}) -<<<<<<< HEAD download_project(PROJ ARMADILLO GIT_REPOSITORY https://gitlab.com/conradsnicta/armadillo-code.git @@ -160,19 +129,13 @@ if(USE_ENSMALLEN) ) add_subdirectory(${ARMADILLO_SOURCE_DIR} ${ARMADILLO_BINARY_DIR}) target_include_directories(${PROJECT_NAME} PUBLIC armadillo ) - -======= - set(ARMADILLO_SOURCE_DIR "/home/iason/Coding/Libraries/armadillo") - add_subdirectory(${ARMADILLO_SOURCE_DIR} ${EXTERNAL_DEPS_DIR}/armadillo_build) ->>>>>>> c9fc6ccd0877f92308795b99e51c8e5dfd1e31eb if(${MYSOURCES_STATIC_LINK}) - target_link_libraries(${PROJECT_NAME} PUBLIC "-static" ensmallen ${EXTERNAL_DEPS_DIR}/armadillo_build/libarmadillo.a) + target_link_libraries(${PROJECT_NAME} PUBLIC "-static" ensmallen ${ARMADILLO_BINARY_DIR}/libarmadillo.a) else() target_link_libraries(${PROJECT_NAME} PUBLIC armadillo ensmallen) endif() - target_include_directories(${PROJECT_NAME} PUBLIC ${ARMADILLO_SOURCE_DIR}/include) + target_include_directories(${PROJECT_NAME} PUBLIC armadillo) endif() -<<<<<<< HEAD target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_LIST_DIR}/boost_graph @@ -216,17 +179,14 @@ if(${MYSOURCES_STATIC_LINK}) else() target_link_libraries(${PROJECT_NAME} PUBLIC matplot) endif() -#endif() -#download_project(PROJ GSL -# GIT_REPOSITORY https://github.com/microsoft/GSL.git -# GIT_TAG master -# PREFIX ${EXTERNAL_DEPS_DIR} -# ${UPDATE_DISCONNECTED_IF_AVAILABLE} -# ) -#add_subdirectory(${GSL_SOURCE_DIR} ${GSL_BINARY_DIR}) -#target_link_libraries(${PROJECT_NAME} PUBLIC GSL) -#target_include_directories(${PROJECT_NAME} PUBLIC GSL) +download_project(PROJ GSL + GIT_REPOSITORY https://github.com/microsoft/GSL.git + GIT_TAG master + PREFIX ${EXTERNAL_DEPS_DIR} + ${UPDATE_DISCONNECTED_IF_AVAILABLE} + ) +add_subdirectory(${GSL_SOURCE_DIR} ${GSL_BINARY_DIR}) +target_link_libraries(${PROJECT_NAME} PUBLIC GSL) +target_include_directories(${PROJECT_NAME} PUBLIC GSL) -======= ->>>>>>> c9fc6ccd0877f92308795b99e51c8e5dfd1e31eb diff --git a/reducedmodeloptimizer_structs.hpp b/reducedmodeloptimizer_structs.hpp index 4cc695a..d507a83 100644 --- a/reducedmodeloptimizer_structs.hpp +++ b/reducedmodeloptimizer_structs.hpp @@ -67,7 +67,7 @@ enum OptimizationParameterIndex { E, A, I2, I3, J, R, Theta, NumberOfOptimizatio struct Settings { std::filesystem::path intermediateResultsDirectoryPath; - std::vector> optimizationVariables; + std::vector> optimizationVariables; enum NormalizationStrategy { NonNormalized, Epsilon }; std::vector parameterRanges; inline static vector normalizationStrategyStrings{"NonNormalized", "Epsilon"};