BELFEM 0.9.0
Berkeley Lab Finite Element Framework
Loading...
Searching...
No Matches
belfem::Spline Class Reference

Cubic spline on a uniform grid, C2, with natural, parabolic or clamped boundary conditions. More...

#include <cl_Spline.hpp>

Public Member Functions

 Spline (const Vector< real > &aX, const Vector< real > &aY, SpMatrix &aA, const real aXref, const real aSref=0., const proc_t aMasterProc=gNoOwner)
 Spline (const Vector< real > &aX, const Vector< real > &aY, SpMatrix &aA, const spline::SplineBC aStartBC=spline::SplineBC::NoCurvature, const spline::SplineBC aEndBC=spline::SplineBC::NoCurvature, const real adYdX0=0., const real adYdX1=0., const real aXref=0., const real aSref=0., const proc_t aMasterProc=gNoOwner)
 Spline (const string &aFile, const string &aLabel, const proc_t aMaster=0)
 Spline (const hid_t aGroup, const proc_t aMaster)
 Spline (const proc_t aMasterProc)
 Spline (const index_t &aN, const real aXmin, const real aXmax)
index_t n () const
real x_min () const
real x_max () const
real delta_x () const
Matrix< real > & coefficients ()
const Matrix< real > & coefficients () const
real eval (const real aX) const
 interpolate the function
real deval (const real aX) const
 interpolate first derivative
real eval (const real aX, const index_t aCol) const
 interpolate the function
real deval (const real aX, const index_t aCol) const
 interpolate first derivative
real ddeval (const real aX) const
 interpolate second derivative
real ddeval (const real aX, const index_t aCol) const
real entropy (const real aX) const
 interpolate entropy
real entropy (const real aX, const index_t aCol) const
real dentropy (const real aX) const
 interpolate entropy derivative
real dentropy (const real aX, const index_t aCol) const
Matrix< real > & matrix_data ()
 expose matrix
void set_extra_mode (const spline::ExtraMode aMode)
 Declare what the extra row of the coefficient table holds.
const Matrix< real > & matrix_data () const
 expose matrix
void save (const string &aLabel, const string &aPath, const enum FileMode aMode=FileMode::NEW)
herr_t save (hid_t &aGroup)
herr_t load (hid_t &aGroup)
void save_to_database (const string &aDatabase, const string &aLabel)
void update_data (SpMatrix &aHelpMatrix, const Vector< real > &aValues, const spline::SplineBC aStartBC=spline::SplineBC::NoCurvature, const spline::SplineBC aEndBC=spline::SplineBC::NoCurvature, const real adYdX0=0.0, const real adYdX1=0.0, const real aXref=0.0, const real aSref=0.0)
 Recompute spline coefficients for new y-values on the same grid.
void initialize (const Vector< real > &aX, const Vector< real > &aY, SpMatrix &aA, const spline::SplineBC aStartBC=spline::SplineBC::NoCurvature, const spline::SplineBC aEndBC=spline::SplineBC::NoCurvature, const real adYdX0=0.0, const real adYdX1=0.0, const real aXref=0.0, const real aSref=0.0)
index_t find_col (const real aX) const
void create_integral (const real aXref=BELFEM_QUIET_NAN, const real aYref=0.0)
real integrate (const real aX) const
real integrate (const real aX0, const real aX1) const

Detailed Description

Cubic spline on a uniform grid, C2, with natural, parabolic or clamped boundary conditions.

See also
Spline Usage Guide

Constructor & Destructor Documentation

◆ Spline() [1/6]

belfem::Spline::Spline ( const Vector< real > & aX,
const Vector< real > & aY,
SpMatrix & aA,
const real aXref,
const real aSref = 0.,
const proc_t aMasterProc = gNoOwner )

◆ Spline() [2/6]

belfem::Spline::Spline ( const Vector< real > & aX,
const Vector< real > & aY,
SpMatrix & aA,
const spline::SplineBC aStartBC = spline::SplineBC::NoCurvature,
const spline::SplineBC aEndBC = spline::SplineBC::NoCurvature,
const real adYdX0 = 0.,
const real adYdX1 = 0.,
const real aXref = 0.,
const real aSref = 0.,
const proc_t aMasterProc = gNoOwner )

◆ Spline() [3/6]

belfem::Spline::Spline ( const string & aFile,
const string & aLabel,
const proc_t aMaster = 0 )

◆ Spline() [4/6]

belfem::Spline::Spline ( const hid_t aGroup,
const proc_t aMaster )

◆ Spline() [5/6]

belfem::Spline::Spline ( const proc_t aMasterProc)

◆ Spline() [6/6]

