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

#include "XdmfSet.hpp"
9
#include "XdmfSetType.hpp"
10 11 12 13 14 15 16 17 18 19 20 21 22

XdmfSet::XdmfSet() :
	mSetType(XdmfSetType::NoSetType()),
	mName("")
{
	std::cout << "Created Set " << this << std::endl;
}

XdmfSet::~XdmfSet()
{
	std::cout << "Deleted Set " << this << std::endl;
}

23
const std::string XdmfSet::ItemTag = "Set";
24 25 26 27 28 29

std::string XdmfSet::getName() const
{
	return mName;
}

30
boost::shared_ptr<const XdmfSetType> XdmfSet::getSetType() const
31 32 33 34 35 36 37 38
{
	return mSetType;
}

std::map<std::string, std::string> XdmfSet::getItemProperties() const
{
	std::map<std::string, std::string> setProperties;
	setProperties["Name"] = mName;
39
	mSetType->getProperties(setProperties);
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
	return setProperties;
}

std::string XdmfSet::getItemTag() const
{
	return ItemTag;
}

void XdmfSet::populateItem(const std::map<std::string, std::string> & itemProperties, std::vector<boost::shared_ptr<XdmfItem> > & childItems)
{
	std::map<std::string, std::string>::const_iterator name = itemProperties.find("Name");
	if(name != itemProperties.end())
	{
		mName = name->second;
	}
	else
	{
		assert(false);
	}
	mSetType = XdmfSetType::New(itemProperties);
	XdmfDataItem::populateItem(itemProperties, childItems);
}

void XdmfSet::setName(const std::string & name)
{
	mName= name;
}

68
void XdmfSet::setSetType(const boost::shared_ptr<const XdmfSetType> setType)
69 70 71
{
	mSetType = setType;
}