27 #ifndef GNODEARRAY_HPP
28 #define GNODEARRAY_HPP
67 explicit GNodeArray(
const std::vector<double>& vector);
68 GNodeArray(
const int& num,
const double* array);
75 const double&
operator[](
const int& index)
const;
81 double&
at(
const int& index);
82 const double&
at(
const int& index)
const;
85 void append(
const double& node);
86 void insert(
const int& index,
const double& node);
87 void remove(
const int& index);
90 void nodes(
const int& num,
const double* array);
92 void nodes(
const std::vector<double>& vector);
94 const std::vector<double>& vector)
const;
95 void set_value(
const double& value)
const;
104 const bool& clobber =
false)
const;
107 const std::string& extname =
"NODES")
const;
115 void setup(
void)
const;
145 return (
"GNodeArray");
194 return (
int)
m_node.size();
GNodeArray & operator=(const GNodeArray &array)
Assignment operator.
int size(void) const
Return number of nodes in node array.
virtual ~GNodeArray(void)
Destructor.
std::string classname(void) const
Return class name.
const double & wgt_grad_left(void) const
Returns left node weight gradient.
void free_members(void)
Delete class members.
void load(const GFilename &filename)
Load nodes from FITS file.
bool m_has_last_value
Last value is valid.
double m_linear_offset
Offset for linear array.
const double & wgt_left(void) const
Returns left node weight.
void clear(void)
Clear node array.
void reserve(const int &num)
Reserves space for nodes in node array.
void set_value(const double &value) const
Set indices and weighting factors for interpolation.
double m_wgt_grad_left
Weight gradient for left node.
double m_linear_slope
Slope for linear array.
std::vector< double > m_node
Array of nodes.
bool is_empty(void) const
Signals if there are no nodes in node array.
void save(const GFilename &filename, const bool &clobber=false) const
Save node array into FITS file.
void write(GFits &fits, const std::string &extname="NODES") const
Write nodes into FITS object.
void init_members(void)
Initialise class members.
double m_wgt_right
Weight for right node for linear interpolation.
double m_last_value
Last requested value.
double m_wgt_left
Weight for left node for linear interpolation.
void setup(void) const
Compute distance array and linear slope/offset.
const double & wgt_right(void) const
Returns right node weight.
double & at(const int &index)
Node access operator.
std::vector< double > m_step
Distance to next node.
double interpolate(const double &value, const std::vector< double > &vector) const
Interpolate value.
void extend(const GNodeArray &nodes)
Append node array.
Abstract interface for FITS table.
const int & inx_left(void) const
Returns left node index.
bool m_need_setup
Call of setup is required.
GNodeArray(void)
Void constructor.
int m_inx_left
Index of left node for linear interpolation.
int m_inx_right
Index of right node for linear interpolation.
void nodes(const int &num, const double *array)
Set node array.
const int & inx_right(void) const
Returns right node index.
double m_wgt_grad_right
Weight gradient for right node.
std::string print(const GChatter &chatter=NORMAL) const
Print nodes.
GNodeArray * clone(void) const
Clone node array.
void insert(const int &index, const double &node)
Insert one node into array.
void read(const GFitsTable &table)
Read nodes from FITS table.
Definition of interface for container classes.
bool m_is_linear
Nodes form a linear array.
void append(const double &node)
Append one node to array.
const double & wgt_grad_right(void) const
Returns right node weight gradient.
Interface class for container classes.
double & operator[](const int &index)
Node access operator.
void copy_members(const GNodeArray &array)
Copy class members.