belfem::Spline::Spline ( const index_t & aN,
const real aXmin,
const real aXmax )

Member Function Documentation

◆ coefficients() [1/2]

Matrix< real > & belfem::Spline::coefficients ( )
inline

◆ coefficients() [2/2]

const Matrix< real > & belfem::Spline::coefficients ( ) const
inline

◆ create_integral()

void belfem::Spline::create_integral ( const real aXref = BELFEM_QUIET_NAN,
const real aYref = 0.0 )

◆ ddeval() [1/2]

real belfem::Spline::ddeval ( const real aX) const
inline

interpolate second derivative

◆ ddeval() [2/2]

real belfem::Spline::ddeval ( const real aX,
const index_t aCol ) const
inline

◆ delta_x()

real belfem::Spline::delta_x ( ) const
inline

◆ dentropy() [1/2]

real belfem::Spline::dentropy ( const real aX) const
inline

interpolate entropy derivative

◆ dentropy() [2/2]

real belfem::Spline::dentropy ( const real aX,
const index_t aCol ) const
inline

◆ deval() [1/2]

real belfem::Spline::deval ( const real aX) const
inline

interpolate first derivative

◆ deval() [2/2]

real belfem::Spline::deval ( const real aX,
const index_t aCol ) const
inline

interpolate first derivative

◆ entropy() [1/2]

real belfem::Spline::entropy ( const real aX) const
inline

interpolate entropy

◆ entropy() [2/2]

real belfem::Spline::entropy ( const real aX,
const index_t aCol ) const
inline

◆ eval() [1/2]

real belfem::Spline::eval ( const real aX) const
inline

interpolate the function

◆ eval() [2/2]

real belfem::Spline::eval ( const real aX,
const index_t aCol ) const
inline

interpolate the function

◆ find_col()

index_t belfem::Spline::find_col ( const real aX) const
inline

◆ initialize()

void belfem::Spline::initialize ( const Vector< real > & aX,
const Vector< real > & aY,
SpMatrix & aA,
const spline::SplineBC aStartBC = spline::SplineBC::NoCurvature,
const spline::SplineBC aEndBC = spline::SplineBC::NoCurvature,
const real adYdX0 = 0.0,
const real adYdX1 = 0.0,
const real aXref = 0.0,
const real aSref = 0.0 )

◆ integrate() [1/2]

real belfem::Spline::integrate ( const real aX) const
inline

◆ integrate() [2/2]

real belfem::Spline::integrate ( const real aX0,
const real aX1 ) const
inline

◆ load()

herr_t belfem::Spline::load ( hid_t & aGroup)

◆ matrix_data() [1/2]

Matrix< real > & belfem::Spline::matrix_data ( )
inline

expose matrix

◆ matrix_data() [2/2]

const Matrix< real > & belfem::Spline::matrix_data ( ) const
inline

expose matrix

◆ n()

index_t belfem::Spline::n ( ) const
inline

◆ save() [1/2]

void belfem::Spline::save ( const string & aLabel,
const string & aPath,
const enum FileMode aMode = FileMode::NEW )

◆ save() [2/2]

herr_t belfem::Spline::save ( hid_t & aGroup)

◆ save_to_database()

void belfem::Spline::save_to_database ( const string & aDatabase,
const string & aLabel )

◆ set_extra_mode()

void belfem::Spline::set_extra_mode ( const spline::ExtraMode aMode)
inline

Declare what the extra row of the coefficient table holds.

initialize() and update_data() set this themselves. It is needed by a caller that writes coefficients straight through matrix_data(), which bypasses them: mixing the tables of several splines mixes the extra row along with the rest, so the result carries the same quantity the parts did, but nothing on that path has said so.

◆ update_data()

void belfem::Spline::update_data ( SpMatrix & aHelpMatrix,
const Vector< real > & aValues,
const spline::SplineBC aStartBC = spline::SplineBC::NoCurvature,
const spline::SplineBC aEndBC = spline::SplineBC::NoCurvature,
const real adYdX0 = 0.0,
const real adYdX1 = 0.0,
const real aXref = 0.0,
const real aSref = 0.0 )

Recompute spline coefficients for new y-values on the same grid.

Note
Rank-0 only: this method executes only on rank 0 (mCommRank == 0). It does not broadcast the new coefficients; other ranks keep the old table. synchronize() is private, so if all ranks need the update, re-create the spline through a constructor that takes aMasterProc. This is by design — not every spline is constructed on all ranks, so automatic synchronization would be incorrect in general.

◆ x_max()

real belfem::Spline::x_max ( ) const
inline

◆ x_min()

real belfem::Spline::x_min ( ) const
inline

The documentation for this class was generated from the following files: