Start cleaning geometry module.
This commit is contained in:
parent
26ecae46b3
commit
cd688f608f
52 changed files with 493 additions and 277 deletions
|
@ -1,50 +1,43 @@
|
|||
#include "Grid.h"
|
||||
|
||||
template<typename T>
|
||||
Grid<T>::Grid(const ntk::Rectangle& bounds)
|
||||
Grid::Grid(const Bounds& bounds)
|
||||
: mBounds(bounds)
|
||||
{
|
||||
mValues = std::vector<T>(mNumX*mNumY, T());
|
||||
mValues = std::vector<double>(mNumX*mNumY, 0.0);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
const ntk::Rectangle& Grid<T>::getBounds() const
|
||||
const Bounds& Grid::getBounds() const
|
||||
{
|
||||
return mBounds;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
double Grid<T>::getXSpacing() const
|
||||
double Grid::getXSpacing() const
|
||||
{
|
||||
return mBounds.getWidth()/double(mNumX);
|
||||
const auto width = mBounds.mMaxX - mBounds.mMinX;
|
||||
return width/double(mNumX);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
double Grid<T>::getYSpacing() const
|
||||
double Grid::getYSpacing() const
|
||||
{
|
||||
return mBounds.getHeight()/double(mNumY);
|
||||
const auto height = mBounds.mMaxY - mBounds.mMinY;
|
||||
return height/double(mNumY);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
const std::vector<T>& Grid<T>::getValues() const
|
||||
const std::vector<double>& Grid::getValues() const
|
||||
{
|
||||
return mValues;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void Grid<T>::resetBounds(const ntk::Rectangle& bounds)
|
||||
void Grid::resetBounds(const Bounds& bounds)
|
||||
{
|
||||
mBounds = bounds;
|
||||
mValues = std::vector<T>(mNumX*mNumY, T());
|
||||
mValues = std::vector<double>(mNumX*mNumY, 0.0);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void Grid<T>::setValues(const std::vector<std::size_t>& indices, T value)
|
||||
void Grid::setValues(const std::vector<std::size_t>& indices, double value)
|
||||
{
|
||||
for (auto index : indices)
|
||||
{
|
||||
mValues[index] = value;
|
||||
}
|
||||
}
|
||||
|
||||
template class Grid<unsigned char>;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue