MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / oblate_to_cart_position

Function oblate_to_cart_position

examples/pde/bhrt.cpp:304–321  ·  view source on GitHub ↗

* @brief Transform the position vectors from oblate to cartesian coordinates * * @param vel * @param pos * @return af::array */

Source from the content-addressed store, hash-verified

302 * @return af::array
303 */
304af::array oblate_to_cart_position(const af::array& pos) {
305 if (pos.dims()[0] != 3)
306 throw make_error("Arrays must have 3 principal coordintes");
307
308 af::array r = pos(0, af::span);
309 af::array o = pos(1, af::span);
310 af::array p = pos(2, af::span);
311 auto a = J / M;
312 auto R = af::sqrt(r * r + a * a);
313
314 af::array x = R * af::sin(o) * af::cos(p);
315 af::array y = R * af::sin(o) * af::sin(p);
316 af::array z = r * af::cos(o);
317
318 af::array transformed_pos = af::join(0, x, y, z);
319
320 return transformed_pos;
321}
322
323/**
324 * @brief Transform the velocity vectors from oblate to cartesian coordinates

Callers 1

generate_imageFunction · 0.85

Calls 6

make_errorFunction · 0.85
sqrtFunction · 0.85
sinFunction · 0.85
cosFunction · 0.85
joinFunction · 0.50
dimsMethod · 0.45

Tested by

no test coverage detected