02.05.2014 Views

CoreandServices.book - Ocean - Schlumberger

CoreandServices.book - Ocean - Schlumberger

CoreandServices.book - Ocean - Schlumberger

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Basics<br />

== (equal to)<br />

if (idx_double_1 == idx_double_2)<br />

// test is false<br />

Cast other Index types to this type.<br />

IndexDouble2 idx2 = new IndexDouble2(5.0, 7.0);<br />

IndexDouble3 idx3_from_idx2 = (IndexDouble3)idx2;<br />

// idx3_from_idx2 value is (5.0, 7.0, 0.0);<br />

IndexDouble4 idx4 = new IndexDouble4(3.0, 5.0, 7.0, 9.0);<br />

IndexDouble3 idx3_from_idx4 = (IndexDouble3)idx4;<br />

// idx3_from_idx4 value is (3.0, 5.0, 7.0);<br />

Cast double array to this type.<br />

double[ ] arr = new double[ ] { 3.0, 5.0, 7.0 };<br />

IndexDouble3 idx3_from_arr = (IndexDouble3)arr;<br />

// idx3_from_arr value is (3.0, 5.0, 7.0);<br />

Index types support the following methods:<br />

Clone – This method makes an exact copy, equivalent to using the copy constructor.<br />

IndexDouble3 idx = new IndexDouble3(3.0, 5.0, 7.0);<br />

IndexDouble3 idx2 = idx.clone() as IndexDouble3;<br />

// idx2 value is (3.0, 5.0, 7.0). Equivalent to copy ctor<br />

Dot – This method multiplies Index properties (I * I, J * J, ...) and sums the results.<br />

IndexDouble3 idx_1 = new IndexDouble3(3.0, 5.0, 7.0);<br />

IndexDouble3 idx_2 = new IndexDouble3(9.0, 13.0, 17.0);<br />

double dot = IndexDouble3.Dot(idx_1, idx_2) ;<br />

// dot = 3*9 + 5*13 + 7*17 = 211.00<br />

Equals – This method completes an equality check.<br />

IndexDouble3 idx_1 = new IndexDouble3(3.0, 5.0, 7.0);<br />

IndexDouble3 idx_2 = new IndexDouble3(9.0, 13.0, 17.0);<br />

if (idx_1.Equals(idx_2))<br />

// result is false<br />

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

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

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

Saved successfully!

Ooh no, something went wrong!