aboutsummaryrefslogtreecommitdiff
path: root/init.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2018-04-22 17:44:04 +0200
committerAnton Khirnov <anton@khirnov.net>2018-04-22 17:44:04 +0200
commit2ee593d56a83f0264cc41620c2feb3e03a13974f (patch)
tree53e092c698b17eccfe5eb16e81d88a2ca180e848 /init.c
parent0baa72a2d3b0a3a7303f42f9ce84d145d126b7c5 (diff)
Add a function for evaluating K_rtheta
Diffstat (limited to 'init.c')
-rw-r--r--init.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/init.c b/init.c
index 5050f5e..a7d54a8 100644
--- a/init.c
+++ b/init.c
@@ -583,3 +583,30 @@ int td_eval_kpp(const TDContext *td,
{
return eval_var(td, 2, nb_coords, r, theta, diff_order, out);
}
+
+int td_eval_krt(const TDContext *td,
+ size_t nb_coords, const double *r, const double *theta,
+ const unsigned int diff_order[2],
+ double *out)
+{
+ TDConstraintEvalContext *ce;
+ int ret;
+
+ if (diff_order[0] || diff_order[1])
+ return -ENOSYS;
+
+ ret = constraint_eval_alloc(td, td->amplitude, &ce);
+ if (ret < 0)
+ return ret;
+
+ for (int i = 0; i < nb_coords; i++) {
+ double theta_val = theta[i];
+ double r_val = r[i];
+
+ out[i] = tdi_constraint_eval_k_rtheta(ce, r_val, theta_val);
+ }
+
+ tdi_constraint_eval_free(&ce);
+
+ return 0;
+}