Commit 259e3eba authored by Kenneth Leiter's avatar Kenneth Leiter

ENH: Remove XdmfGrid inheritance from XdmfGridCollection. If there is a need...

ENH: Remove XdmfGrid inheritance from XdmfGridCollection.  If there is a need for Sets/Attributes at the "global" collection level then we can deal with it in the future.
parent 16a914c6
......@@ -14,7 +14,7 @@ class XdmfGridCollection;
* XdmfDomain is the top XdmfItem in an Xdmf structure. It can store a number of grids and
* provides methods to insert, retrieve, and remove these grids.
*/
class XdmfDomain : public virtual XdmfItem {
class XdmfDomain : public XdmfItem {
public:
......
......@@ -20,7 +20,7 @@ class XdmfTopology;
* into the XdmfGrid to specify values attached at various parts of the mesh. XdmfSets can be inserted in the XdmfGrid
* to specify collections of mesh elements.
*/
class XdmfGrid : public virtual XdmfItem {
class XdmfGrid : public XdmfItem {
public:
......@@ -265,19 +265,18 @@ protected:
XdmfGrid();
virtual void populateItem(const std::map<std::string, std::string> & itemProperties, std::vector<boost::shared_ptr<XdmfItem> > & childItems, const XdmfCoreReader * const reader);
boost::shared_ptr<XdmfGeometry> mGeometry;
std::string mName;
boost::shared_ptr<XdmfTopology> mTopology;
private:
XdmfGrid(const XdmfGrid & grid); // Not implemented.
void operator=(const XdmfGrid & grid); // Not implemented.
std::vector<boost::shared_ptr<XdmfAttribute> > mAttributes;
boost::shared_ptr<XdmfGeometry> mGeometry;
boost::shared_ptr<XdmfMap> mMap;
std::string mName;
std::vector<boost::shared_ptr<XdmfSet> > mSets;
boost::shared_ptr<XdmfTime> mTime;
boost::shared_ptr<XdmfTopology> mTopology;
};
#endif /* XDMFGRID_HPP_ */
......@@ -15,12 +15,9 @@ boost::shared_ptr<XdmfGridCollection> XdmfGridCollection::New()
};
XdmfGridCollection::XdmfGridCollection() :
XdmfGrid(),
mCollectionType(XdmfGridCollectionType::NoCollectionType())
mCollectionType(XdmfGridCollectionType::NoCollectionType()),
mName("Collection")
{
mGeometry = boost::shared_ptr<XdmfGeometry>();
mName = "Collection";
mTopology = boost::shared_ptr<XdmfTopology>();
}
XdmfGridCollection::~XdmfGridCollection()
......@@ -43,6 +40,11 @@ std::string XdmfGridCollection::getItemTag() const
return ItemTag;
}
std::string XdmfGridCollection::getName() const
{
return mName;
}
boost::shared_ptr<const XdmfGridCollectionType> XdmfGridCollection::getType() const
{
return mCollectionType;
......@@ -51,17 +53,24 @@ boost::shared_ptr<const XdmfGridCollectionType> XdmfGridCollection::getType() co
void XdmfGridCollection::populateItem(const std::map<std::string, std::string> & itemProperties, std::vector<boost::shared_ptr<XdmfItem> > & childItems, const XdmfCoreReader * const reader)
{
mCollectionType = XdmfGridCollectionType::New(itemProperties);
std::map<std::string, std::string>::const_iterator name = itemProperties.find("Name");
if(name != itemProperties.end())
{
mName = name->second;
}
else
{
mName = "";
}
XdmfDomain::populateItem(itemProperties, childItems, reader);
XdmfGrid::populateItem(itemProperties, childItems, reader);
}
void XdmfGridCollection::setType(const boost::shared_ptr<const XdmfGridCollectionType> collectionType)
void XdmfGridCollection::setName(const std::string & name)
{
mCollectionType = collectionType;
mName = name;
}
void XdmfGridCollection::traverse(const boost::shared_ptr<XdmfBaseVisitor> visitor)
void XdmfGridCollection::setType(const boost::shared_ptr<const XdmfGridCollectionType> collectionType)
{
XdmfGrid::traverse(visitor);
XdmfDomain::traverse(visitor);
mCollectionType = collectionType;
}
......@@ -6,7 +6,6 @@ class XdmfGridCollectionType;
// Includes
#include "XdmfDomain.hpp"
#include "XdmfGrid.hpp"
/**
* @brief A spatial or temporal collection of XdmfGrids.
......@@ -16,8 +15,7 @@ class XdmfGridCollectionType;
*
* It is valid to nest collections. A spatial collection within a temporal collection is commonly used.
*/
class XdmfGridCollection : public XdmfGrid,
public XdmfDomain {
class XdmfGridCollection : public XdmfDomain {
public:
......@@ -30,13 +28,20 @@ public:
virtual ~XdmfGridCollection();
LOKI_DEFINE_VISITABLE(XdmfGridCollection, XdmfGrid)
LOKI_DEFINE_VISITABLE(XdmfGridCollection, XdmfDomain)
static const std::string ItemTag;
std::map<std::string, std::string> getItemProperties() const;
std::string getItemTag() const;
/**
* Get the name of the grid collection.
*
* @return the name of the grid collection.
*/
std::string getName() const;
/**
* Get the XdmfGridCollectionType associated with this grid collection.
*
......@@ -44,8 +49,12 @@ public:
*/
boost::shared_ptr<const XdmfGridCollectionType> getType() const;
using XdmfDomain::insert;
using XdmfGrid::insert;
/**
* Set the name of the grid collection.
*
* @param name of the grid collection to set.
*/
void setName(const std::string & name);
/**
* Set the XdmfGridCollectionType associated with this grid collection.
......@@ -54,8 +63,6 @@ public:
*/
void setType(const boost::shared_ptr<const XdmfGridCollectionType> collectionType);
void traverse(const boost::shared_ptr<XdmfBaseVisitor> visitor);
protected:
XdmfGridCollection();
......@@ -67,6 +74,7 @@ private:
void operator=(const XdmfGridCollection & collection); // Not implemented.
boost::shared_ptr<const XdmfGridCollectionType> mCollectionType;
std::string mName;
};
#endif /* XDMFGRID_HPP_ */
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