Commit dcd4504a authored by David E. DeMarle's avatar David E. DeMarle

Revert the noboost work as it doesn't compile with visstudio 2013

This brings us back to commit 605db515
parent 63c88e6e
...@@ -84,7 +84,8 @@ MACRO(ADD_TEST_C executable) ...@@ -84,7 +84,8 @@ MACRO(ADD_TEST_C executable)
ADD_TEST(C${is_core}_${executable}${dup} ${CMAKE_COMMAND} ADD_TEST(C${is_core}_${executable}${dup} ${CMAKE_COMMAND}
-D "EXECUTABLE=${executable}${dup}" -D "EXECUTABLE=${executable}${dup}"
-D "ARGUMENTS=${arguments}" -D "ARGUMENTS=${arguments}"
-D "PATH=${c_path}" -D "LDPATH=${c_ldpath}"
-D "PATH=${c_path}"
-D "SEPARATOR=${sep}" -D "SEPARATOR=${sep}"
-P "${c_binary_dir}/TestDriverC.cmake" -P "${c_binary_dir}/TestDriverC.cmake"
) )
......
...@@ -87,7 +87,8 @@ MACRO(ADD_TEST_CXX executable) ...@@ -87,7 +87,8 @@ MACRO(ADD_TEST_CXX executable)
SET_CORE("${cxx_binary_dir}") SET_CORE("${cxx_binary_dir}")
ADD_TEST(Cxx${is_core}_${executable}${dup} ${CMAKE_COMMAND} ADD_TEST(Cxx${is_core}_${executable}${dup} ${CMAKE_COMMAND}
-D "EXECUTABLE=${executable}${dup}" -D "EXECUTABLE=${executable}${dup}"
-D "ARGUMENTS=${arguments}" -D "ARGUMENTS=${arguments}"
-D "LDPATH=${cxx_ldpath}"
-D "PATH=${cxx_path}" -D "PATH=${cxx_path}"
-D "SEPARATOR=${sep}" -D "SEPARATOR=${sep}"
-P "${cxx_binary_dir}/TestDriverCxx.cmake" -P "${cxx_binary_dir}/TestDriverCxx.cmake"
......
...@@ -121,6 +121,7 @@ MACRO(ADD_TEST_PYTHON executable) ...@@ -121,6 +121,7 @@ MACRO(ADD_TEST_PYTHON executable)
-D "EXECUTABLE=${executable}" -D "EXECUTABLE=${executable}"
-D "ARGUMENTS=${arguments}" -D "ARGUMENTS=${arguments}"
-D "PYTHONPATH=${python_pythonpath}" -D "PYTHONPATH=${python_pythonpath}"
-D "LDPATH=${python_ldpath}"
-D "PATH=${python_path}" -D "PATH=${python_path}"
-D "SEPARATOR=${sep}" -D "SEPARATOR=${sep}"
-P "${python_binary_dir}/TestDriverPython.cmake" -P "${python_binary_dir}/TestDriverPython.cmake"
......
project(Xdmf) project(Xdmf)
cmake_minimum_required(VERSION 3.1) cmake_minimum_required(VERSION 2.8.5)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
#Needed to build DSM because relative paths are used to add its libraries #Needed to build DSM because relative paths are used to add its libraries
if (POLICY CMP0015) if (POLICY CMP0015)
cmake_policy(SET CMP0015 NEW) cmake_policy(SET CMP0015 NEW)
endif () endif ()
if(WIN32)
ADD_DEFINITIONS(-D_CRT_NONSTDC_NO_DEPRECATE)
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
endif()
if(MSVC10) if(MSVC10)
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}) SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR})
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}) SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR})
......
...@@ -137,11 +137,9 @@ ...@@ -137,11 +137,9 @@
# define XDMFCORE_EXPORT # define XDMFCORE_EXPORT
# define XDMFDSM_EXPORT # define XDMFDSM_EXPORT
# define XDMF_EXPORT # define XDMF_EXPORT
# define XDMFUTILS_EXPORT
# define XDMFCORE_TEMPLATE # define XDMFCORE_TEMPLATE
# define XDMFDSM_TEMPLATE # define XDMFDSM_TEMPLATE
# define XDMF_TEMPLATE # define XDMF_TEMPLATE
# define XDMFUTILS_TEMPLATE
#else #else
/* Used to export/import from the dlls */ /* Used to export/import from the dlls */
# undef XDMFCORE_EXPORT # undef XDMFCORE_EXPORT
...@@ -154,11 +152,6 @@ ...@@ -154,11 +152,6 @@
# undef XDMFDSM_TEMPLATE # undef XDMFDSM_TEMPLATE
# define XDMFDSM_TEMPLATE extern # define XDMFDSM_TEMPLATE extern
# undef XDMFUTILS_EXPORT
# define XDMFUTILS_EXPORT __declspec(dllimport)
# undef XDMFUTILS_TEMPLATE
# define XDMFUTILS_TEMPLATE extern
# ifdef XDMF_EXPORTS # ifdef XDMF_EXPORTS
# define XDMF_EXPORT __declspec(dllexport) # define XDMF_EXPORT __declspec(dllexport)
# define XDMF_TEMPLATE # define XDMF_TEMPLATE
...@@ -166,8 +159,6 @@ ...@@ -166,8 +159,6 @@
# define XDMF_EXPORT __declspec(dllimport) # define XDMF_EXPORT __declspec(dllimport)
# define XDMF_TEMPLATE extern # define XDMF_TEMPLATE extern
# endif /* XDMF_EXPORTS */ # endif /* XDMF_EXPORTS */
#endif #endif
/* Compiler Warnings */ /* Compiler Warnings */
...@@ -182,19 +173,13 @@ ...@@ -182,19 +173,13 @@
/* Compiler Optimizations will result in an 'internal compiler error', so turn them off */ /* Compiler Optimizations will result in an 'internal compiler error', so turn them off */
#pragma optimize("g", off) #pragma optimize("g", off)
#pragma warning( disable : 4297 ) /* __declspec(nothrow), throw(), noexcept(true), or noexcept was specified in the function */
#pragma warning( disable : 4800 ) /* 'int': forcing value to bool 'true' or 'false' (performance warning) */
#pragma warning( disable : 4250 ) /* inherits insert via dominance */
#else /* _WIN32 */ #else /* _WIN32 */
/* We don't need to export/import since there are no dlls */ /* We don't need to export/import since there are no dlls */
#define XDMFCORE_EXPORT #define XDMFCORE_EXPORT
#define XDMFDSM_EXPORT #define XDMFDSM_EXPORT
#define XDMF_EXPORT #define XDMF_EXPORT
#define XDMFUTILS_EXPORT
#define XDMFCORE_TEMPLATE #define XDMFCORE_TEMPLATE
#define XDMFDSM_TEMPLATE #define XDMFDSM_TEMPLATE
#define XDMF_TEMPLATE #define XDMF_TEMPLATE
#define XDMFUTILS_TEMPLATE
#endif /* _WIN32 */ #endif /* _WIN32 */
#endif /* _XDMF_HPP */ #endif /* _XDMF_HPP */
...@@ -1120,49 +1120,49 @@ vXdmfSetRemoveAttribute(XDMFSET * set, unsigned int index); ...@@ -1120,49 +1120,49 @@ vXdmfSetRemoveAttribute(XDMFSET * set, unsigned int index);
PyObject * XdmfItemCast(shared_ptr<XdmfItem> obj) { PyObject * XdmfItemCast(shared_ptr<XdmfItem> obj) {
PyObject * result; PyObject * result;
if(shared_ptr<XdmfAttribute> attribute = shared_dynamic_cast<XdmfAttribute>(obj)) { if(shared_ptr<XdmfAttribute> attribute = shared_dynamic_cast<XdmfAttribute>(obj)) {
result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfAttribute>(attribute)), SWIGTYPE_p_std__shared_ptrT_XdmfAttribute_t, SWIG_POINTER_OWN); result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfAttribute>(attribute)), SWIGTYPE_p_boost__shared_ptrT_XdmfAttribute_t, SWIG_POINTER_OWN);
} }
else if(shared_ptr<XdmfCurvilinearGrid> gridCurvilinear = shared_dynamic_cast<XdmfCurvilinearGrid>(obj)) { else if(shared_ptr<XdmfCurvilinearGrid> gridCurvilinear = shared_dynamic_cast<XdmfCurvilinearGrid>(obj)) {
result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfCurvilinearGrid>(gridCurvilinear)), SWIGTYPE_p_std__shared_ptrT_XdmfCurvilinearGrid_t, SWIG_POINTER_OWN); result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfCurvilinearGrid>(gridCurvilinear)), SWIGTYPE_p_boost__shared_ptrT_XdmfCurvilinearGrid_t, SWIG_POINTER_OWN);
} }
else if(shared_ptr<XdmfGridCollection> gridCollection = shared_dynamic_cast<XdmfGridCollection>(obj)) { else if(shared_ptr<XdmfGridCollection> gridCollection = shared_dynamic_cast<XdmfGridCollection>(obj)) {
result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfGridCollection>(gridCollection)), SWIGTYPE_p_std__shared_ptrT_XdmfGridCollection_t, SWIG_POINTER_OWN); result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfGridCollection>(gridCollection)), SWIGTYPE_p_boost__shared_ptrT_XdmfGridCollection_t, SWIG_POINTER_OWN);
} }
else if(shared_ptr<XdmfDomain> domain = shared_dynamic_cast<XdmfDomain>(obj)) { else if(shared_ptr<XdmfDomain> domain = shared_dynamic_cast<XdmfDomain>(obj)) {
result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfDomain>(domain)), SWIGTYPE_p_std__shared_ptrT_XdmfDomain_t, SWIG_POINTER_OWN); result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfDomain>(domain)), SWIGTYPE_p_boost__shared_ptrT_XdmfDomain_t, SWIG_POINTER_OWN);
} }
else if(shared_ptr<XdmfGeometry> geometry = shared_dynamic_cast<XdmfGeometry>(obj)) { else if(shared_ptr<XdmfGeometry> geometry = shared_dynamic_cast<XdmfGeometry>(obj)) {
result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfGeometry>(geometry)), SWIGTYPE_p_std__shared_ptrT_XdmfGeometry_t, SWIG_POINTER_OWN); result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfGeometry>(geometry)), SWIGTYPE_p_boost__shared_ptrT_XdmfGeometry_t, SWIG_POINTER_OWN);
} }
else if(shared_ptr<XdmfGraph> graph = shared_dynamic_cast<XdmfGraph>(obj)) { else if(shared_ptr<XdmfGraph> graph = shared_dynamic_cast<XdmfGraph>(obj)) {
result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfGraph>(graph)), SWIGTYPE_p_std__shared_ptrT_XdmfGraph_t, SWIG_POINTER_OWN); result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfGraph>(graph)), SWIGTYPE_p_boost__shared_ptrT_XdmfGraph_t, SWIG_POINTER_OWN);
} }
else if(shared_ptr<XdmfInformation> information = shared_dynamic_cast<XdmfInformation>(obj)) { else if(shared_ptr<XdmfInformation> information = shared_dynamic_cast<XdmfInformation>(obj)) {
result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfInformation>(information)), SWIGTYPE_p_std__shared_ptrT_XdmfInformation_t, SWIG_POINTER_OWN); result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfInformation>(information)), SWIGTYPE_p_boost__shared_ptrT_XdmfInformation_t, SWIG_POINTER_OWN);
} }
else if(shared_ptr<XdmfMap> map = shared_dynamic_cast<XdmfMap>(obj)) { else if(shared_ptr<XdmfMap> map = shared_dynamic_cast<XdmfMap>(obj)) {
result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfMap>(map)), SWIGTYPE_p_std__shared_ptrT_XdmfMap_t, SWIG_POINTER_OWN); result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfMap>(map)), SWIGTYPE_p_boost__shared_ptrT_XdmfMap_t, SWIG_POINTER_OWN);
} }
else if(shared_ptr<XdmfRectilinearGrid> gridRectilinear = shared_dynamic_cast<XdmfRectilinearGrid>(obj)) { else if(shared_ptr<XdmfRectilinearGrid> gridRectilinear = shared_dynamic_cast<XdmfRectilinearGrid>(obj)) {
result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfRectilinearGrid>(gridRectilinear)), SWIGTYPE_p_std__shared_ptrT_XdmfRectilinearGrid_t, SWIG_POINTER_OWN); result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfRectilinearGrid>(gridRectilinear)), SWIGTYPE_p_boost__shared_ptrT_XdmfRectilinearGrid_t, SWIG_POINTER_OWN);
} }
else if(shared_ptr<XdmfRegularGrid> gridRegular = shared_dynamic_cast<XdmfRegularGrid>(obj)) { else if(shared_ptr<XdmfRegularGrid> gridRegular = shared_dynamic_cast<XdmfRegularGrid>(obj)) {
result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfRegularGrid>(gridRegular)), SWIGTYPE_p_std__shared_ptrT_XdmfRegularGrid_t, SWIG_POINTER_OWN); result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfRegularGrid>(gridRegular)), SWIGTYPE_p_boost__shared_ptrT_XdmfRegularGrid_t, SWIG_POINTER_OWN);
} }
else if(shared_ptr<XdmfSet> set = shared_dynamic_cast<XdmfSet>(obj)) { else if(shared_ptr<XdmfSet> set = shared_dynamic_cast<XdmfSet>(obj)) {
result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfSet>(set)), SWIGTYPE_p_std__shared_ptrT_XdmfSet_t, SWIG_POINTER_OWN); result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfSet>(set)), SWIGTYPE_p_boost__shared_ptrT_XdmfSet_t, SWIG_POINTER_OWN);
} }
else if(shared_ptr<XdmfTime> time = shared_dynamic_cast<XdmfTime>(obj)) { else if(shared_ptr<XdmfTime> time = shared_dynamic_cast<XdmfTime>(obj)) {
result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfTime>(time)), SWIGTYPE_p_std__shared_ptrT_XdmfTime_t, SWIG_POINTER_OWN); result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfTime>(time)), SWIGTYPE_p_boost__shared_ptrT_XdmfTime_t, SWIG_POINTER_OWN);
} }
else if(shared_ptr<XdmfTopology> topology = shared_dynamic_cast<XdmfTopology>(obj)) { else if(shared_ptr<XdmfTopology> topology = shared_dynamic_cast<XdmfTopology>(obj)) {
result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfTopology>(topology)), SWIGTYPE_p_std__shared_ptrT_XdmfTopology_t, SWIG_POINTER_OWN); result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfTopology>(topology)), SWIGTYPE_p_boost__shared_ptrT_XdmfTopology_t, SWIG_POINTER_OWN);
} }
else if(shared_ptr<XdmfUnstructuredGrid> gridUnstructured = shared_dynamic_cast<XdmfUnstructuredGrid>(obj)) { else if(shared_ptr<XdmfUnstructuredGrid> gridUnstructured = shared_dynamic_cast<XdmfUnstructuredGrid>(obj)) {
result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfUnstructuredGrid>(gridUnstructured)), SWIGTYPE_p_std__shared_ptrT_XdmfUnstructuredGrid_t, SWIG_POINTER_OWN); result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfUnstructuredGrid>(gridUnstructured)), SWIGTYPE_p_boost__shared_ptrT_XdmfUnstructuredGrid_t, SWIG_POINTER_OWN);
} }
else { else {
result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfItem>(obj)), SWIGTYPE_p_std__shared_ptrT_XdmfItem_t, SWIG_POINTER_OWN); result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfItem>(obj)), SWIGTYPE_p_boost__shared_ptrT_XdmfItem_t, SWIG_POINTER_OWN);
} }
return result; return result;
} }
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <numeric> #include <numeric>
#include <functional> #include <functional>
#include <boost/tokenizer.hpp>
#include "XdmfArray.hpp" #include "XdmfArray.hpp"
#include "XdmfError.hpp" #include "XdmfError.hpp"
#include "XdmfAggregate.hpp" #include "XdmfAggregate.hpp"
...@@ -36,6 +37,11 @@ XdmfAggregate::XdmfAggregate() ...@@ -36,6 +37,11 @@ XdmfAggregate::XdmfAggregate()
{ {
} }
XdmfAggregate::XdmfAggregate(XdmfAggregate & refAggregate) :
XdmfArrayReference(refAggregate)
{
}
XdmfAggregate::~XdmfAggregate() XdmfAggregate::~XdmfAggregate()
{ {
} }
...@@ -80,7 +86,7 @@ std::vector<unsigned int> XdmfAggregate::getDimensions() const ...@@ -80,7 +86,7 @@ std::vector<unsigned int> XdmfAggregate::getDimensions() const
if (isSame) if (isSame)
{ {
testDims.push_back(static_cast<unsigned int>(mArrays.size())); testDims.push_back(mArrays.size());
return testDims; return testDims;
} }
else else
...@@ -207,53 +213,57 @@ XdmfAggregate::traverse(const shared_ptr<XdmfBaseVisitor> visitor) ...@@ -207,53 +213,57 @@ XdmfAggregate::traverse(const shared_ptr<XdmfBaseVisitor> visitor)
XDMFAGGREGATE * XdmfAggregateNew() XDMFAGGREGATE * XdmfAggregateNew()
{ {
shared_ptr<XdmfAggregate> * p = new shared_ptr<XdmfAggregate>(XdmfAggregate::New()); try
return (XDMFAGGREGATE *) p; {
shared_ptr<XdmfAggregate> generatedAggregate = XdmfAggregate::New();
return (XDMFAGGREGATE *)((void *)(new XdmfAggregate(*generatedAggregate.get())));
}
catch (...)
{
shared_ptr<XdmfAggregate> generatedAggregate = XdmfAggregate::New();
return (XDMFAGGREGATE *)((void *)(new XdmfAggregate(*generatedAggregate.get())));
}
} }
XDMFARRAY * XDMFARRAY *
XdmfAggregateGetArray(XDMFAGGREGATE * aggregate, unsigned int index) XdmfAggregateGetArray(XDMFAGGREGATE * aggregate, unsigned int index)
{ {
shared_ptr<XdmfAggregate> & refAggregate = *(shared_ptr<XdmfAggregate> *)(aggregate); return (XDMFARRAY *)((void *)(((XdmfAggregate *)(aggregate))->getArray(index).get()));
shared_ptr<XdmfArray> * p = new shared_ptr<XdmfArray>(refAggregate->getArray(index));
return (XDMFARRAY *) p;
} }
XDMFARRAY * XDMFARRAY *
XdmfAggregateGetArrayByName(XDMFAGGREGATE * aggregate, char * name) XdmfAggregateGetArrayByName(XDMFAGGREGATE * aggregate, char * name)
{ {
shared_ptr<XdmfAggregate> & refAggregate = *(shared_ptr<XdmfAggregate> *)(aggregate); return (XDMFARRAY *)((void *)(((XdmfAggregate *)(aggregate))->getArray(name).get()));
shared_ptr<XdmfArray> * p = new shared_ptr<XdmfArray>(refAggregate->getArray(name));
return (XDMFARRAY *) p;
} }
unsigned int unsigned int
XdmfAggregateGetNumberArrays(XDMFAGGREGATE * aggregate) XdmfAggregateGetNumberArrays(XDMFAGGREGATE * aggregate)
{ {
shared_ptr<XdmfAggregate> & refAggregate = *(shared_ptr<XdmfAggregate> *)(aggregate); return ((XdmfAggregate *)(aggregate))->getNumberArrays();
return refAggregate->getNumberArrays();
} }
void void
XdmfAggregateInsertArray(XDMFAGGREGATE * aggregate, XDMFARRAY * array, int transferOwnership) XdmfAggregateInsertArray(XDMFAGGREGATE * aggregate, XDMFARRAY * array, int transferOwnership)
{ {
shared_ptr<XdmfAggregate> & refAggregate = *(shared_ptr<XdmfAggregate> *)(aggregate); if (transferOwnership) {
shared_ptr<XdmfArray> & refArray = *(shared_ptr<XdmfArray> *)(array); ((XdmfAggregate *)(aggregate))->insert(shared_ptr<XdmfArray>((XdmfArray *)array));
refAggregate->insert(refArray); }
else {
((XdmfAggregate *)(aggregate))->insert(shared_ptr<XdmfArray>((XdmfArray *)array, XdmfNullDeleter()));
}
} }
void void
XdmfAggregateRemoveArray(XDMFAGGREGATE * aggregate, unsigned int index) XdmfAggregateRemoveArray(XDMFAGGREGATE * aggregate, unsigned int index)
{ {
shared_ptr<XdmfAggregate> & refAggregate = *(shared_ptr<XdmfAggregate> *)(aggregate); ((XdmfAggregate *)(aggregate))->removeArray(index);
refAggregate->removeArray(index);
} }
void void
XdmfAggregateRemoveArrayByName(XDMFAGGREGATE * aggregate, char * name) XdmfAggregateRemoveArrayByName(XDMFAGGREGATE * aggregate, char * name)
{ {
shared_ptr<XdmfAggregate> & refAggregate = *(shared_ptr<XdmfAggregate> *)(aggregate); ((XdmfAggregate *)(aggregate))->removeArray(name);
refAggregate->removeArray(name);
} }
// C Wrappers for parent classes are generated by macros // C Wrappers for parent classes are generated by macros
......
...@@ -159,6 +159,8 @@ public: ...@@ -159,6 +159,8 @@ public:
void traverse(const shared_ptr<XdmfBaseVisitor> visitor); void traverse(const shared_ptr<XdmfBaseVisitor> visitor);
XdmfAggregate(XdmfAggregate&);
protected: protected:
XdmfAggregate(); XdmfAggregate();
......
...@@ -49,6 +49,18 @@ XdmfAttribute::XdmfAttribute() : ...@@ -49,6 +49,18 @@ XdmfAttribute::XdmfAttribute() :
{ {
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
XdmfAttribute::XdmfAttribute(XdmfAttribute & refAttribute) :
XdmfArray(refAttribute),
mCenter(refAttribute.mCenter),
mName(refAttribute.mName),
mType(refAttribute.mType),
mItemType(refAttribute.mItemType),
mElementDegree(refAttribute.mElementDegree),
mElementFamily(refAttribute.mElementFamily),
mElementCell(refAttribute.mElementCell)
{
}
//-----------------------------------------------------------------------------
XdmfAttribute::~XdmfAttribute() XdmfAttribute::~XdmfAttribute()
{ {
} }
...@@ -252,27 +264,33 @@ XdmfAttribute::setElementCell(std::string cell) ...@@ -252,27 +264,33 @@ XdmfAttribute::setElementCell(std::string cell)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
XDMFATTRIBUTE * XdmfAttributeNew() XDMFATTRIBUTE * XdmfAttributeNew()
{ {
shared_ptr<XdmfAttribute> * p = new shared_ptr<XdmfAttribute>(XdmfAttribute::New()); try
return (XDMFATTRIBUTE *) p; {
shared_ptr<XdmfAttribute> generatedAttribute = XdmfAttribute::New();
return (XDMFATTRIBUTE *)((void *)(new XdmfAttribute(*generatedAttribute.get())));
}
catch (...)
{
shared_ptr<XdmfAttribute> generatedAttribute = XdmfAttribute::New();
return (XDMFATTRIBUTE *)((void *)(new XdmfAttribute(*generatedAttribute.get())));
}
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
int XdmfAttributeGetCenter(XDMFATTRIBUTE * attribute) int XdmfAttributeGetCenter(XDMFATTRIBUTE * attribute)
{ {
shared_ptr<XdmfAttribute> & refAttribute = *(shared_ptr<XdmfAttribute> *)(attribute); if (((XdmfAttribute *)attribute)->getCenter() == XdmfAttributeCenter::Grid()) {
const shared_ptr<const XdmfAttributeCenter> attributeCenter = refAttribute->getCenter();
if (attributeCenter == XdmfAttributeCenter::Grid()) {
return XDMF_ATTRIBUTE_CENTER_GRID; return XDMF_ATTRIBUTE_CENTER_GRID;
} }
else if (attributeCenter == XdmfAttributeCenter::Cell()) { else if (((XdmfAttribute *)attribute)->getCenter() == XdmfAttributeCenter::Cell()) {
return XDMF_ATTRIBUTE_CENTER_CELL; return XDMF_ATTRIBUTE_CENTER_CELL;
} }
else if (attributeCenter == XdmfAttributeCenter::Face()) { else if (((XdmfAttribute *)attribute)->getCenter() == XdmfAttributeCenter::Face()) {
return XDMF_ATTRIBUTE_CENTER_FACE; return XDMF_ATTRIBUTE_CENTER_FACE;
} }
else if (attributeCenter == XdmfAttributeCenter::Edge()) { else if (((XdmfAttribute *)attribute)->getCenter() == XdmfAttributeCenter::Edge()) {
return XDMF_ATTRIBUTE_CENTER_EDGE; return XDMF_ATTRIBUTE_CENTER_EDGE;
} }
else if (attributeCenter == XdmfAttributeCenter::Node()) { else if (((XdmfAttribute *)attribute)->getCenter() == XdmfAttributeCenter::Node()) {
return XDMF_ATTRIBUTE_CENTER_NODE; return XDMF_ATTRIBUTE_CENTER_NODE;
} }
else if (((XdmfAttribute *)attribute)->getCenter() == else if (((XdmfAttribute *)attribute)->getCenter() ==
...@@ -286,27 +304,25 @@ int XdmfAttributeGetCenter(XDMFATTRIBUTE * attribute) ...@@ -286,27 +304,25 @@ int XdmfAttributeGetCenter(XDMFATTRIBUTE * attribute)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
int XdmfAttributeGetType(XDMFATTRIBUTE * attribute) int XdmfAttributeGetType(XDMFATTRIBUTE * attribute)
{ {
shared_ptr<XdmfAttribute> & refAttribute = *(shared_ptr<XdmfAttribute> *)(attribute); if (((XdmfAttribute *)attribute)->getType() == XdmfAttributeType::Scalar()) {
const shared_ptr<const XdmfAttributeType> attributeType = refAttribute->getType();
if (attributeType == XdmfAttributeType::Scalar()) {
return XDMF_ATTRIBUTE_TYPE_SCALAR; return XDMF_ATTRIBUTE_TYPE_SCALAR;
} }
else if (attributeType == XdmfAttributeType::Vector()) { else if (((XdmfAttribute *)attribute)->getType() == XdmfAttributeType::Vector()) {
return XDMF_ATTRIBUTE_TYPE_VECTOR; return XDMF_ATTRIBUTE_TYPE_VECTOR;
} }
else if (attributeType == XdmfAttributeType::Tensor()) { else if (((XdmfAttribute *)attribute)->getType() == XdmfAttributeType::Tensor()) {
return XDMF_ATTRIBUTE_TYPE_TENSOR; return XDMF_ATTRIBUTE_TYPE_TENSOR;
} }
else if (attributeType == XdmfAttributeType::Matrix()) { else if (((XdmfAttribute *)attribute)->getType() == XdmfAttributeType::Matrix()) {
return XDMF_ATTRIBUTE_TYPE_MATRIX; return XDMF_ATTRIBUTE_TYPE_MATRIX;
} }
else if (attributeType == XdmfAttributeType::Tensor6()) { else if (((XdmfAttribute *)attribute)->getType() == XdmfAttributeType::Tensor6()) {
return XDMF_ATTRIBUTE_TYPE_TENSOR6; return XDMF_ATTRIBUTE_TYPE_TENSOR6;
} }
else if (attributeType == XdmfAttributeType::GlobalId()) { else if (((XdmfAttribute *)attribute)->getType() == XdmfAttributeType::GlobalId()) {
return XDMF_ATTRIBUTE_TYPE_GLOBALID; return XDMF_ATTRIBUTE_TYPE_GLOBALID;
} }
else if (attributeType == XdmfAttributeType::NoAttributeType()) { else if (((XdmfAttribute *)attribute)->getType() == XdmfAttributeType::NoAttributeType()) {
return XDMF_ATTRIBUTE_TYPE_NOTYPE; return XDMF_ATTRIBUTE_TYPE_NOTYPE;
} }
else { else {
...@@ -317,27 +333,26 @@ int XdmfAttributeGetType(XDMFATTRIBUTE * attribute) ...@@ -317,27 +333,26 @@ int XdmfAttributeGetType(XDMFATTRIBUTE * attribute)
void XdmfAttributeSetCenter(XDMFATTRIBUTE * attribute, int center, int * status) void XdmfAttributeSetCenter(XDMFATTRIBUTE * attribute, int center, int * status)
{ {
XDMF_ERROR_WRAP_START(status) XDMF_ERROR_WRAP_START(status)
shared_ptr<XdmfAttribute> & refAttribute = *(shared_ptr<XdmfAttribute> *)(attribute);
switch(center) { switch(center) {
case XDMF_ATTRIBUTE_CENTER_GRID: case XDMF_ATTRIBUTE_CENTER_GRID:
refAttribute->setCenter(XdmfAttributeCenter::Grid()); ((XdmfAttribute *)attribute)->setCenter(XdmfAttributeCenter::Grid());
break; break;
case XDMF_ATTRIBUTE_CENTER_CELL: case XDMF_ATTRIBUTE_CENTER_CELL:
refAttribute->setCenter(XdmfAttributeCenter::Cell()); ((XdmfAttribute *)attribute)->setCenter(XdmfAttributeCenter::Cell());
break; break;
case XDMF_ATTRIBUTE_CENTER_FACE: case XDMF_ATTRIBUTE_CENTER_FACE:
refAttribute->setCenter(XdmfAttributeCenter::Face()); ((XdmfAttribute *)attribute)->setCenter(XdmfAttributeCenter::Face());
break; break;
case XDMF_ATTRIBUTE_CENTER_EDGE: case XDMF_ATTRIBUTE_CENTER_EDGE:
refAttribute->setCenter(XdmfAttributeCenter::Edge()); ((XdmfAttribute *)attribute)->setCenter(XdmfAttributeCenter::Edge());
break; break;
case XDMF_ATTRIBUTE_CENTER_NODE: case XDMF_ATTRIBUTE_CENTER_NODE:
refAttribute->setCenter(XdmfAttributeCenter::Node()); ((XdmfAttribute *)attribute)->setCenter(XdmfAttributeCenter::Node());
break; break;
default: default:
XdmfError::message(XdmfError::FATAL, XdmfError::message(XdmfError::FATAL,
"Error: Invalid Attribute Center: Code " + center); "Error: Invalid Attribute Center: Code " + center);
break; break;
} }
XDMF_ERROR_WRAP_END(status) XDMF_ERROR_WRAP_END(status)
} }
...@@ -345,33 +360,32 @@ void XdmfAttributeSetCenter(XDMFATTRIBUTE * attribute, int center, int * status) ...@@ -345,33 +360,32 @@ void XdmfAttributeSetCenter(XDMFATTRIBUTE * attribute, int center, int * status)
void XdmfAttributeSetType(XDMFATTRIBUTE * attribute, int type, int * status) void XdmfAttributeSetType(XDMFATTRIBUTE * attribute, int type, int * status)
{ {
XDMF_ERROR_WRAP_START(status) XDMF_ERROR_WRAP_START(status)
shared_ptr<XdmfAttribute> & refAttribute = *(shared_ptr<XdmfAttribute> *)(attribute);
switch(type) { switch(type) {
case XDMF_ATTRIBUTE_TYPE_SCALAR: case XDMF_ATTRIBUTE_TYPE_SCALAR:
refAttribute->setType(XdmfAttributeType::Scalar()); ((XdmfAttribute *)attribute)->setType(XdmfAttributeType::Scalar());
break; break;
case XDMF_ATTRIBUTE_TYPE_VECTOR: case XDMF_ATTRIBUTE_TYPE_VECTOR:
refAttribute->setType(XdmfAttributeType::Vector()); ((XdmfAttribute *)attribute)->setType(XdmfAttributeType::Vector());
break; break;
case XDMF_ATTRIBUTE_TYPE_TENSOR: case XDMF_ATTRIBUTE_TYPE_TENSOR:
refAttribute->setType(XdmfAttributeType::Tensor()); ((XdmfAttribute *)attribute)->setType(XdmfAttributeType::Tensor());
break; break;
case XDMF_ATTRIBUTE_TYPE_MATRIX: case XDMF_ATTRIBUTE_TYPE_MATRIX:
refAttribute->setType(XdmfAttributeType::Matrix()); ((XdmfAttribute *)attribute)->setType(XdmfAttributeType::Matrix());
break; break;
case XDMF_ATTRIBUTE_TYPE_TENSOR6: case XDMF_ATTRIBUTE_TYPE_TENSOR6:
refAttribute->setType(XdmfAttributeType::Tensor6()); ((XdmfAttribute *)attribute)->setType(XdmfAttributeType::Tensor6());
break; break;
case XDMF_ATTRIBUTE_TYPE_GLOBALID: case XDMF_ATTRIBUTE_TYPE_GLOBALID:
refAttribute->setType(XdmfAttributeType::GlobalId()); ((XdmfAttribute *)attribute)->setType(XdmfAttributeType::GlobalId());
break; break;
case XDMF_ATTRIBUTE_TYPE_NOTYPE: case XDMF_ATTRIBUTE_TYPE_NOTYPE:
refAttribute->setType(XdmfAttributeType::NoAttributeType()); ((XdmfAttribute *)attribute)->setType(XdmfAttributeType::NoAttributeType());
break; break;
default: default:
XdmfError::message(XdmfError::FATAL, XdmfError::message(XdmfError::FATAL,
"Error: Invalid Attribute Type: Code " + type); "Error: Invalid Attribute Type: Code " + type);
break; break;
} }
XDMF_ERROR_WRAP_END(status) XDMF_ERROR_WRAP_END(status)
} }
......
...@@ -301,6 +301,7 @@ public: ...@@ -301,6 +301,7 @@ public:
*/ */
void setElementCell(std::string cell); void setElementCell(std::string cell);
XdmfAttribute(XdmfAttribute &);
void traverse(const shared_ptr<XdmfBaseVisitor> visitor); void traverse(const shared_ptr<XdmfBaseVisitor> visitor);
......
...@@ -21,11 +21,9 @@ ...@@ -21,11 +21,9 @@
/* */