Commit 63991cd1 authored by Kenneth Leiter's avatar Kenneth Leiter
Browse files

ENH: Allow arrays to be attached to XdmfInformation (we use this functionality

in client code to store input parameters).
parent 72f54617
......@@ -21,8 +21,11 @@
/* */
/*****************************************************************************/
#include "XdmfInformation.hpp"
#include "XdmfArray.hpp"
#include "XdmfError.hpp"
#include "XdmfInformation.hpp"
XDMF_CHILDREN_IMPLEMENTATION(XdmfInformation, XdmfArray, Array, Name)
shared_ptr<XdmfInformation>
XdmfInformation::New()
......@@ -113,6 +116,14 @@ XdmfInformation::populateItem(const std::map<std::string, std::string> & itemPro
"XdmfInformation::populateItem");
}
}
for(std::vector<shared_ptr<XdmfItem> >::const_iterator iter =
childItems.begin();
iter != childItems.end();
++iter) {
if(shared_ptr<XdmfArray> array = shared_dynamic_cast<XdmfArray>(*iter)) {
this->insert(array);
}
}
}
void
......@@ -126,3 +137,15 @@ XdmfInformation::setValue(const std::string & value)
{
mValue= value;
}
void
XdmfInformation::traverse(const shared_ptr<XdmfBaseVisitor> visitor)
{
XdmfItem::traverse(visitor);
for(std::vector<shared_ptr<XdmfArray> >::const_iterator iter =
mArrays.begin();
iter != mArrays.end();
++iter) {
(*iter)->accept(visitor);
}
}
......@@ -24,6 +24,9 @@
#ifndef XDMFINFORMATION_HPP_
#define XDMFINFORMATION_HPP_
// Forward declarations
class XdmfArray;
// Includes
#include "XdmfCore.hpp"
#include "XdmfItem.hpp"
......@@ -62,6 +65,7 @@ public:
virtual ~XdmfInformation();
LOKI_DEFINE_VISITABLE(XdmfInformation, XdmfItem);
XDMF_CHILDREN(XdmfArray, Array, Name);
static const std::string ItemTag;
std::map<std::string, std::string> getItemProperties() const;
......@@ -82,6 +86,8 @@ public:
*/
std::string getValue() const;
using XdmfItem::insert;
/**
* Set the key for this information item.
*
......@@ -96,6 +102,8 @@ public:
*/
void setValue(const std::string & value);
virtual void traverse(const shared_ptr<XdmfBaseVisitor> visitor);
protected:
XdmfInformation(const std::string & key = "",
......
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