add support for region style plugins

This commit is contained in:
Axel Kohlmeyer
2021-03-18 18:03:12 -04:00
parent 03793d5e4d
commit 023d42b5bb
3 changed files with 47 additions and 2 deletions

View File

@ -1816,8 +1816,18 @@ void Domain::delete_region(int narg, char **arg)
int iregion = find_region(arg[0]);
if (iregion == -1) error->all(FLERR,"Delete region ID does not exist");
delete_region(iregion);
}
void Domain::delete_region(int iregion)
{
if ((iregion < 0) || (iregion >= nregion)) return;
// delete and move other Regions down in list one slot
delete regions[iregion];
regions[iregion] = regions[nregion-1];
for (int i = iregion+1; iregion < nregion; ++i)
regions[i-1] = regions[i];
nregion--;
}
@ -1833,6 +1843,18 @@ int Domain::find_region(const std::string &name)
return -1;
}
/* ----------------------------------------------------------------------
return region index if name matches existing region style
return -1 if no such region
------------------------------------------------------------------------- */
int Domain::find_region_by_style(const std::string &name)
{
for (int iregion = 0; iregion < nregion; iregion++)
if (name == regions[iregion]->style) return iregion;
return -1;
}
/* ----------------------------------------------------------------------
(re)set boundary settings
flag = 0, called from the input script