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)
ADD_TEST(C${is_core}_${executable}${dup} ${CMAKE_COMMAND}
-D "EXECUTABLE=${executable}${dup}"
-D "ARGUMENTS=${arguments}"
-D "PATH=${c_path}"
-D "LDPATH=${c_ldpath}"
-D "PATH=${c_path}"
-D "SEPARATOR=${sep}"
-P "${c_binary_dir}/TestDriverC.cmake"
)
......
......@@ -87,7 +87,8 @@ MACRO(ADD_TEST_CXX executable)
SET_CORE("${cxx_binary_dir}")
ADD_TEST(Cxx${is_core}_${executable}${dup} ${CMAKE_COMMAND}
-D "EXECUTABLE=${executable}${dup}"
-D "ARGUMENTS=${arguments}"
-D "ARGUMENTS=${arguments}"
-D "LDPATH=${cxx_ldpath}"
-D "PATH=${cxx_path}"
-D "SEPARATOR=${sep}"
-P "${cxx_binary_dir}/TestDriverCxx.cmake"
......
......@@ -121,6 +121,7 @@ MACRO(ADD_TEST_PYTHON executable)
-D "EXECUTABLE=${executable}"
-D "ARGUMENTS=${arguments}"
-D "PYTHONPATH=${python_pythonpath}"
-D "LDPATH=${python_ldpath}"
-D "PATH=${python_path}"
-D "SEPARATOR=${sep}"
-P "${python_binary_dir}/TestDriverPython.cmake"
......
project(Xdmf)
cmake_minimum_required(VERSION 3.1)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
cmake_minimum_required(VERSION 2.8.5)
#Needed to build DSM because relative paths are used to add its libraries
if (POLICY CMP0015)
cmake_policy(SET CMP0015 NEW)
endif ()
if(WIN32)
ADD_DEFINITIONS(-D_CRT_NONSTDC_NO_DEPRECATE)
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
endif()
if(MSVC10)
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR})
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR})
......
......@@ -137,11 +137,9 @@
# define XDMFCORE_EXPORT
# define XDMFDSM_EXPORT
# define XDMF_EXPORT
# define XDMFUTILS_EXPORT
# define XDMFCORE_TEMPLATE
# define XDMFDSM_TEMPLATE
# define XDMF_TEMPLATE
# define XDMFUTILS_TEMPLATE
#else
/* Used to export/import from the dlls */
# undef XDMFCORE_EXPORT
......@@ -154,11 +152,6 @@
# undef XDMFDSM_TEMPLATE
# define XDMFDSM_TEMPLATE extern
# undef XDMFUTILS_EXPORT
# define XDMFUTILS_EXPORT __declspec(dllimport)
# undef XDMFUTILS_TEMPLATE
# define XDMFUTILS_TEMPLATE extern
# ifdef XDMF_EXPORTS
# define XDMF_EXPORT __declspec(dllexport)
# define XDMF_TEMPLATE
......@@ -166,8 +159,6 @@
# define XDMF_EXPORT __declspec(dllimport)
# define XDMF_TEMPLATE extern
# endif /* XDMF_EXPORTS */
#endif
/* Compiler Warnings */
......@@ -182,19 +173,13 @@
/* Compiler Optimizations will result in an 'internal compiler error', so turn them 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 */
/* We don't need to export/import since there are no dlls */
#define XDMFCORE_EXPORT
#define XDMFDSM_EXPORT
#define XDMF_EXPORT
#define XDMFUTILS_EXPORT
#define XDMFCORE_TEMPLATE
#define XDMFDSM_TEMPLATE
#define XDMF_TEMPLATE
#define XDMFUTILS_TEMPLATE
#endif /* _WIN32 */
#endif /* _XDMF_HPP */
......@@ -1120,49 +1120,49 @@ vXdmfSetRemoveAttribute(XDMFSET * set, unsigned int index);
PyObject * XdmfItemCast(shared_ptr<XdmfItem> obj) {
PyObject * result;
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)) {
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)) {
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)) {
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)) {
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)) {
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)) {
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)) {
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)) {
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)) {
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)) {
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)) {
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)) {
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)) {
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 {
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;
}
......
......@@ -23,6 +23,7 @@
#include <numeric>
#include <functional>
#include <boost/tokenizer.hpp>
#include "XdmfArray.hpp"
#include "XdmfError.hpp"
#include "XdmfAggregate.hpp"
......@@ -36,6 +37,11 @@ XdmfAggregate::XdmfAggregate()
{
}
XdmfAggregate::XdmfAggregate(XdmfAggregate & refAggregate) :
XdmfArrayReference(refAggregate)
{
}
XdmfAggregate::~XdmfAggregate()
{
}
......@@ -80,7 +86,7 @@ std::vector<unsigned int> XdmfAggregate::getDimensions() const
if (isSame)
{
testDims.push_back(static_cast<unsigned int>(mArrays.size()));
testDims.push_back(mArrays.size());
return testDims;
}
else
......@@ -207,53 +213,57 @@ XdmfAggregate::traverse(const shared_ptr<XdmfBaseVisitor> visitor)
XDMFAGGREGATE * XdmfAggregateNew()
{
shared_ptr<XdmfAggregate> * p = new shared_ptr<XdmfAggregate>(XdmfAggregate::New());
return (XDMFAGGREGATE *) p;
try
{
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 *
XdmfAggregateGetArray(XDMFAGGREGATE * aggregate, unsigned int index)
{
shared_ptr<XdmfAggregate> & refAggregate = *(shared_ptr<XdmfAggregate> *)(aggregate);
shared_ptr<XdmfArray> * p = new shared_ptr<XdmfArray>(refAggregate->getArray(index));
return (XDMFARRAY *) p;
return (XDMFARRAY *)((void *)(((XdmfAggregate *)(aggregate))->getArray(index).get()));
}
XDMFARRAY *
XdmfAggregateGetArrayByName(XDMFAGGREGATE * aggregate, char * name)
{
shared_ptr<XdmfAggregate> & refAggregate = *(shared_ptr<XdmfAggregate> *)(aggregate);
shared_ptr<XdmfArray> * p = new shared_ptr<XdmfArray>(refAggregate->getArray(name));
return (XDMFARRAY *) p;
return (XDMFARRAY *)((void *)(((XdmfAggregate *)(aggregate))->getArray(name).get()));
}
unsigned int
XdmfAggregateGetNumberArrays(XDMFAGGREGATE * aggregate)
{
shared_ptr<XdmfAggregate> & refAggregate = *(shared_ptr<XdmfAggregate> *)(aggregate);
return refAggregate->getNumberArrays();
return ((XdmfAggregate *)(aggregate))->getNumberArrays();
}
void
XdmfAggregateInsertArray(XDMFAGGREGATE * aggregate, XDMFARRAY * array, int transferOwnership)
{
shared_ptr<XdmfAggregate> & refAggregate = *(shared_ptr<XdmfAggregate> *)(aggregate);
shared_ptr<XdmfArray> & refArray = *(shared_ptr<XdmfArray> *)(array);
refAggregate->insert(refArray);
if (transferOwnership) {
((XdmfAggregate *)(aggregate))->insert(shared_ptr<XdmfArray>((XdmfArray *)array));
}
else {
((XdmfAggregate *)(aggregate))->insert(shared_ptr<XdmfArray>((XdmfArray *)array, XdmfNullDeleter()));
}
}
void
XdmfAggregateRemoveArray(XDMFAGGREGATE * aggregate, unsigned int index)
{
shared_ptr<XdmfAggregate> & refAggregate = *(shared_ptr<XdmfAggregate> *)(aggregate);
refAggregate->removeArray(index);
((XdmfAggregate *)(aggregate))->removeArray(index);
}
void
XdmfAggregateRemoveArrayByName(XDMFAGGREGATE * aggregate, char * name)
{
shared_ptr<XdmfAggregate> & refAggregate = *(shared_ptr<XdmfAggregate> *)(aggregate);
refAggregate->removeArray(name);
((XdmfAggregate *)(aggregate))->removeArray(name);
}
// C Wrappers for parent classes are generated by macros
......
......@@ -159,6 +159,8 @@ public:
void traverse(const shared_ptr<XdmfBaseVisitor> visitor);
XdmfAggregate(XdmfAggregate&);
protected:
XdmfAggregate();
......
......@@ -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()
{
}
......@@ -252,27 +264,33 @@ XdmfAttribute::setElementCell(std::string cell)
//-----------------------------------------------------------------------------
XDMFATTRIBUTE * XdmfAttributeNew()
{
shared_ptr<XdmfAttribute> * p = new shared_ptr<XdmfAttribute>(XdmfAttribute::New());
return (XDMFATTRIBUTE *) p;
try
{
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)
{
shared_ptr<XdmfAttribute> & refAttribute = *(shared_ptr<XdmfAttribute> *)(attribute);
const shared_ptr<const XdmfAttributeCenter> attributeCenter = refAttribute->getCenter();
if (attributeCenter == XdmfAttributeCenter::Grid()) {
if (((XdmfAttribute *)attribute)->getCenter() == XdmfAttributeCenter::Grid()) {
return XDMF_ATTRIBUTE_CENTER_GRID;
}
else if (attributeCenter == XdmfAttributeCenter::Cell()) {
else if (((XdmfAttribute *)attribute)->getCenter() == XdmfAttributeCenter::Cell()) {
return XDMF_ATTRIBUTE_CENTER_CELL;
}
else if (attributeCenter == XdmfAttributeCenter::Face()) {
else if (((XdmfAttribute *)attribute)->getCenter() == XdmfAttributeCenter::Face()) {
return XDMF_ATTRIBUTE_CENTER_FACE;
}
else if (attributeCenter == XdmfAttributeCenter::Edge()) {
else if (((XdmfAttribute *)attribute)->getCenter() == XdmfAttributeCenter::Edge()) {
return XDMF_ATTRIBUTE_CENTER_EDGE;
}
else if (attributeCenter == XdmfAttributeCenter::Node()) {
else if (((XdmfAttribute *)attribute)->getCenter() == XdmfAttributeCenter::Node()) {
return XDMF_ATTRIBUTE_CENTER_NODE;
}
else if (((XdmfAttribute *)attribute)->getCenter() ==
......@@ -286,27 +304,25 @@ int XdmfAttributeGetCenter(XDMFATTRIBUTE * attribute)
//-----------------------------------------------------------------------------
int XdmfAttributeGetType(XDMFATTRIBUTE * attribute)
{
shared_ptr<XdmfAttribute> & refAttribute = *(shared_ptr<XdmfAttribute> *)(attribute);
const shared_ptr<const XdmfAttributeType> attributeType = refAttribute->getType();
if (attributeType == XdmfAttributeType::Scalar()) {
if (((XdmfAttribute *)attribute)->getType() == XdmfAttributeType::Scalar()) {
return XDMF_ATTRIBUTE_TYPE_SCALAR;
}
else if (attributeType == XdmfAttributeType::Vector()) {
else if (((XdmfAttribute *)attribute)->getType() == XdmfAttributeType::Vector()) {
return XDMF_ATTRIBUTE_TYPE_VECTOR;
}
else if (attributeType == XdmfAttributeType::Tensor()) {
else if (((XdmfAttribute *)attribute)->getType() == XdmfAttributeType::Tensor()) {
return XDMF_ATTRIBUTE_TYPE_TENSOR;
}
else if (attributeType == XdmfAttributeType::Matrix()) {
else if (((XdmfAttribute *)attribute)->getType() == XdmfAttributeType::Matrix()) {
return XDMF_ATTRIBUTE_TYPE_MATRIX;
}
else if (attributeType == XdmfAttributeType::Tensor6()) {
else if (((XdmfAttribute *)attribute)->getType() == XdmfAttributeType::Tensor6()) {
return XDMF_ATTRIBUTE_TYPE_TENSOR6;
}
else if (attributeType == XdmfAttributeType::GlobalId()) {
else if (((XdmfAttribute *)attribute)->getType() == XdmfAttributeType::GlobalId()) {
return XDMF_ATTRIBUTE_TYPE_GLOBALID;
}
else if (attributeType == XdmfAttributeType::NoAttributeType()) {
else if (((XdmfAttribute *)attribute)->getType() == XdmfAttributeType::NoAttributeType()) {
return XDMF_ATTRIBUTE_TYPE_NOTYPE;
}
else {
......@@ -317,27 +333,26 @@ int XdmfAttributeGetType(XDMFATTRIBUTE * attribute)
void XdmfAttributeSetCenter(XDMFATTRIBUTE * attribute, int center, int * status)
{
XDMF_ERROR_WRAP_START(status)
shared_ptr<XdmfAttribute> & refAttribute = *(shared_ptr<XdmfAttribute> *)(attribute);
switch(center) {
case XDMF_ATTRIBUTE_CENTER_GRID:
refAttribute->setCenter(XdmfAttributeCenter::Grid());
break;
case XDMF_ATTRIBUTE_CENTER_CELL:
refAttribute->setCenter(XdmfAttributeCenter::Cell());
break;
case XDMF_ATTRIBUTE_CENTER_FACE:
refAttribute->setCenter(XdmfAttributeCenter::Face());
break;
case XDMF_ATTRIBUTE_CENTER_EDGE:
refAttribute->setCenter(XdmfAttributeCenter::Edge());
break;
case XDMF_ATTRIBUTE_CENTER_NODE:
refAttribute->setCenter(XdmfAttributeCenter::Node());
break;
default:
XdmfError::message(XdmfError::FATAL,
"Error: Invalid Attribute Center: Code " + center);
break;
case XDMF_ATTRIBUTE_CENTER_GRID:
((XdmfAttribute *)attribute)->setCenter(XdmfAttributeCenter::Grid());
break;
case XDMF_ATTRIBUTE_CENTER_CELL:
((XdmfAttribute *)attribute)->setCenter(XdmfAttributeCenter::Cell());
break;
case XDMF_ATTRIBUTE_CENTER_FACE:
((XdmfAttribute *)attribute)->setCenter(XdmfAttributeCenter::Face());
break;
case XDMF_ATTRIBUTE_CENTER_EDGE:
((XdmfAttribute *)attribute)->setCenter(XdmfAttributeCenter::Edge());
break;
case XDMF_ATTRIBUTE_CENTER_NODE:
((XdmfAttribute *)attribute)->setCenter(XdmfAttributeCenter::Node());
break;
default:
XdmfError::message(XdmfError::FATAL,
"Error: Invalid Attribute Center: Code " + center);
break;
}
XDMF_ERROR_WRAP_END(status)
}
......@@ -345,33 +360,32 @@ void XdmfAttributeSetCenter(XDMFATTRIBUTE * attribute, int center, int * status)
void XdmfAttributeSetType(XDMFATTRIBUTE * attribute, int type, int * status)
{
XDMF_ERROR_WRAP_START(status)
shared_ptr<XdmfAttribute> & refAttribute = *(shared_ptr<XdmfAttribute> *)(attribute);
switch(type) {
case XDMF_ATTRIBUTE_TYPE_SCALAR:
refAttribute->setType(XdmfAttributeType::Scalar());
break;
case XDMF_ATTRIBUTE_TYPE_VECTOR:
refAttribute->setType(XdmfAttributeType::Vector());
break;
case XDMF_ATTRIBUTE_TYPE_TENSOR:
refAttribute->setType(XdmfAttributeType::Tensor());
break;
case XDMF_ATTRIBUTE_TYPE_MATRIX:
refAttribute->setType(XdmfAttributeType::Matrix());
break;
case XDMF_ATTRIBUTE_TYPE_TENSOR6:
refAttribute->setType(XdmfAttributeType::Tensor6());
break;
case XDMF_ATTRIBUTE_TYPE_GLOBALID:
refAttribute->setType(XdmfAttributeType::GlobalId());
break;
case XDMF_ATTRIBUTE_TYPE_NOTYPE:
refAttribute->setType(XdmfAttributeType::NoAttributeType());
break;
default:
XdmfError::message(XdmfError::FATAL,
"Error: Invalid Attribute Type: Code " + type);
break;
case XDMF_ATTRIBUTE_TYPE_SCALAR:
((XdmfAttribute *)attribute)->setType(XdmfAttributeType::Scalar());
break;
case XDMF_ATTRIBUTE_TYPE_VECTOR:
((XdmfAttribute *)attribute)->setType(XdmfAttributeType::Vector());
break;
case XDMF_ATTRIBUTE_TYPE_TENSOR:
((XdmfAttribute *)attribute)->setType(XdmfAttributeType::Tensor());
break;
case XDMF_ATTRIBUTE_TYPE_MATRIX:
((XdmfAttribute *)attribute)->setType(XdmfAttributeType::Matrix());
break;
case XDMF_ATTRIBUTE_TYPE_TENSOR6:
((XdmfAttribute *)attribute)->setType(XdmfAttributeType::Tensor6());
break;
case XDMF_ATTRIBUTE_TYPE_GLOBALID:
((XdmfAttribute *)attribute)->setType(XdmfAttributeType::GlobalId());
break;
case XDMF_ATTRIBUTE_TYPE_NOTYPE:
((XdmfAttribute *)attribute)->setType(XdmfAttributeType::NoAttributeType());
break;
default:
XdmfError::message(XdmfError::FATAL,
"Error: Invalid Attribute Type: Code " + type);
break;
}
XDMF_ERROR_WRAP_END(status)
}
......
......@@ -301,6 +301,7 @@ public:
*/
void setElementCell(std::string cell);
XdmfAttribute(XdmfAttribute &);
void traverse(const shared_ptr<XdmfBaseVisitor> visitor);
......
......@@ -21,11 +21,9 @@
/* */
/*****************************************************************************/
#include <string.h>
#include <utility>
#include "XdmfAttributeCenter.hpp"
#include "XdmfError.hpp"
#include "XdmfStringUtils.hpp"
std::map<std::string, shared_ptr<const XdmfAttributeCenter>(*)()> XdmfAttributeCenter::mAttributeCenterDefinitions;
......@@ -110,7 +108,7 @@ XdmfAttributeCenter::New(const std::map<std::string, std::string> & itemProperti
"XdmfAttributeCenter::New");
}
const std::string centerVal = XdmfStringUtils::toUpper(center->second);
const std::string & centerVal = ConvertToUpper(center->second);
std::map<std::string, shared_ptr<const XdmfAttributeCenter>(*)()>::const_iterator returnType = mAttributeCenterDefinitions.find(centerVal);
......
......@@ -24,7 +24,6 @@
#include <utility>
#include "XdmfAttributeType.hpp"
#include "XdmfError.hpp"
#include "XdmfStringUtils.hpp"
std::map<std::string, shared_ptr<const XdmfAttributeType>(*)()> XdmfAttributeType::mAttributeDefinitions;
......@@ -121,7 +120,7 @@ XdmfAttributeType::New(const std::map<std::string, std::string> & itemProperties
}
const std::string & typeVal = XdmfStringUtils::toUpper(type->second);
const std::string & typeVal = ConvertToUpper(type->second);
std::map<std::string, shared_ptr<const XdmfAttributeType>(*)()>::const_iterator returnType = mAttributeDefinitions.find(typeVal);
......
......@@ -24,4 +24,9 @@
#ifndef XDMFCONFIG_HPP_
#define XDMFCONFIG_HPP_
#cmakedefine BUILD_SHARED
#ifndef BUILD_SHARED
# define XDMFSTATIC
#endif
#endif
......@@ -24,15 +24,15 @@
#include <cmath>
#include "XdmfArray.hpp"
#include "XdmfCurvilinearGrid.hpp"
#include "XdmfError.hpp"
#include "XdmfGeometry.hpp"
#include "XdmfTopology.hpp"
#include "XdmfTopologyType.hpp"
#include "XdmfError.hpp"
/**
* PIMPL
*/
class XdmfCurvilinearGrid::XdmfCurvilinearGridImpl {
class XdmfCurvilinearGrid::XdmfCurvilinearGridImpl : public XdmfGridImpl {
public:
......@@ -194,10 +194,15 @@ public:
XdmfCurvilinearGridImpl(const shared_ptr<XdmfArray> numPoints) :
mDimensions(numPoints)
{
mGridType ="Curvilinear";
}
shared_ptr<XdmfArray> mDimensions;
XdmfGridImpl * duplicate()
{
return new XdmfCurvilinearGridImpl(mDimensions);
}
shared_ptr<XdmfArray> mDimensions;
};
shared_ptr<XdmfCurvilinearGrid>
......@@ -235,9 +240,15 @@ XdmfCurvilinearGrid::New(const shared_ptr<XdmfArray> numPoints)
XdmfCurvilinearGrid::XdmfCurvilinearGrid(const shared_ptr<XdmfArray> numPoints) :
XdmfGrid(XdmfGeometry::New(),
XdmfCurvilinearGridImpl::XdmfTopologyCurvilinear::New(this)),
mImpl(new XdmfCurvilinearGridImpl(numPoints))
XdmfCurvilinearGridImpl::XdmfTopologyCurvilinear::New(this))
{
mImpl = new XdmfCurvilinearGridImpl(numPoints);
}
XdmfCurvilinearGrid::XdmfCurvilinearGrid(XdmfCurvilinearGrid & refGrid) :
XdmfGrid(refGrid)
{
mTopology = XdmfCurvilinearGridImpl::XdmfTopologyCurvilinear::New(this);
}
XdmfCurvilinearGrid::~XdmfCurvilinearGrid()
......@@ -254,8 +265,7 @@ void
XdmfCurvilinearGrid::copyGrid(shared_ptr<XdmfGrid> sourceGrid)
{
XdmfGrid::copyGrid(sourceGrid);
if (shared_ptr<XdmfCurvilinearGrid> classedGrid =
shared_dynamic_cast<XdmfCurvilinearGrid>(sourceGrid))
if (shared_ptr<XdmfCurvilinearGrid> classedGrid = shared_dynamic_cast<XdmfCurvilinearGrid>(sourceGrid))
{
// Copy stucture from read grid to this grid
this->setGeometry(classedGrid->getGeometry());
......@@ -266,20 +276,20 @@ XdmfCurvilinearGrid::copyGrid(shared_ptr<XdmfGrid> sourceGrid)
shared_ptr<XdmfArray>
XdmfCurvilinearGrid::getDimensions()
{
return const_pointer_cast<XdmfArray>
return boost::const_pointer_cast<XdmfArray>
(static_cast<const XdmfCurvilinearGrid &>(*this).getDimensions());
}
shared_ptr<const XdmfArray>
XdmfCurvilinearGrid::getDimensions() const
{
return mImpl->mDimensions;
return ((XdmfCurvilinearGridImpl *)mImpl)->mDimensions;
}
shared_ptr<XdmfGeometry>
XdmfCurvilinearGrid::getGeometry()
{
return const_pointer_cast<XdmfGeometry>
return boost::const_pointer_cast<XdmfGeometry>
(static_cast<const XdmfGrid &>(*this).getGeometry());
}
......@@ -306,16 +316,17 @@ XdmfCurvilinearGrid::read()
{
if (mGridController)
{
if (shared_ptr<XdmfCurvilinearGrid> grid =
shared_dynamic_cast<XdmfCurvilinearGrid>(mGridController->read())) {
if (shared_ptr<XdmfCurvilinearGrid> grid = shared_dynamic_cast<XdmfCurvilinearGrid>(mGridController->read()))
{
// Copy stucture from read grid to this grid
copyGrid(grid);
}
else if (shared_ptr<XdmfGrid> grid =
shared_dynamic_cast<XdmfGrid>(mGridController->read())) {
else if (shared_ptr<XdmfGrid> grid = shared_dynamic_cast<XdmfGrid>(mGridController->read()))
{
XdmfError::message(XdmfError::FATAL, "Error: Grid Type Mismatch");
}
else {
else
{
XdmfError::message(XdmfError::FATAL, "Error: Invalid Grid Reference");
}
}
......@@ -332,7 +343,7 @@ XdmfCurvilinearGrid::release()
void
XdmfCurvilinearGrid::setDimensions(const shared_ptr<XdmfArray> dimensions)
{
mImpl->mDimensions = dimensions;
((XdmfCurvilinearGridImpl *)mImpl)->mDimensions = dimensions;
this->setIsChanged(true);
}
......@@ -348,30 +359,49 @@ XdmfCurvilinearGrid::setGeometry(const shared_ptr<XdmfGeometry> geometry)
XDMFCURVILINEARGRID * XdmfCurvilinearGridNew2D(unsigned int xNumPoints,
unsigned int yNumPoints)
{
shared_ptr<XdmfCurvilinearGrid> * p =
new shared_ptr<XdmfCurvilinearGrid>(XdmfCurvilinearGrid::New(xNumPoints,
yNumPoints));
return (XDMFCURVILINEARGRID *) p;
try