Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
iMSTK
iMSTK
Commits
352051e7
Commit
352051e7
authored
Jun 21, 2019
by
Nghia Truong
Browse files
STYLE: Change ParallelSpinLock to SpinLock
parent
c97050d9
Changes
10
Hide whitespace changes
Inline
Side-by-side
Source/Collision/CollisionDetection/imstkPointSetToCapsuleCD.cpp
View file @
352051e7
...
...
@@ -57,7 +57,7 @@ PointSetToCapsuleCD::computeCollisionData()
auto
pDotp
=
p
.
dot
(
p
);
auto
pDotp0
=
p
.
dot
(
p0
);
ParallelUtils
::
Parallel
SpinLock
lock
;
ParallelUtils
::
SpinLock
lock
;
ParallelUtils
::
parallelFor
(
m_pointSet
->
getVertexPositions
().
size
(),
[
&
](
const
size_t
idx
)
{
...
...
Source/Collision/CollisionDetection/imstkPointSetToPlaneCD.cpp
View file @
352051e7
...
...
@@ -47,7 +47,7 @@ void PointSetToPlaneCD::computeCollisionData()
auto
planePos
=
m_plane
->
getPosition
();
auto
planeNormal
=
m_plane
->
getNormal
();
ParallelUtils
::
Parallel
SpinLock
lock
;
ParallelUtils
::
SpinLock
lock
;
ParallelUtils
::
parallelFor
(
m_pointSet
->
getVertexPositions
().
size
(),
[
&
](
const
size_t
idx
)
{
...
...
Source/Collision/CollisionDetection/imstkPointSetToSphereCD.cpp
View file @
352051e7
...
...
@@ -49,7 +49,7 @@ PointSetToSphereCD::computeCollisionData()
const
auto
sphereRadius
=
m_sphere
->
getRadius
();
const
auto
sphereRadiusSqr
=
sphereRadius
*
sphereRadius
;
ParallelUtils
::
Parallel
SpinLock
lock
;
ParallelUtils
::
SpinLock
lock
;
ParallelUtils
::
parallelFor
(
m_pointSet
->
getVertexPositions
().
size
(),
[
&
](
const
size_t
idx
)
{
...
...
Source/Collision/CollisionDetection/imstkPointSetToSpherePickingCD.cpp
View file @
352051e7
...
...
@@ -51,7 +51,7 @@ PointSetToSpherePickingCD::computeCollisionData()
auto
spherePos
=
m_sphere
->
getPosition
();
auto
radius
=
m_sphere
->
getRadius
()
*
m_sphere
->
getScaling
();
ParallelUtils
::
Parallel
SpinLock
lock
;
ParallelUtils
::
SpinLock
lock
;
ParallelUtils
::
parallelFor
(
m_pointSet
->
getVertexPositions
().
size
(),
[
&
](
const
size_t
idx
)
{
...
...
Source/Collision/CollisionDetection/imstkTetraToTetraCD.cpp
View file @
352051e7
...
...
@@ -50,7 +50,7 @@ TetraToTetraCD::findCollisionsForMeshWithinHashTable(const std::shared_ptr<Tetra
auto
nodesMeshA
=
m_meshA
->
getVertexPositions
();
auto
nodesMeshB
=
m_meshB
->
getVertexPositions
();
ParallelUtils
::
Parallel
SpinLock
lock
;
ParallelUtils
::
SpinLock
lock
;
ParallelUtils
::
parallelFor
(
mesh
->
getNumTetrahedra
(),
[
&
](
const
size_t
tId
)
{
...
...
Source/Collision/CollisionHandling/imstkPenaltyCH.cpp
View file @
352051e7
...
...
@@ -112,7 +112,7 @@ PenaltyCH::computeContactForcesDiscreteDeformable(const std::shared_ptr<Deformab
const
auto
&
velVector
=
deformableObj
->
getVelocities
();
// If collision data, append forces
ParallelUtils
::
Parallel
SpinLock
lock
;
ParallelUtils
::
SpinLock
lock
;
ParallelUtils
::
parallelFor
(
m_colData
->
MAColData
.
size
(),
[
&
](
const
size_t
idx
)
{
const
auto
&
cd
=
m_colData
->
MAColData
[
idx
];
...
...
Source/Collision/CollisionHandling/imstkPickingCH.cpp
View file @
352051e7
...
...
@@ -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
::
Parallel
SpinLock
lock
;
ParallelUtils
::
SpinLock
lock
;
ParallelUtils
::
parallelFor
(
m_colData
->
NodePickData
.
size
(),
[
&
](
const
size_t
idx
)
{
const
auto
&
cd
=
m_colData
->
NodePickData
[
idx
];
...
...
Source/Core/Parallel/imstkParallelUtils.h
View file @
352051e7
...
...
@@ -24,5 +24,5 @@
#include
"imstkThreadManager.h"
#include
"imstkParallelFor.h"
#include
"imstkParallelReduce.h"
#include
"imstk
Parallel
SpinLock.h"
#include
"imstkSpinLock.h"
#include
"imstkAtomicOperations.h"
Source/Core/Parallel/imstk
Parallel
SpinLock.h
→
Source/Core/Parallel/imstkSpinLock.h
View file @
352051e7
...
...
@@ -28,23 +28,23 @@ namespace imstk
namespace
ParallelUtils
{
///
/// \brief The
Parallel
SpinLock 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
Parallel
SpinLock
class
SpinLock
{
public:
///
/// \brief Constructor
///
Parallel
SpinLock
()
=
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
///
Parallel
SpinLock
(
const
Parallel
SpinLock
&
)
{}
SpinLock
(
const
SpinLock
&
)
{}
///
/// \brief Start a thread-safe region, where only one thread can execute at a time until
...
...
Source/DataStructures/imstkGridBasedNeighborSearch.h
View file @
352051e7
...
...
@@ -22,7 +22,7 @@
#pragma once
#include
"imstkUniformSpatialGrid.h"
#include
"imstk
Parallel
SpinLock.h"
#include
"imstkSpinLock.h"
namespace
imstk
{
...
...
@@ -82,7 +82,7 @@ private:
struct
CellData
{
std
::
vector
<
size_t
>
particleIndices
;
// Store list of particles
ParallelUtils
::
Parallel
SpinLock
lock
;
// An atomic lock for thread-safe writing
ParallelUtils
::
SpinLock
lock
;
// An atomic lock for thread-safe writing
};
UniformSpatialGrid
<
CellData
>
m_Grid
;
};
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment