chiark / gitweb /
added fortran wrapper for nlopt_copy
authorstevenj <stevenj@alum.mit.edu>
Wed, 2 Jun 2010 03:50:21 +0000 (23:50 -0400)
committerstevenj <stevenj@alum.mit.edu>
Wed, 2 Jun 2010 03:50:21 +0000 (23:50 -0400)
darcs-hash:20100602035021-c8de0-d1fabb203b45275b539e487a4868933cf9551be9.gz

api/f77funcs_.h

index 61e29df1f21086f08b38b3bd0a1874104deec8ad..bac7e8204792cb2895e02f049dc576c63e1ff221 100644 (file)
@@ -40,6 +40,15 @@ void F77_(nlo_create,NLO_CREATE)(nlopt_opt *opt, int *alg, int *n)
      }
 }
 
+void F77_(nlo_copy,NLO_COPY)(nlopt_opt *nopt, nlopt_opt *opt)
+{
+     *nopt = nlopt_copy(*opt);
+     if (*nopt && nlopt_dup_f_data(*nopt, sizeof(f77_func_data)) < 0) {
+         nlopt_destroy(*nopt);
+         *nopt = NULL;
+     }
+}
+
 void F77_(nlo_destroy,NLO_DESTROY)(nlopt_opt *opt)
 {
      nlopt_destroy(*opt);