Commit 41c12c95 authored by Ken Leiter (Civ's avatar Ken Leiter (Civ

ENH: Add ability to set Light Data Limit for Visitor, which controls how many...

ENH: Add ability to set Light Data Limit for Visitor, which controls how many values there need to be in a DataItem before it writes those values to a heavy data format.  Set the default value to 100.
parent 46189e19
......@@ -14,7 +14,7 @@
XdmfVisitor::XdmfVisitor() :
mTabIndex(0),
xmlData(),
mLightDataLimit(0),
mLightDataLimit(100),
mHeavyFileName("output.h5"),
hdf5Handle(H5Fcreate("output.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT))
{
......@@ -157,6 +157,16 @@ std::string XdmfVisitor::printSelf() const
return "XdmfVisitor:\n" + xmlData.str();
}
int XdmfVisitor::getLightDataLimit() const
{
return mLightDataLimit;
}
void XdmfVisitor::setLightDataLimit(int numValues)
{
mLightDataLimit = numValues;
}
std::string XdmfVisitor::getHDF5GroupName()
{
std::stringstream datasetName;
......
......@@ -38,6 +38,20 @@ public:
virtual std::string printSelf() const;
/**
* Get the number of values that this visitor writes to light data (XML) before switching to a heavy data format.
*
* @return an int containing the number of values.
*/
int getLightDataLimit() const;
/**
* Set the number of values that this visitor writes to light data (XML) before switching to a heavy data format.
*
* @param an int containing the number of values
*/
void setLightDataLimit(int numValues);
protected:
XdmfVisitor();
......@@ -54,8 +68,8 @@ private:
std::stringstream xmlData;
hid_t hdf5Handle;
std::vector<std::string> dataHierarchy;
int mLightDataLimit;
std::string mHeavyFileName;
int mLightDataLimit;
};
......
......@@ -8,7 +8,8 @@
int main(int argc, char* argv[])
{
boost::shared_ptr<XdmfVisitor> visitor3 = XdmfVisitor::New();
boost::shared_ptr<XdmfVisitor> visitor = XdmfVisitor::New();
visitor->setLightDataLimit(10);
boost::shared_ptr<XdmfGrid> grid = XdmfGrid::New();
grid->setName("test");
......@@ -49,9 +50,9 @@ int main(int argc, char* argv[])
boost::shared_ptr<XdmfDomain> domain = XdmfDomain::New();
domain->insert(grid);
domain->write(visitor3);
domain->write(visitor);
std::cout << visitor3->printSelf() << std::endl;
std::cout << visitor->printSelf() << std::endl;
return 0;
}
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