Various small cleanups to RHEO package flagged by compiler warnings
The individual changes are: - remove of unused function parameters - replace non-standard variable length arrays on the stack with static ones - disable citation removed from the manual - replace #defined constants with enum or static constexpr - enable and apply clang-format
This commit is contained in:
@ -1,4 +1,3 @@
|
||||
// clang-format off
|
||||
/* ----------------------------------------------------------------------
|
||||
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
|
||||
https://www.lammps.org/, Sandia National Laboratories
|
||||
@ -21,18 +20,18 @@
|
||||
|
||||
#include "atom.h"
|
||||
#include "comm.h"
|
||||
#include "domain.h"
|
||||
#include "compute_rheo_kernel.h"
|
||||
#include "domain.h"
|
||||
#include "error.h"
|
||||
#include "force.h"
|
||||
#include "fix_rheo.h"
|
||||
#include "fix_rheo_pressure.h"
|
||||
#include "force.h"
|
||||
#include "math_extra.h"
|
||||
#include "memory.h"
|
||||
#include "modify.h"
|
||||
#include "neighbor.h"
|
||||
#include "neigh_list.h"
|
||||
#include "neigh_request.h"
|
||||
#include "neighbor.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
@ -45,12 +44,12 @@ static constexpr double EPSILON = 1e-1;
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
ComputeRHEOInterface::ComputeRHEOInterface(LAMMPS *lmp, int narg, char **arg) :
|
||||
Compute(lmp, narg, arg), chi(nullptr), fp_store(nullptr), fix_rheo(nullptr),
|
||||
rho0(nullptr), norm(nullptr), normwf(nullptr), id_fix_pa(nullptr), list(nullptr),
|
||||
compute_kernel(nullptr), fix_pressure(nullptr)
|
||||
Compute(lmp, narg, arg), chi(nullptr), fp_store(nullptr), fix_rheo(nullptr), rho0(nullptr),
|
||||
norm(nullptr), normwf(nullptr), id_fix_pa(nullptr), list(nullptr), compute_kernel(nullptr),
|
||||
fix_pressure(nullptr)
|
||||
|
||||
{
|
||||
if (narg != 3) error->all(FLERR,"Illegal compute rheo/interface command");
|
||||
if (narg != 3) error->all(FLERR, "Illegal compute rheo/interface command");
|
||||
|
||||
comm_forward = 3;
|
||||
comm_reverse = 4;
|
||||
@ -166,20 +165,18 @@ void ComputeRHEOInterface::compute_peratom()
|
||||
if (rsq < cutsq) {
|
||||
jtype = type[j];
|
||||
fluidj = !(status[j] & PHASECHECK);
|
||||
w = compute_kernel->calc_w_quintic(i, j, dx[0], dx[1], dx[2], sqrt(rsq));
|
||||
w = compute_kernel->calc_w_quintic(sqrt(rsq));
|
||||
|
||||
norm[i] += w;
|
||||
|
||||
status_match = 0;
|
||||
if ((fluidi && fluidj) || ((!fluidi) && (!fluidj)))
|
||||
status_match = 1;
|
||||
if ((fluidi && fluidj) || ((!fluidi) && (!fluidj))) status_match = 1;
|
||||
if (status_match) {
|
||||
chi[i] += w;
|
||||
} else {
|
||||
if (!fluidi) {
|
||||
dot = 0;
|
||||
for (a = 0; a < 3; a++)
|
||||
dot += (-fp_store[j][a] + fp_store[i][a]) * dx[a];
|
||||
for (a = 0; a < 3; a++) dot += (-fp_store[j][a] + fp_store[i][a]) * dx[a];
|
||||
|
||||
rho[i] += w * (fix_pressure->calc_pressure(rho[j], jtype) - rho[j] * dot);
|
||||
normwf[i] += w;
|
||||
@ -193,8 +190,7 @@ void ComputeRHEOInterface::compute_peratom()
|
||||
} else {
|
||||
if (!fluidj) {
|
||||
dot = 0;
|
||||
for (a = 0; a < 3; a++)
|
||||
dot += (-fp_store[i][a] + fp_store[j][a]) * dx[a];
|
||||
for (a = 0; a < 3; a++) dot += (-fp_store[i][a] + fp_store[j][a]) * dx[a];
|
||||
|
||||
rho[j] += w * (fix_pressure->calc_pressure(rho[i], itype) + rho[i] * dot);
|
||||
normwf[j] += w;
|
||||
@ -228,7 +224,8 @@ void ComputeRHEOInterface::compute_peratom()
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
int ComputeRHEOInterface::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/, int * /*pbc*/)
|
||||
int ComputeRHEOInterface::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/,
|
||||
int * /*pbc*/)
|
||||
{
|
||||
int m = 0;
|
||||
double *rho = atom->rho;
|
||||
@ -293,7 +290,7 @@ void ComputeRHEOInterface::unpack_reverse_comm(int n, int *list, double *buf)
|
||||
int j = list[i];
|
||||
norm[j] += buf[m++];
|
||||
chi[j] += buf[m++];
|
||||
if (status[j] & PHASECHECK){
|
||||
if (status[j] & PHASECHECK) {
|
||||
normwf[j] += buf[m++];
|
||||
rho[j] += buf[m++];
|
||||
} else {
|
||||
@ -321,7 +318,7 @@ void ComputeRHEOInterface::correct_v(double *v_solid, double *v_fluid, int i_sol
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
double ComputeRHEOInterface::correct_rho(int i_solid, int i_fluid)
|
||||
double ComputeRHEOInterface::correct_rho(int i_solid)
|
||||
{
|
||||
int itype = atom->type[i_solid];
|
||||
return MAX(rho0[itype], atom->rho[i_solid]);
|
||||
@ -347,28 +344,26 @@ void ComputeRHEOInterface::store_forces()
|
||||
if (fixlist.size() != 0) {
|
||||
for (const auto &fix : fixlist) {
|
||||
for (int i = 0; i < atom->nlocal; i++) {
|
||||
if (rmass) minv = 1.0 / rmass[i];
|
||||
else minv = 1.0 / mass[type[i]];
|
||||
if (mask[i] & fix->groupbit)
|
||||
for (int a = 0; a < 3; a++)
|
||||
fp_store[i][a] = f[i][a] * minv;
|
||||
if (rmass)
|
||||
minv = 1.0 / rmass[i];
|
||||
else
|
||||
for (int a = 0; a < 3; a++)
|
||||
fp_store[i][a] = (f[i][a] - fp_store[i][a]) * minv;
|
||||
minv = 1.0 / mass[type[i]];
|
||||
if (mask[i] & fix->groupbit)
|
||||
for (int a = 0; a < 3; a++) fp_store[i][a] = f[i][a] * minv;
|
||||
else
|
||||
for (int a = 0; a < 3; a++) fp_store[i][a] = (f[i][a] - fp_store[i][a]) * minv;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (rmass) {
|
||||
for (int i = 0; i < atom->nlocal; i++) {
|
||||
minv = 1.0 / rmass[i];
|
||||
for (int a = 0; a < 3; a++)
|
||||
fp_store[i][a] = (f[i][a] - fp_store[i][a]) * minv;
|
||||
for (int a = 0; a < 3; a++) fp_store[i][a] = (f[i][a] - fp_store[i][a]) * minv;
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < atom->nlocal; i++) {
|
||||
minv = 1.0 / mass[type[i]];
|
||||
for (int a = 0; a < 3; a++)
|
||||
fp_store[i][a] = (f[i][a] - fp_store[i][a]) * minv;
|
||||
for (int a = 0; a < 3; a++) fp_store[i][a] = (f[i][a] - fp_store[i][a]) * minv;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -388,4 +383,3 @@ double ComputeRHEOInterface::memory_usage()
|
||||
double bytes = 3 * nmax_store * sizeof(double);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user