Commit 5f928d58 authored by Andrew Burns's avatar Andrew Burns

Merge branch 'master' into 'master'

Cxx11 updates

See merge request !30
parents 009e6e18 397e235f
......@@ -79,13 +79,17 @@ ENDMACRO()
# Output:
# is_core = variable is set to 'Core' is core was found in dir
MACRO(SET_CORE dir)
STRING(REGEX MATCH "core" is_core "${dir}")
IF(EXISTS ${is_core})
SET(is_core "Core")
ELSE(EXISTS ${is_core})
STRING(REGEX MATCH "utils" is_core "${dir}")
IF(NOT "${XDMF_SUBSECTION}" STREQUAL "")
set(is_core ${XDMF_SUBSECTION})
ELSE()
STRING(REGEX MATCH "core" is_core "${dir}")
IF(EXISTS ${is_core})
SET(is_core "Util")
SET(is_core "Core")
ELSE(EXISTS ${is_core})
STRING(REGEX MATCH "utils" is_core "${dir}")
IF(EXISTS ${is_core})
SET(is_core "Util")
ENDIF(EXISTS ${is_core})
ENDIF(EXISTS ${is_core})
ENDIF(EXISTS ${is_core})
ENDIF(NOT "${XDMF_SUBSECTION}" STREQUAL "")
ENDMACRO(SET_CORE dir)
......@@ -12,6 +12,8 @@ if(MSVC10)
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR})
endif()
include(CheckCXXSourceCompiles)
set(XDMF_LIBNAME "Xdmf" CACHE STRING "Name for this xdmf library to avoid collision")
if(BUILD_SHARED_LIBS)
......@@ -43,6 +45,7 @@ if (XDMF_STATIC_AND_SHARED)
endif ()
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/CMake/VersionSuite)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
list(APPEND CMAKE_MODULE_PATH
......@@ -94,6 +97,29 @@ endif (TIFF_FOUND)
option(XDMF_BUILD_DSM OFF)
mark_as_advanced(XDMF_BUILD_DSM)
# Test for Cxx11
unset(HAVE_CXX11_SHARED_PTR CACHE)
check_cxx_source_compiles("
#include <memory>
using namespace std;
struct Base { virtual ~Base(){} };
int main(int ac, char * av[])
{
shared_ptr<Base> ptr(new Base());
}
"
HAVE_CXX11_SHARED_PTR)
# Cxx11 does not work with swig due to an issue with swig
if (HAVE_CXX11_SHARED_PTR AND NOT XDMF_WRAP_PYTHON)
set(HAVE_CXX11_SHARED_PTR ${HAVE_CXX11_SHARED_PTR} PARENT_SCOPE)
add_definitions(-DHAVE_CXX11_SHARED_PTR)
endif ()
if(XDMF_BUILD_DSM)
find_package(MPI REQUIRED)
if(MPI_FOUND)
......@@ -348,15 +374,31 @@ if(NOT XDMF_BUILD_CORE_ONLY)
OUTPUT_NAME "Xdmf")
endif (BUILD_SHARED_LIBS)
else()
add_library(${XDMF_LIBNAME} ${LIBTYPE} ${XdmfSources})
if (WIN32)
if (XDMF_BUILD_DSM)
add_library(${XDMF_LIBNAME} ${LIBTYPE} ${XdmfSources} ${XdmfCoreSources} ${XdmfDSMSources})
else ()
add_library(${XDMF_LIBNAME} ${LIBTYPE} ${XdmfSources} ${XdmfCoreSources})
endif ()
else ()
add_library(${XDMF_LIBNAME} ${LIBTYPE} ${XdmfSources})
endif ()
endif()
if(XDMF_BUILD_DSM)
target_link_libraries(${XDMF_LIBNAME} XdmfCore XdmfDSM)
if (NOT WIN32)
target_link_libraries(${XDMF_LIBNAME} XdmfCore XdmfDSM)
else ()
target_link_libraries(${XDMF_LIBNAME} ${XdmfLibraries} ${XdmfDSMLinkLibraries})
endif ()
if(XDMF_STATIC_AND_SHARED AND BUILD_SHARED_LIBS)
target_link_libraries(Xdmf_Static XdmfCore_Static XdmfDSM_Static)
endif()
else(XDMF_BUILD_DSM)
target_link_libraries(${XDMF_LIBNAME} XdmfCore)
if (NOT WIN32)
target_link_libraries(${XDMF_LIBNAME} XdmfCore)
else ()
target_link_libraries(${XDMF_LIBNAME} ${XdmfLibraries})
endif ()
if(XDMF_STATIC_AND_SHARED AND BUILD_SHARED_LIBS)
target_link_libraries(Xdmf_Static XdmfCore_Static)
endif ()
......
......@@ -142,22 +142,28 @@
# define XDMF_TEMPLATE
#else
/* Used to export/import from the dlls */
# undef XDMFCORE_EXPORT
# define XDMFCORE_EXPORT __declspec(dllimport)
# undef XDMFCORE_TEMPLATE
# define XDMFCORE_TEMPLATE extern
# undef XDMFDSM_EXPORT
# define XDMFDSM_EXPORT __declspec(dllimport)
# undef XDMFDSM_TEMPLATE
# define XDMFDSM_TEMPLATE extern
# ifdef XDMF_EXPORTS
# define XDMF_EXPORT __declspec(dllexport)
# define XDMF_TEMPLATE
# define XDMF_EXPORT __declspec(dllexport)
# define XDMF_TEMPLATE
# undef XDMFCORE_EXPORT
# define XDMFCORE_EXPORT __declspec(dllexport)
# undef XDMFCORE_TEMPLATE
# define XDMFCORE_TEMPLATE
# undef XDMFDSM_EXPORT
# define XDMFDSM_EXPORT __declspec(dllexport)
# undef XDMFDSM_TEMPLATE
# define XDMFDSM_TEMPLATE
# else /* XDMF_EXPORTS */
# define XDMF_EXPORT __declspec(dllimport)
# define XDMF_TEMPLATE extern
# define XDMF_EXPORT __declspec(dllimport)
# define XDMF_TEMPLATE extern
# undef XDMFCORE_EXPORT
# define XDMFCORE_EXPORT __declspec(dllimport)
# undef XDMFCORE_TEMPLATE
# define XDMFCORE_TEMPLATE extern
# undef XDMFDSM_EXPORT
# define XDMFDSM_EXPORT __declspec(dllimport)
# undef XDMFDSM_TEMPLATE
# define XDMFDSM_TEMPLATE extern
# endif /* XDMF_EXPORTS */
#endif
......
......@@ -23,7 +23,6 @@
#include <numeric>
#include <functional>
#include <boost/tokenizer.hpp>
#include "XdmfArray.hpp"
#include "XdmfError.hpp"
#include "XdmfAggregate.hpp"
......
......@@ -114,11 +114,7 @@ XdmfAttribute::populateItem(const std::map<std::string, std::string> & itemPrope
iter != childItems.end();
++iter) {
if(shared_ptr<XdmfArray> array = shared_dynamic_cast<XdmfArray>(*iter)) {
this->swap(array);
if (array->getReference()) {
this->setReference(array->getReference());
this->setReadMode(XdmfArray::Reference);
}
this->populateArray(array);
break;
}
}
......
......@@ -276,7 +276,7 @@ XdmfCurvilinearGrid::copyGrid(shared_ptr<XdmfGrid> sourceGrid)
shared_ptr<XdmfArray>
XdmfCurvilinearGrid::getDimensions()
{
return boost::const_pointer_cast<XdmfArray>
return const_pointer_cast<XdmfArray>
(static_cast<const XdmfCurvilinearGrid &>(*this).getDimensions());
}
......@@ -289,7 +289,7 @@ XdmfCurvilinearGrid::getDimensions() const
shared_ptr<XdmfGeometry>
XdmfCurvilinearGrid::getGeometry()
{
return boost::const_pointer_cast<XdmfGeometry>
return const_pointer_cast<XdmfGeometry>
(static_cast<const XdmfGrid &>(*this).getGeometry());
}
......
......@@ -25,7 +25,7 @@
#include "XdmfGeometryType.hpp"
#include "XdmfError.hpp"
#include "XdmfFunction.hpp"
#include <boost/tokenizer.hpp>
#include <cstring>
shared_ptr<XdmfGeometry> XdmfGeometry::New()
{
......@@ -176,11 +176,7 @@ XdmfGeometry::populateItem(const std::map<std::string, std::string> & itemProper
iter != childItems.end();
++iter) {
if(shared_ptr<XdmfArray> array = shared_dynamic_cast<XdmfArray>(*iter)) {
this->swap(array);
if (array->getReference()) {
this->setReference(array->getReference());
this->setReadMode(XdmfArray::Reference);
}
this->populateArray(array);
break;
}
}
......@@ -195,12 +191,25 @@ XdmfGeometry::populateItem(const std::map<std::string, std::string> & itemProper
std::map<std::string, std::string>::const_iterator origin =
itemProperties.find("Origin");
if (origin != itemProperties.end()) {
#ifdef HAVE_CXX11_SHARED_PTR
char * originString = strdup(origin->second.c_str());
char * token = std::strtok(originString, " ");
while (token != NULL)
{
mOrigin.push_back(atoi(token));
token = std::strtok(NULL, " ");
}
free(originString);
originString = NULL;
#else
boost::tokenizer<> tokens(origin->second);
for(boost::tokenizer<>::const_iterator iter = tokens.begin();
iter != tokens.end();
++iter) {
mOrigin.push_back(atof((*iter).c_str()));
}
#endif
}
}
......
......@@ -62,7 +62,7 @@ XdmfGraph::getItemTag() const
shared_ptr<XdmfTime>
XdmfGraph::getTime()
{
return boost::const_pointer_cast<XdmfTime>
return const_pointer_cast<XdmfTime>
(static_cast<const XdmfGraph &>(*this).getTime());
}
......
......@@ -141,7 +141,7 @@ XdmfGrid::getName() const
shared_ptr<XdmfTime>
XdmfGrid::getTime()
{
return boost::const_pointer_cast<XdmfTime>
return const_pointer_cast<XdmfTime>
(static_cast<const XdmfGrid &>(*this).getTime());
}
......
......@@ -42,8 +42,6 @@
#include "XdmfSystemUtils.hpp"
#include <boost/tokenizer.hpp>
#include <stdio.h>
shared_ptr<XdmfGridTemplate>
......
......@@ -21,8 +21,9 @@
/* */
/*****************************************************************************/
#include <algorithm>
#include <cctype>
#include <boost/tokenizer.hpp>
#include <cstring>
#include "XdmfAttribute.hpp"
#include "XdmfCurvilinearGrid.hpp"
#include "XdmfDomain.hpp"
......@@ -277,12 +278,25 @@ XdmfItemFactory::createItem(const std::string & itemTag,
if(dimensions != itemProperties.end()) {
dimensionsString = dimensions->second;
}
#ifdef HAVE_CXX11_SHARED_PTR
char * dimString = strdup(dimensionsString.c_str());
char * token = std::strtok(dimString, " ");
while (token != NULL)
{
dimensionsArray->pushBack(atoi(token));
token = std::strtok(NULL, " ");
}
free(dimString);
dimString = NULL;
#else
boost::tokenizer<> tokens(dimensionsString);
for(boost::tokenizer<>::const_iterator iter = tokens.begin();
iter != tokens.end();
++iter) {
dimensionsArray->pushBack<unsigned int>(atoi((*iter).c_str()));
}
#endif
if(typeVal.compare("2DCORECTMESH") == 0 ||
typeVal.compare("3DCORECTMESH") == 0 ||
typeVal.compare("CORECTMESH") == 0) {
......
......@@ -333,7 +333,7 @@ XdmfRectilinearGrid::copyGrid(shared_ptr<XdmfGrid> sourceGrid)
shared_ptr<XdmfArray>
XdmfRectilinearGrid::getCoordinates(const unsigned int axisIndex)
{
return boost::const_pointer_cast<XdmfArray>
return const_pointer_cast<XdmfArray>
(static_cast<const XdmfRectilinearGrid &>
(*this).getCoordinates(axisIndex));
}
......@@ -362,7 +362,7 @@ XdmfRectilinearGrid::getCoordinates() const
shared_ptr<XdmfArray>
XdmfRectilinearGrid::getDimensions()
{
return boost::const_pointer_cast<XdmfArray>
return const_pointer_cast<XdmfArray>
(static_cast<const XdmfRectilinearGrid &>(*this).getDimensions());
}
......
......@@ -373,7 +373,7 @@ XdmfRegularGrid::copyGrid(shared_ptr<XdmfGrid> sourceGrid)
shared_ptr<XdmfArray>
XdmfRegularGrid::getBrickSize()
{
return boost::const_pointer_cast<XdmfArray>
return const_pointer_cast<XdmfArray>
(static_cast<const XdmfRegularGrid &>(*this).getBrickSize());
}
......@@ -386,7 +386,7 @@ XdmfRegularGrid::getBrickSize() const
shared_ptr<XdmfArray>
XdmfRegularGrid::getDimensions()
{
return boost::const_pointer_cast<XdmfArray>
return const_pointer_cast<XdmfArray>
(static_cast<const XdmfRegularGrid &>(*this).getDimensions());
}
......@@ -399,7 +399,7 @@ XdmfRegularGrid::getDimensions() const
shared_ptr<XdmfArray>
XdmfRegularGrid::getOrigin()
{
return boost::const_pointer_cast<XdmfArray>
return const_pointer_cast<XdmfArray>
(static_cast<const XdmfRegularGrid &>(*this).getOrigin());
}
......
......@@ -107,7 +107,7 @@ XdmfSet::populateItem(const std::map<std::string, std::string> & itemProperties,
else if(shared_ptr<XdmfArray> array =
shared_dynamic_cast<XdmfArray>(*iter)) {
if (!filled) {
this->swap(array);
this->populateArray(array);
filled = true;
}
if (array->getReference()) {
......
......@@ -24,6 +24,7 @@
#include <sstream>
#include <utility>
#include <climits>
#include <cstring>
#include <set>
#include "XdmfArray.hpp"
#include "XdmfHDF5Controller.hpp"
......@@ -38,8 +39,6 @@
#include "XdmfSystemUtils.hpp"
#include <boost/tokenizer.hpp>
#include <stdio.h>
std::vector<shared_ptr<XdmfHeavyDataController> >
......@@ -888,7 +887,9 @@ XdmfTemplate::preallocateSteps(unsigned int numSteps)
//printf("allocating subsection %u\n", allocateIteration);
//*/
//printf("initializing base array\n");
tempArray->initialize(mTrackedArrays[i]->getArrayType(), preallocatedSize);
std::vector<unsigned int> preallocatedSizeVector;
preallocatedSizeVector.push_back(preallocatedSize);
tempArray->initialize(mTrackedArrays[i]->getArrayType(), preallocatedSizeVector);
//printf("writing subsection");
tempArray->accept(mHeavyWriter);
//printf("subsection written\n");
......@@ -1114,6 +1115,26 @@ XdmfTemplate::setStep(unsigned int stepId)
mTrackedArrays[i]->initialize(mTrackedArrayTypes[i], mTrackedArrayDims[i]);
unsigned int index = 0;
#ifdef HAVE_CXX11_SHARED_PTR
char * trackedString = strdup(content.c_str());
char * token = std::strtok(trackedString, " \t\n");
if(mTrackedArrayTypes[i] == XdmfArrayType::String()) {
while (token != NULL)
{
mTrackedArrays[i]->insert(index, std::string(token));
token = std::strtok(NULL, " \t\n");
}
}
else {
while (token != NULL)
{
mTrackedArrays[i]->insert(index, atof(token));
token = std::strtok(NULL, " \t\n");
}
}
free(trackedString);
trackedString = NULL;
#else
boost::char_separator<char> sep(" \t\n");
boost::tokenizer<boost::char_separator<char> > valtokens(content, sep);
if(mTrackedArrayTypes[i] == XdmfArrayType::String()) {
......@@ -1132,6 +1153,7 @@ XdmfTemplate::setStep(unsigned int stepId)
mTrackedArrays[i]->insert(index, atof((*iter).c_str()));
}
}
#endif
}
}
}
......
......@@ -158,11 +158,7 @@ XdmfTopology::populateItem(const std::map<std::string, std::string> & itemProper
iter != childItems.end();
++iter) {
if(shared_ptr<XdmfArray> array = shared_dynamic_cast<XdmfArray>(*iter)) {
this->swap(array);
if (array->getReference()) {
this->setReference(array->getReference());
this->setReadMode(XdmfArray::Reference);
}
this->populateArray(array);
break;
}
}
......
......@@ -259,7 +259,7 @@ XdmfUnstructuredGrid::copyGrid(shared_ptr<XdmfGrid> sourceGrid)
shared_ptr<XdmfGeometry>
XdmfUnstructuredGrid::getGeometry()
{
return boost::const_pointer_cast<XdmfGeometry>
return const_pointer_cast<XdmfGeometry>
(static_cast<const XdmfGrid &>(*this).getGeometry());
}
......@@ -272,7 +272,7 @@ XdmfUnstructuredGrid::getItemTag() const
shared_ptr<XdmfTopology>
XdmfUnstructuredGrid::getTopology()
{
return boost::const_pointer_cast<XdmfTopology>
return const_pointer_cast<XdmfTopology>
(static_cast<const XdmfGrid &>(*this).getTopology());
}
......
......@@ -35,7 +35,7 @@ if(XDMF_BUILD_DSM)
endif()
mark_as_advanced(CLEAR Boost_INCLUDE_DIR)
find_package(Boost REQUIRED)
find_package(Boost)
if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
mark_as_advanced(FORCE Boost_INCLUDE_DIR)
......@@ -113,7 +113,8 @@ endif()
TEST_BIG_ENDIAN(XDMF_BIG_ENDIAN)
unset(HAVE_BOOST_SHARED_DYNAMIC_CAST CACHE)
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${Boost_INCLUDE_DIRS})
unset(HAVE_CXX11_SHARED_PTR CACHE)
check_cxx_source_compiles("
#include <boost/shared_ptr.hpp>
......@@ -127,6 +128,26 @@ int main(int ac, char * av[])
}
"
HAVE_BOOST_SHARED_DYNAMIC_CAST)
check_cxx_source_compiles("
#include <memory>
using namespace std;
struct Base { virtual ~Base(){} };
int main(int ac, char * av[])
{
shared_ptr<Base> ptr(new Base());
}
"
HAVE_CXX11_SHARED_PTR)
if (HAVE_CXX11_SHARED_PTR AND NOT XDMF_WRAP_PYTHON)
set(HAVE_CXX11_SHARED_PTR ${HAVE_CXX11_SHARED_PTR} PARENT_SCOPE)
add_definitions(-DHAVE_CXX11_SHARED_PTR)
endif ()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/XdmfCoreConfig.hpp.in
${CMAKE_CURRENT_BINARY_DIR}/XdmfCoreConfig.hpp)
......@@ -159,6 +180,58 @@ if (TIFF_FOUND)
set(XdmfCoreSources
${XdmfCoreSources}
XdmfTIFFController)
set(XdmfCoreSources
core/XdmfArray
core/XdmfArrayReference
core/XdmfArrayType
core/XdmfBinaryController
core/XdmfCoreItemFactory
core/XdmfCoreReader
core/XdmfError
core/XdmfFunction
core/XdmfHDF5Controller
core/XdmfHDF5Writer
core/XdmfHeavyDataController
core/XdmfHeavyDataDescription
core/XdmfHeavyDataWriter
core/XdmfInformation
core/XdmfItem
core/XdmfItemProperty
core/XdmfPlaceholder
core/XdmfSparseMatrix
core/XdmfSubset
core/XdmfSystemUtils
core/XdmfTIFFController
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/XdmfVersion
core/XdmfVisitor
core/XdmfWriter
PARENT_SCOPE)
else ()
set(XdmfCoreSources
core/XdmfArray
core/XdmfArrayReference
core/XdmfArrayType
core/XdmfBinaryController
core/XdmfCoreItemFactory
core/XdmfCoreReader
core/XdmfError
core/XdmfFunction
core/XdmfHDF5Controller
core/XdmfHDF5Writer
core/XdmfHeavyDataController
core/XdmfHeavyDataDescription
core/XdmfHeavyDataWriter
core/XdmfInformation
core/XdmfItem
core/XdmfItemProperty
core/XdmfPlaceholder
core/XdmfSparseMatrix
core/XdmfSubset
core/XdmfSystemUtils
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/XdmfVersion
core/XdmfVisitor
core/XdmfWriter
PARENT_SCOPE)
endif()
if (XDMF_STATIC_AND_SHARED)
......@@ -175,6 +248,9 @@ else()
add_library(XdmfCore ${LIBTYPE} ${XdmfCoreSources})
endif()
set(XDMF_LIBRARY_DIRS ${XDMF_LIBRARY_DIRS} PARENT_SCOPE)
set(XDMF_LIBRARIES ${XDMF_LIBRARIES} PARENT_SCOPE)
link_directories(${XDMF_LIBRARY_DIRS})
target_link_libraries(XdmfCore ${XDMF_LIBRARIES})
......@@ -269,17 +345,26 @@ if (XDMF_STATIC_AND_SHARED AND BUILD_SHARED_LIBS)
ARCHIVE DESTINATION lib)
endif ()
set(XdmfCore_INCLUDE_DIRS
${Boost_INCLUDE_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${HDF5_INCLUDE_DIR}
${LIBXML2_INCLUDE_DIR}
${PYTHON_INCLUDE_DIRS}
CACHE INTERNAL "")
if (Boost_FOUND)
set(XdmfCore_INCLUDE_DIRS
${Boost_INCLUDE_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${HDF5_INCLUDE_DIR}
${LIBXML2_INCLUDE_DIR}
${PYTHON_INCLUDE_DIRS}
CACHE INTERNAL "")
else ()
set(XdmfCore_INCLUDE_DIRS
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${HDF5_INCLUDE_DIR}
${LIBXML2_INCLUDE_DIR}
${PYTHON_INCLUDE_DIRS}
CACHE INTERNAL "")
endif ()
set(XDMF_INCLUDE_DIRS ${CMAKE_INSTALL_PREFIX}/include PARENT_SCOPE)
set(XDMF_LIBRARIES ${XDMF_LIBRARIES} ${CMAKE_INSTALL_PREFIX}/lib)
set(XDMF_DIR ${CMAKE_INSTALL_PREFIX} PARENT_SCOPE)
set(XDMF_BINARIES ${XDMF_BINARIES} ${CMAKE_INSTALL_PREFIX}/bin)
......
This diff is collapsed.
......@@ -37,8 +37,6 @@ class XdmfArrayType;
class XdmfHeavyDataController;
// Includes
#include <boost/shared_array.hpp>
#include <boost/variant.hpp>
/**
* @brief Provides storage for data values that are read in or will be
......@@ -110,6 +108,11 @@ public:
Reference
};
friend class XdmfHeavyDataWriter;
friend class XdmfHDF5Writer;
friend class XdmfHeavyDataController;
friend class XdmfHDF5Controller;
/**
* Create a new XdmfArray.
*
......@@ -600,7 +603,7 @@ public:
* initialized in this array.
*/
template <typename T>
shared_ptr<std::vector<T> > initialize(const unsigned int size = 0);
T * initialize(const unsigned int size = 0);
/**
* Initialize the array to specific dimensions.
......@@ -625,8 +628,7 @@ public:
* initialized in this array.
*/
template <typename T>
shared_ptr<std::vector<T> >
initialize(const std::vector<unsigned int> & dimensions);
T * initialize(const std::vector<unsigned int> & dimensions);
/**
* Initialize the array to contain a specified amount of a particular type.
......@@ -1320,7 +1322,7 @@ public:
* deletion of the array to XdmfArray.
*/
template<typename T>
void setValuesInternal(const T * const arrayPointer,
void setValuesInternal(T * const arrayPointer,
const unsigned int numValues,
const bool transferOwnership = 0);
......@@ -1378,56 +1380,6 @@ public:
template<typename T>
void setValuesInternal(const shared_ptr<std::vector<T> > array);
/**
* Exchange the contents of the vector with the contents of this
* array. No copy is made. The internal arrays are swapped.
*
* Example of use
*
* C++
*
* @dontinclude ExampleXdmfArray.cpp
* @skipline //#initialization
* @until //#initialization
* @skipline //#initinternalvector
* @until //#initinternalvector
* @skipline //#swapvector
* @until //#swapvector
*
* Python: The Python version only supports swapping XdmfArrays
*
* @param array A vector to exchange values with.
* @return bool whether the swap was successful.
*/
template<typename T>
bool swap(std::vector<T> & array);
/**
* Exchange the contents of the vector with the contents of this
* array. No copy is made. The internal arrays are swapped.
*
* Example of use
*
* C++
*
* @dontinclude ExampleXdmfArray.cpp
* @skipline //#initialization
* @until //#initialization
* @skipline //#initinternalvector
* @until //#initinternalvector
* @skipline //#initsharedvector
* @until //#initsharedvector
* @skipline //#swapsharedvector
* @until //#swapsharedvector
*
* Python: The Python version only supports swapping XdmfArrays
*
* @param array A smart pointer to a vector to exchange values with.
* @return bool whether the swap was successful.
*/
template<typename T>
bool swap(const shared_ptr<std::vector<T> > array);
/**
* Exchange the contents of an XdmfArray with the contents of this
* array. No copy is made. The internal arrays are swapped.
......@@ -1464,26 +1416,52 @@ protected:
XdmfArray();
template <typename T>
void setArrayType();
virtual void
populateArray(const shared_ptr<XdmfArray> array);
virtual void
populateItem(const std::map<std::string, std::string> & itemProperties,
const std::vector<shared_ptr<XdmfItem> > & childItems,
const XdmfCoreReader * const reader);