git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@9299 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -36,9 +36,10 @@ Region::Region(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp)
|
||||
style = new char[n];
|
||||
strcpy(style,arg[1]);
|
||||
|
||||
varshape = 0;
|
||||
xstr = ystr = zstr = tstr = NULL;
|
||||
dx = dy = dz = 0.0;
|
||||
laststep = -1;
|
||||
lastshape = lastdynamic = -1;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -100,23 +101,35 @@ int Region::dynamic_check()
|
||||
XOR computes 0 if 2 args are the same, 1 if different
|
||||
note that inside() returns 1 for points on surface of region
|
||||
thus point on surface of exterior region will not match
|
||||
if region has variable shape, invoke shape_update() once per timestep
|
||||
if region is dynamic, apply inverse transform to x,y,z
|
||||
unmove first, then unrotate, so don't have to change rotation point
|
||||
caller is responsible for wrapping this call with
|
||||
modify->clearstep_compute() and modify->addstep_compute() if needed
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
int Region::match(double x, double y, double z)
|
||||
{
|
||||
if (dynamic) inverse_transform(x,y,z);
|
||||
if (varshape && update->ntimestep != lastshape) {
|
||||
shape_update();
|
||||
lastshape = update->ntimestep;
|
||||
}
|
||||
|
||||
if (dynamic && update->ntimestep) inverse_transform(x,y,z);
|
||||
|
||||
return !(inside(x,y,z) ^ interior);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
generate list of contact points for interior or exterior regions
|
||||
if region has variable shape, invoke shape_update() once per timestep
|
||||
if region is dynamic:
|
||||
before: inverse transform x,y,z (unmove, then unrotate)
|
||||
after: forward transform contact point xs,yx,zs (rotate, then move),
|
||||
then reset contact delx,dely,delz based on new contact point
|
||||
no need to do this if no rotation since delxyz doesn't change
|
||||
caller is responsible for wrapping this call with
|
||||
modify->clearstep_compute() and modify->addstep_compute() if needed
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
int Region::surface(double x, double y, double z, double cutoff)
|
||||
@ -125,6 +138,11 @@ int Region::surface(double x, double y, double z, double cutoff)
|
||||
double xs,ys,zs;
|
||||
double xnear[3],xorig[3];
|
||||
|
||||
if (varshape && update->ntimestep != lastshape) {
|
||||
shape_update();
|
||||
lastshape = update->ntimestep;
|
||||
}
|
||||
|
||||
if (dynamic) {
|
||||
xorig[0] = x;
|
||||
xorig[1] = y;
|
||||
@ -179,13 +197,13 @@ void Region::add_contact(int n, double *x, double xp, double yp, double zp)
|
||||
void Region::forward_transform(double &x, double &y, double &z)
|
||||
{
|
||||
if (rotateflag) {
|
||||
if (update->ntimestep != laststep)
|
||||
if (update->ntimestep != lastdynamic)
|
||||
theta = input->variable->compute_equal(tvar);
|
||||
rotate(x,y,z,theta);
|
||||
}
|
||||
|
||||
if (moveflag) {
|
||||
if (update->ntimestep != laststep) {
|
||||
if (update->ntimestep != lastdynamic) {
|
||||
if (xstr) dx = input->variable->compute_equal(xvar);
|
||||
if (ystr) dy = input->variable->compute_equal(yvar);
|
||||
if (zstr) dz = input->variable->compute_equal(zvar);
|
||||
@ -195,7 +213,7 @@ void Region::forward_transform(double &x, double &y, double &z)
|
||||
z += dz;
|
||||
}
|
||||
|
||||
laststep = update->ntimestep;
|
||||
lastdynamic = update->ntimestep;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
@ -206,7 +224,7 @@ void Region::forward_transform(double &x, double &y, double &z)
|
||||
void Region::inverse_transform(double &x, double &y, double &z)
|
||||
{
|
||||
if (moveflag) {
|
||||
if (update->ntimestep != laststep) {
|
||||
if (update->ntimestep != lastdynamic) {
|
||||
if (xstr) dx = input->variable->compute_equal(xvar);
|
||||
if (ystr) dy = input->variable->compute_equal(yvar);
|
||||
if (zstr) dz = input->variable->compute_equal(zvar);
|
||||
@ -217,12 +235,12 @@ void Region::inverse_transform(double &x, double &y, double &z)
|
||||
}
|
||||
|
||||
if (rotateflag) {
|
||||
if (update->ntimestep != laststep)
|
||||
if (update->ntimestep != lastdynamic)
|
||||
theta = input->variable->compute_equal(tvar);
|
||||
rotate(x,y,z,-theta);
|
||||
}
|
||||
|
||||
laststep = update->ntimestep;
|
||||
lastdynamic = update->ntimestep;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user