help-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-gsl] how to find out if a spline really exists


From: Andreas
Subject: [Help-gsl] how to find out if a spline really exists
Date: Thu, 06 Aug 2009 14:02:39 +0200
User-agent: Thunderbird 2.0.0.22 (X11/20090608)

hi there,

sorry if the subject line is a bit weird, but i don't really know how to
put it in 80something characters...

i have the problem that at a point i'm calling gsl_spline_free() without
really knowing if the pointer i pass as an argument really points to
something valid:

SimpleInterpolator::~SimpleInterpolator() {
  for (int d = 0; d < 2; d++) {
    for (int i = 0; i < latsize; i++) {
      std::cout << "  freeing spline ..." << std::endl;
      gsl_spline_free(lat_splines[d][i]);
      std::cout << "     ... done!" << std::endl;
      std::cout << "  freeing accelerator ..." << std::endl;
      gsl_interp_accel_free(lat_accelerators[d][i]);
      std::cout << "     ... done!" << std::endl;
    }
    delete [] lat_accelerators[d];
    delete [] lat_splines[d];
    delete [] interp_lat_values[d];
  }
  delete [] lat_accelerators;
  delete [] lat_splines;
  delete [] interp_lat_values;
}

If, for some reason, not all indices of lat_slines[][] have been
initialised with splines, i get an EAccessViolation when running the
program.

So I thought I could get around this problem by doing something like

if lat_splines[d][i] is instanceof gsl_spline then
gsl_spline_free(lat_splines[d][i]).

How could this work?

Thanks for all your help!

Andreas.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]