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-2018 Allan Leal
4 //
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
9 //
10 // This library 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 GNU
13 // Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library. 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 xCoordinates() const -> const std::vector<double>&;
63 
65  auto yCoordinates() 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 yCoordinates() const -> const std::vector< double > &
Return the y-coordinates of the interpolation.
Definition: BilinearInterpolator.cpp:100
auto setData(const std::vector< double > &data) -> void
Set the x-coordinates of the interpolation.
Definition: BilinearInterpolator.cpp:90
The namespace containing all components of the Reaktoro library.
Definition: ChemicalScalar.hpp:24
auto data() const -> const std::vector< double > &
Return the interpolation data.
Definition: BilinearInterpolator.cpp:105
auto setCoordinatesX(const std::vector< double > &xcoordinates) -> void
setCoordinatesY the x-coordinates of the interpolation
Definition: BilinearInterpolator.cpp:80
auto operator()(double x, double y) const -> double
Calculate the interpolation at the provided (x, y) point.
Definition: BilinearInterpolator.cpp:115
auto xCoordinates() const -> const std::vector< double > &
Return the x-coordinates of the interpolation.
Definition: BilinearInterpolator.cpp:95
auto setCoordinatesY(const std::vector< double > &ycoordinates) -> void
Set the y-coordinates of the interpolation.
Definition: BilinearInterpolator.cpp:85
auto empty() const -> bool
Check if the BilinearInterpolator instance is empty.
Definition: BilinearInterpolator.cpp:110
A class used to calculate bilinear interpolation of data in two dimensions.
Definition: BilinearInterpolator.hpp:29
BilinearInterpolator()
Construct a default BilinearInterpolator instance.
Definition: BilinearInterpolator.cpp:54