XdmfDomain.cpp 1.27 KB
Newer Older
Kenneth Leiter's avatar
Kenneth Leiter committed
1 2 3 4 5 6 7 8
/*
 * XdmfGrid.cpp
 *
 *  Created on: Jan 25, 2010
 *      Author: kleiter
 */

#include "XdmfDomain.hpp"
9
#include "XdmfGrid.hpp"
Kenneth Leiter's avatar
Kenneth Leiter committed
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
#include "XdmfVisitor.hpp"

XdmfDomain::XdmfDomain()
{
	std::cout << "Created Domain " << this << std::endl;
}

XdmfDomain::~XdmfDomain()
{
  std::cout << "Deleted Domain " << this << std::endl;
}

void XdmfDomain::insert(boost::shared_ptr<XdmfGrid> grid)
{
	mGrids.push_back(grid);
}

boost::shared_ptr<XdmfGrid> XdmfDomain::getGrid(unsigned int index)
{
	if(index >= mGrids.size())
	{
		assert(false);
		// Out of range --- should we throw exceptions?
	}
	return mGrids[index];
}

boost::shared_ptr<const XdmfGrid> XdmfDomain::getGrid(unsigned int index) const
{
	if(index >= mGrids.size())
	{
		assert(false);
		// Out of range --- should we throw exceptions?
	}
	return mGrids[index];
}

unsigned int XdmfDomain::getNumberOfGrids() const
{
	return mGrids.size();
}

std::string XdmfDomain::printSelf() const
{
	return "XdmfDomain";
}

57 58 59 60 61 62 63 64
void XdmfDomain::traverse(boost::shared_ptr<XdmfVisitor> visitor) const
{
	for(std::vector<boost::shared_ptr<XdmfGrid> >::const_iterator iter = mGrids.begin(); iter != mGrids.end(); ++iter)
	{
		(*iter)->write(visitor);
	}
}

Kenneth Leiter's avatar
Kenneth Leiter committed
65 66
void XdmfDomain::write(boost::shared_ptr<XdmfVisitor> visitor) const
{
67
	visitor->visit(this, visitor);
Kenneth Leiter's avatar
Kenneth Leiter committed
68
}