If I understand your problem correctly, what your trying to do is to have a preallocated array, which you are only filling partially and your wanting to determine how much is filled.
I would create a class which contains all of the logic for dealing with this "array" and write a property setter for the array which contained the following logic:
Procedure SetArrayValue(X,Y:Extended);
begin
fInternalArray[x,y] := Extended;
fInternalArrayMaxX := Max(fInternalArrayMaxX,X);
fInternalArrayMaxY := Max(fInternalArrayMaxY,Y);
end;
and an array initialization/clear function which looked like the following:
Procedure ClearArray;
begin
FillMemory(@fInternalArray,SizeOf(fInternalArray),0);
fInternalArrayMaxX := 0;
fInternalArrayMaxY := 0;
end;
You can also extend the determination of if an array element has a value by adding another array which matches the bounds of boolean and modifying it appropriately.