Commit 0f652507 authored by David E. DeMarle's avatar David E. DeMarle

Merge branch 'noboost2' into 'master'

Noboost2

See merge request !44
parents 605db515 c1f1b831
......@@ -84,8 +84,7 @@ MACRO(ADD_TEST_C executable)
ADD_TEST(C${is_core}_${executable}${dup} ${CMAKE_COMMAND}
-D "EXECUTABLE=${executable}${dup}"
-D "ARGUMENTS=${arguments}"
-D "LDPATH=${c_ldpath}"
-D "PATH=${c_path}"
-D "PATH=${c_path}"
-D "SEPARATOR=${sep}"
-P "${c_binary_dir}/TestDriverC.cmake"
)
......
......@@ -87,8 +87,7 @@ 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 "LDPATH=${cxx_ldpath}"
-D "ARGUMENTS=${arguments}"
-D "PATH=${cxx_path}"
-D "SEPARATOR=${sep}"
-P "${cxx_binary_dir}/TestDriverCxx.cmake"
......
......@@ -121,7 +121,6 @@ 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 2.8.5)
cmake_minimum_required(VERSION 3.1)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
#Needed to build DSM because relative paths are used to add its libraries
if (POLICY CMP0015)
......
......@@ -137,9 +137,11 @@
# 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
......@@ -159,6 +161,12 @@
# define XDMF_EXPORT __declspec(dllimport)
# define XDMF_TEMPLATE extern
# endif /* XDMF_EXPORTS */
# undef XDMFUTILS_EXPORT
# define XDMFUTILS_EXPORT __declspec(dllimport)
# undef XDMFUTILS_TEMPLATE
# define XDMFUTILS_TEMPLATE extern
#endif
/* Compiler Warnings */
......@@ -178,8 +186,10 @@
#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_boost__shared_ptrT_XdmfAttribute_t, SWIG_POINTER_OWN);
result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfAttribute>(attribute)), SWIGTYPE_p_std__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_boost__shared_ptrT_XdmfCurvilinearGrid_t, SWIG_POINTER_OWN);
result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfCurvilinearGrid>(gridCurvilinear)), SWIGTYPE_p_std__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_boost__shared_ptrT_XdmfGridCollection_t, SWIG_POINTER_OWN);
result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfGridCollection>(gridCollection)), SWIGTYPE_p_std__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_boost__shared_ptrT_XdmfDomain_t, SWIG_POINTER_OWN);
result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfDomain>(domain)), SWIGTYPE_p_std__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_boost__shared_ptrT_XdmfGeometry_t, SWIG_POINTER_OWN);
result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfGeometry>(geometry)), SWIGTYPE_p_std__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_boost__shared_ptrT_XdmfGraph_t, SWIG_POINTER_OWN);
result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfGraph>(graph)), SWIGTYPE_p_std__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_boost__shared_ptrT_XdmfInformation_t, SWIG_POINTER_OWN);
result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfInformation>(information)), SWIGTYPE_p_std__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_boost__shared_ptrT_XdmfMap_t, SWIG_POINTER_OWN);
result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfMap>(map)), SWIGTYPE_p_std__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_boost__shared_ptrT_XdmfRectilinearGrid_t, SWIG_POINTER_OWN);
result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfRectilinearGrid>(gridRectilinear)), SWIGTYPE_p_std__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_boost__shared_ptrT_XdmfRegularGrid_t, SWIG_POINTER_OWN);
result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfRegularGrid>(gridRegular)), SWIGTYPE_p_std__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_boost__shared_ptrT_XdmfSet_t, SWIG_POINTER_OWN);
result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfSet>(set)), SWIGTYPE_p_std__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_boost__shared_ptrT_XdmfTime_t, SWIG_POINTER_OWN);
result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfTime>(time)), SWIGTYPE_p_std__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_boost__shared_ptrT_XdmfTopology_t, SWIG_POINTER_OWN);
result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfTopology>(topology)), SWIGTYPE_p_std__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_boost__shared_ptrT_XdmfUnstructuredGrid_t, SWIG_POINTER_OWN);
result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfUnstructuredGrid>(gridUnstructured)), SWIGTYPE_p_std__shared_ptrT_XdmfUnstructuredGrid_t, SWIG_POINTER_OWN);
}
else {
result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfItem>(obj)), SWIGTYPE_p_boost__shared_ptrT_XdmfItem_t, SWIG_POINTER_OWN);
result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfItem>(obj)), SWIGTYPE_p_std__shared_ptrT_XdmfItem_t, SWIG_POINTER_OWN);
}
return result;
}
......
......@@ -23,7 +23,6 @@
#include <numeric>
#include <functional>
#include <boost/tokenizer.hpp>
#include "XdmfArray.hpp"
#include "XdmfError.hpp"
#include "XdmfAggregate.hpp"
......@@ -37,11 +36,6 @@ XdmfAggregate::XdmfAggregate()
{
}
XdmfAggregate::XdmfAggregate(XdmfAggregate & refAggregate) :
XdmfArrayReference(refAggregate)
{
}
XdmfAggregate::~XdmfAggregate()
{
}
......@@ -213,57 +207,53 @@ XdmfAggregate::traverse(const shared_ptr<XdmfBaseVisitor> visitor)
XDMFAGGREGATE * XdmfAggregateNew()
{
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())));
}
shared_ptr<XdmfAggregate> * p = new shared_ptr<XdmfAggregate>(XdmfAggregate::New());
return (XDMFAGGREGATE *) p;
}
XDMFARRAY *
XdmfAggregateGetArray(XDMFAGGREGATE * aggregate, unsigned int index)
{
return (XDMFARRAY *)((void *)(((XdmfAggregate *)(aggregate))->getArray(index).get()));
shared_ptr<XdmfAggregate> & refAggregate = *(shared_ptr<XdmfAggregate> *)(aggregate);
shared_ptr<XdmfArray> * p = new shared_ptr<XdmfArray>(refAggregate->getArray(index));
return (XDMFARRAY *) p;
}
XDMFARRAY *
XdmfAggregateGetArrayByName(XDMFAGGREGATE * aggregate, char * name)
{
return (XDMFARRAY *)((void *)(((XdmfAggregate *)(aggregate))->getArray(name).get()));
shared_ptr<XdmfAggregate> & refAggregate = *(shared_ptr<XdmfAggregate> *)(aggregate);
shared_ptr<XdmfArray> * p = new shared_ptr<XdmfArray>(refAggregate->getArray(name));
return (XDMFARRAY *) p;
}
unsigned int
XdmfAggregateGetNumberArrays(XDMFAGGREGATE * aggregate)
{
return ((XdmfAggregate *)(aggregate))->getNumberArrays();
shared_ptr<XdmfAggregate> & refAggregate = *(shared_ptr<XdmfAggregate> *)(aggregate);
return refAggregate->getNumberArrays();
}
void
XdmfAggregateInsertArray(XDMFAGGREGATE * aggregate, XDMFARRAY * array, int transferOwnership)
{
if (transferOwnership) {
((XdmfAggregate *)(aggregate))->insert(shared_ptr<XdmfArray>((XdmfArray *)array));
}
else {
((XdmfAggregate *)(aggregate))->insert(shared_ptr<XdmfArray>((XdmfArray *)array, XdmfNullDeleter()));
}
shared_ptr<XdmfAggregate> & refAggregate = *(shared_ptr<XdmfAggregate> *)(aggregate);
shared_ptr<XdmfArray> & refArray = *(shared_ptr<XdmfArray> *)(array);
refAggregate->insert(refArray);
}
void
XdmfAggregateRemoveArray(XDMFAGGREGATE * aggregate, unsigned int index)
{
((XdmfAggregate *)(aggregate))->removeArray(index);
shared_ptr<XdmfAggregate> & refAggregate = *(shared_ptr<XdmfAggregate> *)(aggregate);
refAggregate->removeArray(index);
}
void
XdmfAggregateRemoveArrayByName(XDMFAGGREGATE * aggregate, char * name)
{
((XdmfAggregate *)(aggregate))->removeArray(name);
shared_ptr<XdmfAggregate> & refAggregate = *(shared_ptr<XdmfAggregate> *)(aggregate);
refAggregate->removeArray(name);
}
// C Wrappers for parent classes are generated by macros
......
......@@ -159,8 +159,6 @@ public:
void traverse(const shared_ptr<XdmfBaseVisitor> visitor);
XdmfAggregate(XdmfAggregate&);
protected:
XdmfAggregate();
......
......@@ -48,6 +48,7 @@ XdmfAttribute::XdmfAttribute() :
mElementCell("")
{
}
/*
//-----------------------------------------------------------------------------
XdmfAttribute::XdmfAttribute(XdmfAttribute & refAttribute) :
XdmfArray(refAttribute),
......@@ -60,7 +61,9 @@ XdmfAttribute::XdmfAttribute(XdmfAttribute & refAttribute) :
mElementCell(refAttribute.mElementCell)
{
}
*/
//-----------------------------------------------------------------------------
XdmfAttribute::~XdmfAttribute()
{
}
......@@ -264,33 +267,27 @@ XdmfAttribute::setElementCell(std::string cell)
//-----------------------------------------------------------------------------
XDMFATTRIBUTE * XdmfAttributeNew()
{
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())));
}
shared_ptr<XdmfAttribute> * p = new shared_ptr<XdmfAttribute>(XdmfAttribute::New());
return (XDMFATTRIBUTE *) p;
}
//-----------------------------------------------------------------------------
int XdmfAttributeGetCenter(XDMFATTRIBUTE * attribute)
{
if (((XdmfAttribute *)attribute)->getCenter() == XdmfAttributeCenter::Grid()) {
shared_ptr<XdmfAttribute> & refAttribute = *(shared_ptr<XdmfAttribute> *)(attribute);
const shared_ptr<const XdmfAttributeCenter> attributeCenter = refAttribute->getCenter();
if (attributeCenter == XdmfAttributeCenter::Grid()) {
return XDMF_ATTRIBUTE_CENTER_GRID;
}
else if (((XdmfAttribute *)attribute)->getCenter() == XdmfAttributeCenter::Cell()) {
else if (attributeCenter == XdmfAttributeCenter::Cell()) {
return XDMF_ATTRIBUTE_CENTER_CELL;
}
else if (((XdmfAttribute *)attribute)->getCenter() == XdmfAttributeCenter::Face()) {
else if (attributeCenter == XdmfAttributeCenter::Face()) {
return XDMF_ATTRIBUTE_CENTER_FACE;
}
else if (((XdmfAttribute *)attribute)->getCenter() == XdmfAttributeCenter::Edge()) {
else if (attributeCenter == XdmfAttributeCenter::Edge()) {
return XDMF_ATTRIBUTE_CENTER_EDGE;
}
else if (((XdmfAttribute *)attribute)->getCenter() == XdmfAttributeCenter::Node()) {
else if (attributeCenter == XdmfAttributeCenter::Node()) {
return XDMF_ATTRIBUTE_CENTER_NODE;
}
else if (((XdmfAttribute *)attribute)->getCenter() ==
......@@ -304,25 +301,27 @@ int XdmfAttributeGetCenter(XDMFATTRIBUTE * attribute)
//-----------------------------------------------------------------------------
int XdmfAttributeGetType(XDMFATTRIBUTE * attribute)
{
if (((XdmfAttribute *)attribute)->getType() == XdmfAttributeType::Scalar()) {
shared_ptr<XdmfAttribute> & refAttribute = *(shared_ptr<XdmfAttribute> *)(attribute);
const shared_ptr<const XdmfAttributeType> attributeType = refAttribute->getType();
if (attributeType == XdmfAttributeType::Scalar()) {
return XDMF_ATTRIBUTE_TYPE_SCALAR;
}
else if (((XdmfAttribute *)attribute)->getType() == XdmfAttributeType::Vector()) {
else if (attributeType == XdmfAttributeType::Vector()) {
return XDMF_ATTRIBUTE_TYPE_VECTOR;
}
else if (((XdmfAttribute *)attribute)->getType() == XdmfAttributeType::Tensor()) {
else if (attributeType == XdmfAttributeType::Tensor()) {
return XDMF_ATTRIBUTE_TYPE_TENSOR;
}
else if (((XdmfAttribute *)attribute)->getType() == XdmfAttributeType::Matrix()) {
else if (attributeType == XdmfAttributeType::Matrix()) {
return XDMF_ATTRIBUTE_TYPE_MATRIX;
}
else if (((XdmfAttribute *)attribute)->getType() == XdmfAttributeType::Tensor6()) {
else if (attributeType == XdmfAttributeType::Tensor6()) {
return XDMF_ATTRIBUTE_TYPE_TENSOR6;
}
else if (((XdmfAttribute *)attribute)->getType() == XdmfAttributeType::GlobalId()) {
else if (attributeType == XdmfAttributeType::GlobalId()) {
return XDMF_ATTRIBUTE_TYPE_GLOBALID;
}
else if (((XdmfAttribute *)attribute)->getType() == XdmfAttributeType::NoAttributeType()) {
else if (attributeType == XdmfAttributeType::NoAttributeType()) {
return XDMF_ATTRIBUTE_TYPE_NOTYPE;
}
else {
......@@ -333,26 +332,27 @@ 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:
((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;
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;
}
XDMF_ERROR_WRAP_END(status)
}
......@@ -360,32 +360,33 @@ 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:
((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;
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;
}
XDMF_ERROR_WRAP_END(status)
}
......
......@@ -301,10 +301,11 @@ public:
*/
void setElementCell(std::string cell);
XdmfAttribute(XdmfAttribute &);
void traverse(const shared_ptr<XdmfBaseVisitor> visitor);
// XdmfAttribute(XdmfAttribute &);
protected:
XdmfAttribute();
......
......@@ -21,9 +21,11 @@
/* */
/*****************************************************************************/
#include <string.h>
#include <utility>
#include "XdmfAttributeCenter.hpp"
#include "XdmfError.hpp"
#include "XdmfStringUtils.hpp"
std::map<std::string, shared_ptr<const XdmfAttributeCenter>(*)()> XdmfAttributeCenter::mAttributeCenterDefinitions;
......@@ -108,7 +110,7 @@ XdmfAttributeCenter::New(const std::map<std::string, std::string> & itemProperti
"XdmfAttributeCenter::New");
}
const std::string & centerVal = ConvertToUpper(center->second);
const std::string centerVal = XdmfStringUtils::toUpper(center->second);
std::map<std::string, shared_ptr<const XdmfAttributeCenter>(*)()>::const_iterator returnType = mAttributeCenterDefinitions.find(centerVal);
......
......@@ -24,6 +24,7 @@
#include <utility>
#include "XdmfAttributeType.hpp"
#include "XdmfError.hpp"
#include "XdmfStringUtils.hpp"
std::map<std::string, shared_ptr<const XdmfAttributeType>(*)()> XdmfAttributeType::mAttributeDefinitions;
......@@ -120,7 +121,7 @@ XdmfAttributeType::New(const std::map<std::string, std::string> & itemProperties
}
const std::string & typeVal = ConvertToUpper(type->second);
const std::string & typeVal = XdmfStringUtils::toUpper(type->second);
std::map<std::string, shared_ptr<const XdmfAttributeType>(*)()>::const_iterator returnType = mAttributeDefinitions.find(typeVal);
......
......@@ -24,9 +24,4 @@
#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 : public XdmfGridImpl {
class XdmfCurvilinearGrid::XdmfCurvilinearGridImpl {
public:
......@@ -194,15 +194,10 @@ public:
XdmfCurvilinearGridImpl(const shared_ptr<XdmfArray> numPoints) :
mDimensions(numPoints)
{
mGridType ="Curvilinear";
}
XdmfGridImpl * duplicate()
{
return new XdmfCurvilinearGridImpl(mDimensions);
}
shared_ptr<XdmfArray> mDimensions;
};
shared_ptr<XdmfCurvilinearGrid>
......@@ -240,15 +235,9 @@ 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);
}
XdmfCurvilinearGrid::XdmfCurvilinearGrid(XdmfCurvilinearGrid & refGrid) :
XdmfGrid(refGrid)
XdmfCurvilinearGridImpl::XdmfTopologyCurvilinear::New(this)),
mImpl(new XdmfCurvilinearGridImpl(numPoints))
{
mTopology = XdmfCurvilinearGridImpl::XdmfTopologyCurvilinear::New(this);
}
XdmfCurvilinearGrid::~XdmfCurvilinearGrid()
......@@ -265,7 +254,8 @@ 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());
......@@ -276,20 +266,20 @@ 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());
}
shared_ptr<const XdmfArray>
XdmfCurvilinearGrid::getDimensions() const
{
return ((XdmfCurvilinearGridImpl *)mImpl)->mDimensions;
return mImpl->mDimensions;
}
shared_ptr<XdmfGeometry>
XdmfCurvilinearGrid::getGeometry()
{
return boost::const_pointer_cast<XdmfGeometry>
return const_pointer_cast<XdmfGeometry>
(static_cast<const XdmfGrid &>(*this).getGeometry());
}
......@@ -316,17 +306,16 @@ 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");
}
}
......@@ -343,7 +332,7 @@ XdmfCurvilinearGrid::release()
void
XdmfCurvilinearGrid::setDimensions(const shared_ptr<XdmfArray> dimensions)
{
((XdmfCurvilinearGridImpl *)mImpl)->mDimensions = dimensions;
mImpl->mDimensions = dimensions;
this->setIsChanged(true);
}
......@@ -359,49 +348,30 @@ XdmfCurvilinearGrid::setGeometry(const shared_ptr<XdmfGeometry> geometry)
XDMFCURVILINEARGRID * XdmfCurvilinearGridNew2D(unsigned int xNumPoints,
unsigned int yNumPoints)
{
try
{
shared_ptr<XdmfCurvilinearGrid> generatedGrid = XdmfCurvilinearGrid::New(xNumPoints, yNumPoints);
return (XDMFCURVILINEARGRID *)((void *)((XdmfItem *)(new XdmfCurvilinearGrid(*generatedGrid.get()))));
}
catch (...)
{
shared_ptr<XdmfCurvilinearGrid> generatedGrid = XdmfCurvilinearGrid::New(xNumPoints, yNumPoints);
return (XDMFCURVILINEARGRID *)((void *)((XdmfItem *)(new XdmfCurvilinearGrid(*generatedGrid.get()))));
}
shared_ptr<XdmfCurvilinearGrid> * p =
new shared_ptr<XdmfCurvilinearGrid>(XdmfCurvilinearGrid::New(xNumPoints,
yNumPoints));
return (XDMFCURVILINEARGRID *) p;
}
XDMFCURVILINEARGRID * XdmfCurvilinearGridNew3D(unsigned int xNumPoints,
unsigned int yNumPoints,
unsigned int zNumPoints)
{
try
{