Scine::Readuct  6.0.0
This is the SCINE module ReaDuct.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
ProfileEnergies.h
Go to the documentation of this file.
1 
8 #ifndef READUCT_ELEMENTARYSTEPOPTIMIZATION_PROFILEENERGIES_H
9 #define READUCT_ELEMENTARYSTEPOPTIMIZATION_PROFILEENERGIES_H
10 
11 #include <cassert>
12 #include <utility>
13 #include <vector>
14 
15 // TODO: Improve documentation
16 
17 namespace Scine {
18 namespace Readuct {
19 
20 namespace ElementaryStepOptimization {
21 
27  public:
28  using Array = std::vector<double>;
29 
30  ProfileEnergies() = default;
31  ProfileEnergies(Array x, Array y);
32 
33  void setValues(Array x, Array y);
34 
35  const Array& getCoordinates() const;
36  const Array& getEnergies() const;
37  std::pair<double, double> getPair(int index) const;
38 
39  int size() const;
40  bool empty() const;
41 
42  private:
43  Array x_;
44  Array y_;
45 };
46 
47 inline ProfileEnergies::ProfileEnergies(ProfileEnergies::Array x, ProfileEnergies::Array y) {
48  setValues(std::move(x), std::move(y));
49 }
50 
51 inline void ProfileEnergies::setValues(ProfileEnergies::Array x, ProfileEnergies::Array y) {
52  assert(x.size() == y.size());
53  x_ = std::move(x);
54  y_ = std::move(y);
55 }
56 
57 inline int ProfileEnergies::size() const {
58  return static_cast<int>(x_.size());
59 }
60 
61 inline bool ProfileEnergies::empty() const {
62  return size() == 0;
63 }
64 
65 inline const ProfileEnergies::Array& ProfileEnergies::getCoordinates() const {
66  return x_;
67 }
68 
69 inline const ProfileEnergies::Array& ProfileEnergies::getEnergies() const {
70  return y_;
71 }
72 
73 inline std::pair<double, double> ProfileEnergies::getPair(int index) const {
74  assert(0 <= index && index < size());
75  return std::make_pair(x_[index], y_[index]);
76 }
77 
78 } // namespace ElementaryStepOptimization
79 
80 } // namespace Readuct
81 } // namespace Scine
82 
83 #endif // ELEMENTARYSTEPOPTIMIZATION_PROFILEENERGIES_H