#include "Grid.h"

template<typename T>
Grid<T>::Grid(const Rectangle& bounds)
    : mBounds(bounds)
{
    mValues = std::vector<T>(mNumX*mNumY, T());
}

template<typename T>
const Rectangle& Grid<T>::getBounds() const
{
    return mBounds;
}

template<typename T>
double Grid<T>::getXSpacing() const
{
    return mBounds.getWidth()/double(mNumX);
}

template<typename T>
double Grid<T>::getYSpacing() const
{
    return mBounds.getHeight()/double(mNumY);
}

template<typename T>
const std::vector<T>& Grid<T>::getValues() const
{
    return mValues;
}

template<typename T>
void Grid<T>::resetBounds(const Rectangle& bounds)
{
    mBounds = bounds;
    mValues = std::vector<T>(mNumX*mNumY, T());
}

template<typename T>
void Grid<T>::setValues(const std::vector<std::size_t>& indices, T value)
{
    for (auto index : indices)
    {
        mValues[index] = value;
    }
}

template class Grid<unsigned char>;
