git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@10513 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -31,13 +31,18 @@ RegIntersect::RegIntersect(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
options(narg-(n+3),&arg[n+3]);
|
options(narg-(n+3),&arg[n+3]);
|
||||||
|
|
||||||
// build list of regions to intersect
|
// build list of regions to intersect
|
||||||
|
// store sub-region IDs in idsub
|
||||||
|
|
||||||
|
idsub = new char*[n];
|
||||||
list = new int[n];
|
list = new int[n];
|
||||||
nregion = 0;
|
nregion = 0;
|
||||||
|
|
||||||
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]);
|
n = strlen(arg[iarg+3]) + 1;
|
||||||
|
idsub[nregion] = new char[n];
|
||||||
|
strcpy(idsub[nregion],arg[iarg+3]);
|
||||||
|
iregion = domain->find_region(idsub[nregion]);
|
||||||
if (iregion == -1)
|
if (iregion == -1)
|
||||||
error->all(FLERR,"Region intersect region ID does not exist");
|
error->all(FLERR,"Region intersect region ID does not exist");
|
||||||
list[nregion++] = iregion;
|
list[nregion++] = iregion;
|
||||||
@ -92,6 +97,8 @@ RegIntersect::RegIntersect(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
|
|
||||||
RegIntersect::~RegIntersect()
|
RegIntersect::~RegIntersect()
|
||||||
{
|
{
|
||||||
|
for (int ilist = 0; ilist < nregion; ilist++) delete [] idsub[ilist];
|
||||||
|
delete [] idsub;
|
||||||
delete [] list;
|
delete [] list;
|
||||||
delete [] contact;
|
delete [] contact;
|
||||||
}
|
}
|
||||||
@ -101,6 +108,20 @@ RegIntersect::~RegIntersect()
|
|||||||
void RegIntersect::init()
|
void RegIntersect::init()
|
||||||
{
|
{
|
||||||
Region::init();
|
Region::init();
|
||||||
|
|
||||||
|
// re-build list of sub-regions in case other regions were deleted
|
||||||
|
// error if a sub-region was deleted
|
||||||
|
|
||||||
|
int iregion;
|
||||||
|
for (int ilist = 0; ilist < nregion; ilist++) {
|
||||||
|
iregion = domain->find_region(idsub[ilist]);
|
||||||
|
if (iregion == -1)
|
||||||
|
error->all(FLERR,"Region union region ID does not exist");
|
||||||
|
list[ilist] = iregion;
|
||||||
|
}
|
||||||
|
|
||||||
|
// init the sub-regions
|
||||||
|
|
||||||
Region **regions = domain->regions;
|
Region **regions = domain->regions;
|
||||||
for (int ilist = 0; ilist < nregion; ilist++)
|
for (int ilist = 0; ilist < nregion; ilist++)
|
||||||
regions[list[ilist]]->init();
|
regions[list[ilist]]->init();
|
||||||
|
|||||||
@ -38,6 +38,7 @@ class RegIntersect : public Region {
|
|||||||
private:
|
private:
|
||||||
int nregion;
|
int nregion;
|
||||||
int *list;
|
int *list;
|
||||||
|
char **idsub;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,14 +31,19 @@ RegUnion::RegUnion(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg)
|
|||||||
if (n < 2) error->all(FLERR,"Illegal region command");
|
if (n < 2) error->all(FLERR,"Illegal region command");
|
||||||
options(narg-(n+3),&arg[n+3]);
|
options(narg-(n+3),&arg[n+3]);
|
||||||
|
|
||||||
// build list of regions to union
|
// build list of region indices to union
|
||||||
|
// store sub-region IDs in idsub
|
||||||
|
|
||||||
|
idsub = new char*[n];
|
||||||
list = new int[n];
|
list = new int[n];
|
||||||
nregion = 0;
|
nregion = 0;
|
||||||
|
|
||||||
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]);
|
n = strlen(arg[iarg+3]) + 1;
|
||||||
|
idsub[nregion] = new char[n];
|
||||||
|
strcpy(idsub[nregion],arg[iarg+3]);
|
||||||
|
iregion = domain->find_region(idsub[nregion]);
|
||||||
if (iregion == -1)
|
if (iregion == -1)
|
||||||
error->all(FLERR,"Region union region ID does not exist");
|
error->all(FLERR,"Region union region ID does not exist");
|
||||||
list[nregion++] = iregion;
|
list[nregion++] = iregion;
|
||||||
@ -84,6 +89,8 @@ RegUnion::RegUnion(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg)
|
|||||||
|
|
||||||
RegUnion::~RegUnion()
|
RegUnion::~RegUnion()
|
||||||
{
|
{
|
||||||
|
for (int ilist = 0; ilist < nregion; ilist++) delete [] idsub[ilist];
|
||||||
|
delete [] idsub;
|
||||||
delete [] list;
|
delete [] list;
|
||||||
delete [] contact;
|
delete [] contact;
|
||||||
}
|
}
|
||||||
@ -93,6 +100,20 @@ RegUnion::~RegUnion()
|
|||||||
void RegUnion::init()
|
void RegUnion::init()
|
||||||
{
|
{
|
||||||
Region::init();
|
Region::init();
|
||||||
|
|
||||||
|
// re-build list of sub-regions in case other regions were deleted
|
||||||
|
// error if a sub-region was deleted
|
||||||
|
|
||||||
|
int iregion;
|
||||||
|
for (int ilist = 0; ilist < nregion; ilist++) {
|
||||||
|
iregion = domain->find_region(idsub[ilist]);
|
||||||
|
if (iregion == -1)
|
||||||
|
error->all(FLERR,"Region union region ID does not exist");
|
||||||
|
list[ilist] = iregion;
|
||||||
|
}
|
||||||
|
|
||||||
|
// init the sub-regions
|
||||||
|
|
||||||
Region **regions = domain->regions;
|
Region **regions = domain->regions;
|
||||||
for (int ilist = 0; ilist < nregion; ilist++)
|
for (int ilist = 0; ilist < nregion; ilist++)
|
||||||
regions[list[ilist]]->init();
|
regions[list[ilist]]->init();
|
||||||
|
|||||||
@ -38,6 +38,7 @@ class RegUnion : public Region {
|
|||||||
private:
|
private:
|
||||||
int nregion;
|
int nregion;
|
||||||
int *list;
|
int *list;
|
||||||
|
char **idsub;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user