20#ifndef CCGSL_SPLINE2D_HPP
21#define CCGSL_SPLINE2D_HPP
24#include<gsl/gsl_spline2d.h>
37 typedef gsl_interp2d_type
type;
54 explicit spline2d(
type const* T,
size_t const xsize,
size_t const ysize ){
57 try {
count =
new size_t; }
catch( std::bad_alloc& e ){
107#ifdef __GXX_EXPERIMENTAL_CXX0X__
113 std::swap(
count, v.count );
114 v.ccgsl_pointer =
nullptr;
122 spline2d( std::move( v ) ).swap( *
this );
232#ifdef __GXX_EXPERIMENTAL_CXX0X__
245 int init(
double const xa[],
double const ya[],
double const za[],
246 size_t xsize,
size_t ysize ){
247 return gsl_spline2d_init(
get(), xa, ya, za, xsize, ysize ); }
256 template<
typename XA,
typename YA,
typename ZA>
257 int init( XA
const& xa, YA
const& ya, ZA
const& za ){
258 return gsl_spline2d_init(
get(), xa.data(), ya.data(), za.data(),
259 xa.size(), ya.size() ); }
269 return gsl_spline2d_eval(
get(), x, y, xa.
get(), ya.
get() ); }
281 return gsl_spline2d_eval_e(
get(), x, y, xa.
get(), ya.
get(), &z ); }
292 return gsl_spline2d_eval_extrap(
get(), x, y, xa.
get(), ya.
get() ); }
304 return gsl_spline2d_eval_extrap_e(
get(), x, y, xa.
get(), ya.
get(), &z ); }
315 return gsl_spline2d_eval_deriv_x(
get(), x, y, xa.
get(), ya.
get() ); }
327 return gsl_spline2d_eval_deriv_x_e(
get(), x, y, xa.
get(), ya.
get(), &z ); }
338 return gsl_spline2d_eval_deriv_y(
get(), x, y, xa.
get(), ya.
get() ); }
350 return gsl_spline2d_eval_deriv_y_e(
get(), x, y, xa.
get(), ya.
get(), &z ); }
361 return gsl_spline2d_eval_deriv_xx(
get(), x, y, xa.
get(), ya.
get() ); }
373 return gsl_spline2d_eval_deriv_xx_e(
get(), x, y, xa.
get(), ya.
get(), &z ); }
384 return gsl_spline2d_eval_deriv_yy(
get(), x, y, xa.
get(), ya.
get() ); }
396 return gsl_spline2d_eval_deriv_yy_e(
get(), x, y, xa.
get(), ya.
get(), &z ); }
407 return gsl_spline2d_eval_deriv_xy(
get(), x, y, xa.
get(), ya.
get() ); }
419 return gsl_spline2d_eval_deriv_xy_e(
get(), x, y, xa.
get(), ya.
get(), &z ); }
424 size_t min_size()
const {
return gsl_spline2d_min_size(
get() ); }
430 name()
const {
return gsl_spline2d_name(
get() ); }
439 int set(
double zarr[],
size_t const i,
size_t const j,
double const z )
const {
440 return gsl_spline2d_set(
get(), zarr, i, j, z ); }
450 template<
typename ZARR>
451 int set( ZARR& zarr,
size_t const i,
size_t const j,
double const z )
const {
452 return gsl_spline2d_set(
get(), zarr.data(), i, j, z ); }
460 double get(
double const zarr[],
size_t const i,
size_t const j )
const {
461 return gsl_spline2d_get(
get(), zarr, i, j ); }
470 template<
typename ZARR>
471 double get( ZARR
const& zarr,
size_t const i,
size_t const j )
const {
472 return gsl_spline2d_get(
get(), zarr.data(), i, j ); }
Workspace for acceleration.
gsl_interp_accel * get() const
Get the gsl_interp_accel.
Higher level interface for interpolation.
gsl_spline2d * ccgsl_pointer
The shared pointer.
size_t min_size() const
C++ version of gsl_spline2d_min_size().
double eval_deriv_y(double const x, double const y, interp::accel &xa, interp::accel &ya) const
C++ version of gsl_spline2d_eval_deriv_y().
int eval_deriv_xy_e(double const x, double const y, interp::accel &xa, interp::accel &ya, double &z) const
C++ version of gsl_spline2d_eval_deriv_xy_e().
int set(ZARR &zarr, size_t const i, size_t const j, double const z) const
C++ version of gsl_spline2d_set().
spline2d & operator=(spline2d const &v)
The assignment operator.
int set(double zarr[], size_t const i, size_t const j, double const z) const
C++ version of gsl_spline2d_set().
int init(double const xa[], double const ya[], double const za[], size_t xsize, size_t ysize)
C++ version of gsl_spline2d_init().
size_t * count
The shared reference count.
spline2d(spline2d &&v)
Move constructor.
spline2d(spline2d const &v)
The copy constructor.
bool operator!=(spline2d const &v) const
Two spline2d are different if their elements are not identical.
int eval_e(double const x, double const y, interp::accel &xa, interp::accel &ya, double &z) const
C++ version of gsl_spline2d_eval_e().
int eval_deriv_y_e(double const x, double const y, interp::accel &xa, interp::accel &ya, double &z) const
C++ version of gsl_spline2d_eval_deriv_y_e().
gsl_interp2d_type type
Convenience typedef.
double eval_extrap(double const x, double const y, interp::accel &xa, interp::accel &ya) const
C++ version of gsl_spline2d_eval_extrap().
spline2d & operator=(spline2d &&v)
Move operator.
size_t use_count() const
Find how many spline2d objects share this pointer.
int eval_deriv_xx_e(double const x, double const y, interp::accel &xa, interp::accel &ya, double &z) const
C++ version of gsl_spline2d_eval_deriv_xx_e().
double eval_deriv_yy(double const x, double const y, interp::accel &xa, interp::accel &ya) const
C++ version of gsl_spline2d_eval_deriv_yy().
bool operator<(spline2d const &v) const
A container needs to define an ordering for sorting.
spline2d(gsl_spline2d *v)
Could construct from a gsl_spline2d.
double get(ZARR const &zarr, size_t const i, size_t const j) const
C++ version of gsl_spline2d_get().
double eval_deriv_xx(double const x, double const y, interp::accel &xa, interp::accel &ya) const
C++ version of gsl_spline2d_eval_deriv_xx().
void swap(spline2d &v)
Swap two spline2d objects.
gsl_spline2d * get() const
Get the gsl_spline2d.
int init(XA const &xa, YA const &ya, ZA const &za)
C++ version of gsl_spline2d_init().
double eval_deriv_xy(double const x, double const y, interp::accel &xa, interp::accel &ya) const
C++ version of gsl_spline2d_eval_deriv_xy().
bool operator==(spline2d const &v) const
Two spline2d are identically equal if their elements are identical.
bool unique() const
Find if this is the only object sharing the gsl_spline2d.
int eval_extrap_e(double const x, double const y, interp::accel &xa, interp::accel &ya, double &z) const
C++ version of gsl_spline2d_eval_extrap_e().
bool empty() const
Find if the spline2d is empty.
char const * name() const
C++ version of gsl_spline2d_name().
bool operator>(spline2d const &v) const
A container needs to define an ordering for sorting.
int eval_deriv_yy_e(double const x, double const y, interp::accel &xa, interp::accel &ya, double &z) const
C++ version of gsl_spline2d_eval_deriv_yy_e().
spline2d()
The default constructor is only really useful for assigning to.
bool operator>=(spline2d const &v) const
A container needs to define an ordering for sorting.
spline2d(type const *T, size_t const xsize, size_t const ysize)
The default constructor creates a new spline2d with n elements.
double get(double const zarr[], size_t const i, size_t const j) const
C++ version of gsl_spline2d_get().
double eval_deriv_x(double const x, double const y, interp::accel &xa, interp::accel &ya) const
C++ version of gsl_spline2d_eval_deriv_x().
~spline2d()
The destructor only deletes the pointers if count reaches zero.
int eval_deriv_x_e(double const x, double const y, interp::accel &xa, interp::accel &ya, double &z) const
C++ version of gsl_spline2d_eval_deriv_x_e().
bool operator<=(spline2d const &v) const
A container needs to define an ordering for sorting.
double eval(double const x, double const y, interp::accel &xa, interp::accel &ya) const
C++ version of gsl_spline2d_eval().
The gsl package creates an interface to the GNU Scientific Library for C++.