forked from lijiext/lammps
git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@13058 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
parent
a2aa6c5be0
commit
0ed5c699cc
|
@ -82,6 +82,12 @@ class ModifyKokkos : public Modify {
|
|||
~ModifyKokkos() {}
|
||||
};
|
||||
|
||||
class DAT {
|
||||
public:
|
||||
typedef double tdual_xfloat_1d;
|
||||
typedef int tdual_int_2d;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
10
src/fix.cpp
10
src/fix.cpp
|
@ -91,15 +91,19 @@ Fix::Fix(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
|
|||
execution_space = Host;
|
||||
datamask_read = ALL_MASK;
|
||||
datamask_modify = ALL_MASK;
|
||||
|
||||
copymode = 0;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
Fix::~Fix()
|
||||
{
|
||||
delete [] id;
|
||||
delete [] style;
|
||||
memory->destroy(vatom);
|
||||
if (!copymode) {
|
||||
delete [] id;
|
||||
delete [] style;
|
||||
memory->destroy(vatom);
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
|
|
@ -209,6 +209,9 @@ class Fix : protected Pointers {
|
|||
int vflag_global,vflag_atom;
|
||||
int maxvatom;
|
||||
|
||||
int copymode; // if set, do not deallocate during destruction
|
||||
// required when classes are used as functors by Kokkos
|
||||
|
||||
void v_setup(int);
|
||||
void v_tally(int, int *, double, double *);
|
||||
|
||||
|
|
|
@ -104,14 +104,18 @@ Pair::Pair(LAMMPS *lmp) : Pointers(lmp)
|
|||
execution_space = Host;
|
||||
datamask_read = ALL_MASK;
|
||||
datamask_modify = ALL_MASK;
|
||||
|
||||
copymode = 0;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
Pair::~Pair()
|
||||
{
|
||||
memory->destroy(eatom);
|
||||
memory->destroy(vatom);
|
||||
if (!copymode) {
|
||||
memory->destroy(eatom);
|
||||
memory->destroy(vatom);
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#define LMP_PAIR_H
|
||||
|
||||
#include "pointers.h"
|
||||
#include "accelerator_kokkos.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
|
@ -167,6 +168,8 @@ class Pair : protected Pointers {
|
|||
|
||||
virtual int pack_forward_comm(int, int *, double *, int, int *) {return 0;}
|
||||
virtual void unpack_forward_comm(int, int, double *) {}
|
||||
virtual int pack_forward_comm_kokkos(int, DAT::tdual_int_2d, int, DAT::tdual_xfloat_1d&, int, int *) {return 0;};
|
||||
virtual void unpack_forward_comm_kokkos(int, int, DAT::tdual_xfloat_1d&) {}
|
||||
virtual int pack_reverse_comm(int, int, double *) {return 0;}
|
||||
virtual void unpack_reverse_comm(int, int *, double *) {}
|
||||
virtual double memory_usage();
|
||||
|
@ -207,6 +210,9 @@ class Pair : protected Pointers {
|
|||
int vflag_fdotr;
|
||||
int maxeatom,maxvatom;
|
||||
|
||||
int copymode; // if set, do not deallocate during destruction
|
||||
// required when classes are used as functors by Kokkos
|
||||
|
||||
virtual void ev_setup(int, int);
|
||||
void ev_unset();
|
||||
void ev_tally_full(int, double, double, double, double, double, double);
|
||||
|
|
|
@ -38,7 +38,7 @@ PairBuck::PairBuck(LAMMPS *lmp) : Pair(lmp)
|
|||
|
||||
PairBuck::~PairBuck()
|
||||
{
|
||||
if (allocated) {
|
||||
if (allocated && !copymode) {
|
||||
memory->destroy(setflag);
|
||||
memory->destroy(cutsq);
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ class PairBuck : public Pair {
|
|||
double **a,**rho,**c;
|
||||
double **rhoinv,**buck1,**buck2,**offset;
|
||||
|
||||
void allocate();
|
||||
virtual void allocate();
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ PairCoulDSF::PairCoulDSF(LAMMPS *lmp) : Pair(lmp)
|
|||
|
||||
PairCoulDSF::~PairCoulDSF()
|
||||
{
|
||||
if (allocated) {
|
||||
if (allocated && !copymode) {
|
||||
memory->destroy(setflag);
|
||||
memory->destroy(cutsq);
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ PairCoulWolf::PairCoulWolf(LAMMPS *lmp) : Pair(lmp)
|
|||
|
||||
PairCoulWolf::~PairCoulWolf()
|
||||
{
|
||||
if (allocated) {
|
||||
if (allocated && !copymode) {
|
||||
memory->destroy(setflag);
|
||||
memory->destroy(cutsq);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue