Commit e0e6d88d authored by Nghia Truong's avatar Nghia Truong
Browse files

STYLE: Reformat files

parent e7b39903
......@@ -147,7 +147,7 @@ int main()
{
SurfaceMesh::TriangleArray tri[2];
tri[0] = { { i*nCols + j, i*nCols + j + 1, (i + 1) * nCols + j } };
tri[1] = { { (i + 1) * nCols + j + 1, (i + 1) * nCols + j, i*nCols + j + 1 } };
tri[1] = { { (i + 1) * nCols + j + 1, (i + 1) * nCols + j, i * nCols + j + 1 } };
triangles.push_back(tri[0]);
triangles.push_back(tri[1]);
}
......
......@@ -42,7 +42,7 @@ void atomicOp(T& target, const T operand, Function&& f)
{
new_val = f(cur_val, operand);
}
while(!tgt.compare_exchange_weak(cur_val, new_val));
while (!tgt.compare_exchange_weak(cur_val, new_val));
}
///
......@@ -87,7 +87,7 @@ void atomicDivide(T& target, const T operand)
template<class T, int N>
void atomicAdd(Eigen::Matrix<T, N, 1>& target, const Eigen::Matrix<T, N, 1>& operand)
{
for(int i = 0; i < N; ++i)
for (int i = 0; i < N; ++i)
{
atomicAdd(target[i], operand[i]);
}
......@@ -99,7 +99,7 @@ void atomicAdd(Eigen::Matrix<T, N, 1>& target, const Eigen::Matrix<T, N, 1>& ope
template<class T, int N>
void atomicSubtract(Eigen::Matrix<T, N, 1>& target, const Eigen::Matrix<T, N, 1>& operand)
{
for(int i = 0; i < N; ++i)
for (int i = 0; i < N; ++i)
{
atomicSubtract(target[i], operand[i]);
}
......@@ -111,7 +111,7 @@ void atomicSubtract(Eigen::Matrix<T, N, 1>& target, const Eigen::Matrix<T, N, 1>
template<class T, int N>
void atomicMultiply(Eigen::Matrix<T, N, 1>& target, const T operand)
{
for(int i = 0; i < N; ++i)
for (int i = 0; i < N; ++i)
{
atomicMultiply(target[i], operand);
}
......@@ -123,7 +123,7 @@ void atomicMultiply(Eigen::Matrix<T, N, 1>& target, const T operand)
template<class T, int N>
void atomicDivide(Eigen::Matrix<T, N, 1>& target, const T operand)
{
for(int i = 0; i < N; ++i)
for (int i = 0; i < N; ++i)
{
atomicDivide(target[i], operand);
}
......
......@@ -35,7 +35,7 @@ void parallelFor(const IndexType beginIdx, const IndexType endIdx, Function&& fu
{
tbb::parallel_for(tbb::blocked_range<IndexType>(beginIdx, endIdx),
[&](const tbb::blocked_range<IndexType>& r) {
for(IndexType i = r.begin(), iEnd = r.end(); i < iEnd; ++i)
for (IndexType i = r.begin(), iEnd = r.end(); i < iEnd; ++i)
{
function(i);
}
......@@ -62,7 +62,7 @@ void parallelFor2Dx(const IndexType beginX, const IndexType endX,
{
parallelFor(beginX, endX,
[&](IndexType i) {
for(IndexType j = beginY; j < endY; ++j)
for (IndexType j = beginY; j < endY; ++j)
{
function(i, j);
}
......@@ -80,7 +80,7 @@ void parallelFor2Dy(const IndexType beginX, const IndexType endX,
{
parallelFor(beginY, endY,
[&](IndexType j) {
for(IndexType i = beginX; i < endX; ++i)
for (IndexType i = beginX; i < endX; ++i)
{
function(i, j);
}
......@@ -99,9 +99,9 @@ void parallelFor3Dx(const IndexType beginX, const IndexType endX,
{
parallelFor(beginX, endX,
[&](IndexType i) {
for(IndexType j = beginY; j < endY; ++j)
for (IndexType j = beginY; j < endY; ++j)
{
for(IndexType k = beginZ; k < endZ; ++k)
for (IndexType k = beginZ; k < endZ; ++k)
{
function(i, j, k);
}
......@@ -121,9 +121,9 @@ void parallelFor3Dy(const IndexType beginX, const IndexType endX,
{
parallelFor(beginY, endY,
[&](IndexType j) {
for(IndexType i = beginX; i < endX; ++i)
for (IndexType i = beginX; i < endX; ++i)
{
for(IndexType k = beginZ; k < endZ; ++k)
for (IndexType k = beginZ; k < endZ; ++k)
{
function(i, j, k);
}
......@@ -143,9 +143,9 @@ void parallelFor3Dz(const IndexType beginX, const IndexType endX,
{
parallelFor(beginX, endX,
[&](IndexType i) {
for(IndexType j = beginY; j < endY; ++j)
for (IndexType j = beginY; j < endY; ++j)
{
for(IndexType k = beginZ; k < endZ; ++k)
for (IndexType k = beginZ; k < endZ; ++k)
{
function(i, j, k);
}
......
......@@ -49,7 +49,7 @@ public:
void operator()(const tbb::blocked_range<size_t>& r)
{
for(size_t i = r.begin(); i != r.end(); ++i)
for (size_t i = r.begin(); i != r.end(); ++i)
{
Real mag2 = m_Data[i].squaredNorm();
m_Result = m_Result > mag2 ? m_Result : mag2;
......@@ -71,15 +71,15 @@ private:
class AABBFunctor
{
public:
AABBFunctor(const StdVectorOfVec3r& data) : m_Data(data) { if(data.size() > 0) { m_UpperCorner = data[0]; } }
AABBFunctor(const StdVectorOfVec3r& data) : m_Data(data) { if (data.size() > 0) { m_UpperCorner = data[0]; } }
AABBFunctor(AABBFunctor& pObj, tbb::split) : m_Data(pObj.m_Data) {}
void operator()(const tbb::blocked_range<size_t>& r)
{
for(size_t i = r.begin(); i != r.end(); ++i)
for (size_t i = r.begin(); i != r.end(); ++i)
{
const auto& vec = m_Data[i];
for(int j = 0; j < 3; ++j)
for (int j = 0; j < 3; ++j)
{
m_LowerCorner[j] = (m_LowerCorner[j] < vec[j]) ? m_LowerCorner[j] : vec[j];
m_UpperCorner[j] = (m_UpperCorner[j] > vec[j]) ? m_UpperCorner[j] : vec[j];
......@@ -89,7 +89,7 @@ public:
void join(AABBFunctor& pObj)
{
for(int j = 0; j < 3; ++j)
for (int j = 0; j < 3; ++j)
{
m_LowerCorner[j] = (m_LowerCorner[j] < pObj.m_LowerCorner[j]) ? m_LowerCorner[j] : pObj.m_LowerCorner[j];
m_UpperCorner[j] = (m_UpperCorner[j] > pObj.m_UpperCorner[j]) ? m_UpperCorner[j] : pObj.m_UpperCorner[j];
......
......@@ -19,7 +19,6 @@
=========================================================================*/
#pragma once
#include <atomic>
......@@ -53,7 +52,7 @@ public:
///
void lock()
{
while(m_Lock.test_and_set(std::memory_order_acquire)) {}
while (m_Lock.test_and_set(std::memory_order_acquire)) {}
}
///
......
......@@ -33,7 +33,7 @@ void ThreadManager::setThreadPoolSize(const size_t nThreads)
LOG_IF(FATAL, (nThreads == 0)) << "Invalid number of threads";
LOG(INFO) << "Set number of worker threads to " << nThreads;
if(s_tbbGlobalControl)
if (s_tbbGlobalControl)
{
s_tbbGlobalControl.reset();
}
......
......@@ -19,7 +19,6 @@
=========================================================================*/
#pragma once
// TODO: Remove this in TBB 2019 Update 4: https://github.com/intel/tbb/blob/tbb_2019/CHANGES#L117
......
......@@ -30,7 +30,7 @@ namespace imstk
NeighborSearch::NeighborSearch(NeighborSearch::Method searchMethod, Real searchRadius /*= 0*/) :
m_Method(searchMethod), m_SearchRadius(searchRadius)
{
if(m_Method == Method::UniformGridBasedSearch)
if (m_Method == Method::UniformGridBasedSearch)
{
m_GridBasedSearcher = std::make_shared<GridBasedNeighborSearch>();
m_GridBasedSearcher->setSearchRadius(m_SearchRadius);
......@@ -45,7 +45,7 @@ NeighborSearch::NeighborSearch(NeighborSearch::Method searchMethod, Real searchR
void NeighborSearch::setSearchRadius(const Real searchRadius)
{
m_SearchRadius = searchRadius;
if(m_Method == Method::UniformGridBasedSearch)
if (m_Method == Method::UniformGridBasedSearch)
{
m_GridBasedSearcher->setSearchRadius(m_SearchRadius);
}
......@@ -70,7 +70,7 @@ void NeighborSearch::getNeighbors(std::vector<std::vector<size_t>>&result, const
void NeighborSearch::getNeighbors(std::vector<std::vector<size_t>>& result, const StdVectorOfVec3r& setA, const StdVectorOfVec3r& setB)
{
if(m_Method == Method::UniformGridBasedSearch)
if (m_Method == Method::UniformGridBasedSearch)
{
m_GridBasedSearcher->getNeighbors(result, setA, setB);
}
......
......@@ -174,7 +174,7 @@ SpatialHashTableSeparateChaining::getPointsInSphere(std::vector<size_t>& result,
{
const Vec3d& qpos = it->point;
const auto d2 = (ppos - qpos).squaredNorm();
if(d2 < radiusSqr)
if (d2 < radiusSqr)
{
result.push_back(it->ID);
}
......
......@@ -136,13 +136,13 @@ public:
/// \brief Get data in a cell
/// \param A position in space
///
CellData& getCellData(const Vec3r& ppos) { return m_CellData[getCellLinearizedIndex<unsigned int>(ppos)]; }
CellData& getCellData(const Vec3r& ppos) { return m_CellData[getCellLinearizedIndex < unsigned int > (ppos)]; }
///
/// \brief Get data in a cell
/// \param A position in space
///
const CellData& getCellData(const Vec3r& ppos) const { return m_CellData[getCellLinearizedIndex<unsigned int>(ppos)]; }
const CellData& getCellData(const Vec3r& ppos) const { return m_CellData[getCellLinearizedIndex < unsigned int > (ppos)]; }
///
/// \brief Get data in a cell
......
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