Last change
on this file since 2859 was 2756, checked in by Takeshi Nakazato, 12 years ago |
New Development: No
JIRA Issue: Yes CAS-4770
Ready for Test: Yes
Interface Changes: No
What Interface Changed: Please list interface changes
Test Programs: test_sdcal2
Put in Release Notes: No
Module(s): Module Names change impacts.
Description: Describe your changes here...
Replace assert with casa::assert_ to avoid aborting casapy session.
|
File size:
1.0 KB
|
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 | using namespace casa;
|
---|
| 20 |
|
---|
| 21 | namespace asap {
|
---|
| 22 |
|
---|
| 23 | template <class T, class U>
|
---|
| 24 | NearestInterpolator1D<T, U>::NearestInterpolator1D()
|
---|
| 25 | : Interpolator1D<T, U>()
|
---|
| 26 | {}
|
---|
| 27 |
|
---|
| 28 | template <class T, class U>
|
---|
| 29 | NearestInterpolator1D<T, U>::~NearestInterpolator1D()
|
---|
| 30 | {}
|
---|
| 31 |
|
---|
| 32 | template <class T, class U> U NearestInterpolator1D<T, U>::interpolate(T x)
|
---|
| 33 | {
|
---|
[2756] | 34 | //assert(this->isready());
|
---|
| 35 | casa::assert_<casa::AipsError>(this->isready(),"object is not ready to process.");
|
---|
[2733] | 36 | if (this->n_ == 1)
|
---|
| 37 | return this->y_[0];
|
---|
| 38 |
|
---|
| 39 | unsigned int i = this->locator_->locate(x);
|
---|
| 40 | if (i == 0) {
|
---|
| 41 | return this->y_[i];
|
---|
| 42 | }
|
---|
| 43 | else if (i == this->n_ || abs(x - this->x_[i]) > abs(x - this->x_[i-1])) {
|
---|
| 44 | i--;
|
---|
| 45 | }
|
---|
| 46 | return this->y_[i];
|
---|
| 47 | }
|
---|
| 48 |
|
---|
| 49 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.