1
0
Fork 0
This repository has been archived on 2021-11-03. You can view files and clone it, but cannot push or open issues or pull requests.
uni-m.cds-adv-prog/ex4.2/CaloGrid.cc

18 lines
372 B
C++

//CaloGrid.cc
#include <iostream>
#include "CaloGrid.hh"
CaloCell* CaloGrid::cell(int x, int y ) {
if ( x > nx or x < 0 ) {
std::cout << "CaloGrid::cell() Error: out of grid (x)" << std::endl ;
return nullptr;
}
if ( y > ny or y < 0 ) {
std::cout << "CaloGrid::cell() Error: out of grid (y)" << std::endl ;
return nullptr;
}
return &cells[ x*nx + y ] ;
}