chombo-discharge
Loading...
Searching...
No Matches
CD_KMCDualState.H
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2021-2026 SINTEF Energy Research
3 *
4 * SPDX-License-Identifier: GPL-3.0-or-later
5 */
6
13#ifndef CD_KMCDUALSTATE_H
14#define CD_KMCDUALSTATE_H
15
16// Std includes
17#include <vector>
18#include <cstddef>
19#include <ostream>
20
21// Our includes
22#include <CD_NamespaceHeader.H>
23
30template <typename T = long long>
32{
33public:
37 using State = std::vector<T>;
38
42 inline KMCDualState() = default;
43
47 inline KMCDualState(const KMCDualState&) = default;
48
52 inline KMCDualState(const KMCDualState&&) = delete;
53
59 inline KMCDualState(const size_t a_numReactiveSpecies, const size_t a_numNonReactiveSpecies) noexcept;
60
64 virtual ~KMCDualState();
65
71 inline KMCDualState&
72 operator=(const KMCDualState& a_other) = default;
73
77 inline KMCDualState&
78 operator=(const KMCDualState&&) = delete;
79
85 inline void
86 define(const size_t a_numReactiveSpecies, const size_t a_numNonReactiveSpecies) noexcept;
87
92 inline bool
93 isValidState() const noexcept;
94
99 inline State&
100 getReactiveState() noexcept;
101
106 inline const State&
107 getReactiveState() const noexcept;
108
113 inline State&
114 getNonReactiveState() noexcept;
115
120 inline const State&
121 getNonReactiveState() const noexcept;
122
128 inline std::vector<T>
129 linearOut() const noexcept;
130
137 inline void
138 linearIn(const std::vector<T>& a_linearizedState) noexcept;
139
140protected:
145
150
155
160};
161
168template <typename T>
169inline std::ostream&
170operator<<(std::ostream& ostr, const KMCDualState<T>& a_state);
171
172#include <CD_NamespaceFooter.H>
173
175
176#endif
Implementation of CD_KMCDualState.H.
Declaration of a "dual state" for advancing with the Kinetic Monte Carlo module.
Definition CD_KMCDualState.H:32
std::vector< T > State
Alias for the state type.
Definition CD_KMCDualState.H:37
State & getNonReactiveState() noexcept
Get modifiable non-reactive state.
Definition CD_KMCDualStateImplem.H:114
KMCDualState(const KMCDualState &&)=delete
Disallowed move constructor.
KMCDualState & operator=(const KMCDualState &a_other)=default
Copy assignment operator.
KMCDualState()=default
Default constructor.
KMCDualState(const KMCDualState &)=default
Copy constructor.
int m_numNonReactiveSpecies
Number of non-reactive species.
Definition CD_KMCDualState.H:149
State m_nonReactiveState
Non-reactive state.
Definition CD_KMCDualState.H:159
bool isValidState() const noexcept
Check if state is a valid state. An invalid state will have a negative number of reactants/non-reacta...
Definition CD_KMCDualStateImplem.H:48
void define(const size_t a_numReactiveSpecies, const size_t a_numNonReactiveSpecies) noexcept
Define function.
Definition CD_KMCDualStateImplem.H:37
void linearIn(const std::vector< T > &a_linearizedState) noexcept
Linearize the input buffer onto the current state.
Definition CD_KMCDualStateImplem.H:85
virtual ~KMCDualState()
Destructor.
Definition CD_KMCDualStateImplem.H:32
std::vector< T > linearOut() const noexcept
Linearize the state onto an output vector.
Definition CD_KMCDualStateImplem.H:73
State m_reactiveState
Reactive state.
Definition CD_KMCDualState.H:154
State & getReactiveState() noexcept
Get modifiable reactive state.
Definition CD_KMCDualStateImplem.H:100
KMCDualState & operator=(const KMCDualState &&)=delete
Disallowed move assignment.
int m_numReactiveSpecies
Number of reactive species.
Definition CD_KMCDualState.H:144