Commit 95413fbf authored by Harald Scheirich's avatar Harald Scheirich
Browse files

Merge branch 'master' into feature/add-neighbor-tests

parents 26c52dea 7ea0cb1f
......@@ -60,6 +60,7 @@ imstk_add_external_project( VTK
${VTK_MODULE_SETTINGS}
-DVTK_WRAP_PYTHON:BOOL=OFF
-DVTK_LEGACY_REMOVE:BOOL=ON
-DCMAKE_INSTALL_RPATH:PATH=$ORIGIN/../lib
DEPENDENCIES ${VTK_DEPENDENCIES}
RELATIVE_INCLUDE_PATH ""
#VERBOSE
......
......@@ -43,10 +43,10 @@
using namespace imstk;
// Parameters to play with
const double width = 50.0;
const double height = 50.0;
const int nRows = 12;
const int nCols = 12;
const double gWidth = 50.0;
const double gHeight = 50.0;
const int gNRows = 12;
const int gNCols = 12;
///
/// \brief Creates cloth geometry
......@@ -173,7 +173,7 @@ main()
scene->addSceneObject(cutObj);
// Create a pbd cloth object in the scene
std::shared_ptr<PbdObject> clothObj = makeClothObj("Cloth", width, height, nRows, nCols);
std::shared_ptr<PbdObject> clothObj = makeClothObj("Cloth", gWidth, gHeight, gNRows, gNCols);
scene->addSceneObject(clothObj);
// Add interaction pair for pbd cutting
......
......@@ -77,7 +77,7 @@ static std::shared_ptr<PbdObject>
makePbdString(
const std::string& name,
const Vec3d& pos,
const size_t numVerts,
const int numVerts,
const double stringLength,
const double bendStiffness,
const Color& color)
......
......@@ -52,7 +52,7 @@ TetraToTetraCD::findCollisionsForMeshWithinHashTable(const std::shared_ptr<Tetra
Vec4i& vInd = mesh->getTetrahedronIndices(tId);
for (size_t i = 0; i < 4; ++i) //if idOffset!=0 ?
{
vInd[i] += idOffset;
vInd[i] += static_cast<int>(idOffset);
}
Vec3d min, max; //bounding box of a tetrahedron
......
......@@ -198,12 +198,12 @@ public:
std::vector<int> pointPenetrations(pointset->getNumVertices());
std::vector<double> pointPenetrationDistances(pointset->getNumVertices());
size_t numPenetrations = 0;
for (uint32_t p = 0; p < pointset->getNumVertices(); ++p)
for (size_t p = 0; p < pointset->getNumVertices(); ++p)
{
const auto& point = pointset->getVertexPosition(p);
bool bPenetration = true;
double penetrationDistance = 1e10;
for (uint32_t i = 0; i < 3; ++i)
for (int i = 0; i < 3; ++i)
{
if (point[i] < -0.5 || point[i] > 0.5)
{
......@@ -252,12 +252,12 @@ public:
std::vector<int> pointPenetrations(pointset->getNumVertices());
std::vector<double> pointPenetrationDistances(pointset->getNumVertices());
size_t numPenetrations = 0;
for (uint32_t p = 0; p < pointset->getNumVertices(); ++p)
for (int p = 0; p < pointset->getNumVertices(); ++p)
{
const auto& point = pointset->getVertexPosition(p);
bool bPenetration = true;
double penetrationDistance = 1e10;
for (uint32_t i = 0; i < 3; ++i)
for (int i = 0; i < 3; ++i)
{
if (point[i] < -0.5 || point[i] > 0.5)
{
......@@ -312,7 +312,7 @@ public:
// Manually check for penetration
std::vector<int> pointPenetration(pointset->getNumVertices());
size_t numPenetrations = 0;
for (uint32_t p = 0; p < pointset->getNumVertices(); ++p)
for (int p = 0; p < pointset->getNumVertices(); ++p)
{
const auto& point = pointset->getVertexPosition(p);
if ((point - SPHERE_CENTER).norm() < sphereRadius)
......@@ -353,9 +353,9 @@ public:
// Brute-force check for collision
auto collisionData = std::make_shared<CollisionData>();
for (uint32_t i = 0; i < mesh->getNumTriangles(); ++i)
for (int i = 0; i < mesh->getNumTriangles(); ++i)
{
for (uint32_t j = 0; j < box->getNumTriangles(); ++j)
for (int j = 0; j < box->getNumTriangles(); ++j)
{
NarrowPhaseCD::triangleToTriangle(i, mesh.get(), j, box.get(), collisionData);
}
......@@ -418,9 +418,9 @@ public:
// Brute-force check for collision
auto collisionData = std::make_shared<CollisionData>();
for (uint32_t i = 0; i < mesh->getNumTriangles(); ++i)
for (int i = 0; i < mesh->getNumTriangles(); ++i)
{
for (uint32_t j = 0; j < box->getNumTriangles(); ++j)
for (int j = 0; j < box->getNumTriangles(); ++j)
{
NarrowPhaseCD::triangleToTriangle(i, mesh.get(), j, box.get(), collisionData);
}
......
......@@ -81,17 +81,17 @@ TEST_F(imstkTetraToTetraCDTest, DISABLED_IntersectionThenNoIntersection1T)
auto cd = std::make_shared<CollisionData>();
m_CD = new TetraToTetraCD(a, b, cd);
m_CD->computeCollisionData();
EXPECT_EQ(cd->PTColData.getSize(), 1);
EXPECT_EQ(cd->PTColData.getSize(), 1UL);
EXPECT_EQ(cd->PTColData[0].collisionType, PointTetrahedronCollisionDataElement::bPenetratingA);
EXPECT_EQ(cd->PTColData[0].vertexIdx, 0);
EXPECT_EQ(cd->PTColData[0].tetreahedronIdx, 0);
EXPECT_EQ(cd->PTColData[0].vertexIdx, 0UL);
EXPECT_EQ(cd->PTColData[0].tetreahedronIdx, 0UL);
m_CD = new TetraToTetraCD(b, a, cd);
m_CD->computeCollisionData();
EXPECT_EQ(cd->PTColData.getSize(), 1);
EXPECT_EQ(cd->PTColData.getSize(), 1UL);
EXPECT_EQ(cd->PTColData[0].collisionType, PointTetrahedronCollisionDataElement::aPenetratingB);
EXPECT_EQ(cd->PTColData[0].vertexIdx, 0);
EXPECT_EQ(cd->PTColData[0].tetreahedronIdx, 0);
EXPECT_EQ(cd->PTColData[0].vertexIdx, 0UL);
EXPECT_EQ(cd->PTColData[0].tetreahedronIdx, 0UL);
//now translate b more so there is no intersection
b->translate(Vec3d(0.0, 2.0, 0.0));
......@@ -129,15 +129,15 @@ TEST_F(imstkTetraToTetraCDTest, DISABLED_IntersectionThenNoIntersectionHuman)
m_CD->computeCollisionData();
EXPECT_EQ(cd->PTColData.getSize(), 1);
EXPECT_EQ(cd->PTColData[0].collisionType, PointTetrahedronCollisionDataElement::aPenetratingB);
EXPECT_EQ(cd->PTColData[0].vertexIdx, 81);
EXPECT_EQ(cd->PTColData[0].tetreahedronIdx, 367);
EXPECT_EQ(cd->PTColData[0].vertexIdx, 81UL);
EXPECT_EQ(cd->PTColData[0].tetreahedronIdx, 367UL);
m_CD = new TetraToTetraCD(b, a, cd);
m_CD->computeCollisionData();
EXPECT_EQ(cd->PTColData.getSize(), 1);
EXPECT_EQ(cd->PTColData[0].collisionType, PointTetrahedronCollisionDataElement::bPenetratingA);
EXPECT_EQ(cd->PTColData[0].vertexIdx, 81);
EXPECT_EQ(cd->PTColData[0].tetreahedronIdx, 367);
EXPECT_EQ(cd->PTColData[0].vertexIdx, 81UL);
EXPECT_EQ(cd->PTColData[0].tetreahedronIdx, 367UL);
//now translate b more so there is no intersection
b->translate(Vec3d(0.0, 0.0, 1.0));
......
......@@ -142,11 +142,6 @@ TEST(imstkDataArrayTest, CapacityManagement)
TEST(imstkDataArrayTest, Iterators)
{
DataArray<int> a;
for (const auto& val : a)
{
GTEST_FAIL() << "Should not enter here";
int i = val;
}
auto itBegin = a.begin();
auto itEnd = a.end();
......
......@@ -157,10 +157,6 @@ TEST(imstkVecDataArrayTest, CapacityManagement)
TEST(imstkVecDataArrayTest, Iterators)
{
VecDataArray<int, 2> a;
for (const auto& val : a)
{
GTEST_FAIL() << "Should not enter here";
}
auto itBegin = a.begin();
auto itEnd = a.end();
......
......@@ -72,4 +72,44 @@ case typeN: { using IMSTK_TT = type; call; }; break
(std::is_same<templateType, double>::value ? IMSTK_DOUBLE : \
(std::is_same<templateType, long long>::value ? IMSTK_LONG_LONG : \
(std::is_same<templateType, unsigned long long>::value ? IMSTK_UNSIGNED_LONG_LONG : 0))))))))))))
}
\ No newline at end of file
}
// See https://www.fluentcpp.com/2019/08/30/how-to-disable-a-warning-in-cpp/
// When adding new warnings remember to add the DISABLE_ macro
// for all three sections MSVC, GCC/CLANG, other
#if defined(_MSC_VER)
#define DISABLE_WARNING_PUSH __pragma(warning( push ))
#define DISABLE_WARNING_POP __pragma(warning( pop ))
#define DISABLE_WARNING(warningNumber) __pragma(warning( disable : warningNumber ))
#define DISABLE_WARNING_UNREFERENCED_FORMAL_PARAMETER DISABLE_WARNING(4100)
#define DISABLE_WARNING_UNREFERENCED_FUNCTION DISABLE_WARNING(4505)
#define DISABLE_WARNING_HIDES_CLASS_MEMBER DISABLE_WARNING(4458)
#define DISABLE_WARNING_PADDING DISABLE_WARNING(4324)
// other warnings you want to deactivate...
// Not seen in msvc or not checked, fix when working with windows
#elif defined(__GNUC__) || defined(__clang__)
#define DO_PRAGMA(X) _Pragma(#X)
#define DISABLE_WARNING_PUSH DO_PRAGMA(GCC diagnostic push)
#define DISABLE_WARNING_POP DO_PRAGMA(GCC diagnostic pop)
#define DISABLE_WARNING(warningName) DO_PRAGMA(GCC diagnostic ignored #warningName)
#define DISABLE_WARNING_UNREFERENCED_FORMAL_PARAMETER DISABLE_WARNING(-Wunused - parameter)
#define DISABLE_WARNING_UNREFERENCED_FUNCTION DISABLE_WARNING(-Wunused - function)
// other warnings you want to deactivate...
// Not seen in gcc or not checked, fix when working with linux
#define DISABLE_WARNING_HIDES_CLASS_MEMBER
#define DISABLE_WARNING_PADDING
#else
#define DISABLE_WARNING_PUSH
#define DISABLE_WARNING_POP
#define DISABLE_WARNING_UNREFERENCED_FORMAL_PARAMETER
#define DISABLE_WARNING_UNREFERENCED_FUNCTION
#define DISABLE_WARNING_HIDES_CLASS_MEMBER
// other warnings you want to deactivate...
#endif
\ No newline at end of file
......@@ -269,13 +269,13 @@ public:
pointsets.push_back(std::move(pointset));
m_Octree->build();
EXPECT_EQ(m_Octree->m_MaxDepth, 10);
EXPECT_EQ(m_Octree->m_MaxDepth, 10U);
const auto vPrimitives = m_Octree->m_vPrimitivePtrs[OctreePrimitiveType::Point];
EXPECT_EQ(vPrimitives.size(), iter + 1);
const auto pPrimitive = vPrimitives.back();
const auto pNode = pPrimitive->m_pNode;
EXPECT_EQ(pNode->m_Depth, 10);
EXPECT_EQ(pNode->m_Depth, 10U);
EXPECT_EQ(std::abs(pNode->m_HalfWidth * 2.0 - 0.1953125) < 1e-8, true);
EXPECT_EQ(pNode->looselyContains(pPrimitive->m_Position), true);
EXPECT_EQ(pNode->contains(pPrimitive->m_Position), true);
......@@ -311,14 +311,14 @@ public:
if (bHasPoint)
{
EXPECT_EQ(m_Octree->m_MaxDepth, 10);
EXPECT_EQ(pNode->m_Depth, 8);
EXPECT_EQ(m_Octree->m_MaxDepth, 10U);
EXPECT_EQ(pNode->m_Depth, 8U);
EXPECT_EQ(std::abs(pNode->m_HalfWidth * 2.0 - 0.78125) < 1e-8, true);
}
else
{
EXPECT_EQ(m_Octree->m_MaxDepth, 5);
EXPECT_EQ(pNode->m_Depth, 5);
EXPECT_EQ(m_Octree->m_MaxDepth, 5U);
EXPECT_EQ(pNode->m_Depth, 5U);
EXPECT_EQ(std::abs(pNode->m_HalfWidth * 2.0 - 6.25) < 1e-8, true);
}
}
......
......@@ -21,10 +21,17 @@
#include "imstkLinearFEMForceModel.h"
#include "imstkMacros.h"
DISABLE_WARNING_PUSH
DISABLE_WARNING_HIDES_CLASS_MEMBER
#include <StVKElementABCDLoader.h>
#include <StVKStiffnessMatrix.h>
#include <tetMesh.h>
DISABLE_WARNING_POP
namespace imstk
{
LinearFEMForceModel::LinearFEMForceModel(std::shared_ptr<vega::VolumetricMesh> mesh,
......
......@@ -19,11 +19,18 @@
=========================================================================*/
#include "imstkMacros.h"
DISABLE_WARNING_PUSH
DISABLE_WARNING_HIDES_CLASS_MEMBER
#include "imstkStVKForceModel.h"
#include <StVKElementABCDLoader.h>
#include <tetMesh.h>
DISABLE_WARNING_POP
namespace imstk
{
StVKForceModel::StVKForceModel(std::shared_ptr<vega::VolumetricMesh> mesh,
......
......@@ -27,7 +27,6 @@
#include "imstkLogger.h"
#include "imstkNewtonSolver.h"
#include "imstkPointSet.h"
#include "imstkStVKForceModel.h"
#include "imstkTaskGraph.h"
#include "imstkTimeIntegrator.h"
#include "imstkTypes.h"
......@@ -35,16 +34,15 @@
#include "imstkVegaMeshIO.h"
#include "imstkVolumetricMesh.h"
DISABLE_WARNING_PUSH
DISABLE_WARNING_HIDES_CLASS_MEMBER
#include "imstkStVKForceModel.h"
#include <generateMassMatrix.h>
#include <generateMeshGraph.h>
#ifdef WIN32
#pragma warning( push )
#pragma warning( disable : 4458 )
#endif
#include <configFile.h>
#ifdef WIN32
#pragma warning( pop )
#endif
DISABLE_WARNING_POP
namespace imstk
{
......
......@@ -19,10 +19,11 @@
=========================================================================*/
#include "imstkLevelSetModel.h"
#include "imstkDataArray.h"
#include "imstkImageData.h"
#include "imstkLevelSetModel.h"
#include "imstkLogger.h"
#include "imstkMacros.h"
#include "imstkParallelFor.h"
#include "imstkTaskGraph.h"
......@@ -132,6 +133,8 @@ LevelSetModel::evolve()
{
baseIndexToImageIndex.push_back(iter->first);
}
DISABLE_WARNING_PUSH
DISABLE_WARNING_PADDING
// Compute gradients
const double constantVel = m_config->m_constantVelocity;
......@@ -197,7 +200,7 @@ LevelSetModel::evolve()
}
}, noteUpdatePoolSize > m_maxVelocitiesParallel);
}
DISABLE_WARNING_POP
m_nodesToUpdate.clear();
}
else
......
......@@ -170,7 +170,7 @@ RigidBodyModel2::computeTentativeVelocities()
const Vec3d& fG = m_config->m_gravity;
// Sum gravity to the forces
ParallelUtils::parallelFor(forces.size(), [&forces, &fG](const int& i)
ParallelUtils::parallelFor(forces.size(), [&forces, &fG](const size_t& i)
{
forces[i] += fG;
}, forces.size() > m_maxBodiesParallel);
......
......@@ -26,7 +26,7 @@ limitations under the License.
namespace imstk
{
SPHBoundaryConditions::SPHBoundaryConditions(std::pair<Vec3d, Vec3d>& inletCoords, std::vector<std::pair<Vec3d, Vec3d>>& outletCoords, std::pair<Vec3d, Vec3d>& fluidCoords,
const Vec3d& inletNormal, const StdVectorOfVec3d& outletNormals, const Real inletRadius, const Vec3d& inletCenterPt, const double inletFlowRate,
const Vec3d& inletNormal, const StdVectorOfVec3d&, const Real inletRadius, const Vec3d& inletCenterPt, const double inletFlowRate,
StdVectorOfVec3d& mainParticlePositions, const StdVectorOfVec3d& wallParticlePositions) :
m_inletDomain(inletCoords), m_outletDomain(outletCoords),
m_fluidDomain(fluidCoords),
......
......@@ -702,8 +702,6 @@ SPHModel::moveParticles(const Real timestep)
//ParallelUtils::parallelFor(getState().getNumParticles(),
// [&](const size_t p) {
Vec3d averageVelThroughHemorrhage(0, 0, 0);
int numParticlesAcrossHemorrhagePlane = 0;
VecDataArray<double, 3>& neighborVelContr = *m_neighborVelContr;
VecDataArray<double, 3>& particleShift = *m_particleShift;
VecDataArray<double, 3>& positions = *getCurrentState()->getPositions();
......
......@@ -203,7 +203,7 @@ void
PointSet::setLoadFactor(const double loadFactor)
{
m_loadFactor = loadFactor;
m_maxNumVertices = static_cast<size_t>(m_originalNumVertices * m_loadFactor);
m_maxNumVertices = static_cast<int>(m_originalNumVertices * m_loadFactor);
m_vertexPositions->reserve(static_cast<int>(m_maxNumVertices));
}
......
......@@ -183,7 +183,7 @@ TetrahedralMesh::extractSurfaceMesh()
if (oldToNewVertId.count(face[0]) == 0)
{
// Use size as new index
const int newVertexId = oldToNewVertId.size();
const int newVertexId = static_cast<int>(oldToNewVertId.size());
oldToNewVertId[face[0]] = newVertexId;
face[0] = newVertexId; // Relabel the old one
}
......@@ -195,7 +195,7 @@ TetrahedralMesh::extractSurfaceMesh()
if (oldToNewVertId.count(face[1]) == 0)
{
const int newVertexId = oldToNewVertId.size();
const int newVertexId = static_cast<int>(oldToNewVertId.size());
oldToNewVertId[face[1]] = newVertexId;
face[1] = newVertexId;
}
......@@ -206,7 +206,7 @@ TetrahedralMesh::extractSurfaceMesh()
if (oldToNewVertId.count(face[2]) == 0)
{
const int newVertexId = oldToNewVertId.size();
const int newVertexId = static_cast<int>(oldToNewVertId.size());
oldToNewVertId[face[2]] = newVertexId;
face[2] = newVertexId;
}
......@@ -216,7 +216,7 @@ TetrahedralMesh::extractSurfaceMesh()
}
}
auto triVerticesPtr = std::make_shared<VecDataArray<double, 3>>(oldToNewVertId.size());
auto triVerticesPtr = std::make_shared<VecDataArray<double, 3>>(static_cast<int>(oldToNewVertId.size()));
VecDataArray<double, 3>& triVertices = *triVerticesPtr;
for (auto vertIndexPair : oldToNewVertId)
......
......@@ -145,7 +145,7 @@ TetraTriangleMap::isValid() const
{
auto meshMaster = static_cast<TetrahedralMesh*>(m_master.get());
#if defined(DEBUG) || defined(_DEBUG) || !defined(NDEBUG)
CHECK(dynamic_cast<TetrahedralMesh*>(m_master.get())) << "Fail to cast from geometry to mesh";
CHECK(dynamic_cast<TetrahedralMesh*>(m_master.get()) != nullptr) << "Fail to cast from geometry to mesh";
#endif
auto totalElementsMaster = meshMaster->getNumTetrahedra();
......
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