Reaktoro  v2.11.0
A unified framework for modeling chemically reactive systems
Surface.hpp
1 // Reaktoro is a unified framework for modeling chemically reactive systems.
2 //
3 // Copyright © 2014-2024 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 // Reaktoro includes
21 #include <Reaktoro/Common/Types.hpp>
22 #include <Reaktoro/Core/SurfaceAreaModel.hpp>
23 
24 namespace Reaktoro {
25 
26 // Forward declarations
27 class ChemicalProps;
28 
30 class Surface
31 {
32 public:
35 
37  explicit Surface(String const& name);
38 
40  Surface(String const& name, SurfaceAreaModel const& model);
41 
43  auto clone() const -> Surface;
44 
46  auto withName(String const& name) const -> Surface;
47 
49  auto withAreaModel(SurfaceAreaModel const& model) const -> Surface;
50 
52  auto name() const -> String const&;
53 
55  auto areaModel() const -> SurfaceAreaModel const&;
56 
58  auto area(ChemicalProps const& props) const -> real;
59 
60 private:
61  struct Impl;
62 
63  SharedPtr<Impl> pimpl;
64 };
65 
67 auto operator<(Surface const& lhs, Surface const& rhs) -> bool;
68 
70 auto operator==(Surface const& lhs, Surface const& rhs) -> bool;
71 
72 } // namespace Reaktoro
73 
74 // Custom specialization of std::hash for Reaktoro::Surface
75 namespace std {
76 
77 template<>
78 struct hash<Reaktoro::Surface>
79 {
80  std::size_t operator()(Reaktoro::Surface const& s) const noexcept
81  {
82  return std::hash<std::string>{}(s.name());
83  }
84 };
85 
86 } // namespace std
The class that computes chemical properties of a chemical system.
Definition: ChemicalProps.hpp:34
Used to represent a surface across which chemical reactions take place.
Definition: Surface.hpp:31
auto area(ChemicalProps const &props) const -> real
Calculate the area of the surface for given chemical properties of the system (in m2).
Surface(String const &name, SurfaceAreaModel const &model)
Construct an Surface object with a unique name and area model.
auto withAreaModel(SurfaceAreaModel const &model) const -> Surface
Return a duplicate of this Surface object with new surface area model.
Surface()
Construct a default Surface object.
auto clone() const -> Surface
Return a deep copy of this Surface object.
Surface(String const &name)
Construct an Surface object with a unique name.
auto areaModel() const -> SurfaceAreaModel const &
Return the area model of this surface.
auto name() const -> String const &
Return the unique name of this surface.
auto withName(String const &name) const -> Surface
Return a duplicate of this Surface object with new name.
The namespace containing all components of the Reaktoro library.
Definition: Algorithms.hpp:29
std::string String
Convenient alias for std::string.
Definition: Types.hpp:52
autodiff::real real
The number type used throughout the library.
Definition: Real.hpp:26
std::shared_ptr< T > SharedPtr
Convenient alias for std::shared_ptr<T>.
Definition: Types.hpp:106