Commit 3c103025 authored by allens's avatar allens

added a format option for the time state

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@30343 18c085ea-50e0-402c-830e-de6fd14e8384
parent 1ee16c65
This diff is collapsed.
......@@ -87,19 +87,21 @@ public:
// Property selection methods
virtual void SelectAll();
void SelectDirname();
void SelectFilename();
void SelectTimeStateFormat();
void SelectDb_type();
void SelectDb_type_fullname();
void SelectFilename();
void SelectDirname();
void SelectVariables();
void SelectOpts();
// Property setting methods
void SetAllTimes(bool allTimes_);
void SetDirname(const std::string &dirname_);
void SetFilename(const std::string &filename_);
void SetTimeStateFormat(const std::string &timeStateFormat_);
void SetDb_type(const std::string &db_type_);
void SetDb_type_fullname(const std::string &db_type_fullname_);
void SetFilename(const std::string &filename_);
void SetDirname(const std::string &dirname_);
void SetVariables(const stringVector &variables_);
void SetWriteUsingGroups(bool writeUsingGroups_);
void SetGroupSize(int groupSize_);
......@@ -107,14 +109,16 @@ public:
// Property getting methods
bool GetAllTimes() const;
const std::string &GetDirname() const;
std::string &GetDirname();
const std::string &GetFilename() const;
std::string &GetFilename();
const std::string &GetTimeStateFormat() const;
std::string &GetTimeStateFormat();
const std::string &GetDb_type() const;
std::string &GetDb_type();
const std::string &GetDb_type_fullname() const;
std::string &GetDb_type_fullname();
const std::string &GetFilename() const;
std::string &GetFilename();
const std::string &GetDirname() const;
std::string &GetDirname();
const stringVector &GetVariables() const;
stringVector &GetVariables();
bool GetWriteUsingGroups() const;
......@@ -137,10 +141,11 @@ public:
// IDs that can be used to identify fields in case statements
enum {
ID_allTimes = 0,
ID_dirname,
ID_filename,
ID_timeStateFormat,
ID_db_type,
ID_db_type_fullname,
ID_filename,
ID_dirname,
ID_variables,
ID_writeUsingGroups,
ID_groupSize,
......@@ -150,10 +155,11 @@ public:
private:
bool allTimes;
std::string dirname;
std::string filename;
std::string timeStateFormat;
std::string db_type;
std::string db_type_fullname;
std::string filename;
std::string dirname;
stringVector variables;
bool writeUsingGroups;
int groupSize;
......@@ -163,6 +169,6 @@ private:
static const char *TypeMapFormatString;
static const private_tmfs_t TmfsStruct;
};
#define EXPORTDBATTRIBUTES_TMFS "bsssss*bia"
#define EXPORTDBATTRIBUTES_TMFS "bssssss*bia"
#endif
......@@ -3,15 +3,18 @@
<Field name="allTimes" label="All time steps" type="bool">
false
</Field>
<Field name="db_type" label="db_type" type="string">
</Field>
<Field name="db_type_fullname" label="db_type_fullname" type="string">
<Field name="dirname" label="dirname" type="string">
"."
</Field>
<Field name="filename" label="filename" type="string">
visit_ex_db
</Field>
<Field name="dirname" label="dirname" type="string">
"."
<Field name="timeStateFormat" label="timeStateFormat" type="string">
_%04d
</Field>
<Field name="db_type" label="db_type" type="string">
</Field>
<Field name="db_type_fullname" label="db_type_fullname" type="string">
</Field>
<Field name="variables" label="variables" type="stringVector">
</Field>
......
This diff is collapsed.
......@@ -130,6 +130,7 @@ protected slots:
void selectOutputDirectory();
void delimiterChanged(int);
void allTimesToggled(bool);
void processTimeStateFormatText();
void coordinateGroupsToggled(bool);
void groupSizeChanged(int);
private:
......@@ -149,6 +150,8 @@ private:
QvisVariableButton *varsButton;
QLineEdit *varsLineEdit;
QCheckBox *allTimes;
QLabel *timeStateFormatLabel;
QLineEdit *timeStateFormatEdit;
QCheckBox *coordinateGroups;
QLabel *groupSizeLabel;
QSpinBox *groupSize;
......
......@@ -57,17 +57,18 @@ import java.util.Vector;
public class ExportDBAttributes extends AttributeSubject
{
private static int ExportDBAttributes_numAdditionalAtts = 9;
private static int ExportDBAttributes_numAdditionalAtts = 10;
public ExportDBAttributes()
{
super(ExportDBAttributes_numAdditionalAtts);
allTimes = false;
dirname = new String(".");
filename = new String("visit_ex_db");
timeStateFormat = new String("_%04d");
db_type = new String("");
db_type_fullname = new String("");
filename = new String("visit_ex_db");
dirname = new String(".");
variables = new Vector();
writeUsingGroups = false;
groupSize = 48;
......@@ -79,10 +80,11 @@ public class ExportDBAttributes extends AttributeSubject
super(ExportDBAttributes_numAdditionalAtts + nMoreFields);
allTimes = false;
dirname = new String(".");
filename = new String("visit_ex_db");
timeStateFormat = new String("_%04d");
db_type = new String("");
db_type_fullname = new String("");
filename = new String("visit_ex_db");
dirname = new String(".");
variables = new Vector();
writeUsingGroups = false;
groupSize = 48;
......@@ -96,10 +98,11 @@ public class ExportDBAttributes extends AttributeSubject
int i;
allTimes = obj.allTimes;
dirname = new String(obj.dirname);
filename = new String(obj.filename);
timeStateFormat = new String(obj.timeStateFormat);
db_type = new String(obj.db_type);
db_type_fullname = new String(obj.db_type_fullname);
filename = new String(obj.filename);
dirname = new String(obj.dirname);
variables = new Vector(obj.variables.size());
for(i = 0; i < obj.variables.size(); ++i)
variables.addElement(new String((String)obj.variables.elementAt(i)));
......@@ -136,10 +139,11 @@ public class ExportDBAttributes extends AttributeSubject
}
// Create the return value
return ((allTimes == obj.allTimes) &&
(dirname.equals(obj.dirname)) &&
(filename.equals(obj.filename)) &&
(timeStateFormat.equals(obj.timeStateFormat)) &&
(db_type.equals(obj.db_type)) &&
(db_type_fullname.equals(obj.db_type_fullname)) &&
(filename.equals(obj.filename)) &&
(dirname.equals(obj.dirname)) &&
variables_equal &&
(writeUsingGroups == obj.writeUsingGroups) &&
(groupSize == obj.groupSize) &&
......@@ -153,60 +157,67 @@ public class ExportDBAttributes extends AttributeSubject
Select(0);
}
public void SetDb_type(String db_type_)
public void SetDirname(String dirname_)
{
db_type = db_type_;
dirname = dirname_;
Select(1);
}
public void SetDb_type_fullname(String db_type_fullname_)
public void SetFilename(String filename_)
{
db_type_fullname = db_type_fullname_;
filename = filename_;
Select(2);
}
public void SetFilename(String filename_)
public void SetTimeStateFormat(String timeStateFormat_)
{
filename = filename_;
timeStateFormat = timeStateFormat_;
Select(3);
}
public void SetDirname(String dirname_)
public void SetDb_type(String db_type_)
{
dirname = dirname_;
db_type = db_type_;
Select(4);
}
public void SetDb_type_fullname(String db_type_fullname_)
{
db_type_fullname = db_type_fullname_;
Select(5);
}
public void SetVariables(Vector variables_)
{
variables = variables_;
Select(5);
Select(6);
}
public void SetWriteUsingGroups(boolean writeUsingGroups_)
{
writeUsingGroups = writeUsingGroups_;
Select(6);
Select(7);
}
public void SetGroupSize(int groupSize_)
{
groupSize = groupSize_;
Select(7);
Select(8);
}
public void SetOpts(DBOptionsAttributes opts_)
{
opts = opts_;
Select(8);
Select(9);
}
// Property getting methods
public boolean GetAllTimes() { return allTimes; }
public String GetDirname() { return dirname; }
public String GetFilename() { return filename; }
public String GetTimeStateFormat() { return timeStateFormat; }
public String GetDb_type() { return db_type; }
public String GetDb_type_fullname() { return db_type_fullname; }
public String GetFilename() { return filename; }
public String GetDirname() { return dirname; }
public Vector GetVariables() { return variables; }
public boolean GetWriteUsingGroups() { return writeUsingGroups; }
public int GetGroupSize() { return groupSize; }
......@@ -218,20 +229,22 @@ public class ExportDBAttributes extends AttributeSubject
if(WriteSelect(0, buf))
buf.WriteBool(allTimes);
if(WriteSelect(1, buf))
buf.WriteString(db_type);
buf.WriteString(dirname);
if(WriteSelect(2, buf))
buf.WriteString(db_type_fullname);
if(WriteSelect(3, buf))
buf.WriteString(filename);
if(WriteSelect(3, buf))
buf.WriteString(timeStateFormat);
if(WriteSelect(4, buf))
buf.WriteString(dirname);
buf.WriteString(db_type);
if(WriteSelect(5, buf))
buf.WriteStringVector(variables);
buf.WriteString(db_type_fullname);
if(WriteSelect(6, buf))
buf.WriteBool(writeUsingGroups);
buf.WriteStringVector(variables);
if(WriteSelect(7, buf))
buf.WriteInt(groupSize);
buf.WriteBool(writeUsingGroups);
if(WriteSelect(8, buf))
buf.WriteInt(groupSize);
if(WriteSelect(9, buf))
opts.Write(buf);
}
......@@ -243,29 +256,32 @@ public class ExportDBAttributes extends AttributeSubject
SetAllTimes(buf.ReadBool());
break;
case 1:
SetDb_type(buf.ReadString());
SetDirname(buf.ReadString());
break;
case 2:
SetDb_type_fullname(buf.ReadString());
SetFilename(buf.ReadString());
break;
case 3:
SetFilename(buf.ReadString());
SetTimeStateFormat(buf.ReadString());
break;
case 4:
SetDirname(buf.ReadString());
SetDb_type(buf.ReadString());
break;
case 5:
SetVariables(buf.ReadStringVector());
SetDb_type_fullname(buf.ReadString());
break;
case 6:
SetWriteUsingGroups(buf.ReadBool());
SetVariables(buf.ReadStringVector());
break;
case 7:
SetGroupSize(buf.ReadInt());
SetWriteUsingGroups(buf.ReadBool());
break;
case 8:
SetGroupSize(buf.ReadInt());
break;
case 9:
opts.Read(buf);
Select(8);
Select(9);
break;
}
}
......@@ -274,10 +290,11 @@ public class ExportDBAttributes extends AttributeSubject
{
String str = new String();
str = str + boolToString("allTimes", allTimes, indent) + "\n";
str = str + stringToString("dirname", dirname, indent) + "\n";
str = str + stringToString("filename", filename, indent) + "\n";
str = str + stringToString("timeStateFormat", timeStateFormat, indent) + "\n";
str = str + stringToString("db_type", db_type, indent) + "\n";
str = str + stringToString("db_type_fullname", db_type_fullname, indent) + "\n";
str = str + stringToString("filename", filename, indent) + "\n";
str = str + stringToString("dirname", dirname, indent) + "\n";
str = str + stringVectorToString("variables", variables, indent) + "\n";
str = str + boolToString("writeUsingGroups", writeUsingGroups, indent) + "\n";
str = str + intToString("groupSize", groupSize, indent) + "\n";
......@@ -288,10 +305,11 @@ public class ExportDBAttributes extends AttributeSubject
// Attributes
private boolean allTimes;
private String dirname;
private String filename;
private String timeStateFormat;
private String db_type;
private String db_type_fullname;
private String filename;
private String dirname;
private Vector variables; // vector of String objects
private boolean writeUsingGroups;
private int groupSize;
......
......@@ -198,16 +198,18 @@ ExportDBAction::Execute()
plist->GetTimeSliderStates(plist->GetActiveTimeSlider(), state, nStates);
// Iterate through time and export the current time state.
char digits[10];
char digits[128];
std::string filename(exportAtts.GetFilename());
int status = 0;
for(int i = 0; i < nStates && status == 0; ++i)
{
// Make a new filename for the exported file.
if(nStates >= 10000)
SNPRINTF(digits, 10, "%08d", i);
else
SNPRINTF(digits, 10, "%04d", i);
// if(nStates >= 10000)
// SNPRINTF(digits, 10, "%08d", i);
// else
// SNPRINTF(digits, 10, "%04d", i);
SNPRINTF(digits, 10, exportAtts.GetTimeStateFormat().c_str(), i);
std::string timeSuffix(digits);
TRY
......
......@@ -82,14 +82,16 @@ PyExportDBAttributes_ToString(const ExportDBAttributes *atts, const char *prefix
else
SNPRINTF(tmpStr, 1000, "%sallTimes = 0\n", prefix);
str += tmpStr;
SNPRINTF(tmpStr, 1000, "%sdb_type = \"%s\"\n", prefix, atts->GetDb_type().c_str());
str += tmpStr;
SNPRINTF(tmpStr, 1000, "%sdb_type_fullname = \"%s\"\n", prefix, atts->GetDb_type_fullname().c_str());
SNPRINTF(tmpStr, 1000, "%stimeStateFormat = \"%s\"\n", prefix, atts->GetTimeStateFormat().c_str());
str += tmpStr;
SNPRINTF(tmpStr, 1000, "%sfilename = \"%s\"\n", prefix, atts->GetFilename().c_str());
str += tmpStr;
SNPRINTF(tmpStr, 1000, "%sdirname = \"%s\"\n", prefix, atts->GetDirname().c_str());
str += tmpStr;
SNPRINTF(tmpStr, 1000, "%sdb_type = \"%s\"\n", prefix, atts->GetDb_type().c_str());
str += tmpStr;
SNPRINTF(tmpStr, 1000, "%sdb_type_fullname = \"%s\"\n", prefix, atts->GetDb_type_fullname().c_str());
str += tmpStr;
{ const stringVector &variables = atts->GetVariables();
SNPRINTF(tmpStr, 1000, "%svariables = (", prefix);
str += tmpStr;
......@@ -155,7 +157,7 @@ ExportDBAttributes_GetAllTimes(PyObject *self, PyObject *args)
}
/*static*/ PyObject *
ExportDBAttributes_SetDb_type(PyObject *self, PyObject *args)
ExportDBAttributes_SetTimeStateFormat(PyObject *self, PyObject *args)
{
ExportDBAttributesObject *obj = (ExportDBAttributesObject *)self;
......@@ -163,23 +165,23 @@ ExportDBAttributes_SetDb_type(PyObject *self, PyObject *args)
if(!PyArg_ParseTuple(args, "s", &str))
return NULL;
// Set the db_type in the object.
obj->data->SetDb_type(std::string(str));
// Set the timeStateFormat in the object.
obj->data->SetTimeStateFormat(std::string(str));
Py_INCREF(Py_None);
return Py_None;
}
/*static*/ PyObject *
ExportDBAttributes_GetDb_type(PyObject *self, PyObject *args)
ExportDBAttributes_GetTimeStateFormat(PyObject *self, PyObject *args)
{
ExportDBAttributesObject *obj = (ExportDBAttributesObject *)self;
PyObject *retval = PyString_FromString(obj->data->GetDb_type().c_str());
PyObject *retval = PyString_FromString(obj->data->GetTimeStateFormat().c_str());
return retval;
}
/*static*/ PyObject *
ExportDBAttributes_SetDb_type_fullname(PyObject *self, PyObject *args)
ExportDBAttributes_SetFilename(PyObject *self, PyObject *args)
{
ExportDBAttributesObject *obj = (ExportDBAttributesObject *)self;
......@@ -187,23 +189,23 @@ ExportDBAttributes_SetDb_type_fullname(PyObject *self, PyObject *args)
if(!PyArg_ParseTuple(args, "s", &str))
return NULL;
// Set the db_type_fullname in the object.
obj->data->SetDb_type_fullname(std::string(str));
// Set the filename in the object.
obj->data->SetFilename(std::string(str));
Py_INCREF(Py_None);
return Py_None;
}
/*static*/ PyObject *
ExportDBAttributes_GetDb_type_fullname(PyObject *self, PyObject *args)
ExportDBAttributes_GetFilename(PyObject *self, PyObject *args)
{
ExportDBAttributesObject *obj = (ExportDBAttributesObject *)self;
PyObject *retval = PyString_FromString(obj->data->GetDb_type_fullname().c_str());
PyObject *retval = PyString_FromString(obj->data->GetFilename().c_str());
return retval;
}
/*static*/ PyObject *
ExportDBAttributes_SetFilename(PyObject *self, PyObject *args)
ExportDBAttributes_SetDirname(PyObject *self, PyObject *args)
{
ExportDBAttributesObject *obj = (ExportDBAttributesObject *)self;
......@@ -211,23 +213,23 @@ ExportDBAttributes_SetFilename(PyObject *self, PyObject *args)
if(!PyArg_ParseTuple(args, "s", &str))
return NULL;
// Set the filename in the object.
obj->data->SetFilename(std::string(str));
// Set the dirname in the object.
obj->data->SetDirname(std::string(str));
Py_INCREF(Py_None);
return Py_None;
}
/*static*/ PyObject *
ExportDBAttributes_GetFilename(PyObject *self, PyObject *args)
ExportDBAttributes_GetDirname(PyObject *self, PyObject *args)
{
ExportDBAttributesObject *obj = (ExportDBAttributesObject *)self;
PyObject *retval = PyString_FromString(obj->data->GetFilename().c_str());
PyObject *retval = PyString_FromString(obj->data->GetDirname().c_str());
return retval;
}
/*static*/ PyObject *
ExportDBAttributes_SetDirname(PyObject *self, PyObject *args)
ExportDBAttributes_SetDb_type(PyObject *self, PyObject *args)
{
ExportDBAttributesObject *obj = (ExportDBAttributesObject *)self;
......@@ -235,18 +237,42 @@ ExportDBAttributes_SetDirname(PyObject *self, PyObject *args)
if(!PyArg_ParseTuple(args, "s", &str))
return NULL;
// Set the dirname in the object.
obj->data->SetDirname(std::string(str));
// Set the db_type in the object.
obj->data->SetDb_type(std::string(str));
Py_INCREF(Py_None);
return Py_None;
}
/*static*/ PyObject *
ExportDBAttributes_GetDirname(PyObject *self, PyObject *args)
ExportDBAttributes_GetDb_type(PyObject *self, PyObject *args)
{
ExportDBAttributesObject *obj = (ExportDBAttributesObject *)self;
PyObject *retval = PyString_FromString(obj->data->GetDirname().c_str());
PyObject *retval = PyString_FromString(obj->data->GetDb_type().c_str());
return retval;
}
/*static*/ PyObject *
ExportDBAttributes_SetDb_type_fullname(PyObject *self, PyObject *args)
{
ExportDBAttributesObject *obj = (ExportDBAttributesObject *)self;
char *str;
if(!PyArg_ParseTuple(args, "s", &str))
return NULL;
// Set the db_type_fullname in the object.
obj->data->SetDb_type_fullname(std::string(str));
Py_INCREF(Py_None);
return Py_None;
}
/*static*/ PyObject *
ExportDBAttributes_GetDb_type_fullname(PyObject *self, PyObject *args)
{
ExportDBAttributesObject *obj = (ExportDBAttributesObject *)self;
PyObject *retval = PyString_FromString(obj->data->GetDb_type_fullname().c_str());
return retval;
}
......@@ -389,14 +415,16 @@ PyMethodDef PyExportDBAttributes_methods[EXPORTDBATTRIBUTES_NMETH] = {
{"Notify", ExportDBAttributes_Notify, METH_VARARGS},
{"SetAllTimes", ExportDBAttributes_SetAllTimes, METH_VARARGS},
{"GetAllTimes", ExportDBAttributes_GetAllTimes, METH_VARARGS},
{"SetDb_type", ExportDBAttributes_SetDb_type, METH_VARARGS},
{"GetDb_type", ExportDBAttributes_GetDb_type, METH_VARARGS},
{"SetDb_type_fullname", ExportDBAttributes_SetDb_type_fullname, METH_VARARGS},
{"GetDb_type_fullname", ExportDBAttributes_GetDb_type_fullname, METH_VARARGS},
{"SetTimeStateFormat", ExportDBAttributes_SetTimeStateFormat, METH_VARARGS},
{"GetTimeStateFormat", ExportDBAttributes_GetTimeStateFormat, METH_VARARGS},
{"SetFilename", ExportDBAttributes_SetFilename, METH_VARARGS},
{"GetFilename", ExportDBAttributes_GetFilename, METH_VARARGS},
{"SetDirname", ExportDBAttributes_SetDirname, METH_VARARGS},
{"GetDirname", ExportDBAttributes_GetDirname, METH_VARARGS},
{"SetDb_type", ExportDBAttributes_SetDb_type, METH_VARARGS},
{"GetDb_type", ExportDBAttributes_GetDb_type, METH_VARARGS},
{"SetDb_type_fullname", ExportDBAttributes_SetDb_type_fullname, METH_VARARGS},
{"GetDb_type_fullname", ExportDBAttributes_GetDb_type_fullname, METH_VARARGS},
{"SetVariables", ExportDBAttributes_SetVariables, METH_VARARGS},
{"GetVariables", ExportDBAttributes_GetVariables, METH_VARARGS},
{"SetWriteUsingGroups", ExportDBAttributes_SetWriteUsingGroups, METH_VARARGS},
......@@ -435,14 +463,16 @@ PyExportDBAttributes_getattr(PyObject *self, char *name)
{
if(strcmp(name, "allTimes") == 0)
return ExportDBAttributes_GetAllTimes(self, NULL);
if(strcmp(name, "db_type") == 0)
return ExportDBAttributes_GetDb_type(self, NULL);
if(strcmp(name, "db_type_fullname") == 0)
return ExportDBAttributes_GetDb_type_fullname(self, NULL);
if(strcmp(name, "timeStateFormat") == 0)
return ExportDBAttributes_GetTimeStateFormat(self, NULL);
if(strcmp(name, "filename") == 0)
return ExportDBAttributes_GetFilename(self, NULL);
if(strcmp(name, "dirname") == 0)
return ExportDBAttributes_GetDirname(self, NULL);
if(strcmp(name, "db_type") == 0)
return ExportDBAttributes_GetDb_type(self, NULL);
if(strcmp(name, "db_type_fullname") == 0)
return ExportDBAttributes_GetDb_type_fullname(self, NULL);
if(strcmp(name, "variables") == 0)
return ExportDBAttributes_GetVariables(self, NULL);
if(strcmp(name, "writeUsingGroups") == 0)
......@@ -467,14 +497,16 @@ PyExportDBAttributes_setattr(PyObject *self, char *name, PyObject *args)
if(strcmp(name, "allTimes") == 0)
obj = ExportDBAttributes_SetAllTimes(self, tuple);
else if(strcmp(name, "db_type") == 0)
obj = ExportDBAttributes_SetDb_type(self, tuple);
else if(strcmp(name, "db_type_fullname") == 0)
obj = ExportDBAttributes_SetDb_type_fullname(self, tuple);
else if(strcmp(name, "timeStateFormat") == 0)
obj = ExportDBAttributes_SetTimeStateFormat(self, tuple);
else if(strcmp(name, "filename") == 0)
obj = ExportDBAttributes_SetFilename(self, tuple);
else if(strcmp(name, "dirname") == 0)
obj = ExportDBAttributes_SetDirname(self, tuple);
else if(strcmp(name, "db_type") == 0)
obj = ExportDBAttributes_SetDb_type(self, tuple);
else if(strcmp(name, "db_type_fullname") == 0)
obj = ExportDBAttributes_SetDb_type_fullname(self, tuple);
else if(strcmp(name, "variables") == 0)
obj = ExportDBAttributes_SetVariables(self, tuple);
else if(strcmp(name, "writeUsingGroups") == 0)
......
......@@ -45,7 +45,7 @@
//
// Functions exposed to the VisIt module.
//
#define EXPORTDBATTRIBUTES_NMETH 20
#define EXPORTDBATTRIBUTES_NMETH 22
void VISITPY_API PyExportDBAttributes_StartUp(ExportDBAttributes *subj, void *data);
void VISITPY_API PyExportDBAttributes_CloseDown();
VISITPY_API PyMethodDef * PyExportDBAttributes_GetMethodTable(int *nMethods);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment