add image_fname string for caching the last active dump image filename pattern

This commit is contained in:
Axel Kohlmeyer
2023-08-29 19:22:33 -04:00
parent d0c1cfd292
commit 26ef4065da
3 changed files with 13 additions and 2 deletions

View File

@ -36,6 +36,8 @@
#include "memory.h" #include "memory.h"
#include "modify.h" #include "modify.h"
#include "molecule.h" #include "molecule.h"
#include "output.h"
#include "thermo.h"
#include "tokenizer.h" #include "tokenizer.h"
#include "update.h" #include "update.h"
#include "variable.h" #include "variable.h"
@ -498,6 +500,10 @@ 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

View File

@ -113,6 +113,7 @@ Thermo::Thermo(LAMMPS *_lmp, int narg, char **arg) :
flushflag = 0; flushflag = 0;
ntimestep = -1; ntimestep = -1;
nline = -1; nline = -1;
image_fname.clear();
// set style and corresponding lineflag // set style and corresponding lineflag
// custom style builds its own line of keywords, including wildcard expansion // custom style builds its own line of keywords, including wildcard expansion

View File

@ -42,14 +42,17 @@ class Thermo : protected Pointers {
void compute(int); void compute(int);
int evaluate_keyword(const std::string &, double *); int evaluate_keyword(const std::string &, double *);
// for accessing cached thermo data // for accessing cached thermo and related data
const int *get_nfield() const { return &nfield; }
const int *get_line() const { return &nline; } const int *get_line() const { return &nline; }
const char *get_image_fname() const { return image_fname.c_str(); }
const int *get_nfield() const { return &nfield; }
const bigint *get_timestep() const { return &ntimestep; } const bigint *get_timestep() const { return &ntimestep; }
const std::vector<multitype> &get_fields() const { return field_data; } const std::vector<multitype> &get_fields() const { return field_data; }
const std::vector<std::string> &get_keywords() const { return keyword; } const std::vector<std::string> &get_keywords() const { return keyword; }
void set_line(int _nline) { nline = _nline; } void set_line(int _nline) { nline = _nline; }
void set_image_fname(const std::string &fname) { image_fname = fname; }
private: private:
int nfield, nfield_initial; int nfield, nfield_initial;
@ -75,6 +78,7 @@ class Thermo : protected Pointers {
bigint natoms; bigint natoms;
bigint ntimestep; bigint ntimestep;
int nline; int nline;
std::string image_fname;
// data used by routines that compute single values // data used by routines that compute single values
int ivalue; // integer value to print int ivalue; // integer value to print