Commit 67bf3fee authored by Kenneth Leiter's avatar Kenneth Leiter

ENH: Revert back to XdmfGridCollection inheriting from XdmfGrid - we want the...

ENH: Revert back to XdmfGridCollection inheriting from XdmfGrid - we want the flexibility to be able to add global sets (might be necessary for dft work).
parent 15b20fb9
......@@ -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 XdmfItem {
class XdmfDomain : public virtual XdmfItem {
public:
......
......@@ -13,14 +13,14 @@ class XdmfTopology;
#include "XdmfItem.hpp"
/**
* @brief A mesh that consists of elements, points, and values attached to the mesh.
* @brief A mesh containing elements, points, and fields attached to the mesh.
*
* XdmfGrid represents a mesh. It is required to contain two other Xdmf data structures, an XdmfGeometry
* that stores point locations and an XdmfTopology that store connectivity information. XdmfAttributes can be inserted
* into the XdmfGrid to specify values attached at various parts of the mesh. XdmfSets can be inserted in the XdmfGrid
* into the XdmfGrid to specify fields centered on various parts of the mesh. XdmfSets can be inserted into XdmfGrids
* to specify collections of mesh elements.
*/
class XdmfGrid : public XdmfItem {
class XdmfGrid : public virtual XdmfItem {
public:
......@@ -265,6 +265,8 @@ protected:
XdmfGrid();
virtual void populateItem(const std::map<std::string, std::string> & itemProperties, std::vector<boost::shared_ptr<XdmfItem> > & childItems, const XdmfCoreReader * const reader);
std::string mName;
private:
XdmfGrid(const XdmfGrid & grid); // Not implemented.
......@@ -273,7 +275,6 @@ private:
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;
......
......@@ -15,9 +15,10 @@ boost::shared_ptr<XdmfGridCollection> XdmfGridCollection::New()
};
XdmfGridCollection::XdmfGridCollection() :
mCollectionType(XdmfGridCollectionType::NoCollectionType()),
mName("Collection")
XdmfGrid(),
mCollectionType(XdmfGridCollectionType::NoCollectionType())
{
mName = "Collection";
}
XdmfGridCollection::~XdmfGridCollection()
......@@ -40,11 +41,6 @@ std::string XdmfGridCollection::getItemTag() const
return ItemTag;
}
std::string XdmfGridCollection::getName() const
{
return mName;
}
boost::shared_ptr<const XdmfGridCollectionType> XdmfGridCollection::getType() const
{
return mCollectionType;
......@@ -53,24 +49,17 @@ 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::setName(const std::string & name)
void XdmfGridCollection::setType(const boost::shared_ptr<const XdmfGridCollectionType> collectionType)
{
mName = name;
mCollectionType = collectionType;
}
void XdmfGridCollection::setType(const boost::shared_ptr<const XdmfGridCollectionType> collectionType)
void XdmfGridCollection::traverse(const boost::shared_ptr<XdmfBaseVisitor> visitor)
{
mCollectionType = collectionType;
XdmfGrid::traverse(visitor);
XdmfDomain::traverse(visitor);
}
......@@ -6,6 +6,7 @@ class XdmfGridCollectionType;
// Includes
#include "XdmfDomain.hpp"
#include "XdmfGrid.hpp"
/**
* @brief A spatial or temporal collection of XdmfGrids.
......@@ -15,7 +16,8 @@ class XdmfGridCollectionType;
*
* It is valid to nest collections. A spatial collection within a temporal collection is commonly used.
*/
class XdmfGridCollection : public XdmfDomain {
class XdmfGridCollection : public XdmfGrid,
public XdmfDomain {
public:
......@@ -28,20 +30,13 @@ public:
virtual ~XdmfGridCollection();
LOKI_DEFINE_VISITABLE(XdmfGridCollection, XdmfDomain)
LOKI_DEFINE_VISITABLE(XdmfGridCollection, XdmfGrid)
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.
*
......@@ -49,12 +44,8 @@ public:
*/
boost::shared_ptr<const XdmfGridCollectionType> getType() const;
/**
* Set the name of the grid collection.
*
* @param name of the grid collection to set.
*/
void setName(const std::string & name);
using XdmfDomain::insert;
using XdmfGrid::insert;
/**
* Set the XdmfGridCollectionType associated with this grid collection.
......@@ -63,6 +54,8 @@ public:
*/
void setType(const boost::shared_ptr<const XdmfGridCollectionType> collectionType);
void traverse(const boost::shared_ptr<XdmfBaseVisitor> visitor);
protected:
XdmfGridCollection();
......@@ -74,7 +67,6 @@ 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