Commit d28d761d authored by Andrew J. Burns (Cont's avatar Andrew J. Burns (Cont

fixed some issues with adding to previously created files

parent 73ceb409
This diff is collapsed.
......@@ -40,7 +40,8 @@ XdmfHeavyDataController::XdmfHeavyDataController(const std::string & filePath,
mFilePath(filePath),
mStart(start),
mStride(stride),
mType(type)
mType(type),
mArrayStartOffset(0)
{
if(!(mStart.size() == mStride.size() &&
mStride.size() == mDimensions.size()))
......@@ -85,6 +86,18 @@ XdmfHeavyDataController::getSize() const
std::multiplies<unsigned int>());
}
void
XdmfHeavyDataController::setArrayOffset(unsigned int newOffset)
{
mArrayStartOffset = newOffset;
}
unsigned int
XdmfHeavyDataController::getArrayOffset() const
{
return mArrayStartOffset;
}
std::vector<unsigned int>
XdmfHeavyDataController::getStart() const
{
......
......@@ -184,6 +184,38 @@ public:
*/
unsigned int getSize() const;
/**
* For use in conjunction with heavy data controllers set to arrays, the offset within the array from which the controller will be inserted
* Is also set when created by a writer.
*
* C++
*
* @dontinclude ExampleXdmfHeavyDataController.cpp
*
* Python
*
* @dontinclude XdmfExampleHeavyDataController.py
*
* @param newOffset the new index at which the controller will be written
*/
void setArrayOffset(unsigned int newOffset);
/**
* Gets the index at which the controller will offset when an array reads it from its associated controllers.
* Set when created by a Writer or set manually.
*
* C++
*
* @dontinclude ExampleXdmfHeavyDataController.cpp
*
* Python
*
* @dontinclude XdmfExampleHeavyDataController.py
*
* @return the offset that the array will read from
*/
unsigned int getArrayOffset() const;
/**
* Get the start index of the heavy data set owned by this controller.
*
......@@ -266,6 +298,7 @@ protected:
const std::string mFilePath;
const std::vector<unsigned int> mStart;
const std::vector<unsigned int> mStride;
unsigned int mArrayStartOffset;
const shared_ptr<const XdmfArrayType> mType;
private:
......
......@@ -14,7 +14,7 @@ int main(int, char **)
{
writtenArray->pushBack(i);
}
std::vector<unsigned int> starts;
/* std::vector<unsigned int> starts;
std::vector<unsigned int> strides;
std::vector<unsigned int> dimensions;
std::vector<unsigned int> dataspaces;
......@@ -38,15 +38,14 @@ int main(int, char **)
writtenArray->insert(arrayController);
starts[0] = 5;
arrayController = XdmfHDF5Controller::New("arraydata.h5", "Data", XdmfArrayType::Int32(), starts, strides, dimensions, dataspaces);
writtenArray->insert(arrayController);
writtenArray->insert(arrayController);*/
shared_ptr<XdmfHDF5Writer> arrayHeavyWriter = XdmfHDF5Writer::New("arraydata.h5");
arrayHeavyWriter->setFileSizeLimit(1);
arrayHeavyWriter->setMode(XdmfHDF5Writer::Hyperslab);
// arrayHeavyWriter->setMode(XdmfHDF5Writer::Hyperslab);
shared_ptr<XdmfWriter> arrayWriter = XdmfWriter::New("arraydata.xmf", arrayHeavyWriter);
arrayWriter->setLightDataLimit(5);
writtenArray->accept(arrayWriter);
printf("%s\n\n", writtenArray->getValuesString());
writtenArray->release();
printf("after release\narray contains: %s\n", writtenArray->getValuesString());
writtenArray->read();
......
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