Main Page | Class Hierarchy | Class List | Directories | File List | Class Members

Cubic B-Spline

Version 1.3

Version:
Version_1_3
Author:
Gary Granger (http://www.atd.ucar.edu/~granger)
Date:
May 31, 2005

Download

The source should be available for download from here:

This documentation is also online here:

Documentation

For an overview of the library and its usage, see the documentation for the BSplineBase class.

There is no documentation (as yet) on any of the mathematical details of the implementation. Refer to the Ooyama article, and there may be some notes in the source.

The HTML documentation is generated from the source files by Doxygen (http://www.doxygen.org). Thanks to Dimitri for a great tool.

Release Notes

Release 1_3

This release builds against GCC 4.0. Names in the BSplineBase template base class needed to be declared in the BSpline subclass scope, now that GCC enforces the standard rule about non-template-type-dependent names being resolved when templates are declared.

The driver program now takes an optional third command-line argument for setting the boundary condition type.

There is an R script for generating plots of several combinations of the cutoff and boundary condition options to the driver program. See Samples for details.

Release 1_2

This release updates the code to compile with GCC 3.2, which enforces more standards compliance like the use of 'typename'. Also the GNU libstdc++ no longer uses pointers as vector iterators, so occurences of vector<>::begin() have been replaced with &(vector[0])

Lastly, in this release the C++ filename extension has been changed from cxx to cpp.

Samples

The top source directory contains several sample data files for the driver program. The sample.txt file contains an example of dropsonde data. From that file, three fields have been extracted into separate files:

Each file is a simple text format with two columns. The first column is time, the second is the field measurement. This is the format which the example driver program expects. Any text file with alternating X and Y values will work in the driver program.

To run the driver program, pipe the data into the standard input, and pass the step, cutoff, and boundary-condition options on the command line.

BSpline interface version: $Id: README,v 1.8 2005/05/31 19:21:25 granger Exp $
BSpline implementation version: $Id: README,v 1.8 2005/05/31 19:21:25 granger Exp $
Usage: ./driver <step> <cutoff> [<bc>]
  <step> is the number of points to skip in the input.
  <cutoff> is the cutoff wavelength.
  <bc> is the boundary condition--0, 1, or 2--meaning zero
       the 0th, 1st, or 2nd derivative at the end points.

For example:

./driver 1 5 2 < sample.temps

The driver produces two output files:

The R (http://www.r-project.org) script runs the driver program on the sample temperatures over a range of boundary conditions and cutoff frequencies. The results are plotted in 6 PNG images.

CutoffBC 0BC 1BC 2
5plot-1.png plot-2.png plot-3.png
30plot-4.png plot-5.png plot-6.png

Note that for boundary condition 0, the endpoints are not at zero as might be expected. The spline algorithm first removes the mean from the input data to improve the matrix calculations, and the mean is added back in when evaluating the spline at any point. Thus the endpoints for boundary condition 0 will actually be the mean value of the input range. If you need to force the endpoints to be zero, remove the mean from the data before computing the spline, or else change the source code for computing the spline.

Background

This is a C++ implementation of a cubic b-spline least squares and derivative constraint algorithm. See the documentation for the BSplineBase class (in BSpline/BSpline.h) for details.

This work was done for meteorological research at the University Corporation for Atmospheric Research (http://www.ucar.edu/). There is no warranty of any kind. Please see the COPYRIGHT file.

Installation

As the implementation itself is mostly template code, it is not necessary to build the library separately. The template implementation can be included directly. The templates can also be compiled for the usual float and double types into their own object modules and library (DLL on Win32). See the documentation for details. The code is known to compile under the GNU g++ compiler 3.2 (http://gcc.gnu.org/) and Microsft Developer Studio Visual C++ version 6.0.

The distribution contains two parts. The b-spline code itself is contained in the lib/ directory, while the top directory only contains a test driver program. There are MS VC++ projects and/or workspaces for both, but they may not be current. On UNIX, running make in the top directory builds only the driver program by including the template implementation directly. Run make in the lib directory to build a library with float and double instantiations of the BSpline templates.

To install the code into an include directory, all of the *.cxx and *.h files in lib/ must be copied into the include directory.

Questions

I'd be happy to try to answer any questions, and certainly happy to hear about any bugs or improvements.
Generated on Tue May 31 13:21:37 2005 for BSpline Library by  doxygen 1.4.2