Reaktoro
A unified framework for modeling chemically reactive systems
Connectivity.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 <memory>
22 #include <vector>
23 
24 // Reaktoro includes
25 #include <Reaktoro/Common/Index.hpp>
26 
27 namespace Reaktoro {
28 
29 // Forward declarations
30 class ChemicalSystem;
31 
36 {
37 public:
39  Connectivity();
40 
42  Connectivity(const ChemicalSystem& system);
43 
45  Connectivity(const Connectivity& other);
46 
48  virtual ~Connectivity();
49 
51  auto operator=(Connectivity other) -> Connectivity&;
52 
55  auto indicesElementsInSpecies(Index ispecies) const -> const Indices&;
56 
59  auto indicesElementsInPhase(Index iphase) const -> const Indices&;
60 
63  auto indicesSpeciesInPhase(Index iphase) const -> const Indices&;
64 
67  auto indicesSpeciesWithElement(Index ielement) const -> const Indices&;
68 
71  auto indicesPhasesWithElement(Index ielement) const -> const Indices&;
72 
75  auto indexPhaseWithSpecies(Index ispecies) const -> Index;
76 
77 private:
78  struct Impl;
79 
80  std::unique_ptr<Impl> pimpl;
81 };
82 
83 } // namespace Reaktoro
auto operator=(Connectivity other) -> Connectivity &
Assign a Connectivity instance to this instance.
Definition: Connectivity.cpp:102
A class to represent a system and its attributes and properties.
Definition: ChemicalSystem.hpp:38
auto indicesSpeciesInPhase(Index iphase) const -> const Indices &
Return the indices of the species in a phase.
Definition: Connectivity.cpp:118
auto indexPhaseWithSpecies(Index ispecies) const -> Index
Return the index of the phase with a species.
Definition: Connectivity.cpp:133
virtual ~Connectivity()
Destroy this instance.
Definition: Connectivity.cpp:99
auto indicesElementsInSpecies(Index ispecies) const -> const Indices &
Return the indices of the elements in a species.
Definition: Connectivity.cpp:108
The namespace containing all components of the Reaktoro library.
Definition: ChemicalScalar.hpp:24
Connectivity()
Construct a default Connectivity instance.
Definition: Connectivity.cpp:87
std::size_t Index
Define a type that represents an index.
Definition: Index.hpp:26
A type to describe the connectivity of elements, species, and phases in a chemical system.
Definition: Connectivity.hpp:36
std::vector< Index > Indices
Define a type that represents a collection of indices.
Definition: Index.hpp:29
auto indicesPhasesWithElement(Index ielement) const -> const Indices &
Return the indices of the phases with an element.
Definition: Connectivity.cpp:128
auto indicesSpeciesWithElement(Index ielement) const -> const Indices &
Return the indices of the species with an element.
Definition: Connectivity.cpp:123
auto indicesElementsInPhase(Index iphase) const -> const Indices &
Return the indices of the elements in a phase.
Definition: Connectivity.cpp:113