replace more uses of XXXINT_FORMAT with fmtlib

This commit is contained in:
Axel Kohlmeyer
2022-03-30 13:53:25 -04:00
parent 9aad583c7d
commit c4729b39b4
10 changed files with 89 additions and 79 deletions

View File

@ -242,8 +242,7 @@ int DumpLocal::modify_param(int narg, char **arg)
// use of &str[1] removes leading '%' from BIGINT_FORMAT string
char *ptr = strchr(format_int_user,'d');
if (ptr == nullptr)
error->all(FLERR,
"Dump_modify int format does not contain d character");
error->all(FLERR, "Dump_modify int format does not contain d character");
char str[8];
sprintf(str,"%s",BIGINT_FORMAT);
*ptr = '\0';
@ -273,26 +272,29 @@ void DumpLocal::write_header(bigint ndump)
if (me == 0) {
if (unit_flag && !unit_count) {
++unit_count;
fprintf(fp,"ITEM: UNITS\n%s\n",update->unit_style);
fmt::print(fp,"ITEM: UNITS\n{}\n",update->unit_style);
}
if (time_flag) fprintf(fp,"ITEM: TIME\n%.16g\n",compute_time());
if (time_flag) fmt::print(fp,"ITEM: TIME\n{:.16}\n",compute_time());
fmt::print(fp,"ITEM: TIMESTEP\n{}\n"
"ITEM: NUMBER OF {}\n{}\n",
update->ntimestep, label, ndump);
fprintf(fp,"ITEM: TIMESTEP\n");
fprintf(fp,BIGINT_FORMAT "\n",update->ntimestep);
fprintf(fp,"ITEM: NUMBER OF %s\n",label);
fprintf(fp,BIGINT_FORMAT "\n",ndump);
if (domain->triclinic) {
fprintf(fp,"ITEM: BOX BOUNDS xy xz yz %s\n",boundstr);
fprintf(fp,"%-1.16e %-1.16e %-1.16e\n",boxxlo,boxxhi,boxxy);
fprintf(fp,"%-1.16e %-1.16e %-1.16e\n",boxylo,boxyhi,boxxz);
fprintf(fp,"%-1.16e %-1.16e %-1.16e\n",boxzlo,boxzhi,boxyz);
fmt::print(fp,"ITEM: BOX BOUNDS xy xz yz {}\n"
"{:>1.16e} {:>1.16e} {:>1.16e}\n"
"{:>1.16e} {:>1.16e} {:>1.16e}\n"
"{:>1.16e} {:>1.16e} {:>1.16e}\n",
boundstr,boxxlo,boxxhi,boxxy,boxylo,boxyhi,boxxz,boxzlo,boxzhi,boxyz);
} else {
fprintf(fp,"ITEM: BOX BOUNDS %s\n",boundstr);
fprintf(fp,"%-1.16e %-1.16e\n",boxxlo,boxxhi);
fprintf(fp,"%-1.16e %-1.16e\n",boxylo,boxyhi);
fprintf(fp,"%-1.16e %-1.16e\n",boxzlo,boxzhi);
fmt::print(fp,"ITEM: BOX BOUNDS {}\n"
"{:>1.16e} {:>1.16e}\n"
"{:>1.16e} {:>1.16e}\n"
"{:>1.16e} {:>1.16e}\n",
boundstr,boxxlo,boxxhi,boxylo,boxyhi,boxzlo,boxzhi);
}
fprintf(fp,"ITEM: %s %s\n",label,columns);
fmt::print(fp,"ITEM: {} {}\n", label, columns);
}
}