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

changes for file splitting and functions along with assorted changes to...

changes for file splitting and functions along with assorted changes to XdmfFortran for possible speed increases
parent f5c88a96
......@@ -44,6 +44,18 @@ public:
/**
* Create a new XdmfGraph.
*
* Example of use:
*
* C++
*
* @dontinclude ExampleXdmfGraph.cpp
* @skipline New
*
* Python
*
* @dontinclude XdmfExampleGraph.py
* @skipline New
*
* @param numberNodes number of nodes in graph.
*
* @return constructed XdmfGraph.
......
This diff is collapsed.
......@@ -310,7 +310,7 @@ public:
* @param val2 the second array being evaluated
* @return the arrays joined end to end
*/
static shared_ptr<XdmfArray> chunk(shared_ptr<XdmfArray>, shared_ptr<XdmfArray>);
static shared_ptr<XdmfArray> chunk(shared_ptr<XdmfArray> val1, shared_ptr<XdmfArray> val2);
/**
* Joins the two provided arrays while interspercing their values evenly.
......@@ -334,7 +334,7 @@ public:
* @param val2 the second array being evaluated
* @return the interlaced arrays
*/
static shared_ptr<XdmfArray> interlace(shared_ptr<XdmfArray>, shared_ptr<XdmfArray>);
static shared_ptr<XdmfArray> interlace(shared_ptr<XdmfArray> val1, shared_ptr<XdmfArray> val2);
/**
* Evaluates the function specified using the vector of XdmfArrays provided.
......@@ -1032,26 +1032,30 @@ public:
* C++
*
* @dontinclude ExampleXdmfArray.cpp
* @skipline writtenArray
* @until writeStrides)
*
* Python
*
* @dontinclude XdmfExampleArray.py
* @skipline writtenArray
* @until writeStrides)
*
* @param startIndex the index in this array to begin insertion.
* @param startIndex the index in this array to begin insertion for each dimension
* @param values a shared pointer to an XdmfArray to copy into this array.
* @param valuesStartIndex the index in the XdmfArray to begin copying.
* @param numValues the number of values to copy into this array.
* @param arrayStride number of values to stride in this array between each
* copy.
* @param valuesStride number of values to stride in the XdmfArray between
* each copy.
* @param valuesStartIndex the index in the XdmfArray to begin copying for each dimension of the source array
* @param numValues the number of values to copy into this array for each dimension on the source array
* @param numInserted the number of strides to make across the array being written to for each dimension
* @param arrayStride number of values to stride in this array between each copy for each dimension
* @param valuesStride number of values to stride in the XdmfArray between each copy for each dimension of the source array
*/
/* void insert(const std::vector<unsigned int> startIndex,
void insert(const std::vector<unsigned int> startIndex,
const shared_ptr<const XdmfArray> values,
const std::vector<unsigned int> valuesStartIndex,
const std::vector<unsigned int> numValues,
const std::vector<unsigned int> numInserted,
const std::vector<unsigned int> arrayStride,
const std::vector<unsigned int> valuesStride);*/
const std::vector<unsigned int> valuesStride);
/**
* Insert values into this array.
......
This diff is collapsed.
......@@ -489,7 +489,6 @@ public:
}
currNode = currNode->next;
}
return myItems;
}
......@@ -502,7 +501,6 @@ public:
readSingleNode(const xmlNodePtr currNode,
std::vector<shared_ptr<XdmfItem> > & myItems)
{
//check to see if the node is already in the Xpath
std::map<xmlNodePtr, shared_ptr<XdmfItem> >::const_iterator iter =
mXPathMap.find(currNode);
......@@ -585,7 +583,6 @@ public:
"mItemFactory failed to createItem in "
"XdmfCoreReader::XdmfCoreReaderImpl::readSingleNode");
}
newItem->populateItem(itemProperties, childItems, mCoreReader);
myItems.push_back(newItem);
mXPathMap.insert(std::make_pair(currNode, newItem));
......
This diff is collapsed.
......@@ -134,10 +134,18 @@ public:
* C++
*
* @dontinclude ExampleXdmfHDF5Writer.cpp
* @skipline newPath
* @until New
* @skipline newAllow
* @until setAllow
*
* Python
*
* @dontinclude XdmfExampleHDF5Writer.py
* @skipline newPath
* @until New
* @skipline newAllow
* @until setAllow
*
* @param newAllow whether to allow data sets to be split across hdf5 files
*/
......@@ -154,10 +162,16 @@ public:
* C++
*
* @dontinclude ExampleXdmfHDF5Writer.cpp
* @skipline newPath
* @until New
* @skipline exampleAllow
*
* Python
*
* @dontinclude XdmfExampleHDF5Writer.py
* @skipline newPath
* @until New
* @skipline exampleAllow
*
* @return whether to allow data sets to be split across hdf5 files
*/
......@@ -169,10 +183,18 @@ public:
* C++
*
* @dontinclude ExampleXdmfHDF5Writer.cpp
* @skipline newPath
* @until New
* @skipline newFileIndex
* @until setFileIndex
*
* Python
*
* @dontinclude XdmfExampleHDF5Writer.py
* @skipline newPath
* @until New
* @skipline newFileIndex
* @until setFileIndex
*
* @param newIndex The index that the writer will append to the file name when incorperating file splitting
*/
......@@ -184,10 +206,16 @@ public:
* C++
*
* @dontinclude ExampleXdmfHDF5Writer.cpp
* @skipline newPath
* @until New
* @skipline getFileIndex
*
* Python
*
* @dontinclude XdmfExampleHDF5Writer.py
* @skipline newPath
* @until New
* @skipline getFileIndex
*
* @return The current file index.
*/
......@@ -201,10 +229,16 @@ public:
* C++
*
* @dontinclude ExampleXdmfHDF5Writer.cpp
* @skipline newPath
* @until New
* @skipline getChunkSize
*
* Python
*
* @dontinclude XdmfExampleHDF5Writer.py
* @skipline newPath
* @until New
* @skipline getChunkSize
*
* @return chunk size used to output datasets to hdf5.
*/
......@@ -220,10 +254,18 @@ public:
* C++
*
* @dontinclude ExampleXdmfHDF5Writer.cpp
* @skipline newPath
* @until New
* @skipline newChunk
* @until setChunkSize
*
* Python
*
* @dontinclude XdmfExampleHDF5Writer.py
* @skipline newPath
* @until New
* @skipline newChunk
* @until setChunkSize
*
* @param chunkSize the number of elements per chunk.
*/
......
......@@ -191,10 +191,18 @@ public:
* C++
*
* @dontinclude ExampleXdmfHeavyDataController.cpp
* @skipline Assuming
* @until Since
* @skipline newArrayOffset
* @until setArrayOffset
*
* Python
*
* @dontinclude XdmfExampleHeavyDataController.py
* @skipline Assuming
* @until Since
* @skipline newArrayOffset
* @until setArrayOffset
*
* @param newOffset the new index at which the controller will be written
*/
......@@ -207,10 +215,16 @@ public:
* C++
*
* @dontinclude ExampleXdmfHeavyDataController.cpp
* @skipline Assuming
* @until Since
* @skipline getArrayOffset
*
* Python
*
* @dontinclude XdmfExampleHeavyDataController.py
* @skipline Assuming
* @until Since
* @skipline getArrayOffset
*
* @return the offset that the array will read from
*/
......@@ -219,6 +233,20 @@ public:
/**
* Get the start index of the heavy data set owned by this controller.
*
* C++
*
* @dontinclude ExampleXdmfHeavyDataController.cpp
* @skipline Assuming
* @until Since
* @skipline getStart
*
* Python
*
* @dontinclude XdmfExampleHeavyDataController.py
* @skipline Assuming
* @until Since
* @skipline getStart
*
* @return a vector containing the start index in each dimension of
* the heavy data set owned by this controller.
*/
......@@ -227,6 +255,20 @@ public:
/**
* Get the stride of the heavy data set owned by this controller.
*
* C++
*
* @dontinclude ExampleXdmfHeavyDataController.cpp
* @skipline Assuming
* @until Since
* @skipline getStride
*
* Python
*
* @dontinclude XdmfExampleHeavyDataController.py
* @skipline Assuming
* @until Since
* @skipline getStride
*
* @return a vector containing the stride in each dimension of the
* heavy data set owned by this controller.
*/
......
......@@ -41,6 +41,18 @@ public:
/**
* Create a new XdmfSparseMatrix.
*
* Example of use:
*
* C++
*
* @dontinclude ExampleXdmfSparseMatrix.cpp
* @skipline New
*
* Python
*
* @dontinclude XdmfExampleSparseMatrix.py
* @skipline New
*
* @param numberRows number of rows in matrix.
* @param numberColumns number of columns in matrix.
*
......@@ -57,6 +69,22 @@ public:
/**
* Get the column index array.
*
* Example of use:
*
* C++
*
* @dontinclude ExampleXdmfSparseMatrix.cpp
* @skipline New
* @skipline newColumnIndex
* @until getColumnIndex
*
* Python
*
* @dontinclude XdmfExampleSparseMatrix.py
* @skipline New
* @skipline newColumnIndex
* @until getColumnIndex
*
* @return array containing column indices for nonzero entries of
* matrix. This is the same size as values.
*/
......@@ -69,6 +97,20 @@ public:
/**
* Get the name of the sparse matrix.
*
* Example of use:
*
* C++
*
* @dontinclude ExampleXdmfSparseMatrix.cpp
* @skipline New
* @until getName
*
* Python
*
* @dontinclude XdmfExampleSparseMatrix.py
* @skipline New
* @until getName
*
* @return a string containing the name of the sparse matrix.
*/
std::string getName() const;
......@@ -76,6 +118,24 @@ public:
/**
* Get the number of columns in the sparse matrix.
*
* Example of use:
*
* C++
*
* @dontinclude ExampleXdmfSparseMatrix.cpp
* @skipline New
* @skipline newColumnIndex
* @until setColumn
* @skipline getNumberColumns
*
* Python
*
* @dontinclude XdmfExampleSparseMatrix.py
* @skipline New
* @skipline newColumnIndex
* @until setColumn
* @skipline getNumberColumns
*
* @return the number of columns in the sparse matrix.
*/
unsigned int getNumberColumns() const;
......@@ -83,6 +143,24 @@ public:
/**
* Get the number of rows in the sparse matrix.
*
* Example of use:
*
* C++
*
* @dontinclude ExampleXdmfSparseMatrix.cpp
* @skipline New
* @skipline newRowPointer
* @until setRow
* @skipline getNumberRows
*
* Python
*
* @dontinclude XdmfExampleSparseMatrix.py
* @skipline New
* @skipline newRowPointer
* @until setRow
* @skipline getNumberRows
*
* @return the number of rows in the sparse matrix.
*/
unsigned int getNumberRows() const;
......@@ -90,6 +168,22 @@ public:
/**
* Get the row pointer array.
*
* Example of use:
*
* C++
*
* @dontinclude ExampleXdmfSparseMatrix.cpp
* @skipline New
* @skipline newRowPointer
* @until getRow
*
* Python
*
* @dontinclude XdmfExampleSparseMatrix.py
* @skipline New
* @skipline newRowPointer
* @until getRow
*
* @return array containing indices into column array for each
* row. This is the size of the number of rows in the matrix +
* 1. The last value is the number of nonzero entries in the matrix
......@@ -99,6 +193,30 @@ public:
/**
* Get the values array.
*
* Example of use:
*
* C++
*
* @dontinclude ExampleXdmfSparseMatrix.cpp
* @skipline New
* @skipline newRowPointer
* @until getRow
* @skipline newColumnIndex
* @until setColumn
* @skipline newValues
* @until getValues
*
* Python
*
* @dontinclude XdmfExampleSparseMatrix.py
* @skipline New
* @skipline newRowPointer
* @until getRow
* @skipline newColumnIndex
* @until setColumn
* @skipline newValues
* @until getValues
*
* @return array containing values of nonzero entries of matrix.
*/
shared_ptr<XdmfArray> getValues();
......@@ -106,6 +224,32 @@ public:
/**
* Get values as a string in two dimensional format.
*
* Example of use:
*
* C++
*
* @dontinclude ExampleXdmfSparseMatrix.cpp
* @skipline New
* @skipline newRowPointer
* @until getRow
* @skipline newColumnIndex
* @until setColumn
* @skipline newValues
* @until setValues
* @skipline getValuesString
*
* Python
*
* @dontinclude XdmfExampleSparseMatrix.py
* @skipline New
* @skipline newRowPointer
* @until getRow
* @skipline newColumnIndex
* @until setColumn
* @skipline newValues
* @until setValues
* @skipline getValuesString
*
* @return string representation of matrix.
*/
std::string getValuesString() const;
......@@ -113,6 +257,22 @@ public:
/**
* Set the column index array.
*
* Example of use:
*
* C++
*
* @dontinclude ExampleXdmfSparseMatrix.cpp
* @skipline New
* @skipline newColumnIndex
* @until getColumnIndex
*
* Python
*
* @dontinclude XdmfExampleSparseMatrix.py
* @skipline New
* @skipline newColumnIndex
* @until getColumnIndex
*
* @param columnIndex array containing column indices for nonzero
* entries of matrix. This is the same size as values.
*/
......@@ -121,6 +281,20 @@ public:
/**
* Set the name of the sparse matrix.
*
* Example of use:
*
* C++
*
* @dontinclude ExampleXdmfSparseMatrix.cpp
* @skipline New
* @until setName
*
* Python
*
* @dontinclude XdmfExampleSparseMatrix.py
* @skipline New
* @until setName
*
* @param name a string containing the name to set.
*/
void setName(const std::string & name);
......@@ -128,6 +302,22 @@ public:
/**
* Set the row pointer array.
*
* Example of use:
*
* C++
*
* @dontinclude ExampleXdmfSparseMatrix.cpp
* @skipline New
* @skipline newRowPointer
* @until setRow
*
* Python
*
* @dontinclude XdmfExampleSparseMatrix.py
* @skipline New
* @skipline newRowPointer
* @until setRow
*
* @param rowPointer array containing indices into column array for
* each row. This is the size of the number of rows in the matrix +
* 1. The last value is the number of nonzero entries in the matrix
......@@ -137,6 +327,30 @@ public:
/**
* Set the values array.
*
* Example of use:
*
* C++
*
* @dontinclude ExampleXdmfSparseMatrix.cpp
* @skipline New
* @skipline newRowPointer
* @until getRow
* @skipline newColumnIndex
* @until setColumn
* @skipline newValues
* @until setValues
*
* Python
*
* @dontinclude XdmfExampleSparseMatrix.py
* @skipline New
* @skipline newRowPointer
* @until getRow
* @skipline newColumnIndex
* @until setColumn
* @skipline newValues
* @until setValues
*
* @param values array containing values of nonzero entries of
* matrix.
*/
......
......@@ -19,7 +19,9 @@ ADD_TEST_CXX_PATH("${XDMF_BINARIES}")
# Read UseCxxTest.cmake for more information
# ---------------------------------------
ADD_TEST_CXX(TestXdmfArray)
ADD_TEST_CXX(TestXdmfArrayInsert)
ADD_TEST_CXX(TestXdmfArrayMultidimensional)
ADD_TEST_CXX(TestXdmfArrayMultiDimensionalInsert)
ADD_TEST_CXX(TestXdmfArrayWriteRead)
ADD_TEST_CXX(TestXdmfArrayWriteReadHyperSlabs)
ADD_TEST_CXX(TestXdmfHDF5Controller)
......@@ -37,7 +39,9 @@ ADD_TEST_CXX(TestXdmfVersion)
# Read UseCxxTest.cmake for more information
# ---------------------------------------
CLEAN_TEST_CXX(TestXdmfArray)
CLEAN_TEST_CXX(TestXdmfArrayInsert)
CLEAN_TEST_CXX(TestXdmfArrayMultidimensional)
CLEAN_TEST_CXX(TestXdmfArrayMultiDimensionalInsert)
CLEAN_TEST_CXX(TestXdmfArrayWriteRead
test.h5)
CLEAN_TEST_CXX(TestXdmfArrayWriteRead
......
#include "XdmfArray.hpp"
#include "XdmfArrayType.hpp"
#include <iostream>
int main(int, char **)
{
shared_ptr<XdmfArray> resultArray = XdmfArray::New();
shared_ptr<XdmfArray> insertArray1 = XdmfArray::New();
shared_ptr<XdmfArray> insertArray2 = XdmfArray::New();
shared_ptr<XdmfArray> insertArray3 = XdmfArray::New();
shared_ptr<XdmfArray> insertArray4 = XdmfArray::New();
for (int i = 0; i< 10; i++)
{
insertArray1->pushBack(1);
}
for (int i = 0; i< 10; i++)
{
insertArray2->pushBack(2);
}
for (int i = 0; i< 10; i++)
{
insertArray3->pushBack(3);
}
for (int i = 0; i< 10; i++)
{
insertArray4->pushBack(4);
}
resultArray->insert(0, insertArray1, 0, 10, 4, 1);
resultArray->insert(1, insertArray2, 0, 10, 4, 1);
resultArray->insert(2, insertArray3, 0, 10, 4, 1);
resultArray->insert(3, insertArray4, 0, 10, 4, 1);
printf("result array contains:\n%s\n", resultArray->getValuesString());
printf("result should be:\n%s\n", "1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4");
assert(resultArray->getValuesString().compare("1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4") == 0);
return 0;
}
#include <iostream>
#include <stdlib.h>
#include <XdmfArray.hpp>
#include <XdmfArrayType.hpp>
#include <XdmfWriter.hpp>
int main(int, char **)
{
shared_ptr<XdmfArray> writtenArray = XdmfArray::New();
std::vector<unsigned int> dimensionVector;
dimensionVector.push_back(5);
dimensionVector.push_back(4);
writtenArray->initialize<int>(dimensionVector);
for (int i = 0; i < 20; i++)
{
writtenArray->insert(i, i + 1);
}
shared_ptr<XdmfArray> readArray = XdmfArray::New();
std::vector<unsigned int> readDimensionVector;
readDimensionVector.push_back(6);
readDimensionVector.push_back(4);
readArray->initialize<int>(readDimensionVector);
std::vector<unsigned int> writeStarts;
writeStarts.push_back(0);
writeStarts.push_back(0);
std::vector<unsigned int> writeStrides;
writeStrides.push_back(2);
writeStrides.push_back(2);
std::vector<unsigned int> writeDim;
writeDim.push_back(3);
writeDim.push_back(2);
std::vector<unsigned int> readStarts;
readStarts.push_back(0);
readStarts.push_back(0);
std::vector<unsigned int> readStrides;
readStrides.push_back(2);
readStrides.push_back(2);
std::vector<unsigned int> readDim;
readDim.push_back(3);
readDim.push_back(2);
readArray->insert(readStarts, writtenArray, writeStarts, writeDim, readDim, readStrides, writeStrides);
assert(readArray->getValuesString().compare("1 0 3 0 5 0 0 0 0 0 0 0 11 0 13 0 15 0 0 0 0 0 0 0") == 0);
for (int i = 0; i < readArray->getDimensions()[1]; i++)
{
for (int j = 0; j < readArray->getDimensions()[0]; j++)
{
printf("%d ", readArray->getValue<int>(i*readArray->getDimensions()[0]+j));
}
printf("\n");
}
return 0;
}
#include "XdmfArray.hpp"
#include "XdmfHDF5Writer.hpp"
#include "XdmfHDF5Controller.hpp"
int main(int, char **)
{
......
......@@ -184,6 +184,42 @@ int main(int, char **)
std::string parsedExpression = "MAX(A,B)@(A#B)";
answerArray = XdmfArray::evaluateExpression(parsedExpression, valueMap);
shared_ptr<XdmfArray> writtenArray = XdmfArray::New();
std::vector<unsigned int> dimensionVector;
dimensionVector.push_back(5);
dimensionVector.push_back(4);
writtenArray->initialize<int>(dimensionVector);
for (int i = 0; i < 20; i++)
{
writtenArray->insert(i, i + 1);
}
shared_ptr<XdmfArray> readArray = XdmfArray::New();
std::vector<unsigned int> readDimensionVector;
readDimensionVector.push_back(6);
readDimensionVector.push_back(4);
readArray->initialize<int>(readDimensionVector);
std::vector<unsigned int> writeStarts;
writeStarts.push_back(0);
writeStarts.push_back(0);
std::vector<unsigned int> writeStrides;
writeStrides.push_back(2);
writeStrides.push_back(2);
std::vector<unsigned int> writeDim;
writeDim.push_back(3);
writeDim.push_back(2);
std::vector<unsigned int> readStarts;
readStarts.push_back(0);
readStarts.push_back(0);
std::vector<unsigned int> readStrides;
readStrides.push_back(2);
readStrides.push_back(2);
std::vector<unsigned int> readDim;
readDim.push_back(3);
readDim.push_back(2);