From 81fcbcd99cd05b3cf23541de628d5a8f0475839c Mon Sep 17 00:00:00 2001 From: Tim Mattox <timothy.mattox@engilitycorp.com> Date: Wed, 7 Sep 2016 16:06:38 -0400 Subject: [PATCH] USER-DPD: move nstencil_ssa out of core LAMMPS into USER-DPD --- src/USER-DPD/npair_half_bin_newton_ssa.cpp | 10 ++++-- .../nstencil_half_bin_2d_newton_ssa.cpp | 6 ++-- .../nstencil_half_bin_2d_newton_ssa.h | 4 +-- .../nstencil_half_bin_3d_newton_ssa.cpp | 6 ++-- .../nstencil_half_bin_3d_newton_ssa.h | 4 +-- src/USER-DPD/nstencil_ssa.h | 36 +++++++++++++++++++ src/npair.cpp | 1 - src/npair.h | 1 - src/nstencil.h | 1 - 9 files changed, 54 insertions(+), 15 deletions(-) create mode 100644 src/USER-DPD/nstencil_ssa.h diff --git a/src/USER-DPD/npair_half_bin_newton_ssa.cpp b/src/USER-DPD/npair_half_bin_newton_ssa.cpp index e41b9d4276..fa000233a9 100644 --- a/src/USER-DPD/npair_half_bin_newton_ssa.cpp +++ b/src/USER-DPD/npair_half_bin_newton_ssa.cpp @@ -18,6 +18,7 @@ #include "npair_half_bin_newton_ssa.h" #include "neighbor.h" +#include "nstencil_ssa.h" #include "nbin_ssa.h" #include "neigh_list.h" #include "atom.h" @@ -79,6 +80,11 @@ void NPairHalfBinNewtonSSA::build(NeighList *list) int **firstneigh = list->firstneigh; MyPage<int> *ipage = list->ipage; + NStencilSSA *ns_ssa = dynamic_cast<NStencilSSA*>(ns); + if (!ns_ssa) error->one(FLERR, "NStencil wasn't a NStencilSSA object"); + int nstencil_half = ns_ssa->nstencil_half; + int nstencil_full = ns_ssa->nstencil; + NBinSSA *nb_ssa = dynamic_cast<NBinSSA*>(nb); if (!nb_ssa) error->one(FLERR, "NBin wasn't a NBinSSA object"); int *bins_ssa = nb_ssa->bins_ssa; @@ -140,7 +146,7 @@ void NPairHalfBinNewtonSSA::build(NeighList *list) // loop over all local atoms in other bins in "half" stencil - for (k = 0; k < nstencil; k++) { + for (k = 0; k < nstencil_half; k++) { for (j = binhead_ssa[ibin+stencil[k]]; j >= 0; j = bins_ssa[j]) { @@ -176,7 +182,7 @@ void NPairHalfBinNewtonSSA::build(NeighList *list) // That is a significant time savings because of the "full" stencil // Note2: only non-pure locals can have ghosts as neighbors - if (ssaAIR[i] == 1) for (k = 0; k < nstencil_ssa; k++) { + if (ssaAIR[i] == 1) for (k = 0; k < nstencil_full; k++) { for (j = gbinhead_ssa[ibin+stencil[k]]; j >= 0; j = bins_ssa[j]) { diff --git a/src/USER-DPD/nstencil_half_bin_2d_newton_ssa.cpp b/src/USER-DPD/nstencil_half_bin_2d_newton_ssa.cpp index 8c53abfe80..4c548c783c 100644 --- a/src/USER-DPD/nstencil_half_bin_2d_newton_ssa.cpp +++ b/src/USER-DPD/nstencil_half_bin_2d_newton_ssa.cpp @@ -25,7 +25,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ NStencilHalfBin2dNewtonSSA::NStencilHalfBin2dNewtonSSA(LAMMPS *lmp) : - NStencil(lmp) {} + NStencilSSA(lmp) {} /* ---------------------------------------------------------------------- create stencil based on bin geometry and cutoff @@ -49,7 +49,7 @@ void NStencilHalfBin2dNewtonSSA::create() if (bin_distance(i,j,0) < cutneighmaxsq) stencil[pos++] = j*mbinx + i; - nstencil = pos; // record where normal half stencil ends + nstencil_half = pos; // record where normal half stencil ends // include additional bins for AIR ghosts only @@ -60,5 +60,5 @@ void NStencilHalfBin2dNewtonSSA::create() stencil[pos++] = j*mbinx + i; } - nstencil_ssa = pos; // record where full stencil ends + nstencil = pos; // record where full stencil ends } diff --git a/src/USER-DPD/nstencil_half_bin_2d_newton_ssa.h b/src/USER-DPD/nstencil_half_bin_2d_newton_ssa.h index 319a8ce670..30901bb3e2 100644 --- a/src/USER-DPD/nstencil_half_bin_2d_newton_ssa.h +++ b/src/USER-DPD/nstencil_half_bin_2d_newton_ssa.h @@ -22,11 +22,11 @@ NStencilStyle(half/bin/2d/newton/ssa, #ifndef LMP_NSTENCIL_HALF_BIN_2D_NEWTON_SSA_H #define LMP_NSTENCIL_HALF_BIN_2D_NEWTON_SSA_H -#include "nstencil.h" +#include "nstencil_ssa.h" namespace LAMMPS_NS { -class NStencilHalfBin2dNewtonSSA : public NStencil { +class NStencilHalfBin2dNewtonSSA : public NStencilSSA { public: NStencilHalfBin2dNewtonSSA(class LAMMPS *); ~NStencilHalfBin2dNewtonSSA() {} diff --git a/src/USER-DPD/nstencil_half_bin_3d_newton_ssa.cpp b/src/USER-DPD/nstencil_half_bin_3d_newton_ssa.cpp index 1ac15fe61e..4b8bd27016 100644 --- a/src/USER-DPD/nstencil_half_bin_3d_newton_ssa.cpp +++ b/src/USER-DPD/nstencil_half_bin_3d_newton_ssa.cpp @@ -25,7 +25,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ NStencilHalfBin3dNewtonSSA::NStencilHalfBin3dNewtonSSA(LAMMPS *lmp) : - NStencil(lmp) {} + NStencilSSA(lmp) {} /* ---------------------------------------------------------------------- create stencil based on bin geometry and cutoff @@ -50,7 +50,7 @@ void NStencilHalfBin3dNewtonSSA::create() if (bin_distance(i,j,k) < cutneighmaxsq) stencil[pos++] = k*mbiny*mbinx + j*mbinx + i; - nstencil = pos; // record where normal half stencil ends + nstencil_half = pos; // record where normal half stencil ends // include additional bins for AIR ghosts only @@ -70,5 +70,5 @@ void NStencilHalfBin3dNewtonSSA::create() stencil[pos++] = k*mbiny*mbinx + j*mbinx + i; } - nstencil_ssa = pos; // record where full stencil ends + nstencil = pos; // record where full stencil ends } diff --git a/src/USER-DPD/nstencil_half_bin_3d_newton_ssa.h b/src/USER-DPD/nstencil_half_bin_3d_newton_ssa.h index 8cb130a712..7765b256d3 100644 --- a/src/USER-DPD/nstencil_half_bin_3d_newton_ssa.h +++ b/src/USER-DPD/nstencil_half_bin_3d_newton_ssa.h @@ -22,11 +22,11 @@ NStencilStyle(half/bin/3d/newton/ssa, #ifndef LMP_NSTENCIL_HALF_BIN_3D_NEWTON_SSA_H #define LMP_NSTENCIL_HALF_BIN_3D_NEWTON_SSA_H -#include "nstencil.h" +#include "nstencil_ssa.h" namespace LAMMPS_NS { -class NStencilHalfBin3dNewtonSSA : public NStencil { +class NStencilHalfBin3dNewtonSSA : public NStencilSSA { public: NStencilHalfBin3dNewtonSSA(class LAMMPS *); ~NStencilHalfBin3dNewtonSSA() {} diff --git a/src/USER-DPD/nstencil_ssa.h b/src/USER-DPD/nstencil_ssa.h new file mode 100644 index 0000000000..9fcd19ee26 --- /dev/null +++ b/src/USER-DPD/nstencil_ssa.h @@ -0,0 +1,36 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifndef LMP_NSTENCIL_SSA_H +#define LMP_NSTENCIL_SSA_H + +#include "nstencil.h" + +namespace LAMMPS_NS { + +class NStencilSSA : public NStencil { + public: + NStencilSSA(class LAMMPS *lmp) : NStencil(lmp) { } + ~NStencilSSA() {} + virtual void create() = 0; + + int nstencil_half; // where the half stencil ends +}; + +} + +#endif + +/* ERROR/WARNING messages: + +*/ diff --git a/src/npair.cpp b/src/npair.cpp index 20522cde48..6ea4e62550 100644 --- a/src/npair.cpp +++ b/src/npair.cpp @@ -113,7 +113,6 @@ void NPair::copy_bin_info() void NPair::copy_stencil_info() { nstencil = ns->nstencil; - nstencil_ssa = ns->nstencil_ssa; stencil = ns->stencil; stencilxyz = ns->stencilxyz; nstencil_multi = ns->nstencil_multi; diff --git a/src/npair.h b/src/npair.h index aba7256d73..70fcc5c452 100644 --- a/src/npair.h +++ b/src/npair.h @@ -81,7 +81,6 @@ class NPair : protected Pointers { // data from NStencil class int nstencil; - int nstencil_ssa; int *stencil; int **stencilxyz; int *nstencil_multi; diff --git a/src/nstencil.h b/src/nstencil.h index c0ecfe2754..b9c6dd58fb 100644 --- a/src/nstencil.h +++ b/src/nstencil.h @@ -28,7 +28,6 @@ class NStencil : protected Pointers { bigint last_copy_bin; int nstencil; // # of bins in stencil - int nstencil_ssa; // # of total bins in SSA stencil int *stencil; // list of bin offsets int **stencilxyz; // bin offsets in xyz dims int *nstencil_multi; // # bins in each type-based multi stencil -- GitLab