Commit d9c8a53c authored by Ken Leiter (Civ's avatar Ken Leiter (Civ

ENH: Start separating XdmfItem properties from their respective classes - XdmfGeometryType.

parent 282d5e4f
......@@ -24,6 +24,7 @@ set(XdmfSources
XdmfAttributeCenter
XdmfAttributeType
XdmfGeometry
XdmfGeometryType
XdmfGrid
XdmfItem
XdmfObject
......
......@@ -28,6 +28,7 @@ namespace boost {
#include <XdmfAttributeCenter.hpp>
#include <XdmfAttributeType.hpp>
#include <XdmfGeometry.hpp>
#include <XdmfGeometryType.hpp>
#include <XdmfGrid.hpp>
#include <XdmfItem.hpp>
#include <XdmfObject.hpp>
......@@ -44,5 +45,6 @@ namespace boost {
%include XdmfAttributeCenter.hpp
%include XdmfAttributeType.hpp
%include XdmfGeometry.hpp
%include XdmfGeometryType.hpp
%include XdmfGrid.hpp
%include XdmfTopology.hpp
......@@ -426,6 +426,30 @@ def XdmfAttributeType_GlobalId():
return _Xdmf.XdmfAttributeType_GlobalId()
XdmfAttributeType_GlobalId = _Xdmf.XdmfAttributeType_GlobalId
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)
def write(self, *args): return _Xdmf.XdmfGeometry_write(self, *args)
XdmfGeometry_swigregister = _Xdmf.XdmfGeometry_swigregister
XdmfGeometry_swigregister(XdmfGeometry)
def XdmfGeometry_New():
return _Xdmf.XdmfGeometry_New()
XdmfGeometry_New = _Xdmf.XdmfGeometry_New
class XdmfGeometryType(_object):
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, XdmfGeometryType, name, value)
......@@ -499,30 +523,6 @@ def XdmfGeometryType_Origin_DXDY():
return _Xdmf.XdmfGeometryType_Origin_DXDY()
XdmfGeometryType_Origin_DXDY = _Xdmf.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)
def write(self, *args): return _Xdmf.XdmfGeometry_write(self, *args)
XdmfGeometry_swigregister = _Xdmf.XdmfGeometry_swigregister
XdmfGeometry_swigregister(XdmfGeometry)
def XdmfGeometry_New():
return _Xdmf.XdmfGeometry_New()
XdmfGeometry_New = _Xdmf.XdmfGeometry_New
class XdmfGrid(XdmfItem):
__swig_setmethods__ = {}
for _s in [XdmfItem]: __swig_setmethods__.update(getattr(_s,'__swig_setmethods__',{}))
......
......@@ -9,9 +9,9 @@
#include "XdmfVisitor.hpp"
XdmfAttribute::XdmfAttribute() :
mName(""),
mAttributeType(XdmfAttributeType::NoAttributeType()),
mAttributeCenter(XdmfAttributeCenter::Grid())
mName(""),
mAttributeType(XdmfAttributeType::NoAttributeType()),
mAttributeCenter(XdmfAttributeCenter::Grid())
{
std::cout << "Created Attribute " << this << std::endl;
}
......
......@@ -9,8 +9,8 @@
#define XDMFATTRIBUTE_HPP_
#include "XdmfItem.hpp"
#include "XdmfAttributeType.hpp"
#include "XdmfAttributeCenter.hpp"
#include "XdmfAttributeType.hpp"
class XdmfAttribute : public XdmfItem {
......@@ -44,7 +44,7 @@ public:
*
* @param XdmfAttributeType to set.
*/
void setAttributeType(const XdmfAttributeType&);
void setAttributeType(const XdmfAttributeType& attributeType);
/**
* Get the name of the AttributeType associated with this Attribute.
......@@ -65,7 +65,7 @@ public:
*
* @param XdmfAttributeCenter to set.
*/
void setAttributeCenter(const XdmfAttributeCenter&);
void setAttributeCenter(const XdmfAttributeCenter& attributeCenter);
/**
* Get the name of the AttributeCenter associated with this Attribute.
......
......@@ -44,8 +44,8 @@ public:
*/
bool operator!=(const XdmfAttributeCenter& attributeCenter) const;
XdmfAttributeCenter(const XdmfAttributeCenter&);
XdmfAttributeCenter& operator=(const XdmfAttributeCenter&);
XdmfAttributeCenter(const XdmfAttributeCenter& attributeCenter);
XdmfAttributeCenter& operator=(const XdmfAttributeCenter& attributeCenter);
protected:
......
......@@ -46,8 +46,8 @@ public:
*/
bool operator!=(const XdmfAttributeType& top) const;
XdmfAttributeType(const XdmfAttributeType&);
XdmfAttributeType& operator=(const XdmfAttributeType&);
XdmfAttributeType(const XdmfAttributeType& attributeType);
XdmfAttributeType& operator=(const XdmfAttributeType& attributeType);
protected:
......
......@@ -8,70 +8,6 @@
#include "XdmfGeometry.hpp"
#include "XdmfVisitor.hpp"
// Supported XdmfGeometryTypes
XdmfGeometryType XdmfGeometryType::NoGeometryType()
{
return XdmfGeometryType("NONE", 0);
}
XdmfGeometryType XdmfGeometryType::XYZ()
{
return XdmfGeometryType("XYZ", 3);
}
XdmfGeometryType XdmfGeometryType::XY()
{
return XdmfGeometryType("XY", 2);
}
XdmfGeometryType XdmfGeometryType::X_Y_Z()
{
return XdmfGeometryType("X_Y_Z", 3);
}
XdmfGeometryType XdmfGeometryType::X_Y()
{
return XdmfGeometryType("X_Y", 2);
}
XdmfGeometryType XdmfGeometryType::VXVYVZ()
{
return XdmfGeometryType("VXVYVZ", 3);
}
XdmfGeometryType XdmfGeometryType::Origin_DXDYDZ()
{
return XdmfGeometryType("ORIGIN_DXDYDZ", 3);
}
XdmfGeometryType XdmfGeometryType::VXVY()
{
return XdmfGeometryType("VXVY", 2);
}
XdmfGeometryType XdmfGeometryType::Origin_DXDY()
{
return XdmfGeometryType("ORIGIN_DXDY", 2);
}
XdmfGeometryType::XdmfGeometryType(const XdmfGeometryType& geomType):
mDimensions(geomType.mDimensions),
mName(geomType.mName)
{
}
XdmfGeometryType& XdmfGeometryType::operator=(const XdmfGeometryType& geomType)
{
if(this != &geomType)
{
mDimensions = geomType.mDimensions;
mName = geomType.mName;
}
return *this;
}
int XdmfGeometryType::getDimensions() const
{
return mDimensions;
}
std::string XdmfGeometryType::getName() const
{
return mName;
}
XdmfGeometry::XdmfGeometry() :
mGeometryType(XdmfGeometryType::NoGeometryType())
{
......
......@@ -10,77 +10,7 @@
// Includes
#include "XdmfItem.hpp"
class XdmfGeometryType {
public:
// Supported Xdmf Geometry Types
static XdmfGeometryType NoGeometryType();
static XdmfGeometryType XYZ();
static XdmfGeometryType XY();
static XdmfGeometryType X_Y_Z();
static XdmfGeometryType X_Y();
static XdmfGeometryType VXVYVZ();
static XdmfGeometryType Origin_DXDYDZ();
static XdmfGeometryType VXVY();
static XdmfGeometryType Origin_DXDY();
/**
* Get the dimensions of this geometry type - i.e. XYZ = 3.
*
* @return an int containing number of dimensions.
*/
int getDimensions() const;
/**
* Get the name of this geometry type
*
* @return a string containing the name.
*/
std::string getName() const;
/*
* Compare two XdmfGeometry types for equality.
*
* @param an XdmfGeometryType to compare equality to.
* @return true iff the XdmfGeometryTypes are equal.
*/
bool operator==(const XdmfGeometryType& top) const
{
return mDimensions == top.mDimensions && mName.compare(top.mName) == 0;
}
/**
* Compare two XdmfGeometry types for inequality.
*
* @param XdmfGeometryType to compare inequality to.
* @return true iff the XdmfGeometryTypes are not equal.
*/
bool operator!=(const XdmfGeometryType& top) const
{
return !this->operator ==(top);
}
XdmfGeometryType(const XdmfGeometryType&);
XdmfGeometryType& operator=(const XdmfGeometryType&);
protected:
/**
* Protected constructor for XdmfGeometryType. The constructor is protected because all geometry types supported
* by Xdmf should be accessed through more specific static methods that construct XdmfGeometryTypes - i.e. XdmfGeometryType::XYZ().
*/
XdmfGeometryType(const std::string& name, const int& dimensions) :
mName(name),
mDimensions(dimensions)
{};
private:
int mDimensions;
std::string mName;
};
#include "XdmfGeometryType.hpp"
class XdmfGeometry : public XdmfItem {
......
/*
* XdmfGeometryType.cpp
*
* Created on: Jan 29, 2010
* Author: kleiter
*/
#include "XdmfGeometryType.hpp"
// Supported XdmfGeometryTypes
XdmfGeometryType XdmfGeometryType::NoGeometryType()
{
return XdmfGeometryType("NONE", 0);
}
XdmfGeometryType XdmfGeometryType::XYZ()
{
return XdmfGeometryType("XYZ", 3);
}
XdmfGeometryType XdmfGeometryType::XY()
{
return XdmfGeometryType("XY", 2);
}
XdmfGeometryType XdmfGeometryType::X_Y_Z()
{
return XdmfGeometryType("X_Y_Z", 3);
}
XdmfGeometryType XdmfGeometryType::X_Y()
{
return XdmfGeometryType("X_Y", 2);
}
XdmfGeometryType XdmfGeometryType::VXVYVZ()
{
return XdmfGeometryType("VXVYVZ", 3);
}
XdmfGeometryType XdmfGeometryType::Origin_DXDYDZ()
{
return XdmfGeometryType("ORIGIN_DXDYDZ", 3);
}
XdmfGeometryType XdmfGeometryType::VXVY()
{
return XdmfGeometryType("VXVY", 2);
}
XdmfGeometryType XdmfGeometryType::Origin_DXDY()
{
return XdmfGeometryType("ORIGIN_DXDY", 2);
}
XdmfGeometryType::XdmfGeometryType(const XdmfGeometryType& geometryType):
mDimensions(geometryType.mDimensions),
mName(geometryType.mName)
{
}
XdmfGeometryType::XdmfGeometryType(const std::string& name, const int& dimensions) :
mName(name),
mDimensions(dimensions)
{};
XdmfGeometryType& XdmfGeometryType::operator=(const XdmfGeometryType& geometryType)
{
if(this != &geometryType)
{
mDimensions = geometryType.mDimensions;
mName = geometryType.mName;
}
return *this;
}
bool XdmfGeometryType::operator==(const XdmfGeometryType& geometryType) const
{
return mDimensions == geometryType.mDimensions && mName.compare(geometryType.mName) == 0;
}
bool XdmfGeometryType::operator!=(const XdmfGeometryType& geometryType) const
{
return !this->operator==(geometryType);
}
int XdmfGeometryType::getDimensions() const
{
return mDimensions;
}
std::string XdmfGeometryType::getName() const
{
return mName;
}
/*
* XdmfGeometryType.hpp
*
* Created on: Jan 25, 2010
* Author: kleiter
*/
#ifndef XDMFGEOMETRYTYPE_HPP_
#define XDMFGEOMETRYTYPE_HPP_
#include <string>
class XdmfGeometryType {
public:
// Supported Xdmf Geometry Types
static XdmfGeometryType NoGeometryType();
static XdmfGeometryType XYZ();
static XdmfGeometryType XY();
static XdmfGeometryType X_Y_Z();
static XdmfGeometryType X_Y();
static XdmfGeometryType VXVYVZ();
static XdmfGeometryType Origin_DXDYDZ();
static XdmfGeometryType VXVY();
static XdmfGeometryType Origin_DXDY();
/**
* Get the dimensions of this geometry type - i.e. XYZ = 3.
*
* @return an int containing number of dimensions.
*/
int getDimensions() const;
/**
* Get the name of this geometry type
*
* @return a string containing the name.
*/
std::string getName() const;
/*
* Compare two XdmfGeometry types for equality.
*
* @param an XdmfGeometryType to compare equality to.
* @return true iff the XdmfGeometryTypes are equal.
*/
bool operator==(const XdmfGeometryType& geometryType) const;
/**
* Compare two XdmfGeometry types for inequality.
*
* @param XdmfGeometryType to compare inequality to.
* @return true iff the XdmfGeometryTypes are not equal.
*/
bool operator!=(const XdmfGeometryType& geometryType) const;
XdmfGeometryType(const XdmfGeometryType& geometryType);
XdmfGeometryType& operator=(const XdmfGeometryType& geometryType);
protected:
/**
* Protected constructor for XdmfGeometryType. The constructor is protected because all geometry types supported
* by Xdmf should be accessed through more specific static methods that construct XdmfGeometryTypes - i.e. XdmfGeometryType::XYZ().
*/
XdmfGeometryType(const std::string& name, const int& dimensions);
private:
int mDimensions;
std::string mName;
};
#endif /* XDMFATTRIBUTETYPE_HPP_ */
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment