02.05.2014 Views

CoreandServices.book - Ocean - Schlumberger

CoreandServices.book - Ocean - Schlumberger

CoreandServices.book - Ocean - Schlumberger

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

extent, the last index is returned. -1 is returned if the extent is empty. Indexes into the<br />

extent are zero-based.<br />

Basics<br />

Extent2 ext = new Extent2(new Index2 (1, 3), new Index2(4, 5));<br />

//ext is [1 : 1 : 4, 3 : 1 : 7]<br />

Index2 nearest = ext.NearestIndex(new Index2(3, 8));<br />

// result is (2, 4)<br />

Here the Extent2 has two arrays {1, 2, 3, 4} and {3, 4, 5, 6, 7}. In the first array, we are<br />

looking for the value 3 and find it at index position 2. In the second array, we are looking<br />

for the value 8, but it is is not there. It is beyond the end of the array, so the index<br />

position returned is the last index position or 4. The result is (2, 4).<br />

SnapValue – This method returns the nearest value in each Extent2 that falls on an<br />

extent increment closest to the input values. The returned values can be outside the range<br />

of the Extent2 objects.<br />

Index2 begin = new Index2(3, 5);<br />

Index2 size = new Index2(10, 10);<br />

Index2 inc = new Index2(3, 5);<br />

Extent2 ext = new Extent2(begin, size, inc);<br />

//ext is [3 : 3 : 30, 5 : 5 : 50]<br />

Index2 snap = ext.SnapValue(new Index2(13, 22));<br />

//snap is (12, 10).<br />

In this example, the output Index2 value has elements of 12 and 20. The value 13 falls<br />

closest to the value 12 that is an even increment of the starting value of 3 and its<br />

increment of 3. The value 22 falls closest to the value 20 that is an even increment of the<br />

starting value of 5 and its increment of 5.<br />

<strong>Schlumberger</strong> Private<br />

<strong>Ocean</strong> Services 4-125

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!