source: trunk/src/Interpolator1D.cpp @ 2724

Last change on this file since 2724 was 2720, checked in by Takeshi Nakazato, 11 years ago

New Development: Yes

JIRA Issue: Yes CAS-4770 and its sub-tickets

Ready for Test: Yes

Interface Changes: 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...

First version of applycal for single dish calibration.
Added new classes for the operation (STApplyCal, Calibrator, PSAlmaCalibrator,
Locator, BisectionLocator?, Interpolator1D, NearestInterpolator1D).
Also, modified existing classes to fit with implementation of applycal.


File size: 1.1 KB
Line 
1//
2// C++ Implementation: Interpolator1D
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/Arrays/Vector.h>
15#include <casa/Exceptions/Error.h>
16
17#include "Interpolator1D.h"
18#include "BisectionLocator.h"
19
20using namespace casa;
21
22namespace asap {
23
24Interpolator1D::Interpolator1D()
25  : order_(0),
26    n_(0),
27    x_(0),
28    y_(0)
29{
30  locator_ = new BisectionLocator();
31}
32
33Interpolator1D::~Interpolator1D()
34{
35  if (locator_)
36    delete locator_;
37}
38
39void Interpolator1D::setData(double *x, float *y, unsigned int n)
40{
41  x_ = x;
42  y_ = y;
43  n_ = n;
44  locator_->set(x, n);
45}
46
47void Interpolator1D::setX(double *x, unsigned int n)
48{
49  assert(n_ == 0 || n_ == n);
50  x_ = x;
51  n_ = n;
52  locator_->set(x, n);
53}
54
55void Interpolator1D::setY(float *y, unsigned int n)
56{
57  assert(n_ == 0 || n_ == n);
58  y_ = y;
59  n_ = n;
60}
61
62void Interpolator1D::reset()
63{
64  n_ = 0;
65  x_ = 0;
66  y_ = 0;
67}
68
69bool Interpolator1D::isready()
70{
71  return (n_ > 0 && x_ != 0 && y_ != 0);
72}
73
74int Interpolator1D::locate(double x)
75{
76  return locator_->locate(x);
77}
78
79}
Note: See TracBrowser for help on using the repository browser.