Last change
on this file since 3124 was
3106,
checked in by Takeshi Nakazato, 8 years ago
|
New Development: No
JIRA Issue: No
Ready for Test: Yes/No?
Interface Changes: Yes/No?
What Interface Changed: Please list interface changes
Test Programs: List test programs
Put in Release Notes: Yes/No?
Module(s): Module Names change impacts.
Description: Describe your changes here...
Check-in asap modifications from Jim regarding casacore namespace conversion.
|
File size:
1013 bytes
|
Rev | Line | |
---|
[2733] | 1 | // |
---|
| 2 | // C++ Implementation: NearestInterpolator1D |
---|
| 3 | // |
---|
| 4 | // Description: |
---|
| 5 | // |
---|
| 6 | // |
---|
| 7 | // Author: Takeshi Nakazato <takeshi.nakazato@nao.ac.jp>, (C) 2012 |
---|
| 8 | // |
---|
| 9 | // Copyright: See COPYING file that comes with this distribution |
---|
| 10 | // |
---|
| 11 | // |
---|
| 12 | #include <assert.h> |
---|
| 13 | |
---|
[2756] | 14 | #include <casa/Exceptions/Error.h> |
---|
| 15 | #include <casa/Utilities/Assert.h> |
---|
| 16 | |
---|
[2733] | 17 | #include "NearestInterpolator1D.h" |
---|
| 18 | |
---|
| 19 | namespace asap { |
---|
| 20 | |
---|
| 21 | template <class T, class U> |
---|
| 22 | NearestInterpolator1D<T, U>::NearestInterpolator1D() |
---|
| 23 | : Interpolator1D<T, U>() |
---|
| 24 | {} |
---|
| 25 | |
---|
| 26 | template <class T, class U> |
---|
| 27 | NearestInterpolator1D<T, U>::~NearestInterpolator1D() |
---|
| 28 | {} |
---|
| 29 | |
---|
| 30 | template <class T, class U> U NearestInterpolator1D<T, U>::interpolate(T x) |
---|
| 31 | { |
---|
[2756] | 32 | //assert(this->isready()); |
---|
[3106] | 33 | casacore::assert_<casacore::AipsError>(this->isready(),"object is not ready to process."); |
---|
[2733] | 34 | if (this->n_ == 1) |
---|
| 35 | return this->y_[0]; |
---|
| 36 | |
---|
| 37 | unsigned int i = this->locator_->locate(x); |
---|
| 38 | if (i == 0) { |
---|
| 39 | return this->y_[i]; |
---|
| 40 | } |
---|
| 41 | else if (i == this->n_ || abs(x - this->x_[i]) > abs(x - this->x_[i-1])) { |
---|
| 42 | i--; |
---|
| 43 | } |
---|
| 44 | return this->y_[i]; |
---|
| 45 | } |
---|
| 46 | |
---|
| 47 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.