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; ...@@ -14,7 +14,7 @@ class XdmfGridCollection;
* XdmfDomain is the top XdmfItem in an Xdmf structure. It can store a number of grids and * 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. * provides methods to insert, retrieve, and remove these grids.
*/ */
class XdmfDomain : public XdmfItem { class XdmfDomain : public virtual XdmfItem {
public: public:
......
...@@ -13,14 +13,14 @@ class XdmfTopology; ...@@ -13,14 +13,14 @@ class XdmfTopology;
#include "XdmfItem.hpp" #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 * 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 * 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. * to specify collections of mesh elements.
*/ */
class XdmfGrid : public XdmfItem { class XdmfGrid : public virtual XdmfItem {
public: public:
...@@ -265,6 +265,8 @@ protected: ...@@ -265,6 +265,8 @@ protected:
XdmfGrid(); XdmfGrid();
virtual void populateItem(const std::map<std::string, std::string> & itemProperties, std::vector<boost::shared_ptr<XdmfItem> > & childItems, const XdmfCoreReader * const reader); 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: private:
XdmfGrid(const XdmfGrid & grid); // Not implemented. XdmfGrid(const XdmfGrid & grid); // Not implemented.
...@@ -273,7 +275,6 @@ private: ...@@ -273,7 +275,6 @@ private:
std::vector<boost::shared_ptr<XdmfAttribute> > mAttributes; std::vector<boost::shared_ptr<XdmfAttribute> > mAttributes;
boost::shared_ptr<XdmfGeometry> mGeometry; boost::shared_ptr<XdmfGeometry> mGeometry;
boost::shared_ptr<XdmfMap> mMap; boost::shared_ptr<XdmfMap> mMap;
std::string mName;
std::vector<boost::shared_ptr<XdmfSet> > mSets; std::vector<boost::shared_ptr<XdmfSet> > mSets;
boost::shared_ptr<XdmfTime> mTime; boost::shared_ptr<XdmfTime> mTime;
boost::shared_ptr<XdmfTopology> mTopology; boost::shared_ptr<XdmfTopology> mTopology;
......
...@@ -15,9 +15,10 @@ boost::shared_ptr<XdmfGridCollection> XdmfGridCollection::New() ...@@ -15,9 +15,10 @@ boost::shared_ptr<XdmfGridCollection> XdmfGridCollection::New()
}; };
XdmfGridCollection::XdmfGridCollection() : XdmfGridCollection::XdmfGridCollection() :
mCollectionType(XdmfGridCollectionType::NoCollectionType()), XdmfGrid(),
mName("Collection") mCollectionType(XdmfGridCollectionType::NoCollectionType())
{ {
mName = "Collection";
} }
XdmfGridCollection::~XdmfGridCollection() XdmfGridCollection::~XdmfGridCollection()
...@@ -40,11 +41,6 @@ std::string XdmfGridCollection::getItemTag() const ...@@ -40,11 +41,6 @@ std::string XdmfGridCollection::getItemTag() const
return ItemTag; return ItemTag;
} }
std::string XdmfGridCollection::getName() const
{
return mName;
}
boost::shared_ptr<const XdmfGridCollectionType> XdmfGridCollection::getType() const boost::shared_ptr<const XdmfGridCollectionType> XdmfGridCollection::getType() const
{ {
return mCollectionType; return mCollectionType;
...@@ -53,24 +49,17 @@ boost::shared_ptr<const XdmfGridCollectionType> XdmfGridCollection::getType() co ...@@ -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) 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); 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); 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; ...@@ -6,6 +6,7 @@ class XdmfGridCollectionType;
// Includes // Includes
#include "XdmfDomain.hpp" #include "XdmfDomain.hpp"
#include "XdmfGrid.hpp"
/** /**
* @brief A spatial or temporal collection of XdmfGrids. * @brief A spatial or temporal collection of XdmfGrids.
...@@ -15,7 +16,8 @@ class XdmfGridCollectionType; ...@@ -15,7 +16,8 @@ class XdmfGridCollectionType;
* *
* It is valid to nest collections. A spatial collection within a temporal collection is commonly used. * 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: public:
...@@ -28,20 +30,13 @@ public: ...@@ -28,20 +30,13 @@ public:
virtual ~XdmfGridCollection(); virtual ~XdmfGridCollection();
LOKI_DEFINE_VISITABLE(XdmfGridCollection, XdmfDomain) LOKI_DEFINE_VISITABLE(XdmfGridCollection, XdmfGrid)
static const std::string ItemTag; static const std::string ItemTag;
std::map<std::string, std::string> getItemProperties() const; std::map<std::string, std::string> getItemProperties() const;
std::string getItemTag() 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. * Get the XdmfGridCollectionType associated with this grid collection.
* *
...@@ -49,12 +44,8 @@ public: ...@@ -49,12 +44,8 @@ public:
*/ */
boost::shared_ptr<const XdmfGridCollectionType> getType() const; boost::shared_ptr<const XdmfGridCollectionType> getType() const;
/** using XdmfDomain::insert;
* Set the name of the grid collection. using XdmfGrid::insert;
*
* @param name of the grid collection to set.
*/
void setName(const std::string & name);
/** /**
* Set the XdmfGridCollectionType associated with this grid collection. * Set the XdmfGridCollectionType associated with this grid collection.
...@@ -63,6 +54,8 @@ public: ...@@ -63,6 +54,8 @@ public:
*/ */
void setType(const boost::shared_ptr<const XdmfGridCollectionType> collectionType); void setType(const boost::shared_ptr<const XdmfGridCollectionType> collectionType);
void traverse(const boost::shared_ptr<XdmfBaseVisitor> visitor);
protected: protected:
XdmfGridCollection(); XdmfGridCollection();
...@@ -74,7 +67,6 @@ private: ...@@ -74,7 +67,6 @@ private:
void operator=(const XdmfGridCollection & collection); // Not implemented. void operator=(const XdmfGridCollection & collection); // Not implemented.
boost::shared_ptr<const XdmfGridCollectionType> mCollectionType; boost::shared_ptr<const XdmfGridCollectionType> mCollectionType;
std::string mName;
}; };
#endif /* XDMFGRID_HPP_ */ #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