Esempio n. 1
0
double GridMapping::dy() const{
    if (ydim() != 0) {
        double x,y0,y1,z;
        indexToWorld(0, 0, 0, x, y0, z);
        indexToWorld(0, 1, 0, x, y1, z);
        return fabs(y1-y0);
    }
    return 0;
}
Esempio n. 2
0
double GridMapping::dz() const{
    if (ydim() != 0) {
        double x,y,z0,z1;
        indexToWorld(0, 0, 0, x, y, z0);
        indexToWorld(0, 0, 1, x, y, z1);
        return fabs(z1-z0);
    }
    return 0;
}
Esempio n. 3
0
double GridMapping::dx() const{
    if (xdim() != 0) {
        double x1,x0,y,z;
        indexToWorld(0, 0, 0, x0, y, z);
        indexToWorld(1, 0, 0, x1, y, z);
        return fabs(x1-x0);
    }
    return 0;
}
Esempio n. 4
0
T GridField<T>::valueAtWorld(double w_x, double w_y,double w_z) const{

	int i,j,k;
	double w_x0,w_y0,w_z0;
	double w_x1,w_y1,w_z1;
	double x,y,z;

	//Konvertera världskoordinater till cellkoordinater
	worldToUpperLeftIndex(w_x, w_y, w_z, i, j, k);
	indexToWorld(i, j, k, w_x0, w_y0, w_z0);
	indexToWorld(i+1, j+1, k+1, w_x1, w_y1, w_z1);

	x = (w_x-w_x0)/(w_x1-w_x0);
	y = (w_y-w_y0)/(w_y1-w_y0);
	z = (w_z-w_z0)/(w_z1-w_z0);
	//assert(i < 100);
	//FIXA!!! -->
	//Interpolera...

	/*

	CatmullRomInterpolation<T> interpolation = CatmullRomInterpolation<T>();
	T ty[4];
	for (int slice = 0; slice < 4; slice++) {
		T t1 = interpolation(x,valueAtIndex(i-1,j-1,k),valueAtIndex(i,j-1,k),valueAtIndex(i+1,j-1,k),valueAtIndex(i+2,j-1,k));
		T t2 = interpolation(x,valueAtIndex(i-1,j,k),valueAtIndex(i,j,k),valueAtIndex(i+1,j,k),valueAtIndex(i+2,j,k));
		T t3 = interpolation(x,valueAtIndex(i-1,j+1,k),valueAtIndex(i,j+1,k),valueAtIndex(i+1,j+1,k),valueAtIndex(i+2,j+1,k));
		T t4 = interpolation(x,valueAtIndex(i-1,j+2,k),valueAtIndex(i,j+2,k),valueAtIndex(i+1,j+2,k),valueAtIndex(i+2,j+2,k));

		ty[slice] = interpolation(y,t1,t2,t3,t4);
	}

	*/


	return _interpolation->interpolate(*this,i,j,k,x,y,z);
}