refactor group access, enable and apply clang-format

This commit is contained in:
Axel Kohlmeyer
2022-04-14 22:01:48 -04:00
parent 4b400fb4a6
commit 69d9c5187e
187 changed files with 3016 additions and 2927 deletions

View File

@ -53,14 +53,13 @@ enum{LT,LE,GT,GE,EQ,NEQ,XOR};
/* ---------------------------------------------------------------------- */
DumpCustom::DumpCustom(LAMMPS *lmp, int narg, char **arg) :
Dump(lmp, narg, arg),
idregion(nullptr), thresh_array(nullptr), thresh_op(nullptr), thresh_value(nullptr),
thresh_last(nullptr), thresh_fix(nullptr), thresh_fixID(nullptr), thresh_first(nullptr),
earg(nullptr), vtype(nullptr), vformat(nullptr), columns(nullptr), columns_default(nullptr),
choose(nullptr), dchoose(nullptr), clist(nullptr), field2index(nullptr), argindex(nullptr),
id_compute(nullptr), compute(nullptr), id_fix(nullptr), fix(nullptr), id_variable(nullptr),
variable(nullptr), vbuf(nullptr), id_custom(nullptr), custom(nullptr), custom_flag(nullptr),
typenames(nullptr), pack_choice(nullptr)
Dump(lmp, narg, arg), idregion(nullptr), thresh_array(nullptr), thresh_op(nullptr),
thresh_value(nullptr), thresh_last(nullptr), thresh_fix(nullptr), thresh_fixID(nullptr),
thresh_first(nullptr), earg(nullptr), vtype(nullptr), vformat(nullptr), columns(nullptr),
columns_default(nullptr), choose(nullptr), dchoose(nullptr), clist(nullptr),
field2index(nullptr), argindex(nullptr), id_compute(nullptr), compute(nullptr), id_fix(nullptr),
fix(nullptr), id_variable(nullptr), variable(nullptr), vbuf(nullptr), id_custom(nullptr),
custom(nullptr), custom_flag(nullptr), typenames(nullptr), pack_choice(nullptr)
{
if (narg == 5) error->all(FLERR,"No dump custom arguments specified");
@ -87,39 +86,16 @@ DumpCustom::DumpCustom(LAMMPS *lmp, int narg, char **arg) :
buffer_allow = 1;
buffer_flag = 1;
iregion = -1;
idregion = nullptr;
nthresh = 0;
thresh_array = nullptr;
thresh_op = nullptr;
thresh_value = nullptr;
thresh_last = nullptr;
nthreshlast = 0;
thresh_fix = nullptr;
thresh_fixID = nullptr;
thresh_first = nullptr;
// computes, fixes, variables which the dump accesses
ncompute = 0;
id_compute = nullptr;
compute = nullptr;
nfix = 0;
id_fix = nullptr;
fix = nullptr;
nvariable = 0;
id_variable = nullptr;
variable = nullptr;
vbuf = nullptr;
ncustom = 0;
id_custom = nullptr;
custom = nullptr;
custom_flag = nullptr;
// process attributes
// ioptional = start of additional optional args in expanded args
@ -144,9 +120,6 @@ DumpCustom::DumpCustom(LAMMPS *lmp, int narg, char **arg) :
// atom selection arrays
maxlocal = 0;
choose = nullptr;
dchoose = nullptr;
clist = nullptr;
// default element name for all types = C
@ -364,13 +337,10 @@ void DumpCustom::init_style()
else if (flag && cols) custom_flag[i] = DARRAY;
}
// set index and check validity of region
// check validity of region
if (iregion >= 0) {
iregion = domain->find_region(idregion);
if (iregion == -1)
error->all(FLERR,"Region ID for dump custom does not exist");
}
if (idregion && !domain->get_region_by_id(idregion))
error->all(FLERR,"Region {} for dump custom does not exist", idregion);
// open single file, one time only
@ -625,8 +595,8 @@ int DumpCustom::count()
// un-choose if not in region
if (iregion >= 0) {
Region *region = domain->regions[iregion];
if (idregion) {
auto region = domain->get_region_by_id(idregion);
region->prematch();
double **x = atom->x;
for (i = 0; i < nlocal; i++)
@ -1690,12 +1660,13 @@ int DumpCustom::modify_param(int narg, char **arg)
{
if (strcmp(arg[0],"region") == 0) {
if (narg < 2) error->all(FLERR,"Illegal dump_modify command");
if (strcmp(arg[1],"none") == 0) iregion = -1;
else {
iregion = domain->find_region(arg[1]);
if (iregion == -1)
error->all(FLERR,"Dump_modify region ID {} does not exist",arg[1]);
if (strcmp(arg[1],"none") == 0) {
delete[] idregion;
idregion = nullptr;
} else {
delete[] idregion;
if (!domain->get_region_by_id(arg[1]))
error->all(FLERR,"Dump_modify region {} does not exist", arg[1]);
idregion = utils::strdup(arg[1]);
}
return 2;