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.

Basics<br />

Each Index type has multiple constructors, but all have the same pattern. For example, the<br />

IndexDouble3 constructors are:<br />

// Default constructor<br />

IndexDouble3 idx_double_1 = new IndexDouble3();<br />

// Copy constructor<br />

IndexDouble3 idx_double_2 = new IndexDouble3(idx_double_1);<br />

// Construct from I, J, K values<br />

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

// I = 3.0, J = 5.0, K = 7.0<br />

All Index types support the same operators. The results of the various operations are listed<br />

using the following IndexDouble definitions as an example.<br />

double i1 = 3.0 ;<br />

double j1 = 5.0 ;<br />

double k1 = 7.0 ;<br />

double i2 = 9.0 ;<br />

double j2 = 13.0 ;<br />

double k2 = 17.0 ;<br />

IndexDouble3 idx_double_1 = new IndexDouble3(i1, j1, k1);<br />

// Value for idx_double_1 is (3.0, 5.0, 7.0)<br />

IndexDouble3 idx_double_2 = new IndexDouble3(i2, j2, k2);<br />

// Value for idx_double_2 is (9.0, 13.0, 17.0)<br />

+ (addition)<br />

IndexDouble3 idx_add_idx = idx_double_1 + idx_double_2;<br />

// Value for idx_add_idx is (12.0, 18.0, 24.0)<br />

IndexDouble3 idx_add_double = idx_double_1 + 5.0;<br />

// Value for idx_add_double is (8.0, 10.0, 12.0) from 3+5, 5+5, 7+5<br />

IndexDouble3 double_add_idx = 5.0 + idx_double_1;<br />

// Value for idx_add_int is (8.0, 10.0, 12.0) from 5+3, 5+5, 5+7<br />

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

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

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

Saved successfully!

Ooh no, something went wrong!