XdmfDataItem.cpp 1.17 KB
Newer Older
1
2
3
4
5
6
7
/*
 * XdmfDataItem.cpp
 *
 *  Created on: Jan 29, 2010
 *      Author: kleiter
 */

Ken Leiter (Civ ARL/CISD) kleiter's avatar
ENH:    
Ken Leiter (Civ ARL/CISD) kleiter committed
8
#include "XdmfArray.hpp"
9
10
11
#include "XdmfDataItem.hpp"

XdmfDataItem::XdmfDataItem() :
Ken Leiter (Civ ARL/CISD) kleiter's avatar
ENH:    
Ken Leiter (Civ ARL/CISD) kleiter committed
12
	mArray(XdmfArray::New())
13
14
15
16
17
18
19
20
21
{
	std::cout << "Created DataItem " << this << std::endl;
}

XdmfDataItem::~XdmfDataItem()
{
	std::cout << "Deleted DataItem " << this << std::endl;
}

22
boost::shared_ptr<XdmfArray> XdmfDataItem::getArray()
23
{
24
	return boost::const_pointer_cast<XdmfArray>(static_cast<const XdmfDataItem &>(*this).getArray());
25
26
}

27
boost::shared_ptr<const XdmfArray> XdmfDataItem::getArray() const
28
{
29
	return mArray;
30
31
}

32
33
34
35
36
37
38
39
40
41
42
void XdmfDataItem::populateItem(const std::map<std::string, std::string> & itemProperties, std::vector<boost::shared_ptr<XdmfItem> > & childItems)
{
	for(std::vector<boost::shared_ptr<XdmfItem> >::const_iterator iter = childItems.begin(); iter != childItems.end(); ++iter)
	{
		if(boost::shared_ptr<XdmfArray> array = boost::shared_dynamic_cast<XdmfArray>(*iter))
		{
			this->setArray(array);
		}
	}
}

43
void XdmfDataItem::setArray(const boost::shared_ptr<XdmfArray> array)
44
{
45
	mArray = array;
46
}
47

48
void XdmfDataItem::traverse(const boost::shared_ptr<XdmfBaseVisitor> visitor) const
49
{
50
	mArray->accept(visitor);
51
}