Reaktoro 
A unified framework for modeling chemically reactive systems
BilinearInterpolator.hpp
1 // Reaktoro is a unified framework for modeling chemically reactive systems.
2 //
3 // Copyright (C) 2014-2015 Allan Leal
4 //
5 // This program is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18 #pragma once
19 
20 // C++ includes
21 #include <functional>
22 #include <iostream>
23 #include <vector>
24 
25 namespace Reaktoro {
26 
29 {
30 public:
33 
39  const std::vector<double>& xcoordinates,
40  const std::vector<double>& ycoordinates,
41  const std::vector<double>& data);
42 
48  const std::vector<double>& xcoordinates,
49  const std::vector<double>& ycoordinates,
50  const std::function<double(double, double)>& function);
51 
53  auto setCoordinatesX(const std::vector<double>& xcoordinates) -> void;
54 
56  auto setCoordinatesY(const std::vector<double>& ycoordinates) -> void;
57 
59  auto setData(const std::vector<double>& data) -> void;
60 
62  auto xCoodinates() const -> const std::vector<double>&;
63 
65  auto yCoodinates() const -> const std::vector<double>&;
66 
68  auto data() const -> const std::vector<double>&;
69 
71  auto empty() const -> bool;
72 
77  auto operator()(double x, double y) const -> double;
78 
79 private:
81  std::vector<double> m_xcoordinates, m_ycoordinates;
82 
84  std::vector<double> m_data;
85 };
86 
88 auto operator<<(std::ostream& out, const BilinearInterpolator& interpolator) -> std::ostream&;
89 
90 } // namespace Reaktoro
auto data() const -> const std::vector< double > &
Return the interpolation data.
Definition: BilinearInterpolator.cpp:112
auto yCoodinates() const -> const std::vector< double > &
Return the y-coordinates of the interpolation.
Definition: BilinearInterpolator.cpp:107
auto setCoordinatesY(const std::vector< double > &ycoordinates) -> void
Set the y-coordinates of the interpolation.
Definition: BilinearInterpolator.cpp:92
auto setData(const std::vector< double > &data) -> void
Set the x-coordinates of the interpolation.
Definition: BilinearInterpolator.cpp:97
A class used to calculate bilinear interpolation of data in two dimensions.
Definition: BilinearInterpolator.hpp:28
auto empty() const -> bool
Check if the BilinearInterpolator instance is empty.
Definition: BilinearInterpolator.cpp:117
auto operator()(double x, double y) const -> double
Calculate the interpolation at the provided (x, y) point.
Definition: BilinearInterpolator.cpp:122
auto xCoodinates() const -> const std::vector< double > &
Return the x-coordinates of the interpolation.
Definition: BilinearInterpolator.cpp:102
auto setCoordinatesX(const std::vector< double > &xcoordinates) -> void
setCoordinatesY the x-coordinates of the interpolation
Definition: BilinearInterpolator.cpp:87
The namespace containing all components of the Reaktoro library.
Definition: ChemicalScalar.hpp:24
BilinearInterpolator()
Construct a default BilinearInterpolator instance.
Definition: BilinearInterpolator.cpp:61