diff --git a/CMake/External/CMakeLists.txt b/CMake/External/CMakeLists.txt index 166bf7059c8e190d6d19d4d7ed79af3f17c80684..420a1b2c2de92d174342a1c6fbc772b537424064 100644 --- a/CMake/External/CMakeLists.txt +++ b/CMake/External/CMakeLists.txt @@ -98,7 +98,8 @@ ExternalProject_Add( ${PROJECT_NAME} -D${PROJECT_NAME}_USE_MODEL_REDUCTION:BOOL=${${PROJECT_NAME}_USE_MODEL_REDUCTION} -D${PROJECT_NAME}_USE_Vulkan:BOOL=${${PROJECT_NAME}_USE_Vulkan} -D${PROJECT_NAME}_ENABLE_AUDIO:BOOL=${${PROJECT_NAME}_ENABLE_AUDIO} - -D${PROJECT_NAME}_ENABLE_VR:BOOL=${${PROJECT_NAME}_ENABLE_VR} + -D${PROJECT_NAME}_USE_VRPN:BOOL=${${PROJECT_NAME}_USE_VRPN} + -D${PROJECT_NAME}_COLOR_OUTPUT:BOOL=${${PROJECT_NAME}_COLOR_OUTPUT} -D${PROJECT_NAME}_USE_Pulse:BOOL=${${PROJECT_NAME}_USE_Pulse} # External Libraries -DEigen3_DIR:PATH=${Eigen3_DIR} diff --git a/CMake/External/External_OpenHaptics.cmake b/CMake/External/External_OpenHaptics.cmake index d7cd1dcdc29686144f366e88d8f27cd433587cf4..989db0b7e88f15df483d033b9b10dbce36c3cd3d 100644 --- a/CMake/External/External_OpenHaptics.cmake +++ b/CMake/External/External_OpenHaptics.cmake @@ -3,6 +3,13 @@ if(NOT WIN32) return() endif() +if(NOT DEFINED OPENHAPTICS_ROOT_DIR OR NOT EXISTS ${OPENHAPTICS_ROOT_DIR}) + set(OPENHAPTICS_ROOT_DIR "$ENV{OH_SDK_BASE}" CACHE PATH "Path to OpenHaptics install directory." FORCE) +endif() +if(NOT EXISTS ${OPENHAPTICS_ROOT_DIR}) + message(FATAL_ERROR "\nCan not support Phantom Omni without OpenHaptics.\nSet OPENHAPTICS_ROOT_DIR to OpenHaptics installation directory.\n\n") +endif() + #----------------------------------------------------------------------------- # Set install commands #----------------------------------------------------------------------------- diff --git a/CMake/External/External_VRPN.cmake b/CMake/External/External_VRPN.cmake index 021fcf9125b10626542de5b92d971236c2ccd933..f7212a7775a37714f4786ab008441c444640bb9a 100644 --- a/CMake/External/External_VRPN.cmake +++ b/CMake/External/External_VRPN.cmake @@ -55,4 +55,4 @@ imstk_add_external_project( VRPN DEPENDENCIES ${VRPN_DEPENDENCIES} RELATIVE_INCLUDE_PATH "" #VERBOSE -) +) \ No newline at end of file diff --git a/CMake/iMSTKConfig.cmake.in b/CMake/iMSTKConfig.cmake.in index 340d931b03b12a51c19b6461bd2c1cc29eb57945..e363d40737a5ff1fea02843033a29ec3f6835ecd 100644 --- a/CMake/iMSTKConfig.cmake.in +++ b/CMake/iMSTKConfig.cmake.in @@ -80,7 +80,11 @@ set(VegaFEM_DIR "@VegaFEM_DIR@") find_dependency( VegaFEM REQUIRED CONFIG ) # VRPN -find_package( VRPN REQUIRED ) +if (iMSTK_USE_VRPN) + find_package( VRPN REQUIRED ) +endif() + +# OpenHaptics if(iMSTK_USE_OpenHaptics) find_package( OpenHapticsSDK REQUIRED ) add_definitions( -DiMSTK_USE_OPENHAPTICS ) diff --git a/CMakeLists.txt b/CMakeLists.txt index dea3b1aae1e8ee515a47464814dd6cd034e3aa32..6923174f3874c411a6cd1ce2fc12062e310b8bc8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -88,7 +88,11 @@ set(BUILD_TESTING OFF) if (${PROJECT_NAME}_BUILD_TESTING) set(BUILD_TESTING ON) endif () -option(${PROJECT_NAME}_USE_MODEL_REDUCTION "Build with model reduction, requires a VegaFEM built with Intel MKL and arpack" OFF) +if (UNIX) + option(${PROJECT_NAME}_USE_MODEL_REDUCTION "Build with model reduction, requires a VegaFEM built with Intel MKL and arpack" OFF) + option(${PROJECT_NAME}_COLOR_OUTPUT "For coloring output in gcc" OFF) +endif() +option(${PROJECT_NAME}_USE_VRPN "Build with VRPN support" OFF) option(${PROJECT_NAME}_USE_VTK_OSMESA "Build with VTK OSMesa rendering" OFF) if (${${PROJECT_NAME}_USE_VTK_OSMESA} AND NOT UNIX) message(WARNING "OSMesa only works on unix, building without") @@ -153,7 +157,9 @@ if(${PROJECT_NAME}_SUPERBUILD) if(${PROJECT_NAME}_USE_OpenHaptics) imstk_define_dependency(OpenHaptics) endif() - imstk_define_dependency(VRPN) + if (${PROJECT_NAME}_USE_VRPN) + imstk_define_dependency(VRPN) + endif() if(WIN32) imstk_define_dependency(PThreads) @@ -270,7 +276,11 @@ add_definitions(-D__TBB_NO_IMPLICIT_LINKAGE) find_package( VegaFEM REQUIRED CONFIG ) # VRPN -find_package( VRPN REQUIRED ) +if (${PROJECT_NAME}_USE_VRPN) + find_package( VRPN REQUIRED ) +endif() + +# OpenHaptics if(${PROJECT_NAME}_USE_OpenHaptics) find_package( OpenHapticsSDK REQUIRED ) add_definitions( -DiMSTK_USE_OPENHAPTICS ) diff --git a/Source/Devices/CMakeLists.txt b/Source/Devices/CMakeLists.txt index 257f55e9a5ab7ed360a28a8097dc020920716f31..04052d960afa970981a606ea27db87d497a067e9 100644 --- a/Source/Devices/CMakeLists.txt +++ b/Source/Devices/CMakeLists.txt @@ -2,31 +2,31 @@ # Create target #----------------------------------------------------------------------------- -list(APPEND Dependencies - Common - VRPN) - -include(imstkAddLibrary) -set(HAPTIC_DEVICE_LIBS) -if(${PROJECT_NAME}_USE_OpenHaptics) - set(HAPTIC_DEVICE_LIBS OpenHapticsSDK) +list(APPEND Dependencies Common) + +if(iMSTK_USE_OpenHaptics) + list(APPEND Dependencies OpenHapticsSDK) +endif() +if(iMSTK_USE_VRPN) + list(APPEND Dependencies VRPN) endif() list(APPEND ExclusionFiles "") -if(${PROJECT_NAME}_USE_OpenHaptics) - list(APPEND Dependencies - ${HAPTIC_DEVICE_LIBS}) -else() +if(NOT iMSTK_USE_OpenHaptics) list(APPEND ExclusionFiles imstkHapticDeviceClient.h imstkHapticDeviceClient.cpp imstkHapticDeviceManager.h imstkHapticDeviceManager.cpp) endif() - -set(HAPTIC_DEVICE_LIBS) -if(${PROJECT_NAME}_USE_OpenHaptics) - set(HAPTIC_DEVICE_LIBS OpenHapticsSDK) +if(NOT iMSTK_USE_VRPN) + list(APPEND ExclusionFiles + imstkVRPNDeviceServer.h + imstkVRPNDeviceServer.cpp + imstkVRPNArduinoDeviceClient.h + imstkVRPNArduinoDeviceClient.cpp + imstkVRPNDeviceClient.h + imstkVRPNDeviceClient.cpp) endif() include(imstkAddLibrary) diff --git a/Source/DynamicalModels/ObjectModels/imstkReducedStVKBodyModel.cpp b/Source/DynamicalModels/ObjectModels/imstkReducedStVKBodyModel.cpp index 48c0dc269e1a619e7998df4a7741fe7c8c2c0c0d..403b0219323590e1b3129ba928b01abf2b7b4833 100644 --- a/Source/DynamicalModels/ObjectModels/imstkReducedStVKBodyModel.cpp +++ b/Source/DynamicalModels/ObjectModels/imstkReducedStVKBodyModel.cpp @@ -51,7 +51,7 @@ ReducedStVK::ReducedStVK() : DynamicalModel(DynamicalModelType::ElastoDynamics) { // m_fixedNodeIds.reserve(1000); - m_validGeometryTypes = { Geometry::Type::TetrahedralMesh, Geometry::Type::HexahedralMesh }; + m_validGeometryTypes = { "TetrahedralMesh", "HexahedralMesh" }; m_solveNode = m_taskGraph->addFunction("FEMModel_Solve", [&]() { getSolver()->solve(); }); } diff --git a/Source/DynamicalModels/ObjectModels/imstkReducedStVKBodyModel.h b/Source/DynamicalModels/ObjectModels/imstkReducedStVKBodyModel.h index 423604c632b61a493beae7886b1cf9bb702c9886..ddea1d065c61756b3aea135238bb5f209790a1f6 100644 --- a/Source/DynamicalModels/ObjectModels/imstkReducedStVKBodyModel.h +++ b/Source/DynamicalModels/ObjectModels/imstkReducedStVKBodyModel.h @@ -68,11 +68,13 @@ public: /// \brief Constructor /// ReducedStVK(); + /// /// \brief Destructor /// - ~ReducedStVK(); + virtual ~ReducedStVK() override; +public: /// /// \brief Configure the force model from external file /// @@ -190,7 +192,7 @@ public: /// /// \brief Update states /// - void updateBodyStates(const Vectord& solution, const StateUpdateType updateType) override; + void updateBodyStates(const Vectord& solution, const StateUpdateType updateType); void updateBodyIntermediateStates(const Vectord& solution, const StateUpdateType updateType); /// diff --git a/Source/SceneEntities/CMakeLists.txt b/Source/SceneEntities/CMakeLists.txt index b53941e54921a2c759e7711b3b179f3fd91ceb93..5ad9d85d8f1f556ac2beb811cc16a2a6d45a57dc 100644 --- a/Source/SceneEntities/CMakeLists.txt +++ b/Source/SceneEntities/CMakeLists.txt @@ -2,7 +2,7 @@ # Create target #----------------------------------------------------------------------------- -if (NOT ${${PROJECT_NAME}_USE_MODEL_REDUCTION}) +if (NOT iMSTK_USE_MODEL_REDUCTION) list(APPEND ExclusionFiles Objects/imstkReducedFeDeformableObject.h Objects/imstkReducedFeDeformableObject.cpp) diff --git a/Source/SceneEntities/Objects/imstkReducedFeDeformableObject.h b/Source/SceneEntities/Objects/imstkReducedFeDeformableObject.h index 5f577e2e31e7c0ac806082921422e22baa44a3be..5c8726ff2b6d3a61548c43945f3b2e4189acba85 100644 --- a/Source/SceneEntities/Objects/imstkReducedFeDeformableObject.h +++ b/Source/SceneEntities/Objects/imstkReducedFeDeformableObject.h @@ -21,12 +21,7 @@ #pragma once -#include <memory> -#include <string> - -// imstk #include "imstkDynamicObject.h" -#include "imstkMath.h" namespace imstk { @@ -42,17 +37,18 @@ class ReducedStVK; class ReducedFeDeformableObject : public DynamicObject { public: - /// /// \brief Constructor /// - explicit ReducedFeDeformableObject(const std::string& name) : DynamicObject(name) { m_type = Type::ReducedFEMDeformable; } - ReducedFeDeformableObject() = delete; + ReducedFeDeformableObject(const std::string& name) : DynamicObject(name) { } /// /// \brief Destructor /// - ~ReducedFeDeformableObject() = default; + virtual ~ReducedFeDeformableObject() override = default; + +public: + virtual const std::string getTypeName() const override { return "ReducedFeDeformableObject"; } /// /// \brief Initialize the deformable object