store the actual file name *after* it is written
This commit is contained in:
@ -475,6 +475,7 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
DumpImage::~DumpImage()
|
DumpImage::~DumpImage()
|
||||||
{
|
{
|
||||||
delete image;
|
delete image;
|
||||||
|
output->thermo->set_image_fname("");
|
||||||
|
|
||||||
delete[] diamtype;
|
delete[] diamtype;
|
||||||
delete[] diamelement;
|
delete[] diamelement;
|
||||||
@ -500,10 +501,6 @@ void DumpImage::init_style()
|
|||||||
|
|
||||||
DumpCustom::init_style();
|
DumpCustom::init_style();
|
||||||
|
|
||||||
// cache dump image filename pattern for access through library interface.
|
|
||||||
|
|
||||||
if (multifile) output->thermo->set_image_fname(filename);
|
|
||||||
|
|
||||||
// for grid output, find current ptr for compute or fix
|
// for grid output, find current ptr for compute or fix
|
||||||
// check that fix frequency is acceptable
|
// check that fix frequency is acceptable
|
||||||
|
|
||||||
@ -790,6 +787,12 @@ void DumpImage::write()
|
|||||||
if (multifile) {
|
if (multifile) {
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
fp = nullptr;
|
fp = nullptr;
|
||||||
|
|
||||||
|
// cache last dump image filename for access through library interface.
|
||||||
|
// update only *after* the file has been written so there will be no invalid read.
|
||||||
|
// have to recreate the substitution done within openfile().
|
||||||
|
|
||||||
|
output->thermo->set_image_fname(utils::star_subst(filename, update->ntimestep, padflag));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -822,6 +822,10 @@ argument string.
|
|||||||
- line number (0-based) of current line in current file or buffer
|
- line number (0-based) of current line in current file or buffer
|
||||||
- pointer to int
|
- pointer to int
|
||||||
- no
|
- no
|
||||||
|
* - imagename
|
||||||
|
- file name of the last :doc:`dump image <dump_image>` file written
|
||||||
|
- pointer to 0-terminated const char array
|
||||||
|
- no
|
||||||
* - step
|
* - step
|
||||||
- timestep when the last thermo output was generated or -1
|
- timestep when the last thermo output was generated or -1
|
||||||
- pointer to bigint
|
- pointer to bigint
|
||||||
@ -866,6 +870,9 @@ void *lammps_last_thermo(void *handle, const char *what, int index)
|
|||||||
} else if (strcmp(what, "line") == 0) {
|
} else if (strcmp(what, "line") == 0) {
|
||||||
val = (void *) th->get_line();
|
val = (void *) th->get_line();
|
||||||
|
|
||||||
|
} else if (strcmp(what, "imagename") == 0) {
|
||||||
|
val = (void *) th->get_image_fname();
|
||||||
|
|
||||||
} else if (strcmp(what, "step") == 0) {
|
} else if (strcmp(what, "step") == 0) {
|
||||||
val = (void *) th->get_timestep();
|
val = (void *) th->get_timestep();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user