From 6c1be9686a08231d7c20c90f411e40672b67174d Mon Sep 17 00:00:00 2001 From: sjplimp Date: Sat, 20 Dec 2014 00:02:43 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@12844 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/region.h | 8 ++++---- src/region_intersect.cpp | 30 +++++++++++++++--------------- src/region_intersect.h | 2 +- src/region_union.cpp | 30 +++++++++++++++--------------- src/region_union.h | 2 +- 5 files changed, 36 insertions(+), 36 deletions(-) diff --git a/src/region.h b/src/region.h index b68cb74cdf..3249cf5d8b 100644 --- a/src/region.h +++ b/src/region.h @@ -29,6 +29,7 @@ class Region : protected Pointers { double extent_zlo,extent_zhi; int bboxflag; // 1 if bounding box is computable int varshape; // 1 if region shape changes over time + int dynamic; // 1 if position/orient changes over time // contact = particle near region surface @@ -42,7 +43,7 @@ class Region : protected Pointers { Region(class LAMMPS *, int, char **); virtual ~Region(); virtual void init(); - virtual int dynamic_check(); + int dynamic_check(); // called by other classes to check point versus region @@ -56,21 +57,20 @@ class Region : protected Pointers { virtual int surface_interior(double *, double) = 0; virtual int surface_exterior(double *, double) = 0; virtual void shape_update() {} + virtual void pretransform(); protected: void add_contact(int, double *, double, double, double); void options(int, char **); private: - int dynamic; // 1 if region position/orientation changes over time - int moveflag,rotateflag; // 1 if position/orientation changes + int moveflag,rotateflag; // 1 if position/orientation changes double point[3],axis[3],runit[3]; char *xstr,*ystr,*zstr,*tstr; int xvar,yvar,zvar,tvar; double dx,dy,dz,theta; - void pretransform(); void forward_transform(double &, double &, double &); void inverse_transform(double &, double &, double &); void rotate(double &, double &, double &, double); diff --git a/src/region_intersect.cpp b/src/region_intersect.cpp index 527e72962e..96c2e59a7c 100644 --- a/src/region_intersect.cpp +++ b/src/region_intersect.cpp @@ -48,11 +48,13 @@ RegIntersect::RegIntersect(LAMMPS *lmp, int narg, char **arg) : list[nregion++] = iregion; } - // this region is variable shape if any of sub-regions are + // this region is variable shape or dynamic if any of sub-regions are Region **regions = domain->regions; - for (int ilist = 0; ilist < nregion; ilist++) + for (int ilist = 0; ilist < nregion; ilist++) { if (regions[list[ilist]]->varshape) varshape = 1; + if (regions[list[ilist]]->dynamic) dynamic = 1; + } // extent of intersection of regions // has bounding box if interior and any sub-region has bounding box @@ -127,19 +129,6 @@ void RegIntersect::init() regions[list[ilist]]->init(); } -/* ---------------------------------------------------------------------- - return 1 if region is dynamic, 0 if static - dynamic if any sub-region is dynamic, else static -------------------------------------------------------------------------- */ - -int RegIntersect::dynamic_check() -{ - Region **regions = domain->regions; - for (int ilist = 0; ilist < nregion; ilist++) - if (regions[list[ilist]]->dynamic_check()) return 1; - return 0; -} - /* ---------------------------------------------------------------------- inside = 1 if x,y,z is match() with all sub-regions else inside = 0 @@ -253,3 +242,14 @@ void RegIntersect::shape_update() for (int ilist = 0; ilist < nregion; ilist++) regions[list[ilist]]->shape_update(); } + +/* ---------------------------------------------------------------------- + move/rotate all sub-regions +------------------------------------------------------------------------- */ + +void RegIntersect::pretransform() +{ + Region **regions = domain->regions; + for (int ilist = 0; ilist < nregion; ilist++) + regions[list[ilist]]->pretransform(); +} diff --git a/src/region_intersect.h b/src/region_intersect.h index 236c8d57bb..71399fb251 100644 --- a/src/region_intersect.h +++ b/src/region_intersect.h @@ -29,11 +29,11 @@ class RegIntersect : public Region { RegIntersect(class LAMMPS *, int, char **); ~RegIntersect(); void init(); - int dynamic_check(); int inside(double, double, double); int surface_interior(double *, double); int surface_exterior(double *, double); void shape_update(); + void pretransform(); private: int nregion; diff --git a/src/region_union.cpp b/src/region_union.cpp index ccb894ac60..30a33bf48a 100644 --- a/src/region_union.cpp +++ b/src/region_union.cpp @@ -49,11 +49,13 @@ RegUnion::RegUnion(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg) list[nregion++] = iregion; } - // this region is variable shape if any of sub-regions are + // this region is variable shape or dynamic if any of sub-regions are Region **regions = domain->regions; - for (int ilist = 0; ilist < nregion; ilist++) + for (int ilist = 0; ilist < nregion; ilist++) { if (regions[list[ilist]]->varshape) varshape = 1; + if (regions[list[ilist]]->dynamic) dynamic = 1; + } // extent of union of regions // has bounding box if interior and all sub-regions have bounding box @@ -119,19 +121,6 @@ void RegUnion::init() regions[list[ilist]]->init(); } -/* ---------------------------------------------------------------------- - return 1 if region is dynamic, 0 if static - dynamic if any sub-region is dynamic, else static -------------------------------------------------------------------------- */ - -int RegUnion::dynamic_check() -{ - Region **regions = domain->regions; - for (int ilist = 0; ilist < nregion; ilist++) - if (regions[list[ilist]]->dynamic_check()) return 1; - return 0; -} - /* ---------------------------------------------------------------------- inside = 1 if x,y,z is match() with any sub-region else inside = 0 @@ -245,3 +234,14 @@ void RegUnion::shape_update() for (int ilist = 0; ilist < nregion; ilist++) regions[list[ilist]]->shape_update(); } + +/* ---------------------------------------------------------------------- + move/rotate all sub-regions +------------------------------------------------------------------------- */ + +void RegUnion::pretransform() +{ + Region **regions = domain->regions; + for (int ilist = 0; ilist < nregion; ilist++) + regions[list[ilist]]->pretransform(); +} diff --git a/src/region_union.h b/src/region_union.h index dc7e99a693..7cc32b3ed8 100644 --- a/src/region_union.h +++ b/src/region_union.h @@ -29,11 +29,11 @@ class RegUnion : public Region { RegUnion(class LAMMPS *, int, char **); ~RegUnion(); void init(); - int dynamic_check(); int inside(double, double, double); int surface_interior(double *, double); int surface_exterior(double *, double); void shape_update(); + void pretransform(); private: int nregion;