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

This commit is contained in:
sjplimp
2013-01-18 20:55:26 +00:00
parent 746deead15
commit 35769609d9
5 changed files with 61 additions and 7 deletions

View File

@ -28,6 +28,7 @@ class Region : protected Pointers {
double extent_ylo,extent_yhi; double extent_ylo,extent_yhi;
double extent_zlo,extent_zhi; double extent_zlo,extent_zhi;
int bboxflag; // 1 if bounding box is computable int bboxflag; // 1 if bounding box is computable
int varshape; // 1 if region shape changes over time
// contact = particle near region surface // contact = particle near region surface
@ -56,8 +57,6 @@ class Region : protected Pointers {
virtual void shape_update() {} virtual void shape_update() {}
protected: protected:
int varshape; // 1 if region shape changes over time
void add_contact(int, double *, double, double, double); void add_contact(int, double *, double, double, double);
void options(int, char **); void options(int, char **);

View File

@ -42,10 +42,14 @@ RegIntersect::RegIntersect(LAMMPS *lmp, int narg, char **arg) :
list[nregion++] = iregion; list[nregion++] = iregion;
} }
// extent of intersection of regions // this region is variable shape if any of sub-regions are
// has bounding box if interior and any sub-region has bounding box
Region **regions = domain->regions; Region **regions = domain->regions;
for (int ilist = 0; ilist < nregion; ilist++)
if (regions[list[ilist]]->varshape) varshape = 1;
// extent of intersection of regions
// has bounding box if interior and any sub-region has bounding box
bboxflag = 0; bboxflag = 0;
for (int ilist = 0; ilist < nregion; ilist++) for (int ilist = 0; ilist < nregion; ilist++)
@ -91,6 +95,16 @@ RegIntersect::~RegIntersect()
delete [] contact; delete [] contact;
} }
/* ---------------------------------------------------------------------- */
void RegIntersect::init()
{
Region::init();
Region **regions = domain->regions;
for (int ilist = 0; ilist < nregion; ilist++)
regions[list[ilist]]->init();
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
return 1 if region is dynamic, 0 if static return 1 if region is dynamic, 0 if static
dynamic if any sub-region is dynamic, else static dynamic if any sub-region is dynamic, else static
@ -206,3 +220,14 @@ int RegIntersect::surface_exterior(double *x, double cutoff)
return n; return n;
} }
/* ----------------------------------------------------------------------
change region shape of all sub-regions
------------------------------------------------------------------------- */
void RegIntersect::shape_update()
{
Region **regions = domain->regions;
for (int ilist = 0; ilist < nregion; ilist++)
regions[list[ilist]]->shape_update();
}

View File

@ -28,10 +28,12 @@ class RegIntersect : public Region {
public: public:
RegIntersect(class LAMMPS *, int, char **); RegIntersect(class LAMMPS *, int, char **);
~RegIntersect(); ~RegIntersect();
void init();
int dynamic_check(); int dynamic_check();
int inside(double, double, double); int inside(double, double, double);
int surface_interior(double *, double); int surface_interior(double *, double);
int surface_exterior(double *, double); int surface_exterior(double *, double);
void shape_update();
private: private:
int nregion; int nregion;

View File

@ -38,14 +38,19 @@ RegUnion::RegUnion(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg)
int iregion; int iregion;
for (int iarg = 0; iarg < n; iarg++) { for (int iarg = 0; iarg < n; iarg++) {
iregion = domain->find_region(arg[iarg+3]); iregion = domain->find_region(arg[iarg+3]);
if (iregion == -1) error->all(FLERR,"Region union region ID does not exist"); if (iregion == -1)
error->all(FLERR,"Region union region ID does not exist");
list[nregion++] = iregion; list[nregion++] = iregion;
} }
// extent of union of regions // this region is variable shape if any of sub-regions are
// has bounding box if interior and all sub-regions have bounding box
Region **regions = domain->regions; Region **regions = domain->regions;
for (int ilist = 0; ilist < nregion; ilist++)
if (regions[list[ilist]]->varshape) varshape = 1;
// extent of union of regions
// has bounding box if interior and all sub-regions have bounding box
bboxflag = 1; bboxflag = 1;
for (int ilist = 0; ilist < nregion; ilist++) for (int ilist = 0; ilist < nregion; ilist++)
@ -82,6 +87,16 @@ RegUnion::~RegUnion()
delete [] contact; delete [] contact;
} }
/* ---------------------------------------------------------------------- */
void RegUnion::init()
{
Region::init();
Region **regions = domain->regions;
for (int ilist = 0; ilist < nregion; ilist++)
regions[list[ilist]]->init();
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
return 1 if region is dynamic, 0 if static return 1 if region is dynamic, 0 if static
dynamic if any sub-region is dynamic, else static dynamic if any sub-region is dynamic, else static
@ -197,3 +212,14 @@ int RegUnion::surface_exterior(double *x, double cutoff)
return n; return n;
} }
/* ----------------------------------------------------------------------
change region shape of all sub-regions
------------------------------------------------------------------------- */
void RegUnion::shape_update()
{
Region **regions = domain->regions;
for (int ilist = 0; ilist < nregion; ilist++)
regions[list[ilist]]->shape_update();
}

View File

@ -28,10 +28,12 @@ class RegUnion : public Region {
public: public:
RegUnion(class LAMMPS *, int, char **); RegUnion(class LAMMPS *, int, char **);
~RegUnion(); ~RegUnion();
void init();
int dynamic_check(); int dynamic_check();
int inside(double, double, double); int inside(double, double, double);
int surface_interior(double *, double); int surface_interior(double *, double);
int surface_exterior(double *, double); int surface_exterior(double *, double);
void shape_update();
private: private:
int nregion; int nregion;