bool GridMapping::operator== (const GridMapping & other){ return (other.xdim() == xdim() && other.ydim() == ydim() && other.zdim() == zdim() && other._trans == _trans && other._itrans == _itrans && other.size() == size()); }
bool GridField<T>::isUndefined(int i,int j,int k) const{ return i < 0 || i >= xdim() || j < 0 || j >= ydim() || k < 0 || k >= zdim(); }
void GridMapping::localToUpperLeftIndex(const double l_x,const double l_y,const double l_z, int &i,int &j,int &k) const{ i = (int)floor(l_x*double(xdim()-1)); j = (int)floor(l_y*double(ydim()-1)); k = (int)floor(l_z*double(zdim()-1)); }
//Local to... void GridMapping::localToIndex(double l_x, double l_y,double l_z,int &i,int &j,int &k) const{ i = (int)round(l_x*double(xdim()-1)); j = (int)round(l_y*double(ydim()-1)); k = (int)round(l_z*double(zdim()-1)); }
void GridMapping::indexToLocal(int i,int j,int k, double &l_x, double &l_y,double &l_z) const{ l_x = double(i)/double(xdim()-1); l_y = double(j)/double(ydim()-1); l_z = double(k)/double(zdim()-1);//TODO om zdim = 1 så funkar inte detta, en ifsats kan lösa detta }
bool GridMapping::isValid(int i, int j, int k) const{ return ( i >= 0 && i < xdim() && j >= 0 && j < ydim() && k >= 0 && k < zdim()); }
double GridMapping::local_dz() const{ return 1.0/double(zdim()-1); }