Commit 5aa71a64 authored by Kenneth Leiter's avatar Kenneth Leiter

ENH: Hide use of boost::shared_ptr and boost::shared_dynamic_cast.

Using statements have been added to XdmfSharedPtr.hpp. All used of
boost::shared_ptr and boost::shared_dynamic_cast have been replaced
by shared_ptr and shared_dynamic_cast. Slight modification to XdmfCore.i
to get swig wrapping working again.
parent 518b5838
......@@ -58,45 +58,45 @@ swig -v -c++ -python -o XdmfPython.cpp Xdmf.i
// Typemaps that work for Java
%typemap(out) boost::shared_ptr<XdmfItem> {
if(boost::shared_ptr<XdmfAttribute> value = boost::shared_dynamic_cast<XdmfAttribute>($1)) {
*(boost::shared_ptr< XdmfAttribute > **)&($result) = value ? new boost::shared_ptr< XdmfAttribute >(value) : 0;
%typemap(out) shared_ptr<XdmfItem> {
if(shared_ptr<XdmfAttribute> value = shared_dynamic_cast<XdmfAttribute>($1)) {
*(shared_ptr< XdmfAttribute > **)&($result) = value ? new shared_ptr< XdmfAttribute >(value) : 0;
}
else if(boost::shared_ptr<XdmfCurvilinearGrid> value = boost::shared_dynamic_cast<XdmfCurvilinearGrid>($1)) {
*(boost::shared_ptr< XdmfCurvilinearGrid > **)&($result) = value ? new boost::shared_ptr< XdmfCurvilinearGrid >(value) : 0;
else if(shared_ptr<XdmfCurvilinearGrid> value = shared_dynamic_cast<XdmfCurvilinearGrid>($1)) {
*(shared_ptr< XdmfCurvilinearGrid > **)&($result) = value ? new shared_ptr< XdmfCurvilinearGrid >(value) : 0;
}
else if(boost::shared_ptr<XdmfDomain> value = boost::shared_dynamic_cast<XdmfDomain>($1)) {
*(boost::shared_ptr< XdmfDomain > **)&($result) = value ? new boost::shared_ptr< XdmfDomain >(value) : 0;
else if(shared_ptr<XdmfDomain> value = shared_dynamic_cast<XdmfDomain>($1)) {
*(shared_ptr< XdmfDomain > **)&($result) = value ? new shared_ptr< XdmfDomain >(value) : 0;
}
else if(boost::shared_ptr<XdmfGeometry> value = boost::shared_dynamic_cast<XdmfGeometry>($1)) {
*(boost::shared_ptr< XdmfGeometry > **)&($result) = value ? new boost::shared_ptr< XdmfGeometry >(value) : 0;
else if(shared_ptr<XdmfGeometry> value = shared_dynamic_cast<XdmfGeometry>($1)) {
*(shared_ptr< XdmfGeometry > **)&($result) = value ? new shared_ptr< XdmfGeometry >(value) : 0;
}
else if(boost::shared_ptr<XdmfGridCollection> value = boost::shared_dynamic_cast<XdmfGridCollection>($1)) {
*(boost::shared_ptr< XdmfGridCollection > **)&($result) = value ? new boost::shared_ptr< XdmfGridCollection >(value) : 0;
else if(shared_ptr<XdmfGridCollection> value = shared_dynamic_cast<XdmfGridCollection>($1)) {
*(shared_ptr< XdmfGridCollection > **)&($result) = value ? new shared_ptr< XdmfGridCollection >(value) : 0;
}
else if(boost::shared_ptr<XdmfInformation> value = boost::shared_dynamic_cast<XdmfInformation>($1)) {
*(boost::shared_ptr< XdmfInformation > **)&($result) = value ? new boost::shared_ptr< XdmfInformation >(value) : 0;
else if(shared_ptr<XdmfInformation> value = shared_dynamic_cast<XdmfInformation>($1)) {
*(shared_ptr< XdmfInformation > **)&($result) = value ? new shared_ptr< XdmfInformation >(value) : 0;
}
else if(boost::shared_ptr<XdmfRectilinearGrid> value = boost::shared_dynamic_cast<XdmfRectilinearGrid>($1)) {
*(boost::shared_ptr< XdmfRectilinearGrid > **)&($result) = value ? new boost::shared_ptr< XdmfRectilinearGrid >(value) : 0;
else if(shared_ptr<XdmfRectilinearGrid> value = shared_dynamic_cast<XdmfRectilinearGrid>($1)) {
*(shared_ptr< XdmfRectilinearGrid > **)&($result) = value ? new shared_ptr< XdmfRectilinearGrid >(value) : 0;
}
else if(boost::shared_ptr<XdmfRegularGrid> value = boost::shared_dynamic_cast<XdmfRegularGrid>($1)) {
*(boost::shared_ptr< XdmfRegularGrid > **)&($result) = value ? new boost::shared_ptr< XdmfRegularGrid >(value) : 0;
else if(shared_ptr<XdmfRegularGrid> value = shared_dynamic_cast<XdmfRegularGrid>($1)) {
*(shared_ptr< XdmfRegularGrid > **)&($result) = value ? new shared_ptr< XdmfRegularGrid >(value) : 0;
}
else if(boost::shared_ptr<XdmfSet> value = boost::shared_dynamic_cast<XdmfSet>($1)) {
*(boost::shared_ptr< XdmfSet > **)&($result) = value ? new boost::shared_ptr< XdmfSet >(value) : 0;
else if(shared_ptr<XdmfSet> value = shared_dynamic_cast<XdmfSet>($1)) {
*(shared_ptr< XdmfSet > **)&($result) = value ? new shared_ptr< XdmfSet >(value) : 0;
}
else if(boost::shared_ptr<XdmfTime> value = boost::shared_dynamic_cast<XdmfTime>($1)) {
*(boost::shared_ptr< XdmfTime > **)&($result) = value ? new boost::shared_ptr< XdmfTime >(value) : 0;
else if(shared_ptr<XdmfTime> value = shared_dynamic_cast<XdmfTime>($1)) {
*(shared_ptr< XdmfTime > **)&($result) = value ? new shared_ptr< XdmfTime >(value) : 0;
}
else if(boost::shared_ptr<XdmfTopology> value = boost::shared_dynamic_cast<XdmfTopology>($1)) {
*(boost::shared_ptr< XdmfTopology > **)&($result) = value ? new boost::shared_ptr< XdmfTopology >(value) : 0;
else if(shared_ptr<XdmfTopology> value = shared_dynamic_cast<XdmfTopology>($1)) {
*(shared_ptr< XdmfTopology > **)&($result) = value ? new shared_ptr< XdmfTopology >(value) : 0;
}
else if(boost::shared_ptr<XdmfUnstructuredGrid> value = boost::shared_dynamic_cast<XdmfUnstructuredGrid>($1)) {
*(boost::shared_ptr< XdmfUnstructuredGrid > **)&($result) = value ? new boost::shared_ptr< XdmfUnstructuredGrid >(value) : 0;
else if(shared_ptr<XdmfUnstructuredGrid> value = shared_dynamic_cast<XdmfUnstructuredGrid>($1)) {
*(shared_ptr< XdmfUnstructuredGrid > **)&($result) = value ? new shared_ptr< XdmfUnstructuredGrid >(value) : 0;
}
else {
*(boost::shared_ptr< XdmfItem > **)&($result) = &($1);
*(shared_ptr< XdmfItem > **)&($result) = &($1);
}
}
......@@ -171,48 +171,48 @@ swig -v -c++ -python -o XdmfPython.cpp Xdmf.i
from XdmfCore import *
}
%typemap(out) boost::shared_ptr<XdmfItem> {
if(boost::shared_ptr<XdmfAttribute> attribute = boost::shared_dynamic_cast<XdmfAttribute>($1)) {
$result = SWIG_NewPointerObj(SWIG_as_voidptr(new boost::shared_ptr<XdmfAttribute>(attribute)), SWIGTYPE_p_boost__shared_ptrT_XdmfAttribute_t, SWIG_POINTER_OWN);
%typemap(out) shared_ptr<XdmfItem> {
if(shared_ptr<XdmfAttribute> attribute = shared_dynamic_cast<XdmfAttribute>($1)) {
$result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfAttribute>(attribute)), SWIGTYPE_p_boost__shared_ptrT_XdmfAttribute_t, SWIG_POINTER_OWN);
}
else if(boost::shared_ptr<XdmfCurvilinearGrid> gridCurvilinear = boost::shared_dynamic_cast<XdmfCurvilinearGrid>($1)) {
$result = SWIG_NewPointerObj(SWIG_as_voidptr(new boost::shared_ptr<XdmfCurvilinearGrid>(gridCurvilinear)), SWIGTYPE_p_boost__shared_ptrT_XdmfCurvilinearGrid_t, SWIG_POINTER_OWN);
else if(shared_ptr<XdmfCurvilinearGrid> gridCurvilinear = shared_dynamic_cast<XdmfCurvilinearGrid>($1)) {
$result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfCurvilinearGrid>(gridCurvilinear)), SWIGTYPE_p_boost__shared_ptrT_XdmfCurvilinearGrid_t, SWIG_POINTER_OWN);
}
else if(boost::shared_ptr<XdmfDomain> domain = boost::shared_dynamic_cast<XdmfDomain>($1)) {
$result = SWIG_NewPointerObj(SWIG_as_voidptr(new boost::shared_ptr<XdmfDomain>(domain)), SWIGTYPE_p_boost__shared_ptrT_XdmfDomain_t, SWIG_POINTER_OWN);
else if(shared_ptr<XdmfDomain> domain = shared_dynamic_cast<XdmfDomain>($1)) {
$result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfDomain>(domain)), SWIGTYPE_p_boost__shared_ptrT_XdmfDomain_t, SWIG_POINTER_OWN);
}
else if(boost::shared_ptr<XdmfGeometry> geometry = boost::shared_dynamic_cast<XdmfGeometry>($1)) {
$result = SWIG_NewPointerObj(SWIG_as_voidptr(new boost::shared_ptr<XdmfGeometry>(geometry)), SWIGTYPE_p_boost__shared_ptrT_XdmfGeometry_t, SWIG_POINTER_OWN);
else if(shared_ptr<XdmfGeometry> geometry = shared_dynamic_cast<XdmfGeometry>($1)) {
$result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfGeometry>(geometry)), SWIGTYPE_p_boost__shared_ptrT_XdmfGeometry_t, SWIG_POINTER_OWN);
}
else if(boost::shared_ptr<XdmfGridCollection> gridCollection = boost::shared_dynamic_cast<XdmfGridCollection>($1)) {
$result = SWIG_NewPointerObj(SWIG_as_voidptr(new boost::shared_ptr<XdmfGridCollection>(gridCollection)), SWIGTYPE_p_boost__shared_ptrT_XdmfGridCollection_t, SWIG_POINTER_OWN);
else if(shared_ptr<XdmfGridCollection> gridCollection = shared_dynamic_cast<XdmfGridCollection>($1)) {
$result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfGridCollection>(gridCollection)), SWIGTYPE_p_boost__shared_ptrT_XdmfGridCollection_t, SWIG_POINTER_OWN);
}
else if(boost::shared_ptr<XdmfInformation> information = boost::shared_dynamic_cast<XdmfInformation>($1)) {
$result = SWIG_NewPointerObj(SWIG_as_voidptr(new boost::shared_ptr<XdmfInformation>(information)), SWIGTYPE_p_boost__shared_ptrT_XdmfInformation_t, SWIG_POINTER_OWN);
else if(shared_ptr<XdmfInformation> information = shared_dynamic_cast<XdmfInformation>($1)) {
$result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfInformation>(information)), SWIGTYPE_p_boost__shared_ptrT_XdmfInformation_t, SWIG_POINTER_OWN);
}
else if(boost::shared_ptr<XdmfMap> map = boost::shared_dynamic_cast<XdmfMap>($1)) {
$result = SWIG_NewPointerObj(SWIG_as_voidptr(new boost::shared_ptr<XdmfMap>(map)), SWIGTYPE_p_boost__shared_ptrT_XdmfMap_t, SWIG_POINTER_OWN);
else if(shared_ptr<XdmfMap> map = shared_dynamic_cast<XdmfMap>($1)) {
$result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfMap>(map)), SWIGTYPE_p_boost__shared_ptrT_XdmfMap_t, SWIG_POINTER_OWN);
}
else if(boost::shared_ptr<XdmfRectilinearGrid> gridRectilinear = boost::shared_dynamic_cast<XdmfRectilinearGrid>($1)) {
$result = SWIG_NewPointerObj(SWIG_as_voidptr(new boost::shared_ptr<XdmfRectilinearGrid>(gridRectilinear)), SWIGTYPE_p_boost__shared_ptrT_XdmfRectilinearGrid_t, SWIG_POINTER_OWN);
else if(shared_ptr<XdmfRectilinearGrid> gridRectilinear = shared_dynamic_cast<XdmfRectilinearGrid>($1)) {
$result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfRectilinearGrid>(gridRectilinear)), SWIGTYPE_p_boost__shared_ptrT_XdmfRectilinearGrid_t, SWIG_POINTER_OWN);
}
else if(boost::shared_ptr<XdmfRegularGrid> gridRegular = boost::shared_dynamic_cast<XdmfRegularGrid>($1)) {
$result = SWIG_NewPointerObj(SWIG_as_voidptr(new boost::shared_ptr<XdmfRegularGrid>(gridRegular)), SWIGTYPE_p_boost__shared_ptrT_XdmfRegularGrid_t, SWIG_POINTER_OWN);
else if(shared_ptr<XdmfRegularGrid> gridRegular = shared_dynamic_cast<XdmfRegularGrid>($1)) {
$result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfRegularGrid>(gridRegular)), SWIGTYPE_p_boost__shared_ptrT_XdmfRegularGrid_t, SWIG_POINTER_OWN);
}
else if(boost::shared_ptr<XdmfSet> set = boost::shared_dynamic_cast<XdmfSet>($1)) {
$result = SWIG_NewPointerObj(SWIG_as_voidptr(new boost::shared_ptr<XdmfSet>(set)), SWIGTYPE_p_boost__shared_ptrT_XdmfSet_t, SWIG_POINTER_OWN);
else if(shared_ptr<XdmfSet> set = shared_dynamic_cast<XdmfSet>($1)) {
$result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfSet>(set)), SWIGTYPE_p_boost__shared_ptrT_XdmfSet_t, SWIG_POINTER_OWN);
}
else if(boost::shared_ptr<XdmfTime> time = boost::shared_dynamic_cast<XdmfTime>($1)) {
$result = SWIG_NewPointerObj(SWIG_as_voidptr(new boost::shared_ptr<XdmfTime>(time)), SWIGTYPE_p_boost__shared_ptrT_XdmfTime_t, SWIG_POINTER_OWN);
else if(shared_ptr<XdmfTime> time = shared_dynamic_cast<XdmfTime>($1)) {
$result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfTime>(time)), SWIGTYPE_p_boost__shared_ptrT_XdmfTime_t, SWIG_POINTER_OWN);
}
else if(boost::shared_ptr<XdmfTopology> topology = boost::shared_dynamic_cast<XdmfTopology>($1)) {
$result = SWIG_NewPointerObj(SWIG_as_voidptr(new boost::shared_ptr<XdmfTopology>(topology)), SWIGTYPE_p_boost__shared_ptrT_XdmfTopology_t, SWIG_POINTER_OWN);
else if(shared_ptr<XdmfTopology> topology = shared_dynamic_cast<XdmfTopology>($1)) {
$result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfTopology>(topology)), SWIGTYPE_p_boost__shared_ptrT_XdmfTopology_t, SWIG_POINTER_OWN);
}
else if(boost::shared_ptr<XdmfUnstructuredGrid> gridUnstructured = boost::shared_dynamic_cast<XdmfUnstructuredGrid>($1)) {
$result = SWIG_NewPointerObj(SWIG_as_voidptr(new boost::shared_ptr<XdmfUnstructuredGrid>(gridUnstructured)), SWIGTYPE_p_boost__shared_ptrT_XdmfUnstructuredGrid_t, SWIG_POINTER_OWN);
else if(shared_ptr<XdmfUnstructuredGrid> gridUnstructured = shared_dynamic_cast<XdmfUnstructuredGrid>($1)) {
$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 boost::shared_ptr<XdmfItem>($1)), SWIGTYPE_p_boost__shared_ptrT_XdmfItem_t, SWIG_POINTER_OWN);
$result = SWIG_NewPointerObj(SWIG_as_voidptr(new shared_ptr<XdmfItem>($1)), SWIGTYPE_p_boost__shared_ptrT_XdmfItem_t, SWIG_POINTER_OWN);
}
}
......
......@@ -26,10 +26,10 @@
#include "XdmfAttributeType.hpp"
#include "XdmfError.hpp"
boost::shared_ptr<XdmfAttribute>
shared_ptr<XdmfAttribute>
XdmfAttribute::New()
{
boost::shared_ptr<XdmfAttribute> p(new XdmfAttribute());
shared_ptr<XdmfAttribute> p(new XdmfAttribute());
return p;
}
......@@ -46,7 +46,7 @@ XdmfAttribute::~XdmfAttribute()
const std::string XdmfAttribute::ItemTag = "Attribute";
boost::shared_ptr<const XdmfAttributeCenter>
shared_ptr<const XdmfAttributeCenter>
XdmfAttribute::getCenter() const
{
return mCenter;
......@@ -74,7 +74,7 @@ XdmfAttribute::getName() const
return mName;
}
boost::shared_ptr<const XdmfAttributeType>
shared_ptr<const XdmfAttributeType>
XdmfAttribute::getType() const
{
return mType;
......@@ -82,7 +82,7 @@ XdmfAttribute::getType() const
void
XdmfAttribute::populateItem(const std::map<std::string, std::string> & itemProperties,
std::vector<boost::shared_ptr<XdmfItem> > & childItems,
std::vector<shared_ptr<XdmfItem> > & childItems,
const XdmfCoreReader * const reader)
{
XdmfItem::populateItem(itemProperties, childItems, reader);
......@@ -98,12 +98,11 @@ XdmfAttribute::populateItem(const std::map<std::string, std::string> & itemPrope
mCenter = XdmfAttributeCenter::New(itemProperties);
mType = XdmfAttributeType::New(itemProperties);
for(std::vector<boost::shared_ptr<XdmfItem> >::const_iterator iter =
for(std::vector<shared_ptr<XdmfItem> >::const_iterator iter =
childItems.begin();
iter != childItems.end();
++iter) {
if(boost::shared_ptr<XdmfArray> array =
boost::shared_dynamic_cast<XdmfArray>(*iter)) {
if(shared_ptr<XdmfArray> array = shared_dynamic_cast<XdmfArray>(*iter)) {
this->swap(array);
}
// TODO: If multiple dataitems.
......@@ -111,7 +110,7 @@ XdmfAttribute::populateItem(const std::map<std::string, std::string> & itemPrope
}
void
XdmfAttribute::setCenter(const boost::shared_ptr<const XdmfAttributeCenter> center)
XdmfAttribute::setCenter(const shared_ptr<const XdmfAttributeCenter> center)
{
mCenter = center;
}
......@@ -123,7 +122,7 @@ XdmfAttribute::setName(const std::string & name)
}
void
XdmfAttribute::setType(const boost::shared_ptr<const XdmfAttributeType> type)
XdmfAttribute::setType(const shared_ptr<const XdmfAttributeType> type)
{
mType = type;
}
......@@ -43,14 +43,14 @@ class XdmfAttributeType;
*/
class XDMF_EXPORT XdmfAttribute : public XdmfArray {
public:
public:
/**
* Create a new XdmfAttribute.
*
* @return constructed XdmfAttribute.
*/
static boost::shared_ptr<XdmfAttribute> New();
static shared_ptr<XdmfAttribute> New();
virtual ~XdmfAttribute();
......@@ -62,7 +62,7 @@ class XDMF_EXPORT XdmfAttribute : public XdmfArray {
*
* @return XdmfAttributeCenter of the attribute.
*/
boost::shared_ptr<const XdmfAttributeCenter> getCenter() const;
shared_ptr<const XdmfAttributeCenter> getCenter() const;
std::map<std::string, std::string> getItemProperties() const;
......@@ -80,14 +80,14 @@ class XDMF_EXPORT XdmfAttribute : public XdmfArray {
*
* @return XdmfAttributeType of the attribute.
*/
boost::shared_ptr<const XdmfAttributeType> getType() const;
shared_ptr<const XdmfAttributeType> getType() const;
/**
* Set the XdmfAttributeCenter associated with this attribute.
*
* @param center the XdmfAttributeCenter to set.
*/
void setCenter(const boost::shared_ptr<const XdmfAttributeCenter> center);
void setCenter(const shared_ptr<const XdmfAttributeCenter> center);
/**
* Set the name of the attribute.
......@@ -101,32 +101,32 @@ class XDMF_EXPORT XdmfAttribute : public XdmfArray {
*
* @param type XdmfAttributeType to set.
*/
void setType(const boost::shared_ptr<const XdmfAttributeType> type);
void setType(const shared_ptr<const XdmfAttributeType> type);
protected:
protected:
XdmfAttribute();
virtual void
populateItem(const std::map<std::string, std::string> & itemProperties,
std::vector<boost::shared_ptr<XdmfItem> > & childItems,
std::vector<shared_ptr<XdmfItem> > & childItems,
const XdmfCoreReader * const reader);
private:
private:
XdmfAttribute(const XdmfAttribute &); // Not implemented.
void operator=(const XdmfAttribute &); // Not implemented.
boost::shared_ptr<const XdmfAttributeCenter> mCenter;
shared_ptr<const XdmfAttributeCenter> mCenter;
std::string mName;
boost::shared_ptr<const XdmfAttributeType> mType;
shared_ptr<const XdmfAttributeType> mType;
};
#ifdef _WIN32
XDMF_TEMPLATE template class XDMF_EXPORT
boost::shared_ptr<const XdmfAttributeType>;
shared_ptr<const XdmfAttributeType>;
XDMF_TEMPLATE template class XDMF_EXPORT
boost::shared_ptr<const XdmfAttributeCenter>;
shared_ptr<const XdmfAttributeCenter>;
#endif
#endif /* XDMFATTRIBUTE_HPP_ */
......@@ -25,42 +25,42 @@
#include "XdmfError.hpp"
// Supported XdmfAttributeCenters
boost::shared_ptr<const XdmfAttributeCenter>
shared_ptr<const XdmfAttributeCenter>
XdmfAttributeCenter::Grid()
{
static boost::shared_ptr<const XdmfAttributeCenter>
static shared_ptr<const XdmfAttributeCenter>
p(new XdmfAttributeCenter("Grid"));
return p;
}
boost::shared_ptr<const XdmfAttributeCenter>
shared_ptr<const XdmfAttributeCenter>
XdmfAttributeCenter::Cell()
{
static boost::shared_ptr<const XdmfAttributeCenter>
static shared_ptr<const XdmfAttributeCenter>
p(new XdmfAttributeCenter("Cell"));
return p;
}
boost::shared_ptr<const XdmfAttributeCenter>
shared_ptr<const XdmfAttributeCenter>
XdmfAttributeCenter::Face()
{
static boost::shared_ptr<const XdmfAttributeCenter>
static shared_ptr<const XdmfAttributeCenter>
p(new XdmfAttributeCenter("Face"));
return p;
}
boost::shared_ptr<const XdmfAttributeCenter>
shared_ptr<const XdmfAttributeCenter>
XdmfAttributeCenter::Edge()
{
static boost::shared_ptr<const XdmfAttributeCenter>
static shared_ptr<const XdmfAttributeCenter>
p(new XdmfAttributeCenter("Edge"));
return p;
}
boost::shared_ptr<const XdmfAttributeCenter>
shared_ptr<const XdmfAttributeCenter>
XdmfAttributeCenter::Node()
{
static boost::shared_ptr<const XdmfAttributeCenter>
static shared_ptr<const XdmfAttributeCenter>
p(new XdmfAttributeCenter("Node"));
return p;
}
......@@ -74,7 +74,7 @@ XdmfAttributeCenter::~XdmfAttributeCenter()
{
}
boost::shared_ptr<const XdmfAttributeCenter>
shared_ptr<const XdmfAttributeCenter>
XdmfAttributeCenter::New(const std::map<std::string, std::string> & itemProperties)
{
std::map<std::string, std::string>::const_iterator center =
......@@ -97,11 +97,15 @@ XdmfAttributeCenter::New(const std::map<std::string, std::string> & itemProperti
return Node();
}
else {
XdmfError::message(XdmfError::FATAL, "Center not of 'Grid','Cell','Face','Edge','Node' in XdmfAttributeCenter::New");
XdmfError::message(XdmfError::FATAL,
"Center not of 'Grid','Cell','Face','Edge','Node' "
"in XdmfAttributeCenter::New");
}
}
XdmfError::message(XdmfError::FATAL, "'Center' not found in itemProperties in XdmfAttributeCenter::New");
return boost::shared_ptr<const XdmfAttributeCenter>();
XdmfError::message(XdmfError::FATAL,
"'Center' not found in itemProperties in "
"XdmfAttributeCenter::New");
return shared_ptr<const XdmfAttributeCenter>();
}
void
......
......@@ -45,24 +45,24 @@
*/
class XDMF_EXPORT XdmfAttributeCenter : public XdmfItemProperty {
public:
public:
virtual ~XdmfAttributeCenter();
friend class XdmfAttribute;
// Supported Xdmf Attribute Centers
static boost::shared_ptr<const XdmfAttributeCenter> Grid();
static boost::shared_ptr<const XdmfAttributeCenter> Cell();
static boost::shared_ptr<const XdmfAttributeCenter> Face();
static boost::shared_ptr<const XdmfAttributeCenter> Edge();
static boost::shared_ptr<const XdmfAttributeCenter> Node();
static shared_ptr<const XdmfAttributeCenter> Grid();
static shared_ptr<const XdmfAttributeCenter> Cell();
static shared_ptr<const XdmfAttributeCenter> Face();
static shared_ptr<const XdmfAttributeCenter> Edge();
static shared_ptr<const XdmfAttributeCenter> Node();
void
getProperties(std::map<std::string, std::string> & collectedProperties) const;
protected:
protected:
/**
* Protected constructor for XdmfAttributeCenter. The constructor
......@@ -75,12 +75,12 @@ class XDMF_EXPORT XdmfAttributeCenter : public XdmfItemProperty {
*/
XdmfAttributeCenter(const std::string & name);
private:
private:
XdmfAttributeCenter(const XdmfAttributeCenter &); // Not implemented.
void operator=(const XdmfAttributeCenter &); // Not implemented.
static boost::shared_ptr<const XdmfAttributeCenter>
static shared_ptr<const XdmfAttributeCenter>
New(const std::map<std::string, std::string> & itemProperties);
std::string mName;
......
......@@ -25,58 +25,58 @@
#include "XdmfError.hpp"
// Supported XdmfAttributeTypes
boost::shared_ptr<const XdmfAttributeType>
shared_ptr<const XdmfAttributeType>
XdmfAttributeType::NoAttributeType()
{
static boost::shared_ptr<const XdmfAttributeType>
static shared_ptr<const XdmfAttributeType>
p(new XdmfAttributeType("None"));
return p;
}
boost::shared_ptr<const XdmfAttributeType>
shared_ptr<const XdmfAttributeType>
XdmfAttributeType::Scalar()
{
static boost::shared_ptr<const XdmfAttributeType>
static shared_ptr<const XdmfAttributeType>
p(new XdmfAttributeType("Scalar"));
return p;
}
boost::shared_ptr<const XdmfAttributeType>
shared_ptr<const XdmfAttributeType>
XdmfAttributeType::Vector()
{
static boost::shared_ptr<const XdmfAttributeType>
static shared_ptr<const XdmfAttributeType>
p(new XdmfAttributeType("Vector"));
return p;
}
boost::shared_ptr<const XdmfAttributeType>
shared_ptr<const XdmfAttributeType>
XdmfAttributeType::Tensor()
{
static boost::shared_ptr<const XdmfAttributeType>
static shared_ptr<const XdmfAttributeType>
p(new XdmfAttributeType("Tensor"));
return p;
}
boost::shared_ptr<const XdmfAttributeType>
shared_ptr<const XdmfAttributeType>
XdmfAttributeType::Matrix()
{
static boost::shared_ptr<const XdmfAttributeType>
static shared_ptr<const XdmfAttributeType>
p(new XdmfAttributeType("Matrix"));
return p;
}
boost::shared_ptr<const XdmfAttributeType>
shared_ptr<const XdmfAttributeType>
XdmfAttributeType::Tensor6()
{
static boost::shared_ptr<const XdmfAttributeType>
static shared_ptr<const XdmfAttributeType>
p(new XdmfAttributeType("Tensor6"));
return p;
}
boost::shared_ptr<const XdmfAttributeType>
shared_ptr<const XdmfAttributeType>
XdmfAttributeType::GlobalId()
{
static boost::shared_ptr<const XdmfAttributeType>
static shared_ptr<const XdmfAttributeType>
p(new XdmfAttributeType("GlobalId"));
return p;
}
......@@ -90,7 +90,7 @@ XdmfAttributeType::~XdmfAttributeType()
{
}
boost::shared_ptr<const XdmfAttributeType>
shared_ptr<const XdmfAttributeType>
XdmfAttributeType::New(const std::map<std::string, std::string> & itemProperties)
{
std::map<std::string, std::string>::const_iterator type =
......@@ -122,11 +122,16 @@ XdmfAttributeType::New(const std::map<std::string, std::string> & itemProperties
return GlobalId();
}
else {
XdmfError::message(XdmfError::FATAL, "Type not of 'None','Scalar','Vector','Tensor','Matrix','Tensor6', or 'GlobalId' in XdmfAttributeType::New");
XdmfError::message(XdmfError::FATAL,
"Type not of 'None','Scalar','Vector','Tensor', "
"'Matrix','Tensor6', or 'GlobalId' in "
"XdmfAttributeType::New");
}
}
XdmfError::message(XdmfError::FATAL, "Neither 'Type' nor 'AttributeType' found in itemProperties in XdmfAttributeType::New");
return boost::shared_ptr<const XdmfAttributeType>();
XdmfError::message(XdmfError::FATAL,
"Neither 'Type' nor 'AttributeType' found in "
"itemProperties in XdmfAttributeType::New");
return shared_ptr<const XdmfAttributeType>();
}
void
......
......@@ -48,25 +48,25 @@
*/
class XDMF_EXPORT XdmfAttributeType : public XdmfItemProperty {
public:
public:
virtual ~XdmfAttributeType();
friend class XdmfAttribute;
// Supported Xdmf Attribute Types
static boost::shared_ptr<const XdmfAttributeType> NoAttributeType();
static boost::shared_ptr<const XdmfAttributeType> Scalar();
static boost::shared_ptr<const XdmfAttributeType> Vector();
static boost::shared_ptr<const XdmfAttributeType> Tensor();
static boost::shared_ptr<const XdmfAttributeType> Matrix();
static boost::shared_ptr<const XdmfAttributeType> Tensor6();
static boost::shared_ptr<const XdmfAttributeType> GlobalId();
static shared_ptr<const XdmfAttributeType> NoAttributeType();
static shared_ptr<const XdmfAttributeType> Scalar();
static shared_ptr<const XdmfAttributeType> Vector();
static shared_ptr<const XdmfAttributeType> Tensor();
static shared_ptr<const XdmfAttributeType> Matrix();
static shared_ptr<const XdmfAttributeType> Tensor6();
static shared_ptr<const XdmfAttributeType> GlobalId();
void
getProperties(std::map<std::string, std::string> & collectedProperties) const;
protected:
protected:
/**
* Protected constructor for XdmfAttributeType. The constructor is
......@@ -78,12 +78,12 @@ class XDMF_EXPORT XdmfAttributeType : public XdmfItemProperty {
*/
XdmfAttributeType(const std::string & name);
private:
private:
XdmfAttributeType(const XdmfAttributeType &); // Not implemented.
void operator=(const XdmfAttributeType &); // Not implemented.
static boost::shared_ptr<const XdmfAttributeType>
static shared_ptr<const XdmfAttributeType>
New(const std::map<std::string, std::string> & itemProperties);
std::string mName;
......
......@@ -41,10 +41,10 @@ public:
public:
static boost::shared_ptr<XdmfTopologyCurvilinear>
static shared_ptr<XdmfTopologyCurvilinear>
New(const XdmfCurvilinearGrid * const curvilinearGrid)
{
boost::shared_ptr<XdmfTopologyCurvilinear>
shared_ptr<XdmfTopologyCurvilinear>
p(new XdmfTopologyCurvilinear(curvilinearGrid));
return p;
}
......@@ -52,7 +52,7 @@ public:
unsigned int
getNumberElements() const
{
const boost::shared_ptr<const XdmfArray> dimensions =
const shared_ptr<const XdmfArray> dimensions =
mCurvilinearGrid->getDimensions();
if(dimensions->getSize() == 0) {
return 0;
......@@ -80,10 +80,10 @@ public:
public:
static boost::shared_ptr<const XdmfTopologyTypeCurvilinear>
static shared_ptr<const XdmfTopologyTypeCurvilinear>
New(const XdmfCurvilinearGrid * const curvilinearGrid)
{
boost::shared_ptr<const XdmfTopologyTypeCurvilinear>
shared_ptr<const XdmfTopologyTypeCurvilinear>
p(new XdmfTopologyTypeCurvilinear(curvilinearGrid));
return p;
}
......@@ -100,7 +100,7 @@ public:
void
getProperties(std::map<std::string, std::string> & collectedProperties) const
{
boost::shared_ptr<const XdmfArray> dimensions =
shared_ptr<const XdmfArray> dimensions =
mCurvilinearGrid->getDimensions();
if(dimensions->getSize() == 3) {
collectedProperties["Type"] = "3DSMesh";
......@@ -109,7 +109,9 @@ public:
collectedProperties["Type"] = "2DSMesh";
}
else {
XdmfError::message(XdmfError::FATAL, "Grid dimensions not 2 or 3 in XdmfTopologyTypeCurvilinear::getProperties");
XdmfError::message(XdmfError::FATAL,
"Grid dimensions not 2 or 3 in "
"XdmfTopologyTypeCurvilinear::getProperties");
}
collectedProperties["Dimensions"] = dimensions->getValuesString();
}
......@@ -126,49 +128,49 @@ public:
};
XdmfCurvilinearGridImpl(const boost::shared_ptr<XdmfArray> numPoints) :
XdmfCurvilinearGridImpl(const shared_ptr<XdmfArray> numPoints) :
mDimensions(numPoints)