ensure liftime of temporary storage
This commit is contained in:
@ -49,8 +49,7 @@ void WriteDump::command(int narg, char **arg)
|
|||||||
dumpargs[0] = (char *) "WRITE_DUMP"; // dump id
|
dumpargs[0] = (char *) "WRITE_DUMP"; // dump id
|
||||||
dumpargs[1] = arg[0]; // group
|
dumpargs[1] = arg[0]; // group
|
||||||
dumpargs[2] = arg[1]; // dump style
|
dumpargs[2] = arg[1]; // dump style
|
||||||
std::string ntimestep = std::to_string(MAX(update->ntimestep, 1));
|
dumpargs[3] = utils::strdup(std::to_string(MAX(update->ntimestep, 1))); // dump frequency
|
||||||
dumpargs[3] = (char *) ntimestep.c_str(); // dump frequency
|
|
||||||
|
|
||||||
for (int i = 2; i < modindex; ++i) dumpargs[i + 2] = arg[i];
|
for (int i = 2; i < modindex; ++i) dumpargs[i + 2] = arg[i];
|
||||||
|
|
||||||
@ -61,9 +60,7 @@ void WriteDump::command(int narg, char **arg)
|
|||||||
// set multifile_override for DumpImage so that filename needs no "*"
|
// set multifile_override for DumpImage so that filename needs no "*"
|
||||||
|
|
||||||
if (strcmp(arg[1], "image") == 0) (dynamic_cast<DumpImage *>(dump))->multifile_override = 1;
|
if (strcmp(arg[1], "image") == 0) (dynamic_cast<DumpImage *>(dump))->multifile_override = 1;
|
||||||
|
|
||||||
if (strcmp(arg[1], "cfg") == 0) (dynamic_cast<DumpCFG *>(dump))->multifile_override = 1;
|
if (strcmp(arg[1], "cfg") == 0) (dynamic_cast<DumpCFG *>(dump))->multifile_override = 1;
|
||||||
|
|
||||||
if ((update->first_update == 0) && (comm->me == 0))
|
if ((update->first_update == 0) && (comm->me == 0))
|
||||||
error->warning(FLERR, "Calling write_dump before a full system init.");
|
error->warning(FLERR, "Calling write_dump before a full system init.");
|
||||||
|
|
||||||
@ -73,5 +70,6 @@ void WriteDump::command(int narg, char **arg)
|
|||||||
// delete the Dump instance and local storage
|
// delete the Dump instance and local storage
|
||||||
|
|
||||||
output->delete_dump(dumpargs[0]);
|
output->delete_dump(dumpargs[0]);
|
||||||
|
delete[] dumpargs[3];
|
||||||
delete[] dumpargs;
|
delete[] dumpargs;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user