Joey, let's simplify it to just standard MASON for discussion purposes only.  It sounds like you want a method added to, say, DoubleGrid2D, which given an x and y, gives you the interpolated combination of the four nearest cells to that spot?  So you're just looking for a utility method along these lines:

	double value(double x, double y)
		{
		int fx = floor(x);
		int fy = floor(y);
		double alpha = x - fx;
		double beta = y - fy;
		if (alpha < 0.5)
			{
			if (beta < 0.5)
				{
	return get(fx - 1, fy) * (1-alpha*2) * (beta*2) +
		+ get(fx, fy - 1) * (alpha*2) * (1-beta*2) +
		+ get(fx -1, fy - 1) * (1-alpha*2) * (1- beta*2) +
		+ get(fx, fy) * (alpha*2) * (beta*2);
				}
			else { return.... }
			}
		else
			{
			if (beta < 0.5)	{ return.... }
			else { return....	}
			}
		}

Is this right?  That is, could you just add this utility method to AbstractGrid2D or were you looking for something special for GeomGridField?

Sean

> On Nov 9, 2022, at 2:25 PM, Dr. Joey Harrison <[log in to unmask]> wrote:
> 
> Hey Masonites,
>  
> I’m about to write a class and it occurs to me that it’s general enough that someone else may have already something equivalent. It would be either a wrapper or subclass of GeomGridField, and for a given x, y (floats), it would give you a weighted combination of the 4 nearest cells. This is in contrast to the way GeomGridField.toXCoord(x) works, which is to truncate to the nearest integer index, then return the value in that cell. If anyone’s already written this code, I’d be glad to have it.
>  
> Cheers,
> Joey
>  
>  
> -- 
> Joey Harrison, PhD
> Lead Software Engineer for Modeling & Simulation
> The MITRE Corporation
> 7515 Colshire Dr, McLean VA 22102
> w. 571-369-7750, m. 435-760-3159