git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@14336 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -86,6 +86,7 @@ class ModifyKokkos : public Modify {
|
|||||||
class DAT {
|
class DAT {
|
||||||
public:
|
public:
|
||||||
typedef double tdual_xfloat_1d;
|
typedef double tdual_xfloat_1d;
|
||||||
|
typedef int t_int_1d;
|
||||||
typedef int tdual_int_2d;
|
typedef int tdual_int_2d;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -1504,6 +1504,46 @@ void Domain::add_region(int narg, char **arg)
|
|||||||
|
|
||||||
if (strcmp(arg[1],"none") == 0) error->all(FLERR,"Unknown region style");
|
if (strcmp(arg[1],"none") == 0) error->all(FLERR,"Unknown region style");
|
||||||
|
|
||||||
|
if (lmp->suffix_enable) {
|
||||||
|
if (lmp->suffix) {
|
||||||
|
char estyle[256];
|
||||||
|
sprintf(estyle,"%s/%s",arg[1],lmp->suffix);
|
||||||
|
|
||||||
|
if (0) return;
|
||||||
|
|
||||||
|
#define REGION_CLASS
|
||||||
|
#define RegionStyle(key,Class) \
|
||||||
|
else if (strcmp(estyle,#key) == 0) { \
|
||||||
|
regions[nregion] = new Class(lmp,narg,arg); \
|
||||||
|
regions[nregion]->init(); \
|
||||||
|
nregion++; \
|
||||||
|
return; \
|
||||||
|
}
|
||||||
|
#include "style_region.h"
|
||||||
|
#undef RegionStyle
|
||||||
|
#undef REGION_CLASS
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lmp->suffix2) {
|
||||||
|
char estyle[256];
|
||||||
|
sprintf(estyle,"%s/%s",arg[1],lmp->suffix2);
|
||||||
|
|
||||||
|
if (0) return;
|
||||||
|
|
||||||
|
#define REGION_CLASS
|
||||||
|
#define RegionStyle(key,Class) \
|
||||||
|
else if (strcmp(estyle,#key) == 0) { \
|
||||||
|
regions[nregion] = new Class(lmp,narg,arg); \
|
||||||
|
regions[nregion]->init(); \
|
||||||
|
nregion++; \
|
||||||
|
return; \
|
||||||
|
}
|
||||||
|
#include "style_region.h"
|
||||||
|
#undef RegionStyle
|
||||||
|
#undef REGION_CLASS
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#define REGION_CLASS
|
#define REGION_CLASS
|
||||||
#define RegionStyle(key,Class) \
|
#define RegionStyle(key,Class) \
|
||||||
else if (strcmp(arg[1],#key) == 0) \
|
else if (strcmp(arg[1],#key) == 0) \
|
||||||
|
|||||||
@ -107,6 +107,8 @@ FixSetForce::FixSetForce(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
|
|
||||||
FixSetForce::~FixSetForce()
|
FixSetForce::~FixSetForce()
|
||||||
{
|
{
|
||||||
|
if (copymode) return;
|
||||||
|
|
||||||
delete [] xstr;
|
delete [] xstr;
|
||||||
delete [] ystr;
|
delete [] ystr;
|
||||||
delete [] zstr;
|
delete [] zstr;
|
||||||
|
|||||||
@ -27,18 +27,18 @@ namespace LAMMPS_NS {
|
|||||||
class FixSetForce : public Fix {
|
class FixSetForce : public Fix {
|
||||||
public:
|
public:
|
||||||
FixSetForce(class LAMMPS *, int, char **);
|
FixSetForce(class LAMMPS *, int, char **);
|
||||||
~FixSetForce();
|
virtual ~FixSetForce();
|
||||||
int setmask();
|
int setmask();
|
||||||
void init();
|
virtual void init();
|
||||||
void setup(int);
|
void setup(int);
|
||||||
void min_setup(int);
|
void min_setup(int);
|
||||||
void post_force(int);
|
virtual void post_force(int);
|
||||||
void post_force_respa(int, int, int);
|
void post_force_respa(int, int, int);
|
||||||
void min_post_force(int);
|
void min_post_force(int);
|
||||||
double compute_vector(int);
|
double compute_vector(int);
|
||||||
double memory_usage();
|
double memory_usage();
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
double xvalue,yvalue,zvalue;
|
double xvalue,yvalue,zvalue;
|
||||||
int varflag,iregion;
|
int varflag,iregion;
|
||||||
char *xstr,*ystr,*zstr;
|
char *xstr,*ystr,*zstr;
|
||||||
|
|||||||
@ -40,12 +40,16 @@ Region::Region(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
|
|||||||
varshape = 0;
|
varshape = 0;
|
||||||
xstr = ystr = zstr = tstr = NULL;
|
xstr = ystr = zstr = tstr = NULL;
|
||||||
dx = dy = dz = 0.0;
|
dx = dy = dz = 0.0;
|
||||||
|
|
||||||
|
copymode = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
Region::~Region()
|
Region::~Region()
|
||||||
{
|
{
|
||||||
|
if (copymode) return;
|
||||||
|
|
||||||
delete [] id;
|
delete [] id;
|
||||||
delete [] style;
|
delete [] style;
|
||||||
|
|
||||||
@ -128,6 +132,15 @@ int Region::match(double x, double y, double z)
|
|||||||
return !(inside(x,y,z) ^ interior);
|
return !(inside(x,y,z) ^ interior);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------
|
||||||
|
generate error if Kokkos function defaults to base class
|
||||||
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void Region::match_all_kokkos(int, DAT::t_int_1d)
|
||||||
|
{
|
||||||
|
error->all(FLERR,"Can only use Kokkos supported regions with Kokkos package");
|
||||||
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
generate list of contact points for interior or exterior regions
|
generate list of contact points for interior or exterior regions
|
||||||
if region has variable shape, invoke shape_update() once per timestep
|
if region has variable shape, invoke shape_update() once per timestep
|
||||||
|
|||||||
@ -15,6 +15,7 @@
|
|||||||
#define LMP_REGION_H
|
#define LMP_REGION_H
|
||||||
|
|
||||||
#include "pointers.h"
|
#include "pointers.h"
|
||||||
|
#include "accelerator_kokkos.h"
|
||||||
|
|
||||||
namespace LAMMPS_NS {
|
namespace LAMMPS_NS {
|
||||||
|
|
||||||
@ -31,6 +32,8 @@ class Region : protected Pointers {
|
|||||||
int varshape; // 1 if region shape changes over time
|
int varshape; // 1 if region shape changes over time
|
||||||
int dynamic; // 1 if position/orient changes over time
|
int dynamic; // 1 if position/orient changes over time
|
||||||
|
|
||||||
|
int copymode; // 1 if copy of original class
|
||||||
|
|
||||||
// contact = particle near region surface
|
// contact = particle near region surface
|
||||||
|
|
||||||
struct Contact {
|
struct Contact {
|
||||||
@ -59,11 +62,14 @@ class Region : protected Pointers {
|
|||||||
virtual void shape_update() {}
|
virtual void shape_update() {}
|
||||||
virtual void pretransform();
|
virtual void pretransform();
|
||||||
|
|
||||||
|
// Kokkos function, implemented by each Kokkos region
|
||||||
|
|
||||||
|
virtual void match_all_kokkos(int, DAT::t_int_1d);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void add_contact(int, double *, double, double, double);
|
void add_contact(int, double *, double, double, double);
|
||||||
void options(int, char **);
|
void options(int, char **);
|
||||||
|
|
||||||
private:
|
|
||||||
int moveflag,rotateflag; // 1 if position/orientation changes
|
int moveflag,rotateflag; // 1 if position/orientation changes
|
||||||
|
|
||||||
double point[3],axis[3],runit[3];
|
double point[3],axis[3],runit[3];
|
||||||
|
|||||||
@ -103,6 +103,8 @@ RegBlock::RegBlock(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg)
|
|||||||
|
|
||||||
RegBlock::~RegBlock()
|
RegBlock::~RegBlock()
|
||||||
{
|
{
|
||||||
|
if (copymode) return;
|
||||||
|
|
||||||
delete [] contact;
|
delete [] contact;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -34,7 +34,7 @@ class RegBlock : public Region {
|
|||||||
int surface_interior(double *, double);
|
int surface_interior(double *, double);
|
||||||
int surface_exterior(double *, double);
|
int surface_exterior(double *, double);
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
double xlo,xhi,ylo,yhi,zlo,zhi;
|
double xlo,xhi,ylo,yhi,zlo,zhi;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user