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

19 lines
372 B
C++
Raw Normal View History

2019-12-17 15:05:27 +01:00
//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 ] ;
2019-12-17 15:05:27 +01:00
}