Giter Site home page Giter Site logo

ncar / bspline Goto Github PK

View Code? Open in Web Editor NEW
89.0 25.0 21.0 2.51 MB

Cubic B-Spline implementation in C++ templates

License: Other

C++ 15.80% Python 0.51% Fortran 82.90% Makefile 0.02% R 0.22% Raku 0.02% C 0.16% MATLAB 0.38%
cubic-splines atmospheric-science c-plus-plus interpolation library splines

bspline's Introduction

EOL BSpline Library README

This is the source distribution for the NCAR/EOL BSpline C++ library.

Background

The BSpline package provides an implementation of a Cubic B-Spline method devised by Vic Ooyama, and brought to our attention by James Franklin. Franklin employed the B-Spline for general purpose filtering in his dropsonde quality control processing program, known as editsonde.

NCAR used Franklin's code, and a paper published by Ooyama, to build this generic B-Spline class library.

Legal

See the COPYRIGHT file in the source distribution.

Requirements

BSpline builds on Windows, Linux and Mac. Here are the build environments for each operating system:

  • Windows: Microsoft Visual Studio 2005
  • Linux: scons and g++
  • Mac: scons and g++ (both provided by Xcode)

BSpline uses the Doxygen documentation system. Doxygen is not required to build BSpline, but if available it can be used to create html documentation.

Organization

  • BSpline/
    • Contains the source code to create a bspline library, and a header file to access the BSpline from your code.
  • Tests/
    • Contains several subdirectories with code for evaluating the code. The C++ directory is the only one that is currently compiled and known to work. The R directory contains code for plotting results using the R statistical langauge. The Fortran directory contains code for some unknown application.
  • Design/
    • Contains notes and and some original Ooyama code.

Building

Linux/Mac

[Scons] (http://www.scons.org) is used to build BSpline.

BSpline is built by running scons in the top directory:

scons

This will create BSpline/libbspline.a and Tests/C++/bspline. The library will contain float and double instantiations of the BSpline templates.

Windows

A Visual Studio solution (bspline.sln) is provided for building the same products.

Documentation

The BSpline code is documented using the Doxygen embedded comments. Run doxygen in the top directory, where it will find the Doxygen configuration file:

doxygen

This will produce html formatted documentation in the doc/ directory. Open doc/index.html with your favorite browser.

The generated documentation is also committed to the GitHub Pages for this project, so it can be viewed online:

Here are the steps to update the documentation in GitHub pages from the source tree:

In a clone of the bspline project, clone it again into a doc directory:

cd bspline
git clone [email protected]:NCAR/bspline.git doc

Checkout the gh-pages branch in the doc subdirectory.

cd doc
git checkout origin/gh-pages -b gh-pages

Generate the doxygen output into the doc directory:

cd ..
scons doc

Commit the changes to the gh-pages branch:

cd doc
git commit -a -m'generated updated documentation'

bspline's People

Contributors

flociaglia avatar garyjg avatar isabels avatar mistermartin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bspline's Issues

Cutoff wavelength not working


float* x = new float[8] {   0.f, 5.f, 10.f, 15.f, 20.f, 25.f, 30.f, 35.f};
float* y = new float[8]{    2.f, 4.f, 6.f,  8.f,  0.f,  6.f,  9.f,  4.f};
BSpline<float> bSpline(x, 8, y, 30.0);
bool ok = bSpline.ok();
float rez = bSpline.evaluate(2.f);

ok is false whenever I put anything other then 0 for wl and whenever ok is false, rez is 0.

Copying/moving splines is dangerous

BSpline and BSplineBase have destructors defined, but do not have all copy/move/assignment operators defined.
Putting splines into a container that may choose to copy them therefore is dangerous, as copying a BSpline will leave the copy with a deleted spline if the original spline object goes out of scope.

Refer to this:
https://en.cppreference.com/w/cpp/language/rule_of_three

I suggest replacing the use of raw pointers for BSplineBase::base and BSpline::s with std::unique_ptr, and then defining copy and move constructors and assignment operators. Any operator not explicitly defined would then be implicitly deleted as a result of holding a std::unique_ptr, so a compile time error would be generated for unsupported copy/move/assignment operations instead of a runtime segfault/access violation.

g++ compile error

Hi There,
I try to test the bspline algorithm from this project.
I tested with visual studio 2013, it works.
Now I try to compline it with g++ (g++ (GCC) 6.1.1 20160501) in linux OS. It did compile.
Please help. Appreciate it very much.
Sam

Hereby the error msg from the compiler.
**>
**> g++ -c -Wall -march=armv7-a -O2 -DNDEBUG -MMD -I Src -I Src/bspline Src/bspline/BSplineLib.cpp -o obj/Src/bspline/BSplineLib.o

mkdir -p obj/Src/bspline/
g++ -c -Wall -march=armv7-a -O2 -DNDEBUG -MMD -I Src -I Src/bspline Src/bspline/BSpline.cpp -o obj/Src/bspline/BSpline.o
Src/bspline/BSpline.cpp: In member function 'bool BSpline::solve(const T*)':
Src/bspline/BSpline.cpp:110:18: error: 'my' has not been declared
for (m = my::max(0, mx-1); m <= my::min(mx+2, M); ++m) {
^~
Src/bspline/BSpline.cpp:110:41: error: 'my' has not been declared
for (m = my::max(0, mx-1); m <= my::min(mx+2, M); ++m) {
^~****

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.