Commit 6632e999 authored by Kenneth Leiter's avatar Kenneth Leiter

ENH: Add XdmfGeometryType to XdmfGeometry in a similar implementation as...

ENH: Add XdmfGeometryType to XdmfGeometry in a similar implementation as XdmfTopologyType.  Add tests for XdmfGeometry.  Add XdmfItem, an abstract class that is able to be traversed by an XdmfVisitor to write out its information to XML and HDF5 or other heavy data formats.  Modify XdmfGeometry, XdmfGrid, XdmfTopology, and XdmfAttribute to inherit from XdmfItem.
parent ac19e9d4
......@@ -11,26 +11,33 @@ if(Boost_FOUND)
message(${Boost_INCLUDE_DIRS})
endif(Boost_FOUND)
find_package(PythonLibs REQUIRED)
if(PYTHONLIBS_FOUND)
include_directories(${PYTHON_INCLUDE_DIRS})
endif(PYTHONLIBS_FOUND)
option(XDMF_WRAP_PYTHON ON)
if(XDMF_WRAP_PYTHON)
find_package(PythonLibs REQUIRED)
if(PYTHONLIBS_FOUND)
include_directories(${PYTHON_INCLUDE_DIRS})
endif(PYTHONLIBS_FOUND)
endif(XDMF_WRAP_PYTHON)
set(XdmfSources
XdmfGeometry
XdmfGrid
XdmfItem
XdmfObject
XdmfTopology
XdmfVisitor
)
add_library(Xdmf ${XdmfSources})
add_library(_Xdmf MODULE XdmfPython)
set_target_properties(_Xdmf PROPERTIES PREFIX "")
target_link_libraries(_Xdmf Xdmf)
if(WIN32 OR APPLE)
target_link_libraries(_Xdmf ${PYTHON_LIBRARY})
endif(WIN32 OR APPLE)
if(XDMF_WRAP_PYTHON)
add_library(_Xdmf MODULE XdmfPython)
set_target_properties(_Xdmf PROPERTIES PREFIX "")
target_link_libraries(_Xdmf Xdmf)
if(WIN32 OR APPLE)
target_link_libraries(_Xdmf ${PYTHON_LIBRARY})
endif(WIN32 OR APPLE)
endif(XDMF_WRAP_PYTHON)
configure_file(Xdmf.py Xdmf.py COPYONLY)
......
......@@ -7,28 +7,35 @@ swig -v -c++ -python -o XdmfPython.cpp Xdmf.i
%include std_vector.i
namespace boost {
template<class T> class shared_ptr
{
public:
T * operator-> () const;
};
template<class T> class shared_ptr
{
public:
T * operator-> () const;
};
}
%template(XdmfGeometryPtr) boost::shared_ptr<XdmfGeometry>;
%template(XdmfGridPtr) boost::shared_ptr<XdmfGrid>;
%template(XdmfItemPtr) boost::shared_ptr<XdmfItem>;
%template(XdmfObjPtr) boost::shared_ptr<XdmfObject>;
%template(XdmfTopologyPtr) boost::shared_ptr<XdmfTopology>;
%template(XdmfVisitorPtr) boost::shared_ptr<XdmfVisitor>;
%module Xdmf
%{
#include <XdmfGeometry.hpp>
#include <XdmfGrid.hpp>
#include <XdmfObject.hpp>
#include <XdmfTopology.hpp>
#include <XdmfGeometry.hpp>
#include <XdmfGrid.hpp>
#include <XdmfItem.hpp>
#include <XdmfObject.hpp>
#include <XdmfTopology.hpp>
#include <XdmfVisitor.hpp>
%}
%include XdmfObject.hpp
%include XdmfItem.hpp
%include XdmfVisitor.hpp
%include XdmfGeometry.hpp
%include XdmfGrid.hpp
%include XdmfTopology.hpp
......@@ -109,6 +109,10 @@ class XdmfGeometryPtr(_object):
__swig_destroy__ = _Xdmf.delete_XdmfGeometryPtr
__del__ = lambda self : None;
def New(self): return _Xdmf.XdmfGeometryPtr_New(self)
def getGeometryType(self): return _Xdmf.XdmfGeometryPtr_getGeometryType(self)
def setGeometryType(self, *args): return _Xdmf.XdmfGeometryPtr_setGeometryType(self, *args)
def getGeometryTypeAsString(self): return _Xdmf.XdmfGeometryPtr_getGeometryTypeAsString(self)
def getDimensions(self): return _Xdmf.XdmfGeometryPtr_getDimensions(self)
def printSelf(self): return _Xdmf.XdmfGeometryPtr_printSelf(self)
XdmfGeometryPtr_swigregister = _Xdmf.XdmfGeometryPtr_swigregister
XdmfGeometryPtr_swigregister(XdmfGeometryPtr)
......@@ -135,6 +139,23 @@ class XdmfGridPtr(_object):
XdmfGridPtr_swigregister = _Xdmf.XdmfGridPtr_swigregister
XdmfGridPtr_swigregister(XdmfGridPtr)
class XdmfItemPtr(_object):
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, XdmfItemPtr, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, XdmfItemPtr, name)
__repr__ = _swig_repr
def __deref__(self): return _Xdmf.XdmfItemPtr___deref__(self)
def __init__(self):
this = _Xdmf.new_XdmfItemPtr()
try: self.this.append(this)
except: self.this = this
__swig_destroy__ = _Xdmf.delete_XdmfItemPtr
__del__ = lambda self : None;
def printSelf(self): return _Xdmf.XdmfItemPtr_printSelf(self)
XdmfItemPtr_swigregister = _Xdmf.XdmfItemPtr_swigregister
XdmfItemPtr_swigregister(XdmfItemPtr)
class XdmfObjPtr(_object):
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, XdmfObjPtr, name, value)
......@@ -148,7 +169,6 @@ class XdmfObjPtr(_object):
except: self.this = this
__swig_destroy__ = _Xdmf.delete_XdmfObjPtr
__del__ = lambda self : None;
def New(self): return _Xdmf.XdmfObjPtr_New(self)
def printSelf(self): return _Xdmf.XdmfObjPtr_printSelf(self)
XdmfObjPtr_swigregister = _Xdmf.XdmfObjPtr_swigregister
XdmfObjPtr_swigregister(XdmfObjPtr)
......@@ -167,41 +187,117 @@ class XdmfTopologyPtr(_object):
__swig_destroy__ = _Xdmf.delete_XdmfTopologyPtr
__del__ = lambda self : None;
def New(self): return _Xdmf.XdmfTopologyPtr_New(self)
def getXdmfTopologyType(self): return _Xdmf.XdmfTopologyPtr_getXdmfTopologyType(self)
def getTopologyType(self): return _Xdmf.XdmfTopologyPtr_getTopologyType(self)
def setTopologyType(self, *args): return _Xdmf.XdmfTopologyPtr_setTopologyType(self, *args)
def getTopologyTypeAsString(self): return _Xdmf.XdmfTopologyPtr_getTopologyTypeAsString(self)
def getNodesPerElement(self): return _Xdmf.XdmfTopologyPtr_getNodesPerElement(self)
def printSelf(self): return _Xdmf.XdmfTopologyPtr_printSelf(self)
XdmfTopologyPtr_swigregister = _Xdmf.XdmfTopologyPtr_swigregister
XdmfTopologyPtr_swigregister(XdmfTopologyPtr)
class XdmfVisitorPtr(_object):
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, XdmfVisitorPtr, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, XdmfVisitorPtr, name)
__repr__ = _swig_repr
def __deref__(self): return _Xdmf.XdmfVisitorPtr___deref__(self)
def __init__(self):
this = _Xdmf.new_XdmfVisitorPtr()
try: self.this.append(this)
except: self.this = this
__swig_destroy__ = _Xdmf.delete_XdmfVisitorPtr
__del__ = lambda self : None;
def New(self): return _Xdmf.XdmfVisitorPtr_New(self)
def printSelf(self): return _Xdmf.XdmfVisitorPtr_printSelf(self)
XdmfVisitorPtr_swigregister = _Xdmf.XdmfVisitorPtr_swigregister
XdmfVisitorPtr_swigregister(XdmfVisitorPtr)
class XdmfObject(_object):
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, XdmfObject, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, XdmfObject, name)
def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined")
def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined - class is abstract")
__repr__ = _swig_repr
__swig_getmethods__["New"] = lambda x: _Xdmf.XdmfObject_New
if _newclass:New = staticmethod(_Xdmf.XdmfObject_New)
def printSelf(self): return _Xdmf.XdmfObject_printSelf(self)
XdmfObject_swigregister = _Xdmf.XdmfObject_swigregister
XdmfObject_swigregister(XdmfObject)
def XdmfObject_New():
return _Xdmf.XdmfObject_New()
XdmfObject_New = _Xdmf.XdmfObject_New
class XdmfItem(XdmfObject):
__swig_setmethods__ = {}
for _s in [XdmfObject]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{}))
__setattr__ = lambda self, name, value: _swig_setattr(self, XdmfItem, name, value)
__swig_getmethods__ = {}
for _s in [XdmfObject]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{}))
__getattr__ = lambda self, name: _swig_getattr(self, XdmfItem, name)
def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined - class is abstract")
__repr__ = _swig_repr
XdmfItem_swigregister = _Xdmf.XdmfItem_swigregister
XdmfItem_swigregister(XdmfItem)
class XdmfGeometry(XdmfObject):
class XdmfVisitor(XdmfObject):
__swig_setmethods__ = {}
for _s in [XdmfObject]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{}))
__setattr__ = lambda self, name, value: _swig_setattr(self, XdmfGeometry, name, value)
__setattr__ = lambda self, name, value: _swig_setattr(self, XdmfVisitor, name, value)
__swig_getmethods__ = {}
for _s in [XdmfObject]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{}))
__getattr__ = lambda self, name: _swig_getattr(self, XdmfVisitor, name)
def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined")
__repr__ = _swig_repr
__swig_getmethods__["New"] = lambda x: _Xdmf.XdmfVisitor_New
if _newclass:New = staticmethod(_Xdmf.XdmfVisitor_New)
def printSelf(self): return _Xdmf.XdmfVisitor_printSelf(self)
XdmfVisitor_swigregister = _Xdmf.XdmfVisitor_swigregister
XdmfVisitor_swigregister(XdmfVisitor)
def XdmfVisitor_New():
return _Xdmf.XdmfVisitor_New()
XdmfVisitor_New = _Xdmf.XdmfVisitor_New
class XdmfGeometryType(_object):
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, XdmfGeometryType, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, XdmfGeometryType, name)
def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined")
__repr__ = _swig_repr
__swig_getmethods__["dimensions"] = _Xdmf.XdmfGeometryType_dimensions_get
if _newclass:dimensions = _swig_property(_Xdmf.XdmfGeometryType_dimensions_get)
__swig_getmethods__["name"] = _Xdmf.XdmfGeometryType_name_get
if _newclass:name = _swig_property(_Xdmf.XdmfGeometryType_name_get)
def __eq__(self, *args): return _Xdmf.XdmfGeometryType___eq__(self, *args)
def __ne__(self, *args): return _Xdmf.XdmfGeometryType___ne__(self, *args)
__swig_destroy__ = _Xdmf.delete_XdmfGeometryType
__del__ = lambda self : None;
XdmfGeometryType_swigregister = _Xdmf.XdmfGeometryType_swigregister
XdmfGeometryType_swigregister(XdmfGeometryType)
cvar = _Xdmf.cvar
XdmfGeometryType.NoGeometry = _Xdmf.cvar.XdmfGeometryType_NoGeometry
XdmfGeometryType.XYZ = _Xdmf.cvar.XdmfGeometryType_XYZ
XdmfGeometryType.XY = _Xdmf.cvar.XdmfGeometryType_XY
XdmfGeometryType.X_Y_Z = _Xdmf.cvar.XdmfGeometryType_X_Y_Z
XdmfGeometryType.X_Y = _Xdmf.cvar.XdmfGeometryType_X_Y
XdmfGeometryType.VXVYVZ = _Xdmf.cvar.XdmfGeometryType_VXVYVZ
XdmfGeometryType.Origin_DXDYDZ = _Xdmf.cvar.XdmfGeometryType_Origin_DXDYDZ
XdmfGeometryType.VXVY = _Xdmf.cvar.XdmfGeometryType_VXVY
XdmfGeometryType.Origin_DXDY = _Xdmf.cvar.XdmfGeometryType_Origin_DXDY
class XdmfGeometry(XdmfItem):
__swig_setmethods__ = {}
for _s in [XdmfItem]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{}))
__setattr__ = lambda self, name, value: _swig_setattr(self, XdmfGeometry, name, value)
__swig_getmethods__ = {}
for _s in [XdmfItem]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{}))
__getattr__ = lambda self, name: _swig_getattr(self, XdmfGeometry, name)
def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined")
__repr__ = _swig_repr
__swig_getmethods__["New"] = lambda x: _Xdmf.XdmfGeometry_New
if _newclass:New = staticmethod(_Xdmf.XdmfGeometry_New)
def getGeometryType(self): return _Xdmf.XdmfGeometry_getGeometryType(self)
def setGeometryType(self, *args): return _Xdmf.XdmfGeometry_setGeometryType(self, *args)
def getGeometryTypeAsString(self): return _Xdmf.XdmfGeometry_getGeometryTypeAsString(self)
def getDimensions(self): return _Xdmf.XdmfGeometry_getDimensions(self)
def printSelf(self): return _Xdmf.XdmfGeometry_printSelf(self)
XdmfGeometry_swigregister = _Xdmf.XdmfGeometry_swigregister
XdmfGeometry_swigregister(XdmfGeometry)
......@@ -210,12 +306,12 @@ def XdmfGeometry_New():
return _Xdmf.XdmfGeometry_New()
XdmfGeometry_New = _Xdmf.XdmfGeometry_New
class XdmfGrid(XdmfObject):
class XdmfGrid(XdmfItem):
__swig_setmethods__ = {}
for _s in [XdmfObject]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{}))
for _s in [XdmfItem]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{}))
__setattr__ = lambda self, name, value: _swig_setattr(self, XdmfGrid, name, value)
__swig_getmethods__ = {}
for _s in [XdmfObject]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{}))
for _s in [XdmfItem]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{}))
__getattr__ = lambda self, name: _swig_getattr(self, XdmfGrid, name)
def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined")
__repr__ = _swig_repr
......@@ -240,17 +336,23 @@ class XdmfTopologyType(_object):
__getattr__ = lambda self, name: _swig_getattr(self, XdmfTopologyType, name)
def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined")
__repr__ = _swig_repr
__swig_getmethods__["numberVertices"] = _Xdmf.XdmfTopologyType_numberVertices_get
if _newclass:numberVertices = _swig_property(_Xdmf.XdmfTopologyType_numberVertices_get)
NoCellType = _Xdmf.XdmfTopologyType_NoCellType
Linear = _Xdmf.XdmfTopologyType_Linear
Quadratic = _Xdmf.XdmfTopologyType_Quadratic
Arbitrary = _Xdmf.XdmfTopologyType_Arbitrary
Structured = _Xdmf.XdmfTopologyType_Structured
__swig_getmethods__["nodesPerElement"] = _Xdmf.XdmfTopologyType_nodesPerElement_get
if _newclass:nodesPerElement = _swig_property(_Xdmf.XdmfTopologyType_nodesPerElement_get)
__swig_getmethods__["name"] = _Xdmf.XdmfTopologyType_name_get
if _newclass:name = _swig_property(_Xdmf.XdmfTopologyType_name_get)
__swig_getmethods__["cellType"] = _Xdmf.XdmfTopologyType_cellType_get
if _newclass:cellType = _swig_property(_Xdmf.XdmfTopologyType_cellType_get)
def __eq__(self, *args): return _Xdmf.XdmfTopologyType___eq__(self, *args)
def __ne__(self, *args): return _Xdmf.XdmfTopologyType___ne__(self, *args)
__swig_destroy__ = _Xdmf.delete_XdmfTopologyType
__del__ = lambda self : None;
XdmfTopologyType_swigregister = _Xdmf.XdmfTopologyType_swigregister
XdmfTopologyType_swigregister(XdmfTopologyType)
cvar = _Xdmf.cvar
XdmfTopologyType.NoTopology = _Xdmf.cvar.XdmfTopologyType_NoTopology
XdmfTopologyType.Polyvertex = _Xdmf.cvar.XdmfTopologyType_Polyvertex
XdmfTopologyType.Polyline = _Xdmf.cvar.XdmfTopologyType_Polyline
......@@ -276,20 +378,21 @@ XdmfTopologyType.ThreeDSMesh = _Xdmf.cvar.XdmfTopologyType_ThreeDSMesh
XdmfTopologyType.ThreeDRectMesh = _Xdmf.cvar.XdmfTopologyType_ThreeDRectMesh
XdmfTopologyType.ThreeDCoRectMesh = _Xdmf.cvar.XdmfTopologyType_ThreeDCoRectMesh
class XdmfTopology(XdmfObject):
class XdmfTopology(XdmfItem):
__swig_setmethods__ = {}
for _s in [XdmfObject]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{}))
for _s in [XdmfItem]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{}))
__setattr__ = lambda self, name, value: _swig_setattr(self, XdmfTopology, name, value)
__swig_getmethods__ = {}
for _s in [XdmfObject]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{}))
for _s in [XdmfItem]: __swig_getmethods__.update(getattr(_s,'__swig_getmethods__',{}))
__getattr__ = lambda self, name: _swig_getattr(self, XdmfTopology, name)
def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined")
__repr__ = _swig_repr
__swig_getmethods__["New"] = lambda x: _Xdmf.XdmfTopology_New
if _newclass:New = staticmethod(_Xdmf.XdmfTopology_New)
def getXdmfTopologyType(self): return _Xdmf.XdmfTopology_getXdmfTopologyType(self)
def getTopologyType(self): return _Xdmf.XdmfTopology_getTopologyType(self)
def setTopologyType(self, *args): return _Xdmf.XdmfTopology_setTopologyType(self, *args)
def getTopologyTypeAsString(self): return _Xdmf.XdmfTopology_getTopologyTypeAsString(self)
def getNodesPerElement(self): return _Xdmf.XdmfTopology_getNodesPerElement(self)
def printSelf(self): return _Xdmf.XdmfTopology_printSelf(self)
XdmfTopology_swigregister = _Xdmf.XdmfTopology_swigregister
XdmfTopology_swigregister(XdmfTopology)
......
......@@ -8,9 +8,9 @@
#ifndef XDMFATTRIBUTE_HPP_
#define XDMFATTRIBUTE_HPP_
#include "XdmfObject.hpp"
#include "XdmfItem.hpp"
class XdmfAttribute : public XdmfObject {
class XdmfAttribute : public XdmfItem {
XdmfNewMacro(XdmfAttribute);
......
......@@ -7,7 +7,19 @@
#include "XdmfGeometry.hpp"
XdmfGeometry::XdmfGeometry()
// Supported XdmfGeometryTypes
const XdmfGeometryType XdmfGeometryType::NoGeometry("NONE", 0);
const XdmfGeometryType XdmfGeometryType::XYZ("XYZ", 3);
const XdmfGeometryType XdmfGeometryType::XY("XY", 2);
const XdmfGeometryType XdmfGeometryType::X_Y_Z("X_Y_Z", 3);
const XdmfGeometryType XdmfGeometryType::X_Y("X_Y", 2);
const XdmfGeometryType XdmfGeometryType::VXVYVZ("VXVYVZ", 3);
const XdmfGeometryType XdmfGeometryType::Origin_DXDYDZ("ORIGIN_DXDYDZ", 3);
const XdmfGeometryType XdmfGeometryType::VXVY("VXVY", 2);
const XdmfGeometryType XdmfGeometryType::Origin_DXDY("ORIGIN_DXDY", 2);
XdmfGeometry::XdmfGeometry() :
mGeometryType(&XdmfGeometryType::NoGeometry)
{
std::cout << "Created Geometry " << this << std::endl;
}
......@@ -17,6 +29,27 @@ XdmfGeometry::~XdmfGeometry()
std::cout << "Deleted Geometry " << this << std::endl;
}
const XdmfGeometryType& XdmfGeometry::getGeometryType() const
{
return *mGeometryType;
}
void XdmfGeometry::setGeometryType(const XdmfGeometryType& geomType)
{
mGeometryType = &geomType;
return;
}
const std::string XdmfGeometry::getGeometryTypeAsString() const
{
return mGeometryType->name;
}
const int XdmfGeometry::getDimensions() const
{
return mGeometryType->dimensions;
}
const std::string XdmfGeometry::printSelf() const
{
return "XdmfGeometry";
......
......@@ -8,13 +8,102 @@
#ifndef XDMFGEOMETRY_HPP_
#define XDMFGEOMETRY_HPP_
#include "XdmfObject.hpp"
#include "XdmfItem.hpp"
class XdmfGeometry : public XdmfObject {
class XdmfGeometryType {
public:
const int dimensions;
const std::string name;
// Supported Xdmf Geometry Types
static const XdmfGeometryType NoGeometry;
static const XdmfGeometryType XYZ;
static const XdmfGeometryType XY;
static const XdmfGeometryType X_Y_Z;
static const XdmfGeometryType X_Y;
static const XdmfGeometryType VXVYVZ;
static const XdmfGeometryType Origin_DXDYDZ;
static const XdmfGeometryType VXVY;
static const XdmfGeometryType Origin_DXDY;
/*
* Compare two XdmfGeometry types for equality. Each geometry type has a single static instance meaning that
* equality can be determined by determining if they have the same pointer value.
*
* @param an XdmfGeometryType to compare equality to.
* @return true iff the XdmfGeometryTypes are equal.
*/
bool operator==(const XdmfGeometryType& top) const
{
return (this == &top) ? true : false;
}
/**
* Compare two XdmfGeometry types for inequality. Each geometry type has a single static instance meaning that
* equality can be determined by determining if they have the same pointer value.
*
* @param XdmfGeometryType to compare inequality to.
* @return true iff the XdmfGeometryTypes are not equal.
*/
bool operator!=(const XdmfGeometryType& top) const
{
return (this != &top) ? true : false;
}
protected:
/**
* Protected constructor for XdmfGeometryType. The constructor is protected because all geometry types supported
* by Xdmf should be accessed through static public instances of XdmfGeometryType - i.e. XdmfGeometryType::XYZ.
*/
XdmfGeometryType(const std::string& name, const int& dimensions) :
name(name),
dimensions(dimensions)
{};
private:
//XdmfTopologyType(const XdmfTopologyType&); // Not implemented.
//void operator=(const XdmfTopologyType&); // Not implemented.
};
class XdmfGeometry : public XdmfItem {
public:
XdmfNewMacro(XdmfGeometry);
/**
* Get the XdmfGeometryType associated with this Geometry.
*
* @return XdmfGeometryType.
*/
const XdmfGeometryType& getGeometryType() const;
/**
* Set the XdmfGeometryType associated with this Geometry.
*
* @param XdmfGeometryType to set.
*/
void setGeometryType(const XdmfGeometryType&);
/**
* Get the name of the GeometryType associated with this Geometry.
*
* @return std::string containing name of the GeometryType.
*/
const std::string getGeometryTypeAsString() const;
/**
* Get the number of dimensions for this Geometry.
*
* @return int giving number of dimensions: i.e. XY = 2, XYZ = 3.
*/
const int getDimensions() const;
virtual const std::string printSelf() const;
protected:
......@@ -24,15 +113,11 @@ protected:
private:
class Delete
{
public:
void operator()(XdmfGeometry * p) { delete p; }
};
XdmfGeometry(const XdmfGeometry&); // Not implemented.
void operator=(const XdmfGeometry&); // Not implemented.
const XdmfGeometryType * mGeometryType;
};
#endif /* XDMFGEOMETRY_HPP_ */
......@@ -9,11 +9,11 @@
#include "XdmfGeometry.hpp"
#include "XdmfTopology.hpp"
XdmfGrid::XdmfGrid()
XdmfGrid::XdmfGrid() :
mGeometry(XdmfGeometry::New()),
mTopology(XdmfTopology::New())
{
std::cout << "Created Grid " << this << std::endl;
mGeometry = XdmfGeometry::New();
mTopology = XdmfTopology::New();
}
XdmfGrid::~XdmfGrid()
......
......@@ -6,16 +6,15 @@
// Forward Declarations
class XdmfAttribute;
class XdmfAttributeVector;
class XdmfGeometry;
class XdmfTopology;
class XdmfVisitor;
// Includes
#include "XdmfObject.hpp"
#include "XdmfItem.hpp"
#include <vector>
class XdmfGrid : public XdmfObject {
class XdmfGrid : public XdmfItem {
public:
......@@ -31,6 +30,8 @@ public:
// Set the XdmfTopology for this grid
XdmfSetValueMacro(Topology, boost::shared_ptr<XdmfTopology>);
//virtual void write(XdmfVisitor&) const;
virtual const std::string printSelf() const;
protected:
......
#include "XdmfItem.hpp"
XdmfItem::XdmfItem()
{
}
XdmfItem::~XdmfItem()
{
}
/**
* An XdmfItem replaces the XdmfElement class in the previous version of Xdmf. An XdmfElement represents and item that can be
* visited by an XdmfLightDataVisitor and have it's contents added to an XdmfFile. These include XdmfGrids, XdmfSets,
* XdmfTopologies, etc.
*
* This is an abstract base class.
*/
#ifndef XDMFITEM_HPP_
#define XDMFITEM_HPP_
class XdmfVisitor;
// Includes
#include "XdmfObject.hpp"
class XdmfItem : public XdmfObject {
public:
//virtual const std::string printSelf() const = 0;
//virtual void write(XdmfVisitor&) const = 0;
protected:
XdmfItem();
virtual ~XdmfItem();
private:
//XdmfItem(const XdmfItem&); // Not implemented.
//void operator=(const XdmfItem&); // Not implemented.
};
#endif /* XDMFITEM_HPP_ */
......@@ -36,8 +36,7 @@ class XdmfObject {
public:
XdmfNewMacro(XdmfObject);
virtual const std::string printSelf() const;
virtual const std::string printSelf() const = 0;
protected:
......
......@@ -2686,19 +2686,24 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags)
/* -------- TYPES TABLE (BEGIN) -------- */
#define SWIGTYPE_p_XdmfGeometry swig_types[0]
#define SWIGTYPE_p_XdmfGrid swig_types[1]
#define SWIGTYPE_p_XdmfObject swig_types[2]
#define SWIGTYPE_p_XdmfTopology swig_types[3]
#define SWIGTYPE_p_XdmfTopologyType swig_types[4]
#define SWIGTYPE_p_boost__shared_ptrT_XdmfGeometry_t swig_types[5]
#define SWIGTYPE_p_boost__shared_ptrT_XdmfGrid_t swig_types[6]
#define SWIGTYPE_p_boost__shared_ptrT_XdmfObject_t swig_types[7]
#define SWIGTYPE_p_boost__shared_ptrT_XdmfTopology_t swig_types[8]
#define SWIGTYPE_p_char swig_types[9]
#define SWIGTYPE_p_std__invalid_argument swig_types[10]
#define SWIGTYPE_p_swig__SwigPyIterator swig_types[11]
static swig_type_info *swig_types[13];
static swig_module_info swig_module = {swig_types, 12, 0, 0, 0, 0};
#define SWIGTYPE_p_XdmfGeometryType swig_types[1]
#define SWIGTYPE_p_XdmfGrid swig_types[2]
#define SWIGTYPE_p_XdmfItem swig_types[3]
#define SWIGTYPE_p_XdmfObject swig_types[4]
#define SWIGTYPE_p_XdmfTopology swig_types[5]
#define SWIGTYPE_p_XdmfTopologyType swig_types[6]
#define SWIGTYPE_p_XdmfVisitor swig_types[7]
#define SWIGTYPE_p_boost__shared_ptrT_XdmfGeometry_t swig_types[8]
#define SWIGTYPE_p_boost__shared_ptrT_XdmfGrid_t swig_types[9]
#define SWIGTYPE_p_boost__shared_ptrT_XdmfItem_t swig_types[10]
#define SWIGTYPE_p_boost__shared_ptrT_XdmfObject_t swig_types[11]
#define SWIGTYPE_p_boost__shared_ptrT_XdmfTopology_t swig_types[12]
#define SWIGTYPE_p_boost__shared_ptrT_XdmfVisitor_t swig_types[13]
#define SWIGTYPE_p_char swig_types[14]
#define SWIGTYPE_p_std__invalid_argument swig_types[15]
#define SWIGTYPE_p_swig__SwigPyIterator swig_types[16]
static swig_type_info *swig_types[18];
static swig_module_info swig_module = {swig_types, 17, 0, 0, 0, 0};
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
......@@ -3188,18 +3193,20 @@ SWIG_From_std_string (const std::string& s)
}
#include <XdmfGeometry.hpp>
#include <XdmfGrid.hpp>
#include <XdmfObject.hpp>
#include <XdmfTopology.hpp>
SWIGINTERNINLINE PyObject *
SWIG_From_int (int value)
{
return SWIG_From_long (value);
}
#include <XdmfGeometry.hpp>
#include <XdmfGrid.hpp>
#include <XdmfItem.hpp>
#include <XdmfObject.hpp>
#include <XdmfTopology.hpp>
#include <XdmfVisitor.hpp>
#ifdef __cplusplus
extern "C" {
#endif
......@@ -4125,6 +4132,105 @@ fail:
}
SWIGINTERN PyObject *_wrap_XdmfGeometryPtr_getGeometryType(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
boost::shared_ptr< XdmfGeometry > *arg1 = (boost::shared_ptr< XdmfGeometry > *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
XdmfGeometryType *result = 0 ;
if (!PyArg_ParseTuple(args,(char *)"O:XdmfGeometryPtr_getGeometryType",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_boost__shared_ptrT_XdmfGeometry_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "XdmfGeometryPtr_getGeometryType" "', argument " "1"" of type '" "boost::shared_ptr< XdmfGeometry > const *""'");
}
arg1 = reinterpret_cast< boost::shared_ptr< XdmfGeometry > * >(argp1);
result = (XdmfGeometryType *) &(*arg1)->getGeometryType();
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_XdmfGeometryType, 0 | 0 );
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_XdmfGeometryPtr_setGeometryType(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
boost::shared_ptr< XdmfGeometry > *arg1 = (boost::shared_ptr< XdmfGeometry > *) 0 ;
XdmfGeometryType *arg2 = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 = 0 ;
int res2 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
if (!PyArg_ParseTuple(args,(char *)"OO:XdmfGeometryPtr_setGeometryType",&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_boost__shared_ptrT_XdmfGeometry_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "XdmfGeometryPtr_setGeometryType" "', argument " "1"" of type '" "boost::shared_ptr< XdmfGeometry > *""'");
}
arg1 = reinterpret_cast< boost::shared_ptr< XdmfGeometry > * >(argp1);
res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_XdmfGeometryType, 0 | 0);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "XdmfGeometryPtr_setGeometryType" "', argument " "2"" of type '" "XdmfGeometryType const &""'");
}
if (!argp2) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "XdmfGeometryPtr_setGeometryType" "', argument " "2"" of type '" "XdmfGeometryType const &""'");
}
arg2 = reinterpret_cast< XdmfGeometryType * >(argp2);
(*arg1)->setGeometry