add super_grid

This commit is contained in:
kai
2025-06-15 13:55:27 +02:00
parent 0b8075399c
commit 7c45fa2fad

View File

@@ -0,0 +1,29 @@
#ifndef SUPER_GRID_H
#define SUPER_GRID_H
#include "matrix.h"
class SuperGrid {
public:
static SuperGrid zeros(int rows, int cols);
int rows() const;
int cols() const;
double &operator()(int i, int j);
private:
Matrix grid_;
};
inline SuperGrid SuperGrid::zeros(int rows, int cols)
: grid_(Matrix::zeros(rows + 2, cols + 2)), {}
inline double &SuperGrid::operator()(int i, int j) {
return this->grid_(i + 1, j + 1);
}
inline int SuperGrid::rows() const { return this->grid_.rows() - 2; }
inline int SuperGrid::cols() const { return this->grid_.cols() - 2; }
#endif // SUPER_GRID_H