From a8c67f53413836e93029a4598fd767cd7e08418b Mon Sep 17 00:00:00 2001 From: Lukas Werner <lks.werner@fau.de> Date: Tue, 13 Mar 2018 10:46:58 +0100 Subject: [PATCH] Fixed more warnings --- src/pe/ccd/HashGrids.h | 16 ++++++---------- src/pe/raytracing/Raytracer.cpp | 4 ++++ tests/pe/Raytracing.cpp | 15 ++++++++------- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/src/pe/ccd/HashGrids.h b/src/pe/ccd/HashGrids.h index c13b1b4ba..4b6392b2d 100644 --- a/src/pe/ccd/HashGrids.h +++ b/src/pe/ccd/HashGrids.h @@ -191,7 +191,6 @@ private: template<typename BodyTuple> BodyID getBodyIntersectionForBlockCell(const Vector3<int32_t>& blockCell, const int8_t cellNormalAxis, const int8_t cellNormalDir, - const AABB& blockAABB, const raytracing::Ray& ray, real_t& t_closest, Vec3& n_closest) const; @@ -514,7 +513,6 @@ void HashGrids::HashGrid::processBodies( BodyID* bodies, size_t bodyCount, Conta template<typename BodyTuple> BodyID HashGrids::HashGrid::getBodyIntersectionForBlockCell(const Vector3<int32_t>& blockCell, const int8_t cellNormalAxis, const int8_t cellNormalDir, - const AABB& blockAABB, const raytracing::Ray& ray, real_t& t_closest, Vec3& n_closest) const { real_t t_local; @@ -665,8 +663,7 @@ BodyID HashGrids::HashGrid::getRayIntersectingBody(const raytracing::Ray& ray, c currentCell[1] < blockYCellCountMax && currentCell[2] < blockZCellCountMax) { body_local = getBodyIntersectionForBlockCell<BodyTuple>(currentCell, BLOCKCELL_NORMAL_INDETERMINATE, 0, - blockAABB, ray, - t_closest, n_closest); + ray, t_closest, n_closest); if (body_local != NULL) { body_closest = body_local; } @@ -686,7 +683,7 @@ BodyID HashGrids::HashGrid::getRayIntersectingBody(const raytracing::Ray& ray, c tMaxX += tDeltaX; currentCell[0] += stepX; blockCellNormalAxis = 0; - blockCellNormalDir = -stepX; + blockCellNormalDir = int8_c(-stepX); if (currentCell[0] >= blockXCellCountMax || currentCell[0] < blockXCellCountMin) { break; } @@ -699,7 +696,7 @@ BodyID HashGrids::HashGrid::getRayIntersectingBody(const raytracing::Ray& ray, c tMaxZ += tDeltaZ; currentCell[2] += stepZ; blockCellNormalAxis = 2; - blockCellNormalDir = -stepZ; + blockCellNormalDir = int8_c(-stepZ); if (currentCell[2] >= blockZCellCountMax || currentCell[2] < blockZCellCountMin) { break; } @@ -714,7 +711,7 @@ BodyID HashGrids::HashGrid::getRayIntersectingBody(const raytracing::Ray& ray, c tMaxY += tDeltaY; currentCell[1] += stepY; blockCellNormalAxis = 1; - blockCellNormalDir = -stepY; + blockCellNormalDir = int8_c(-stepY); if (currentCell[1] >= blockYCellCountMax || currentCell[1] < blockYCellCountMin) { break; } @@ -727,7 +724,7 @@ BodyID HashGrids::HashGrid::getRayIntersectingBody(const raytracing::Ray& ray, c tMaxZ += tDeltaZ; currentCell[2] += stepZ; blockCellNormalAxis = 2; - blockCellNormalDir = -stepZ; + blockCellNormalDir = int8_c(-stepZ); if (currentCell[2] >= blockZCellCountMax || currentCell[2] < blockZCellCountMin) { break; } @@ -735,8 +732,7 @@ BodyID HashGrids::HashGrid::getRayIntersectingBody(const raytracing::Ray& ray, c } body_local = getBodyIntersectionForBlockCell<BodyTuple>(currentCell, blockCellNormalAxis, blockCellNormalDir, - blockAABB, ray, - t_closest, n_closest); + ray, t_closest, n_closest); if (body_local != NULL) { body_closest = body_local; } diff --git a/src/pe/raytracing/Raytracer.cpp b/src/pe/raytracing/Raytracer.cpp index 21f19d9c3..47b121468 100644 --- a/src/pe/raytracing/Raytracer.cpp +++ b/src/pe/raytracing/Raytracer.cpp @@ -397,6 +397,10 @@ void Raytracer::syncImageUsingMPIReduce(std::vector<BodyIntersectionInfo>& inter WALBERLA_MPI_BARRIER(); if (tt != NULL) tt->stop("Reduction"); +#else + WALBERLA_UNUSED(intersectionsBuffer); + WALBERLA_UNUSED(tt); + WALBERLA_ABORT("Cannot call MPI reduce with MPI-specific code on a non-MPI build."); #endif } diff --git a/tests/pe/Raytracing.cpp b/tests/pe/Raytracing.cpp index 0775d3263..14af5ed61 100644 --- a/tests/pe/Raytracing.cpp +++ b/tests/pe/Raytracing.cpp @@ -523,7 +523,7 @@ void HashGridsTest(Raytracer::Algorithm raytracingAlgorithm, const std::string& Color(0.4, 0.4, 0.4)); //ambient tt.stop("Setup"); - int i = 0; + size_t i = 0; for (auto& vector: viewVectors) { if (i == numberOfViews) { break; @@ -849,6 +849,12 @@ int main( int argc, char** argv ) SetBodyTypeIDs<BodyTuple>::execute(); math::seedRandomGenerator( static_cast<unsigned int>(1337 * mpi::MPIManager::instance()->worldRank()) ); + SphereIntersectsTest(); + PlaneIntersectsTest(); + BoxIntersectsTest(); + AABBIntersectsTest(); + CapsuleIntersectsTest(); + Raytracer::Algorithm algorithm = Raytracer::RAYTRACE_COMPARE_BOTH; bool outputToFoldersEnabled = false; @@ -867,14 +873,9 @@ int main( int argc, char** argv ) } } - //SphereIntersectsTest(); - //PlaneIntersectsTest(); - //BoxIntersectsTest(); - //AABBIntersectsTest(); - //CapsuleIntersectsTest(); RaytracerTest(algorithm, outputFolder); RaytracerSpheresTest(algorithm, outputFolder); - + HashGridsTestScene(algorithm, outputFolder); std::vector<size_t> boxes = {127, 70, 20, 150}; -- GitLab