From 223e165dd1924488b3e466c9575ffe233dc944ea Mon Sep 17 00:00:00 2001 From: Kutscher <kutscher@irmb.tu-bs.de> Date: Thu, 16 Feb 2023 16:34:29 +0100 Subject: [PATCH] fix 3 for merge request --- .../LiggghtsCouplingCoProcessor.cpp | 28 +++++++++---------- src/lbm/constants/NumericConstants.h | 8 +++--- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.cpp b/src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.cpp index 51d451064..bf923b2a2 100644 --- a/src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.cpp +++ b/src/cpu/LiggghtsCoupling/LiggghtsCouplingCoProcessor.cpp @@ -66,7 +66,7 @@ void LiggghtsCouplingCoProcessor::setSpheresOnLattice() if (excludeFlag) continue; - double x[3], v[3], omega[3]; + double x[3] = { 0, 0, 0 }, v[3] = { 0, 0, 0 }, omega[3] = { 0, 0, 0 }; double r; int id = wrapper.lmp->atom->tag[iS]; @@ -194,7 +194,7 @@ double LiggghtsCouplingCoProcessor::calcSolidFraction(double const dx_, double c return 1; double const r_sq = r_ * r_; - double dx_sq[slicesPerDim], dy_sq[slicesPerDim], dz_sq[slicesPerDim]; + double dx_sq[slicesPerDim] = { 0, 0, 0, 0, 0 }, dy_sq[slicesPerDim] = { 0, 0, 0, 0, 0 }, dz_sq[slicesPerDim] = { 0, 0, 0, 0, 0 }; // pre-calculate d[xyz]_sq for efficiency for (int i = 0; i < slicesPerDim; i++) { @@ -255,13 +255,13 @@ void LiggghtsCouplingCoProcessor::getForcesFromLattice() if (nPart == 0) return; // no particles - no work - if (nPart > x_lb.size()) { - for (int iPart = 0; iPart < x_lb.size(); iPart++) { + if (nPart > (int)x_lb.size()) { + for (int iPart = 0; iPart < (int)x_lb.size(); iPart++) { x_lb[iPart][0] = wrapper.lmp->atom->x[iPart][0]; x_lb[iPart][1] = wrapper.lmp->atom->x[iPart][1]; x_lb[iPart][2] = wrapper.lmp->atom->x[iPart][2]; } - for (int iPart = x_lb.size(); iPart < nPart; iPart++) { + for (int iPart = (int)x_lb.size(); iPart < nPart; iPart++) { std::array<double, 3> ar = {wrapper.lmp->atom->x[iPart][0], wrapper.lmp->atom->x[iPart][1], wrapper.lmp->atom->x[iPart][2]}; @@ -277,12 +277,12 @@ void LiggghtsCouplingCoProcessor::getForcesFromLattice() } } - if (n_force > force.size()) { - for (int i = 0; i < force.size(); i++) { + if (n_force > (int)force.size()) { + for (int i = 0; i < (int)force.size(); i++) { force[i] = 0; torque[i] = 0; } - for (int i = force.size(); i < n_force; i++) { + for (int i = (int)force.size(); i < n_force; i++) { force.push_back(0.); torque.push_back(0.); } @@ -367,17 +367,17 @@ void LiggghtsCouplingCoProcessor::SumForceTorque3D(ParticleData::ParticleDataArr // minimum image convention, needed if // (1) PBC are used and // (2) both ends of PBC lie on the same processor - if (dx > nx / 2) + if ((int)dx > nx / 2) dx -= nx; - else if (dx < -nx / 2) + else if ((int)dx < -nx / 2) dx += nx; - if (dy > ny / 2) + if ((int)dy > ny / 2) dy -= ny; - else if (dy < -ny / 2) + else if ((int)dy < -ny / 2) dy += ny; - if (dz > nz / 2) + if ((int)dz > nz / 2) dz -= nz; - else if (dz < -nz / 2) + else if ((int)dz < -nz / 2) dz += nz; double const forceX = (*particleData)(ix1, ix2, ix3)->hydrodynamicForce[0]; diff --git a/src/lbm/constants/NumericConstants.h b/src/lbm/constants/NumericConstants.h index 4e9074f95..5f21fb311 100644 --- a/src/lbm/constants/NumericConstants.h +++ b/src/lbm/constants/NumericConstants.h @@ -122,10 +122,10 @@ static constexpr double c2Pi = 6.28318530717; static constexpr double cPio180 = 1.74532925199e-2; static constexpr double c180oPi = 57.2957795131; -static constexpr double one_over_sqrt2 = 1.0 / sqrt(2.0); // 0.707106781 -static constexpr double one_over_sqrt3 = 1.0 / sqrt(3.0); // 0.577350269 -static constexpr double sqrt2 = sqrt(2.0); // 1.4142135 -static constexpr double sqrt3 = sqrt(3.0); // 1.7320508 +static const double one_over_sqrt2 = 1.0 / sqrt(2.0); // 0.707106781 +static const double one_over_sqrt3 = 1.0 / sqrt(3.0); // 0.577350269 +static const double sqrt2 = sqrt(2.0); // 1.4142135 +static const double sqrt3 = sqrt(3.0); // 1.7320508 #else static constexpr float c1o2 = 0.5f; -- GitLab