Commit 352051e7 authored by Nghia Truong's avatar Nghia Truong
Browse files

STYLE: Change ParallelSpinLock to SpinLock

parent c97050d9
......@@ -57,7 +57,7 @@ PointSetToCapsuleCD::computeCollisionData()
auto pDotp = p.dot(p);
auto pDotp0 = p.dot(p0);
ParallelUtils::ParallelSpinLock lock;
ParallelUtils::SpinLock lock;
ParallelUtils::parallelFor(m_pointSet->getVertexPositions().size(),
[&](const size_t idx)
{
......
......@@ -47,7 +47,7 @@ void PointSetToPlaneCD::computeCollisionData()
auto planePos = m_plane->getPosition();
auto planeNormal = m_plane->getNormal();
ParallelUtils::ParallelSpinLock lock;
ParallelUtils::SpinLock lock;
ParallelUtils::parallelFor(m_pointSet->getVertexPositions().size(),
[&](const size_t idx)
{
......
......@@ -49,7 +49,7 @@ PointSetToSphereCD::computeCollisionData()
const auto sphereRadius = m_sphere->getRadius();
const auto sphereRadiusSqr = sphereRadius * sphereRadius;
ParallelUtils::ParallelSpinLock lock;
ParallelUtils::SpinLock lock;
ParallelUtils::parallelFor(m_pointSet->getVertexPositions().size(),
[&](const size_t idx)
{
......
......@@ -51,7 +51,7 @@ PointSetToSpherePickingCD::computeCollisionData()
auto spherePos = m_sphere->getPosition();
auto radius = m_sphere->getRadius() * m_sphere->getScaling();
ParallelUtils::ParallelSpinLock lock;
ParallelUtils::SpinLock lock;
ParallelUtils::parallelFor(m_pointSet->getVertexPositions().size(),
[&](const size_t idx)
{
......
......@@ -50,7 +50,7 @@ TetraToTetraCD::findCollisionsForMeshWithinHashTable(const std::shared_ptr<Tetra
auto nodesMeshA = m_meshA->getVertexPositions();
auto nodesMeshB = m_meshB->getVertexPositions();
ParallelUtils::ParallelSpinLock lock;
ParallelUtils::SpinLock lock;
ParallelUtils::parallelFor(mesh->getNumTetrahedra(),
[&](const size_t tId)
{
......
......@@ -112,7 +112,7 @@ PenaltyCH::computeContactForcesDiscreteDeformable(const std::shared_ptr<Deformab
const auto& velVector = deformableObj->getVelocities();
// If collision data, append forces
ParallelUtils::ParallelSpinLock lock;
ParallelUtils::SpinLock lock;
ParallelUtils::parallelFor(m_colData->MAColData.size(),
[&](const size_t idx) {
const auto& cd = m_colData->MAColData[idx];
......
......@@ -71,7 +71,7 @@ PickingCH::addPickConstraints(std::shared_ptr<DeformableObject> deformableObj)
auto dT = std::dynamic_pointer_cast<FEMDeformableBodyModel>(m_object->getDynamicalModel())->getTimeIntegrator()->getTimestepSize();
// If collision data, append LPC constraints
ParallelUtils::ParallelSpinLock lock;
ParallelUtils::SpinLock lock;
ParallelUtils::parallelFor(m_colData->NodePickData.size(),
[&](const size_t idx) {
const auto& cd = m_colData->NodePickData[idx];
......
......@@ -24,5 +24,5 @@
#include "imstkThreadManager.h"
#include "imstkParallelFor.h"
#include "imstkParallelReduce.h"
#include "imstkParallelSpinLock.h"
#include "imstkSpinLock.h"
#include "imstkAtomicOperations.h"
......@@ -28,23 +28,23 @@ namespace imstk
namespace ParallelUtils
{
///
/// \brief The ParallelSpinLock class
/// \brief The SpinLock class
/// \brief A SpinLock is a light weight mutex,
/// which can be safely locked and unlocked exclusively by only one thread at a time
///
class ParallelSpinLock
class SpinLock
{
public:
///
/// \brief Constructor
///
ParallelSpinLock() = default;
SpinLock() = default;
///
/// \brief Copy constructor, must be implemented as an empty function
/// because the member variable of type std::atomic_flag has copy constructor deleted
///
ParallelSpinLock(const ParallelSpinLock&) {}
SpinLock(const SpinLock&) {}
///
/// \brief Start a thread-safe region, where only one thread can execute at a time until
......
......@@ -22,7 +22,7 @@
#pragma once
#include "imstkUniformSpatialGrid.h"
#include "imstkParallelSpinLock.h"
#include "imstkSpinLock.h"
namespace imstk
{
......@@ -82,7 +82,7 @@ private:
struct CellData
{
std::vector<size_t> particleIndices; // Store list of particles
ParallelUtils::ParallelSpinLock lock; // An atomic lock for thread-safe writing
ParallelUtils::SpinLock lock; // An atomic lock for thread-safe writing
};
UniformSpatialGrid<CellData> m_Grid;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment