source: branches/casa-release-4_3-test02/src/NearestInterpolator1D.tcc@ 3105

Last change on this file since 3105 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
Line 
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
14#include <casa/Exceptions/Error.h>
15#include <casa/Utilities/Assert.h>
16
17#include "NearestInterpolator1D.h"
18
19using namespace casa;
20
21namespace asap {
22
23template <class T, class U>
24NearestInterpolator1D<T, U>::NearestInterpolator1D()
25 : Interpolator1D<T, U>()
26{}
27
28template <class T, class U>
29NearestInterpolator1D<T, U>::~NearestInterpolator1D()
30{}
31
32template <class T, class U> U NearestInterpolator1D<T, U>::interpolate(T x)
33{
34 //assert(this->isready());
35 casa::assert_<casa::AipsError>(this->isready(),"object is not ready to process.");
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.