git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@14336 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp
2015-12-09 22:31:43 +00:00
parent 704f170053
commit ab01075956
8 changed files with 70 additions and 6 deletions

View File

@ -86,6 +86,7 @@ class ModifyKokkos : public Modify {
class DAT {
public:
typedef double tdual_xfloat_1d;
typedef int t_int_1d;
typedef int tdual_int_2d;
};

View File

@ -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 (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 RegionStyle(key,Class) \
else if (strcmp(arg[1],#key) == 0) \

View File

@ -107,6 +107,8 @@ FixSetForce::FixSetForce(LAMMPS *lmp, int narg, char **arg) :
FixSetForce::~FixSetForce()
{
if (copymode) return;
delete [] xstr;
delete [] ystr;
delete [] zstr;

View File

@ -27,18 +27,18 @@ namespace LAMMPS_NS {
class FixSetForce : public Fix {
public:
FixSetForce(class LAMMPS *, int, char **);
~FixSetForce();
virtual ~FixSetForce();
int setmask();
void init();
virtual void init();
void setup(int);
void min_setup(int);
void post_force(int);
virtual void post_force(int);
void post_force_respa(int, int, int);
void min_post_force(int);
double compute_vector(int);
double memory_usage();
private:
protected:
double xvalue,yvalue,zvalue;
int varflag,iregion;
char *xstr,*ystr,*zstr;

View File

@ -40,12 +40,16 @@ Region::Region(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
varshape = 0;
xstr = ystr = zstr = tstr = NULL;
dx = dy = dz = 0.0;
copymode = 0;
}
/* ---------------------------------------------------------------------- */
Region::~Region()
{
if (copymode) return;
delete [] id;
delete [] style;
@ -128,6 +132,15 @@ int Region::match(double x, double y, double z)
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
if region has variable shape, invoke shape_update() once per timestep

View File

@ -15,6 +15,7 @@
#define LMP_REGION_H
#include "pointers.h"
#include "accelerator_kokkos.h"
namespace LAMMPS_NS {
@ -31,6 +32,8 @@ class Region : protected Pointers {
int varshape; // 1 if region shape 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
struct Contact {
@ -59,11 +62,14 @@ class Region : protected Pointers {
virtual void shape_update() {}
virtual void pretransform();
// Kokkos function, implemented by each Kokkos region
virtual void match_all_kokkos(int, DAT::t_int_1d);
protected:
void add_contact(int, double *, double, double, double);
void options(int, char **);
private:
int moveflag,rotateflag; // 1 if position/orientation changes
double point[3],axis[3],runit[3];

View File

@ -103,6 +103,8 @@ RegBlock::RegBlock(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg)
RegBlock::~RegBlock()
{
if (copymode) return;
delete [] contact;
}

View File

@ -34,7 +34,7 @@ class RegBlock : public Region {
int surface_interior(double *, double);
int surface_exterior(double *, double);
private:
protected:
double xlo,xhi,ylo,yhi,zlo,zhi;
};