XdmfGridCollection.cpp 1.8 KB
Newer Older
1 2 3 4 5 6 7 8
/*
 * XdmfGridCollection.cpp
 *
 *  Created on: Jan 25, 2010
 *      Author: kleiter
 */

#include "XdmfGridCollection.hpp"
9
#include "XdmfGridCollectionType.hpp"
10

11 12 13 14 15 16
boost::shared_ptr<XdmfGridCollection> XdmfGridCollection::New()
{
	boost::shared_ptr<XdmfGridCollection> p(new XdmfGridCollection());
	return p;
};

17
XdmfGridCollection::XdmfGridCollection() :
18 19
	mCollectionType(XdmfGridCollectionType::NoCollectionType()),
	mName("Collection")
20 21 22 23 24 25 26
{
}

XdmfGridCollection::~XdmfGridCollection()
{
}

27
const std::string XdmfGridCollection::ItemTag = "Grid";
28 29 30 31 32 33

std::map<std::string, std::string> XdmfGridCollection::getItemProperties() const
{
	std::map<std::string, std::string> collectionProperties;
	collectionProperties["Name"] = mName;
	collectionProperties["GridType"] = "Collection";
34
	mCollectionType->getProperties(collectionProperties);
35 36 37
	return collectionProperties;
}

38
std::string XdmfGridCollection::getItemTag() const
39
{
40
	return ItemTag;
41 42
}

43 44 45 46 47
std::string XdmfGridCollection::getName() const
{
	return mName;
}

48 49 50 51 52
boost::shared_ptr<const XdmfGridCollectionType> XdmfGridCollection::getType() const
{
	return mCollectionType;
}

53
void XdmfGridCollection::populateItem(const std::map<std::string, std::string> & itemProperties, std::vector<boost::shared_ptr<XdmfItem> > & childItems, const XdmfCoreReader * const reader)
54
{
55
	mCollectionType = XdmfGridCollectionType::New(itemProperties);
56 57 58 59 60 61 62 63 64
	std::map<std::string, std::string>::const_iterator name = itemProperties.find("Name");
	if(name != itemProperties.end())
	{
		mName = name->second;
	}
	else
	{
		mName = "";
	}
65
	XdmfDomain::populateItem(itemProperties, childItems, reader);
66 67
}

68
void XdmfGridCollection::setName(const std::string & name)
69
{
70
	mName = name;
71 72
}

73
void XdmfGridCollection::setType(const boost::shared_ptr<const XdmfGridCollectionType> collectionType)
74
{
75
	mCollectionType = collectionType;
76
}