diff --git a/CMake/External/CMakeLists.txt b/CMake/External/CMakeLists.txt index 420a1b2c2de92d174342a1c6fbc772b537424064..415e69095cc8d696a1f4b4e32ff6fb15f5fa0b2e 100644 --- a/CMake/External/CMakeLists.txt +++ b/CMake/External/CMakeLists.txt @@ -100,14 +100,12 @@ ExternalProject_Add( ${PROJECT_NAME} -D${PROJECT_NAME}_ENABLE_AUDIO:BOOL=${${PROJECT_NAME}_ENABLE_AUDIO} -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} -Dglm_DIR:PATH=${glm_DIR} -DGTest_DIR:PATH=${GTest_DIR} -DVegaFEM_DIR:PATH=${VegaFEM_DIR} -DVTK_DIR:PATH=${VTK_DIR} - -DPulse_DIR:PATH=${Pulse_DIR} # I don't think this is needed by the inner build # -DPHYSX_CONFIGURATION:STRING=${${PROJECT_NAME}_PHYSX_CONFIGURATION} DEPENDS ${${PROJECT_NAME}_DEPENDENCIES} diff --git a/CMake/External/External_Pulse.cmake b/CMake/External/External_Pulse.cmake deleted file mode 100644 index e3120b29408617d9f69e1f1b7a3d071d5bd86fc3..0000000000000000000000000000000000000000 --- a/CMake/External/External_Pulse.cmake +++ /dev/null @@ -1,22 +0,0 @@ -#----------------------------------------------------------------------------- -# Add Pulse External Project -#----------------------------------------------------------------------------- - -include(imstkAddExternalProject) -imstk_add_external_project( Pulse - GIT_REPOSITORY https://gitlab.kitware.com/physiology/engine.git - GIT_TAG f4d501c2f7cc091dc053a96ab5a56f79b7528c4f - GIT_SHALLOW TRUE - #URL https://gitlab.kitware.com/physiology/engine/-/archive/3.x/archive.zip - #URL_HASH 4189591a6859df46920bbc35f160eef23fc33ffd - CMAKE_CACHE_ARGS - -DPulse_SLAVE_BUILD:BOOL=ON - -DPulse_JAVA_API:BOOL=OFF - -DPulse_PYTHON_API:BOOL=OFF - INSTALL_COMMAND $(SKIP_STEP_COMMAND) -) - -if(NOT USE_SYSTEM_Pulse) - set(Pulse_DIR ${CMAKE_INSTALL_PREFIX}/lib/cmake/Pulse-3.0) - #message(STATUS "Pulse_DIR : ${Pulse_DIR}") -endif() diff --git a/CMakeLists.txt b/CMakeLists.txt index 0c88c8a53bb29c94a23e6f79f12fe3809adfd39f..1e9703ff803a526c4c31d11ec612a55d3c957637 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -137,11 +137,6 @@ if(${PROJECT_NAME}_SUPERBUILD) option(${PROJECT_NAME}_USE_Vulkan "Use the custom Vulkan renderer." OFF) option(${PROJECT_NAME}_USE_OpenHaptics "Use OpenHaptic Support." OFF) - option(${PROJECT_NAME}_USE_Pulse "Use Pulse Physiology engine." OFF) - if(${PROJECT_NAME}_USE_Pulse) - imstk_define_dependency(Pulse) - endif() - imstk_define_dependency(Assimp) imstk_define_dependency(Eigen3) imstk_define_dependency(g3log) @@ -249,13 +244,6 @@ set(PHYSX_RELEASE_TYPES "RELEASE;CHECKED;PROFILE" CACHE INTERNAL "List of availa set_property(CACHE PHYSX_CONFIGURATION PROPERTY STRINGS ${PHYSX_RELEASE_TYPES}) find_package(PhysX REQUIRED) -if(${PROJECT_NAME}_USE_Pulse) - add_definitions( -DiMSTK_USE_Pulse ) - find_package( Pulse REQUIRED ) -else() - remove_definitions( -DiMSTK_USE_Pulse ) -endif() - # SCCD find_package( SCCD REQUIRED ) @@ -404,7 +392,6 @@ add_subdirectory(Source/CollisionHandling) add_subdirectory(Source/Scene) add_subdirectory(Source/SimulationManager) add_subdirectory(Source/apiUtilities) -add_subdirectory(Source/Pulse) add_subdirectory(Source/Filtering) add_subdirectory(Source/FilteringCore) diff --git a/Source/DynamicalModels/ObjectModels/imstkRigidBodyModel2.cpp b/Source/DynamicalModels/ObjectModels/imstkRigidBodyModel2.cpp index da78db3bbf3d389fe7b7618868bf5b9e6dc17674..08b81d1b15919ce7d66fabe98bcb065f0cf4e935 100644 --- a/Source/DynamicalModels/ObjectModels/imstkRigidBodyModel2.cpp +++ b/Source/DynamicalModels/ObjectModels/imstkRigidBodyModel2.cpp @@ -171,16 +171,16 @@ RigidBodyModel2::computeTentativeVelocities() // Sum gravity to the forces ParallelUtils::parallelFor(forces.size(), [&forces, &fG](const int& i) - { - forces[i] += fG; + { + forces[i] += fG; }, forces.size() > m_maxBodiesParallel); // Compute the desired velocites, later we will solve for the proper velocities, // adjusted for the constraints ParallelUtils::parallelFor(tentativeVelocities.size(), [&](const size_t& i) - { - tentativeVelocities[i] += forces[i] * invMasses[i] * dt; - tentativeAngularVelocities[i] += invInteriaTensors[i] * torques[i] * dt; + { + tentativeVelocities[i] += forces[i] * invMasses[i] * dt; + tentativeAngularVelocities[i] += invInteriaTensors[i] * torques[i] * dt; }, tentativeVelocities.size() > m_maxBodiesParallel); } @@ -359,33 +359,33 @@ RigidBodyModel2::integrate() StdVectorOfVec3d& torques = getCurrentState()->getTorques(); ParallelUtils::parallelFor(positions.size(), [&](const size_t& i) + { + if (!isStatic[i]) { - if (!isStatic[i]) + velocities[i] += forces[i] * invMasses[i] * dt; + velocities[i] *= velocityDamping; + angularVelocities[i] += invInteriaTensors[i] * torques[i] * dt; + angularVelocities[i] *= angularVelocityDamping; + positions[i] += velocities[i] * dt; { - velocities[i] += forces[i] * invMasses[i] * dt; - velocities[i] *= velocityDamping; - angularVelocities[i] += invInteriaTensors[i] * torques[i] * dt; - angularVelocities[i] *= angularVelocityDamping; - positions[i] += velocities[i] * dt; - { - const Quatd q = Quatd(0.0, + const Quatd q = Quatd(0.0, angularVelocities[i][0], angularVelocities[i][1], angularVelocities[i][2]) * orientations[i]; - orientations[i].x() += q.x() * dt; - orientations[i].y() += q.y() * dt; - orientations[i].z() += q.z() * dt; - orientations[i].w() += q.w() * dt; - orientations[i].normalize(); - } + orientations[i].x() += q.x() * dt; + orientations[i].y() += q.y() * dt; + orientations[i].z() += q.z() * dt; + orientations[i].w() += q.w() * dt; + orientations[i].normalize(); } + } - // Reset - m_bodies[i]->m_prevForce = forces[i]; - forces[i] = Vec3d(0.0, 0.0, 0.0); - torques[i] = Vec3d(0.0, 0.0, 0.0); - tentativeVelocities[i] = velocities[i]; - tentativeAngularVelocities[i] = angularVelocities[i]; + // Reset + m_bodies[i]->m_prevForce = forces[i]; + forces[i] = Vec3d(0.0, 0.0, 0.0); + torques[i] = Vec3d(0.0, 0.0, 0.0); + tentativeVelocities[i] = velocities[i]; + tentativeAngularVelocities[i] = angularVelocities[i]; }, positions.size() > m_maxBodiesParallel); } diff --git a/Source/DynamicalModels/ObjectModels/imstkSPHHemorrhage.cpp b/Source/DynamicalModels/ObjectModels/imstkSPHHemorrhage.cpp deleted file mode 100644 index 44522b8cfcf21e1eeff270b3405499ea149d29ad..0000000000000000000000000000000000000000 --- a/Source/DynamicalModels/ObjectModels/imstkSPHHemorrhage.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/*========================================================================= - -Library: iMSTK - -Copyright (c) Kitware, Inc. & Center for Modeling, Simulation, -& Imaging in Medicine, Rensselaer Polytechnic Institute. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0.txt - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - -=========================================================================*/ - -#include "imstkSPHHemorrhage.h" - -namespace imstk -{ -SPHHemorrhage::SPHHemorrhage(const Vec3d& center, const double radius, const double area, const Vec3d& normal) : - m_area(area), m_center(center), m_normal(normal.normalized()), m_radius(radius) -{ -} - -bool -SPHHemorrhage::pointCrossedHemorrhagePlane(const Vec3d& oldPosition, const Vec3d& newPosition) -{ - // todo - loop through points that are near hemorrhage plane instead of all points - const double dist = m_normal.dot(newPosition - m_center); - - if (m_normal.dot(oldPosition - m_center) < 0 && dist > 0) - { - // particle has crossed plane in the correct direction - // however, we still need to determine if the particle is in the domain of the hemorrhage area - // project point onto plane - const Vec3d pointOnPlane = newPosition - dist * m_normal; - // check if point is farther than radius from center point - const double distFromCenter = (pointOnPlane - m_center).norm(); - - if (distFromCenter <= m_radius) - { - return true; - } - } - return false; -} -} // end namespace imstk diff --git a/Source/DynamicalModels/ObjectModels/imstkSPHHemorrhage.h b/Source/DynamicalModels/ObjectModels/imstkSPHHemorrhage.h deleted file mode 100644 index a924aa971ae4125596ef5f8a4701b5c590b6bb8a..0000000000000000000000000000000000000000 --- a/Source/DynamicalModels/ObjectModels/imstkSPHHemorrhage.h +++ /dev/null @@ -1,70 +0,0 @@ -/*========================================================================= - - Library: iMSTK - - Copyright (c) Kitware, Inc. & Center for Modeling, Simulation, - & Imaging in Medicine, Rensselaer Polytechnic Institute. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0.txt - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -=========================================================================*/ - -#pragma once - -#include "imstkMath.h" - -namespace imstk -{ -/// -/// \class SPHHemorrhage -/// \brief Class that holds methods and members for hemorrhage model -/// -class SPHHemorrhage -{ -public: - // constructor - SPHHemorrhage(const Vec3d& center, const double radius, const double area, const Vec3d& normal); - - /// - /// \brief Determine if fluid particle crossed the hemorrhage plane - /// - bool pointCrossedHemorrhagePlane(const Vec3d& oldPosition, const Vec3d& newPosition); - - /// - /// \brief Get the outward normal to the hemorrhage plane - /// - const Vec3d getNormal() { return m_normal; } - - /// - /// \brief Get the area of the hemorrhage plane - /// - const double getHemorrhagePlaneArea() { return m_area; } - - /// - /// \brief Get the rate of hemorrhage from SPH - /// - const double getHemorrhageRate() { return m_hemorrhageRate; } - - /// - /// \brief Set the rate of hemorrhage from SPH - /// - void setHemorrhageRate(const double hemorrhageRate) { m_hemorrhageRate = hemorrhageRate; } - -private: - double m_area; ///> cross-sectional area of hemorrhage plane - Vec3d m_center; ///> hemorrhage plane center - double m_hemorrhageRate = 0; ///> rate of hemorrhage - Vec3d m_normal; ///> outward unit normal of hemorrhage plane - double m_radius; ///> hemorrhage plane radius -}; -} // end namespace imstk diff --git a/Source/DynamicalModels/ObjectModels/imstkSPHModel.cpp b/Source/DynamicalModels/ObjectModels/imstkSPHModel.cpp index c3eb5af92d85c0c512e4c90edf01841a066e52b7..282e3a6da357df73d8332c1ec632c7c997b7d354 100644 --- a/Source/DynamicalModels/ObjectModels/imstkSPHModel.cpp +++ b/Source/DynamicalModels/ObjectModels/imstkSPHModel.cpp @@ -198,11 +198,6 @@ SPHModel::initialize() m_pointSetGeometry->setVertexAttribute("Normals", m_currentState->getNormals()); m_pointSetGeometry->setVertexAttribute("Accels", m_currentState->getAccelerations()); - if (m_geomUnstructuredGrid) - { - m_minIndices.resize(m_geomUnstructuredGrid->getNumVertices()); - } - return true; } @@ -769,29 +764,7 @@ SPHModel::moveParticles(const Real timestep) m_sphBoundaryConditions->getBufferIndices().push_back(p); } } - - if (m_SPHHemorrhage && m_SPHHemorrhage->pointCrossedHemorrhagePlane(oldPosition, newPosition)) - { - averageVelThroughHemorrhage += m_SPHHemorrhage->getNormal() * fullStepVelocities[p].dot(m_SPHHemorrhage->getNormal()); - numParticlesAcrossHemorrhagePlane++; - } - } - - if (m_SPHHemorrhage) - { - if (numParticlesAcrossHemorrhagePlane > 0) - { - averageVelThroughHemorrhage /= numParticlesAcrossHemorrhagePlane; - } - else - { - averageVelThroughHemorrhage = m_prevAvgVelThroughHemorrhage; - } - m_prevAvgVelThroughHemorrhage = averageVelThroughHemorrhage; - const double hemorrhageFlowRate = averageVelThroughHemorrhage.norm() * m_SPHHemorrhage->getHemorrhagePlaneArea(); - m_SPHHemorrhage->setHemorrhageRate(hemorrhageFlowRate); } - m_totalTime += m_dt; m_timeStepCount++; } @@ -844,52 +817,4 @@ SPHModel::findNearestParticleToVertex(const VecDataArray<double, 3>& points, con m_minIndices[i] = minIndex; } } - -void -SPHModel::writeStateToVtk() -{ - if (!m_geomUnstructuredGrid) - { - return; - } - - if (m_vtkPreviousTime <= m_vtkTimeModulo && m_totalTime >= m_vtkTimeModulo) - { - LOG(INFO) << "Writing VTK at time: " << m_totalTime; - const VecDataArray<double, 3>& particleVelocities = *getCurrentState()->getFullStepVelocities(); - const DataArray<double>& particleDensities = *getCurrentState()->getDensities(); - - std::shared_ptr<VecDataArray<double, 3>> velocityPtr = std::make_shared<VecDataArray<double, 3>>(); - VecDataArray<double, 3>& velocity = *velocityPtr; - std::shared_ptr<DataArray<double>> pressurePtr = std::make_shared<DataArray<double>>(); - DataArray<double>& pressure = *pressurePtr; - std::shared_ptr<DataArray<double>> densityPtr = std::make_shared<DataArray<double>>(); - DataArray<double>& density = *densityPtr; - - velocity.reserve(static_cast<int>(m_geomUnstructuredGrid->getNumVertices())); - pressure.reserve(static_cast<int>(m_geomUnstructuredGrid->getNumVertices())); - density.reserve(static_cast<int>(m_geomUnstructuredGrid->getNumVertices())); - - std::vector<std::vector<size_t>> result; - m_neighborSearcher->getNeighbors(result, *m_geomUnstructuredGrid->getInitialVertexPositions(), *getCurrentState()->getPositions()); - findNearestParticleToVertex(*m_geomUnstructuredGrid->getInitialVertexPositions(), result); - - for (auto i : m_minIndices) - { - velocity.push_back(particleVelocities[i]); - density.push_back(particleDensities[i]); - pressure.push_back(particlePressure(particleDensities[i])); - } - m_geomUnstructuredGrid->setVertexAttribute("velocity", velocityPtr); - m_geomUnstructuredGrid->setVertexAttribute("pressure", pressurePtr); - m_geomUnstructuredGrid->setVertexAttribute("density", densityPtr); - - VTKMeshIO vtkWriter; - std::string filePath = std::string("sph_output_") + std::to_string(m_totalTime) + std::string(".vtu"); - vtkWriter.write(m_geomUnstructuredGrid, filePath, MeshFileType::VTU); - - m_vtkTimeModulo += m_writeToOutputModulo; - m_vtkPreviousTime = m_totalTime; - } -} } // end namespace imstk diff --git a/Source/DynamicalModels/ObjectModels/imstkSPHModel.h b/Source/DynamicalModels/ObjectModels/imstkSPHModel.h index 08ab7455c37567f148792f661c4d1ae0bf4402f1..9181d1ebc32b09b845b5c58fc1a5ed09a9c52383 100644 --- a/Source/DynamicalModels/ObjectModels/imstkSPHModel.h +++ b/Source/DynamicalModels/ObjectModels/imstkSPHModel.h @@ -26,8 +26,6 @@ #include "imstkSPHKernels.h" #include "imstkNeighborSearch.h" #include "imstkSPHBoundaryConditions.h" -#include "imstkSPHHemorrhage.h" -#include "imstkTetrahedralMesh.h" namespace imstk { @@ -157,19 +155,11 @@ public: /// \brief Write the state to external file /// \todo move this out of this class /// - void setWriteToOutputModulo(const double modulo) { m_writeToOutputModulo = modulo; } - double getTotalTime() const { return m_totalTime; } - int getTimeStepCount() const { return m_timeStepCount; } - void writeStateToVtk(); - void setGeometryMesh(std::shared_ptr<TetrahedralMesh>& geometryMesh) { m_geomUnstructuredGrid = geometryMesh; } void findNearestParticleToVertex(const VecDataArray<double, 3>& points, const std::vector<std::vector<size_t>>& indices); void setBoundaryConditions(std::shared_ptr<SPHBoundaryConditions> sphBoundaryConditions) { m_sphBoundaryConditions = sphBoundaryConditions; } std::shared_ptr<SPHBoundaryConditions> getBoundaryConditions() { return m_sphBoundaryConditions; } - void setHemorrhageModel(std::shared_ptr<SPHHemorrhage> sPHHemorrhage) { m_SPHHemorrhage = sPHHemorrhage; } - std::shared_ptr<SPHHemorrhage> getHemorrhageModel() { return m_SPHHemorrhage; } - void setRestDensity(const Real restDensity) { m_modelParameters->m_restDensity = restDensity; } std::shared_ptr<TaskNode> getFindParticleNeighborsNode() const { return m_findParticleNeighborsNode; } @@ -293,19 +283,9 @@ private: std::shared_ptr<VecDataArray<double, 3>> m_initialVelocities = nullptr; std::shared_ptr<DataArray<double>> m_initialDensities = nullptr; - double m_totalTime = 0; - int m_timeStepCount = 0; - double m_writeToOutputModulo = 0; - double m_vtkPreviousTime = 0; - double m_vtkTimeModulo = 0; - double m_csvPreviousTime = 0; - double m_csvTimeModulo = 0; - Vec3d m_prevAvgVelThroughHemorrhage = Vec3d(0., 0., 0.); + int m_timeStepCount = 0; - std::shared_ptr<TetrahedralMesh> m_geomUnstructuredGrid = nullptr; std::shared_ptr<SPHBoundaryConditions> m_sphBoundaryConditions = nullptr; - // \todo: Should be refactored out of the base SPHModel - std::shared_ptr<SPHHemorrhage> m_SPHHemorrhage = nullptr; std::vector<size_t> m_minIndices; }; diff --git a/Source/Pulse/CMakeLists.txt b/Source/Pulse/CMakeLists.txt deleted file mode 100644 index d180f45dafea057baeb310c0f56fb22f856c4cee..0000000000000000000000000000000000000000 --- a/Source/Pulse/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -#----------------------------------------------------------------------------- -# Create target -#----------------------------------------------------------------------------- -if(iMSTK_USE_Pulse) - include(imstkAddLibrary) - imstk_add_library( Pulse - DEPENDS - Scene - Pulse::CommonPulseModels) -endif() \ No newline at end of file diff --git a/Source/Pulse/imstkHemorrhageAction.cpp b/Source/Pulse/imstkHemorrhageAction.cpp deleted file mode 100644 index a95059e69748df0d0ecf9fe937d339c3ea676a69..0000000000000000000000000000000000000000 --- a/Source/Pulse/imstkHemorrhageAction.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/*========================================================================= - -Library: iMSTK - -Copyright (c) Kitware, Inc. & Center for Modeling, Simulation, -& Imaging in Medicine, Rensselaer Polytechnic Institute. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0.txt - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - -=========================================================================*/ - -#include "imstkHemorrhageAction.h" - -#include "PulsePhysiologyEngine.h" -#include "CommonDataModel.h" -#include "engine/SEEngineTracker.h" -#include "engine/SEDataRequest.h" -#include "engine/SEDataRequestManager.h" -#include "engine/SEAction.h" -#include "utils/DataTrack.h" -#include "patient/actions/SEHemorrhage.h" -#include "properties/SEScalarVolumePerTime.h" -#include "compartment/SECompartmentManager.h" - -#include "properties/SEScalarTime.h" -#include "engine/SEEngineTracker.h" -#include "compartment/SECompartmentManager.h" -#include "patient/actions/SESubstanceCompoundInfusion.h" -#include "system/physiology/SEBloodChemistrySystem.h" -#include "system/physiology/SECardiovascularSystem.h" -#include "system/physiology/SEEnergySystem.h" -#include "system/physiology/SERespiratorySystem.h" -#include "substance/SESubstanceManager.h" -#include "substance/SESubstanceCompound.h" -#include "properties/SEScalar0To1.h" -#include "properties/SEScalarFrequency.h" -#include "properties/SEScalarMass.h" -#include "properties/SEScalarMassPerVolume.h" -#include "properties/SEScalarPressure.h" -#include "properties/SEScalarTemperature.h" -#include "properties/SEScalarTime.h" -#include "properties/SEScalarVolume.h" -#include "properties/SEScalarVolumePerTime.h" -#include "properties/SEScalarVolumePerTimeArea.h" -#include "compartment/fluid/SELiquidCompartmentGraph.h" - -namespace imstk -{ -HemorrhageAction::HemorrhageAction(const Type t, const std::string& name) -{ - m_hemorrhage = std::make_shared<SEHemorrhage>(); - this->setType(t); - this->SetCompartment("pulse::" + name); -} - -void -HemorrhageAction::setRate(double val /*in milliLiters/sec*/) -{ - m_hemorrhage->GetRate().SetValue(val, VolumePerTimeUnit::mL_Per_s); -} - -void -HemorrhageAction::setType(const Type t) -{ - (t == Type::External) ? m_hemorrhage->SetType(eHemorrhage_Type::External) : - m_hemorrhage->SetType(eHemorrhage_Type::External); -} - -void -HemorrhageAction::SetCompartment(const std::string& name) -{ - m_hemorrhage->SetCompartment(name); -} - -double -HemorrhageAction::getRate() const -{ - return m_hemorrhage->GetRate().GetValue(VolumePerTimeUnit::mL_Per_s); -} - -std::shared_ptr<SEPatientAction> -HemorrhageAction::getAction() -{ - return std::dynamic_pointer_cast<SEPatientAction>(m_hemorrhage); -} -} \ No newline at end of file diff --git a/Source/Pulse/imstkHemorrhageAction.h b/Source/Pulse/imstkHemorrhageAction.h deleted file mode 100644 index 67aac34aab683d107e3ee5304d828931e45d2352..0000000000000000000000000000000000000000 --- a/Source/Pulse/imstkHemorrhageAction.h +++ /dev/null @@ -1,68 +0,0 @@ -/*========================================================================= - -Library: iMSTK - -Copyright (c) Kitware, Inc. & Center for Modeling, Simulation, -& Imaging in Medicine, Rensselaer Polytechnic Institute. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0.txt - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - -=========================================================================*/ - -#pragma once - -#include "imstkPhysiologyModel.h" - -class SEHemorrhage; - -namespace imstk -{ -class HemorrhageAction : public PhysiologyAction -{ -public: - enum class Type { External = 0, Internal }; - - HemorrhageAction(const Type t, const std::string& name); - -public: - /// - /// \brief Set the rate of hemorrhage - /// - void setRate(double val /*in milliLiters/sec*/); - - /// - /// \brief Set the rate of hemorrhage - /// - void setType(const Type t); - - /// - /// \brief Set the vascular compartment for hemorrhage - /// The string is expected to be pulse::VascularCompartment::<name_of_compartment> - /// (Refer: PulsePhysiologyEngine.h) - /// - void SetCompartment(const std::string& name); - - /// - /// \brief Get the rate of hemorrhage in milliLiters/sec - /// - double getRate() const; - - /// - /// \brief - /// - std::shared_ptr<SEPatientAction> getAction(); - -protected: - std::shared_ptr<SEHemorrhage> m_hemorrhage; -}; -} \ No newline at end of file diff --git a/Source/Pulse/imstkPhysiologyModel.cpp b/Source/Pulse/imstkPhysiologyModel.cpp deleted file mode 100644 index 4215155d5ac89572ff9b61fdeed163251928d821..0000000000000000000000000000000000000000 --- a/Source/Pulse/imstkPhysiologyModel.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/*========================================================================= - -Library: iMSTK - -Copyright (c) Kitware, Inc. & Center for Modeling, Simulation, -& Imaging in Medicine, Rensselaer Polytechnic Institute. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0.txt - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - -=========================================================================*/ - -#include "imstkPhysiologyModel.h" -#include "imstkLogger.h" -#include "imstkTaskGraph.h" - -// Pulse -#include <PulsePhysiologyEngine.h> -#include <engine/SEEngineTracker.h> -#include <engine/SEDataRequestManager.h> -#include <patient/actions/SEHemorrhage.h> -#include <compartment/SECompartmentManager.h> - -namespace imstk -{ -PhysiologyModel::PhysiologyModel() : AbstractDynamicalModel(DynamicalModelType::Physiology) -{ - m_solveNode = m_taskGraph->addFunction("PhysiologyModel_Solve", std::bind(&PhysiologyModel::solve, this)); -} - -bool -PhysiologyModel::initialize() -{ - // Create the engine and load the patient - m_pulseObj = CreatePulseEngine(); - m_pulseObj->GetLogger()->LogToConsole(m_config->m_enableLogging); - - std::string patientFile; - switch (m_config->m_basePatient) - { - case PatientPhysiology::StandardMale: - patientFile = iMSTK_DATA_ROOT "/PhysiologyState/StandardMale@0s.pbb"; - break; - case PatientPhysiology::StandardFemale: - patientFile = iMSTK_DATA_ROOT "/PhysiologyState/StandardFemale.json"; - break; - default: - LOG(WARNING) << "Could not find the patient. Initializing to StandardMale"; - patientFile = iMSTK_DATA_ROOT "/PhysiologyStates/StandardMale.json"; - } - - CHECK(m_pulseObj->SerializeFromFile(patientFile)) << "Could not load Pulse state file."; - - // Submit data requests - for (auto dataPair : m_dataPairs) - { - m_pulseObj->GetEngineTracker()->GetDataRequestManager().CreatePhysiologyDataRequest(dataPair.first, dataPair.second); - } - - return true; -} - -void -PhysiologyModel::addDataRequest(const std::string& property, SEDecimalFormat* dfault /*= nullptr*/) -{ - m_dataPairs.push_back(PhysiologyDataRequestPair(property, dfault)); -} - -const SECompartment* -PhysiologyModel::getCompartment(const PhysiologyCompartmentType type, const std::string& compartmentName) const -{ - switch (type) - { - case PhysiologyCompartmentType::Gas: - return (SECompartment*)m_pulseObj->GetCompartments().GetGasCompartment(compartmentName); - break; - case PhysiologyCompartmentType::Liquid: - return (SECompartment*)m_pulseObj->GetCompartments().GetLiquidCompartment(compartmentName); - break; - case PhysiologyCompartmentType::Thermal: - return (SECompartment*)m_pulseObj->GetCompartments().GetThermalCompartment(compartmentName); - break; - case PhysiologyCompartmentType::Tissue: - return (SECompartment*)m_pulseObj->GetCompartments().GetTissueCompartment(compartmentName); - break; - default: - LOG(WARNING) << "Could not find the compartment type"; - return nullptr; - } -} - -void -PhysiologyModel::solve() -{ - // Process all actions that are currently stored - for (auto i : m_actions) - { - m_pulseObj->ProcessAction(*i.second->getAction().get()); - } - - // Advance physiology model in time - m_pulseObj->AdvanceModelTime(m_config->m_timeStep, TimeUnit::s); - - m_currentTime += m_config->m_timeStep; -} - -void -PhysiologyModel::initGraphEdges(std::shared_ptr<TaskNode> source, std::shared_ptr<TaskNode> sink) -{ - // Setup graph connectivity - m_taskGraph->addEdge(source, m_solveNode); - m_taskGraph->addEdge(m_solveNode, sink); -} -}// imstk diff --git a/Source/Pulse/imstkPhysiologyModel.h b/Source/Pulse/imstkPhysiologyModel.h deleted file mode 100644 index 47156a177ff19d451907d7311e6c007fe5136cb2..0000000000000000000000000000000000000000 --- a/Source/Pulse/imstkPhysiologyModel.h +++ /dev/null @@ -1,186 +0,0 @@ -/*========================================================================= - - Library: iMSTK - - Copyright (c) Kitware, Inc. & Center for Modeling, Simulation, - & Imaging in Medicine, Rensselaer Polytechnic Institute. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0.txt - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -=========================================================================*/ - -#pragma once - -#include <unordered_map> - -#include "imstkAbstractDynamicalModel.h"/* -#include "properties/SEScalarVolumePerTime.h" -#include "compartment/fluid/SELiquidCompartment.h"*/ - -class PhysiologyEngine; -class SELiquidCompartment; -class SEDecimalFormat; -class SEPatientAction; -class VolumePerTimeUnit; -class SECompartment; - -namespace imstk -{ -using PhysiologyDataRequestPair = std::pair<std::string, SEDecimalFormat*>; - -enum class PatientPhysiology -{ - StandardMale=0, - StandardFemale -}; - -enum class PhysiologyCompartmentType -{ - Gas = 0, - Liquid, - Thermal, - Tissue -}; - -class PhysiologyAction -{ -public: - virtual std::shared_ptr<SEPatientAction> getAction() = 0; -}; - -/// -/// \struct PhysiologyModelConfig -/// \brief Contains physiology model settings -/// -struct PhysiologyModelConfig -{ - PatientPhysiology m_basePatient = PatientPhysiology::StandardMale; - - double m_timeStep = 0.02; ///< Pulse time step - bool m_enableLogging = false; ///< Enable Pulse engine logging -}; - -/// -/// \class PhysiologyModel -/// \brief Human physiology dynamical model -/// -class PhysiologyModel : public AbstractDynamicalModel -{ -public: - /// - /// \brief Constructor - /// - PhysiologyModel(); - - /// - /// \brief Destructor - /// - virtual ~PhysiologyModel() override = default; - - /// - /// \brief Set simulation parameters - /// - void configure(const std::shared_ptr<PhysiologyModelConfig>& params) { m_config = params; } - - /// - /// \brief Initialize the dynamical model - /// - virtual bool initialize() override; - - /// - /// \brief Get the solver task node - /// - std::shared_ptr<TaskNode> getSolveNode() const { return m_solveNode; } - - /// - /// \brief Update states - /// - virtual void updateBodyStates(const Vectord&, const StateUpdateType) override {} - - /// - /// \brief Set the default time step size, - /// valid only if using a fixed time step for integration - /// - void setDefaultTimeStep(const Real) {} - - /// - /// \brief Reset the physiology model to the initial state - /// - virtual void resetToInitialState() override {}; - - /// - /// \brief Add a data request that to output vitals to CSV files - /// - void addDataRequest(const std::string& property, SEDecimalFormat* dfault = nullptr); - - /// - /// \brief Returns the time step size - /// - virtual double getTimeStep() const override { return m_config->m_timeStep; } - - /// - /// \brief Set the time step of the pulse solver - /// - virtual void setTimeStep(const double t) override { m_config->m_timeStep = t; } - - /// - /// \brief Add a new action - /// - void addAction(std::string name, std::shared_ptr<PhysiologyAction> action) { m_actions[name] = action; }; - - std::shared_ptr<PhysiologyAction> getAction(std::string name) const { return (m_actions.count(name) == 0) ? nullptr : m_actions.at(name); } - - /// - /// \brief Clear all actions - /// - void clearActions() { m_actions.clear(); } - - /// - /// \brief Set the name of the file to write out the data requests - /// - void setDataWriteOutFileName(const std::string& filename) { m_dataWriteOutFile = filename; } - - /// - /// \brief Get the physiology compartment model of the body - /// - const SECompartment* getCompartment(const PhysiologyCompartmentType type, const std::string& compartmentName) const; - -protected: - /// - /// \brief Setup physiology compute graph connectivity - /// - virtual void initGraphEdges(std::shared_ptr<TaskNode> source, std::shared_ptr<TaskNode> sink) override; - - /// - /// \brief Advance one time step of the pulse engine solver - /// - void solve(); - - std::shared_ptr<TaskNode> m_solveNode = nullptr; - - std::unordered_map<std::string, std::shared_ptr<PhysiologyAction>> m_actions; ///< container for all the actions - std::vector<PhysiologyDataRequestPair> m_dataPairs; ///< container for data requests - -private: - // main pulse object - std::unique_ptr<PhysiologyEngine> m_pulseObj = nullptr; - - double m_currentTime = 0.; ///< Current total time (incremented every solve) - - std::string m_dataWriteOutFile = "pulseVitals.csv"; - - // Physiology Model parameters (must be set before simulation) - // empty for now but can be set if needed - std::shared_ptr<PhysiologyModelConfig> m_config; -}; -} // end namespace imstk diff --git a/Source/Pulse/imstkPhysiologyObject.cpp b/Source/Pulse/imstkPhysiologyObject.cpp deleted file mode 100644 index b792a785ae53254a0fadc155cc0cc2449ded1cd1..0000000000000000000000000000000000000000 --- a/Source/Pulse/imstkPhysiologyObject.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/*========================================================================= - - Library: iMSTK - - Copyright (c) Kitware, Inc. & Center for Modeling, Simulation, - & Imaging in Medicine, Rensselaer Polytechnic Institute. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0.txt - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -=========================================================================*/ - -#include "imstkPhysiologyObject.h" -#include "imstkLogger.h" -#include "imstkPhysiologyModel.h" - -namespace imstk -{ -PhysiologyObject::PhysiologyObject(const std::string& name) : DynamicObject(name) -{ - this->m_type = Type::Physiology; -} - -std::shared_ptr<PhysiologyModel> -PhysiologyObject::getPhysiologyModel() -{ - m_PhysiologyModel = std::dynamic_pointer_cast<PhysiologyModel>(m_dynamicalModel); - return m_PhysiologyModel; -}; - -bool -PhysiologyObject::initialize() -{ - m_PhysiologyModel = std::dynamic_pointer_cast<PhysiologyModel>(m_dynamicalModel); - if (m_PhysiologyModel == nullptr) - { - LOG(FATAL) << "Dynamics pointer cast failure in SPHObject::initialize()"; - return false; - } - - DynamicObject::initialize(); - m_PhysiologyModel->initialize(); - - return true; -} -} // end namespace imstk diff --git a/Source/Pulse/imstkPhysiologyObject.h b/Source/Pulse/imstkPhysiologyObject.h deleted file mode 100644 index 5fa31e1feb9cf94dfe52648310357ad7ccf0522c..0000000000000000000000000000000000000000 --- a/Source/Pulse/imstkPhysiologyObject.h +++ /dev/null @@ -1,53 +0,0 @@ -/*========================================================================= - - Library: iMSTK - - Copyright (c) Kitware, Inc. & Center for Modeling, Simulation, - & Imaging in Medicine, Rensselaer Polytechnic Institute. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0.txt - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -=========================================================================*/ - -#pragma once - -#include "imstkDynamicObject.h" - -namespace imstk -{ -class PhysiologyModel; - -/// -/// \class PhysiologyObject -/// -/// \brief Base class for Physiology objects -/// -class PhysiologyObject : public DynamicObject -{ -public: - explicit PhysiologyObject(const std::string& name); - - virtual ~PhysiologyObject() override = default; - -public: - /// - /// \brief Initialize the Physiology scene object - /// - bool initialize() override; - - std::shared_ptr<PhysiologyModel> getPhysiologyModel(); - -protected: - std::shared_ptr<PhysiologyModel> m_PhysiologyModel = nullptr; -}; -} // end namespace imstk diff --git a/Source/Pulse/imstkSPHPhysiologyInteraction.cpp b/Source/Pulse/imstkSPHPhysiologyInteraction.cpp deleted file mode 100644 index c008c2473f404afd76f665104edefaf07d2612cb..0000000000000000000000000000000000000000 --- a/Source/Pulse/imstkSPHPhysiologyInteraction.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/*========================================================================= - -Library: iMSTK - -Copyright (c) Kitware, Inc. & Center for Modeling, Simulation, -& Imaging in Medicine, Rensselaer Polytechnic Institute. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0.txt - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - -=========================================================================*/ - -#include "imstkSPHPhysiologyInteraction.h" -#include "imstkHemorrhageAction.h" -#include "imstkPhysiologyObject.h" -#include "imstkSPHModel.h" -#include "imstkSPHObject.h" -#include "imstkTaskGraph.h" - -// Pulse -#include <PulsePhysiologyEngine.h> -#include <compartment/fluid/SELiquidCompartmentGraph.h> - -namespace imstk -{ -SPHPhysiologyObjectInteractionPair::SPHPhysiologyObjectInteractionPair( - std::shared_ptr<SPHObject> obj1, - std::shared_ptr<PhysiologyObject> obj2) : - ObjectInteractionPair(obj1, obj2) -{ - m_sphModel = obj1->getDynamicalSPHModel(); - m_physiologyModel = obj2->getPhysiologyModel(); - - // Define where the boundary condition happens - m_bcNode = std::make_shared<TaskNode>([&]() { computeInteraction(); }, - obj1->getName() + "_vs_" + obj2->getName() + "_boundaryCondition", true); - - // Define where solver interaction happens - m_solveNodeInputs.first.push_back(m_sphModel->getTaskGraph()->getSource()); - m_solveNodeInputs.second.push_back(m_physiologyModel->getTaskGraph()->getSource()); - - m_solveNodeOutputs.first.push_back(m_sphModel->getFindParticleNeighborsNode()); - m_solveNodeOutputs.second.push_back(m_physiologyModel->getSolveNode()); -} - -void -SPHPhysiologyObjectInteractionPair::computeInteraction() -{ - std::shared_ptr<SPHHemorrhage> hemorrhageModel = m_sphModel->getHemorrhageModel(); - const SELiquidCompartment* compartment = (SELiquidCompartment*)m_physiologyModel->getCompartment(m_compartmentType, m_compartmentName); - - // check if the hemorrhage is being used in SPH - if (hemorrhageModel != nullptr && m_hemorrhageAction != nullptr && compartment != nullptr) - { - // compute the hemorrhage flow rate - const double hemorrhageRate = m_sphModel->getHemorrhageModel()->getHemorrhageRate(); - - // set the hemorrhage flow rate in Pulse - m_hemorrhageAction->setRate(hemorrhageRate); - - // compute the femoral flow rate from Pulse - const double flowRate = compartment->GetInFlow(VolumePerTimeUnit::mL_Per_s); - - // set the femoral flow rate as an SPH inlet boundary condition - m_sphModel->getBoundaryConditions()->setInletVelocity(flowRate); - - // set how much time to run Pulse for - m_physiologyModel->setTimeStep(m_sphModel->getTimeStep()); - } -} - -void -SPHPhysiologyObjectInteractionPair::apply() -{ - // Add the SPH physiology interaction node to the task graph - m_objects.first->getTaskGraph()->addNode(m_bcNode); - m_objects.second->getTaskGraph()->addNode(m_bcNode); - - // Add the edges to the task graph - for (size_t i = 0; i < m_solveNodeInputs.first.size(); i++) - { - m_objects.first->getTaskGraph()->addEdge(m_solveNodeInputs.first[i], m_bcNode); - } - for (size_t i = 0; i < m_solveNodeInputs.second.size(); i++) - { - m_objects.second->getTaskGraph()->addEdge(m_solveNodeInputs.second[i], m_bcNode); - } - - for (size_t i = 0; i < m_solveNodeOutputs.first.size(); i++) - { - m_objects.first->getTaskGraph()->addEdge(m_bcNode, m_solveNodeOutputs.first[i]); - } - for (size_t i = 0; i < m_solveNodeOutputs.second.size(); i++) - { - m_objects.second->getTaskGraph()->addEdge(m_bcNode, m_solveNodeOutputs.second[i]); - } -} -} \ No newline at end of file diff --git a/Source/Pulse/imstkSPHPhysiologyInteraction.h b/Source/Pulse/imstkSPHPhysiologyInteraction.h deleted file mode 100644 index 7faa274b56d415577166163296fc702ece8b8208..0000000000000000000000000000000000000000 --- a/Source/Pulse/imstkSPHPhysiologyInteraction.h +++ /dev/null @@ -1,80 +0,0 @@ -/*========================================================================= - -Library: iMSTK - -Copyright (c) Kitware, Inc. & Center for Modeling, Simulation, -& Imaging in Medicine, Rensselaer Polytechnic Institute. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0.txt - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - -=========================================================================*/ - -#pragma once - -#include "imstkCollisionPair.h" -#include "imstkPhysiologyModel.h" - -namespace imstk -{ -class SPHObject; -class PhysiologyObject; -class SPHModel; -class HemorrhageAction; - -/// -/// \class SPHPhysiologyObjectInteractionPair -/// -/// \brief This class defines an interaction between SPH and physiology (Pulse) -/// -class SPHPhysiologyObjectInteractionPair : public ObjectInteractionPair -{ -public: - SPHPhysiologyObjectInteractionPair(std::shared_ptr<SPHObject> obj1, std::shared_ptr<PhysiologyObject> obj2); - - virtual ~SPHPhysiologyObjectInteractionPair() override = default; - -public: - void apply() override; - - /// - /// \brief Computes hemorrhage interaction between SPH and physiology (Pulse) - /// - void computeInteraction(); - - /// - /// \brief Set the Pulse hemorrhage action that should be connected to the SPH hemorrhage model - /// - void setHemorrhageAction(std::shared_ptr<HemorrhageAction> hemorrhageAction) { m_hemorrhageAction = hemorrhageAction; } - - /// - /// \brief Set the pulse compartment of the body where the hemorrhage is happening - /// - void setCompartment(const PhysiologyCompartmentType type, const std::string& compartmentName) - { - m_compartmentType = type; - m_compartmentName = compartmentName; - } - -private: - Inputs m_solveNodeInputs; - Outputs m_solveNodeOutputs; - std::shared_ptr<SPHModel> m_sphModel = nullptr; - std::shared_ptr<PhysiologyModel> m_physiologyModel = nullptr; - std::shared_ptr<TaskNode> m_bcNode = nullptr; - - std::shared_ptr<HemorrhageAction> m_hemorrhageAction; - - PhysiologyCompartmentType m_compartmentType; - std::string m_compartmentName; -}; -} \ No newline at end of file diff --git a/Source/Scene/imstkRigidObjectCollisionPair.cpp b/Source/Scene/imstkRigidObjectCollisionPair.cpp index c7f9241f9b2bfd8bf23e9a6e2322c099f783d1c5..0bb493f5066f459428f4b4c51eddc16483402289 100644 --- a/Source/Scene/imstkRigidObjectCollisionPair.cpp +++ b/Source/Scene/imstkRigidObjectCollisionPair.cpp @@ -90,8 +90,8 @@ RigidObjectCollisionPair::apply() // 1.) Copy the vertices at the start of the frame obj1->getTaskGraph()->insertBefore(obj1->getRigidBodyModel2()->getComputeTentativeVelocitiesNode(), std::make_shared<TaskNode>([ = ]() - { - copyVertsToPrevious(); + { + copyVertsToPrevious(); }, "CopyVertsToPrevious")); // If you were to update to tentative, you'd do it here, then compute displacements @@ -99,8 +99,8 @@ RigidObjectCollisionPair::apply() // 2.) Compute the displacements after updating geometry obj1->getTaskGraph()->insertAfter(obj1->getUpdateGeometryNode(), std::make_shared<TaskNode>([ = ]() - { - measureDisplacementFromPrevious(); + { + measureDisplacementFromPrevious(); }, "ComputeDisplacements")); } } @@ -143,8 +143,8 @@ RigidObjectCollisionPair::measureDisplacementFromPrevious() ParallelUtils::parallelFor(displacements->size(), [&](const int i) - { - displacementsArr[i] = vertices[i] - prevVertices[i]; + { + displacementsArr[i] = vertices[i] - prevVertices[i]; }); } } diff --git a/Source/Scene/imstkRigidObjectLevelSetCollisionPair.cpp b/Source/Scene/imstkRigidObjectLevelSetCollisionPair.cpp index 7f18d2768948e019af4b5fd687ae20de34270670..3fb2e7d63ee793144c66c4c761399089a4a2a979 100644 --- a/Source/Scene/imstkRigidObjectLevelSetCollisionPair.cpp +++ b/Source/Scene/imstkRigidObjectLevelSetCollisionPair.cpp @@ -91,8 +91,8 @@ RigidObjectLevelSetCollisionPair::apply() // 1.) Copy the vertices at the start of the frame obj1->getTaskGraph()->insertBefore(obj1->getRigidBodyModel2()->getComputeTentativeVelocitiesNode(), std::make_shared<TaskNode>([ = ]() - { - copyVertsToPrevious(); + { + copyVertsToPrevious(); }, "CopyVertsToPrevious")); // If you were to update to tentative, you'd do it here, then compute displacements @@ -143,8 +143,8 @@ RigidObjectLevelSetCollisionPair::measureDisplacementFromPrevious() ParallelUtils::parallelFor(displacements->size(), [&](const int i) - { - displacementsArr[i] = vertices[i] - prevVertices[i]; + { + displacementsArr[i] = vertices[i] - prevVertices[i]; }); } }