Commit 814a4c67 authored by Kenneth Leiter's avatar Kenneth Leiter
parents 6d64b4aa 4bb47fc4
...@@ -159,7 +159,7 @@ public: ...@@ -159,7 +159,7 @@ public:
}; };
class XdmfArray::GetValuesPointer : class XdmfArray::GetValuesPointer :
public boost::static_visitor<const void * const> { public boost::static_visitor<const void *> {
public: public:
GetValuesPointer() GetValuesPointer()
...@@ -167,14 +167,14 @@ public: ...@@ -167,14 +167,14 @@ public:
} }
template<typename T> template<typename T>
const void * const const void *
operator()(const shared_ptr<std::vector<T> > & array) const operator()(const shared_ptr<std::vector<T> > & array) const
{ {
return &array->operator[](0); return &array->operator[](0);
} }
template<typename T> template<typename T>
const void * const const void *
operator()(const boost::shared_array<const T> & array) const operator()(const boost::shared_array<const T> & array) const
{ {
return array.get(); return array.get();
...@@ -199,7 +199,7 @@ public: ...@@ -199,7 +199,7 @@ public:
getValuesString(const T * const array, getValuesString(const T * const array,
const int numValues) const const int numValues) const
{ {
const unsigned int lastIndex = numValues-1; const int lastIndex = numValues - 1;
if(lastIndex < 0) { if(lastIndex < 0) {
return ""; return "";
......
...@@ -277,6 +277,8 @@ public: ...@@ -277,6 +277,8 @@ public:
void initialize(const shared_ptr<const XdmfArrayType> arrayType, void initialize(const shared_ptr<const XdmfArrayType> arrayType,
const std::vector<unsigned int> & dimensions); const std::vector<unsigned int> & dimensions);
using XdmfItem::insert;
/** /**
* Insert value into this array * Insert value into this array
* *
...@@ -340,7 +342,6 @@ public: ...@@ -340,7 +342,6 @@ public:
* Read data from disk into memory. * Read data from disk into memory.
*/ */
void read(); void read();
/** /**
* Release all data currently held in memory. * Release all data currently held in memory.
*/ */
......
...@@ -26,8 +26,8 @@ int main(int, char **) ...@@ -26,8 +26,8 @@ int main(int, char **)
assert(array->getSize() == 4); assert(array->getSize() == 4);
assert(array->getArrayType() == XdmfArrayType::Int32()); assert(array->getArrayType() == XdmfArrayType::Int32());
assert(array->getValuesString().compare("1 2 3 4") == 0); assert(array->getValuesString().compare("1 2 3 4") == 0);
const int * const arrayPointer = const int * const arrayPointer =
(const int * const)array->getValuesInternal(); static_cast<int *>(array->getValuesInternal());
assert(arrayPointer[0] == 1); assert(arrayPointer[0] == 1);
assert(arrayPointer[1] == 2); assert(arrayPointer[1] == 2);
assert(arrayPointer[2] == 3); assert(arrayPointer[2] == 3);
...@@ -121,8 +121,8 @@ int main(int, char **) ...@@ -121,8 +121,8 @@ int main(int, char **)
assert(array5->getSize() == 2); assert(array5->getSize() == 2);
assert(array5->getArrayType() == XdmfArrayType::Int32()); assert(array5->getArrayType() == XdmfArrayType::Int32());
assert(array5->getValuesString().compare("1 2") == 0); assert(array5->getValuesString().compare("1 2") == 0);
const int * const array5Pointer = const int * const array5Pointer =
(const int * const)array5->getValuesInternal(); static_cast<int *>(array5->getValuesInternal());
assert(array5Pointer[0] == 1); assert(array5Pointer[0] == 1);
assert(array5Pointer[1] == 2); assert(array5Pointer[1] == 2);
// Assert we can copy values out correctly // Assert we can copy values out correctly
......
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