Exemplo n.º 1
0
bool GridField<T>::isUndefined(int i,int j,int k) const{
	return i < 0 || i >= xdim() || j < 0 || j >= ydim() || k < 0 || k >= zdim();
}
Exemplo n.º 2
0
//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));
}
Exemplo n.º 3
0
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));
}
Exemplo n.º 4
0
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
}
Exemplo n.º 5
0
bool GridMapping::isValid(int i, int j, int k) const{
    return (   i >= 0 && i < xdim()
            && j >= 0 && j < ydim()
            && k >= 0 && k < zdim());
}
Exemplo n.º 6
0
void GridMapping::indexAt(int index, int &i, int &j, int &k) const{
    k = index /(xdim()*ydim());
    j = (index-(k*xdim()*ydim()))/(xdim());
    i = (index-j*xdim()-k*xdim()*ydim());
}
Exemplo n.º 7
0
//Funktioner
//Index to index
 int GridMapping::indexAt(int i, int j, int k) const{
    return i+(xdim())*j+(xdim()*ydim()*k);
}
Exemplo n.º 8
0
double GridMapping::local_dy() const{
    return 1.0/double(ydim()-1);
}