|
PISM, A Parallel Ice Sheet Model
stable v0.5
|
#include <math.h>#include <gsl/gsl_spline.h>#include <petscvec.h>#include "cubature.h"Go to the source code of this file.
Functions | |
| PetscErrorCode | conv2_same (Vec vA, int mA, int nA, Vec vB, int mB, int nB, Vec &vresult) |
| double | interp1_linear (double *x, double *Y, int N, double xi) |
| double | dblquad_cubature (integrand f, double ax, double bx, double ay, double by, double reqRelError, void *fdata) |
| PetscErrorCode conv2_same | ( | Vec | vA, |
| int | mA, | ||
| int | nA, | ||
| Vec | vB, | ||
| int | mB, | ||
| int | nB, | ||
| Vec & | vresult | ||
| ) |
Functions like Matlab's conv2(A,B,'same').
Only works on sequential PETSc Vecs.
Works by naively (sans FFT) convolving two sequential Vecs A,B. Size of A is mA x nA. Size of B is mB x nB. Returns a result Vec which is the same size as A. Effectively pads by zero, in that the result matches the discrete but infinite case . (The infinite case is where A(i,j) and B(i,j) are defined for -inf < i,j < inf but A(i,j)=0 if i<0 or i>mA-1 or j<0 or j>nA-1 and B(i,j)=0 if i<0 or i>mB-1 or j<0 or j>nB-1.)
This operation is O(mA^2 nA^2), but an alternate FFT implementation would be O(mA nA log(mA nA)), presumably.
Definition at line 26 of file matlablike.cc.
Referenced by BedDeformLC::step().
| double dblquad_cubature | ( | integrand | f, |
| double | ax, | ||
| double | bx, | ||
| double | ay, | ||
| double | by, | ||
| double | reqRelError, | ||
| void * | fdata | ||
| ) |
Functions like Matlab's dblquad() for 2D integrals. Wrapper for cubature by Steven Johnson.
The cubature code is used for double integration. It replaces iterated use of a single-variable adaptive rule as in Matlab's dblquad. cubature.{h|c} by Johnson is based on HIntLib by Rudolf Schuerer as well on GSL itself. cubature is GPLed.
Definition at line 67 of file matlablike.cc.
Referenced by BedDeformLC::alloc().
| double interp1_linear | ( | double * | x, |
| double * | Y, | ||
| int | N, | ||
| double | xi | ||
| ) |
Functions like Matlab's interp1. Wrapper for GSL 1D interpolation.
Compare Matlab's
yi=interp1(x,Y,xi,'linear')
Also
yi=interp1(x,Y,xi,'linear','extrap')
.
Does no input checking.
Definition at line 53 of file matlablike.cc.
Referenced by ge_integrand().
1.7.5.1