synchronize interface to managing computes in Modify with that of fixes
- add find_compute_by_style() - add delete_compute(int)
This commit is contained in:
@ -1326,7 +1326,12 @@ void Modify::delete_compute(const std::string &id)
|
||||
{
|
||||
int icompute = find_compute(id);
|
||||
if (icompute < 0) error->all(FLERR,"Could not find compute ID to delete");
|
||||
delete compute[icompute];
|
||||
delete_compute(icompute);
|
||||
}
|
||||
|
||||
void Modify::delete_compute(int icompute)
|
||||
{
|
||||
if (compute[icompute]) delete compute[icompute];
|
||||
|
||||
// move other Computes down in list one slot
|
||||
|
||||
@ -1347,6 +1352,20 @@ int Modify::find_compute(const std::string &id)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
find a compute by style
|
||||
return index of compute or -1 if not found
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
int Modify::find_compute_by_style(const char *style)
|
||||
{
|
||||
int icompute;
|
||||
for (icompute = 0; icompute < ncompute; icompute++)
|
||||
if (utils::strmatch(compute[icompute]->style,style)) break;
|
||||
if (icompute == ncompute) return -1;
|
||||
return icompute;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
clear invoked flag of all computes
|
||||
called everywhere that computes are used, before computes are invoked
|
||||
|
||||
11
src/modify.h
11
src/modify.h
@ -109,21 +109,24 @@ class Modify : protected Pointers {
|
||||
void delete_fix(int);
|
||||
int find_fix(const std::string &);
|
||||
int find_fix_by_style(const char *);
|
||||
int check_package(const char *);
|
||||
int check_rigid_group_overlap(int);
|
||||
int check_rigid_region_overlap(int, class Region *);
|
||||
int check_rigid_list_overlap(int *);
|
||||
|
||||
void add_compute(int, char **, int trysuffix=1);
|
||||
void add_compute(const std::string &, int trysuffix=1);
|
||||
void modify_compute(int, char **);
|
||||
void delete_compute(const std::string &);
|
||||
void delete_compute(int);
|
||||
int find_compute(const std::string &);
|
||||
int find_compute_by_style(const char *);
|
||||
|
||||
void clearstep_compute();
|
||||
void addstep_compute(bigint);
|
||||
void addstep_compute_all(bigint);
|
||||
|
||||
int check_package(const char *);
|
||||
int check_rigid_group_overlap(int);
|
||||
int check_rigid_region_overlap(int, class Region *);
|
||||
int check_rigid_list_overlap(int *);
|
||||
|
||||
void write_restart(FILE *);
|
||||
int read_restart(FILE *);
|
||||
void restart_deallocate(int);
|
||||
|
||||
Reference in New Issue
Block a user