chombo-discharge
CD_KMCDualState.H
Go to the documentation of this file.
1 /* chombo-discharge
2  * Copyright © 2022 SINTEF Energy Research.
3  * Please refer to Copyright.txt and LICENSE in the chombo-discharge root directory.
4  */
5 
12 #ifndef CD_KMCDualState_H
13 #define CD_KMCDualState_H
14 
15 // Std includes
16 #include <vector>
17 
18 // Our includes
19 #include <CD_NamespaceHeader.H>
20 
27 template <typename T = long long>
29 {
30 public:
31  using State = std::vector<T>;
32 
36  inline KMCDualState() = default;
37 
41  inline KMCDualState(KMCDualState&) = default;
42 
46  inline KMCDualState(KMCDualState&&) = delete;
47 
53  inline KMCDualState(const size_t a_numReactiveSpecies, const size_t a_numNonReactiveSpecies) noexcept;
54 
58  virtual ~KMCDualState();
59 
63  inline KMCDualState&
64  operator=(const KMCDualState&) = default;
65 
69  inline KMCDualState&
70  operator=(const KMCDualState&&) = delete;
71 
77  inline void
78  define(const size_t a_numReactiveSpecies, const size_t a_numNonReactiveSpecies) noexcept;
79 
83  inline bool
84  isValidState() const noexcept;
85 
90  inline State&
91  getReactiveState() noexcept;
92 
97  inline const State&
98  getReactiveState() const noexcept;
99 
104  inline State&
105  getNonReactiveState() noexcept;
106 
111  inline const State&
112  getNonReactiveState() const noexcept;
113 
114 protected:
119 
124 };
125 
131 template <typename T>
132 inline std::ostream&
133 operator<<(std::ostream& ostr, const KMCDualState<T>& a_state);
134 
135 #include <CD_NamespaceFooter.H>
136 
137 #include <CD_KMCDualStateImplem.H>
138 
139 #endif
Implementation of CD_KMCDualState.H.
Declaration of a "dual state" for advancing with the Kinetic Monte Carlo module.
Definition: CD_KMCDualState.H:29
State & getNonReactiveState() noexcept
Get modifiable non-reactive state.
Definition: CD_KMCDualStateImplem.H:80
KMCDualState()=default
Default constructor.
State m_nonReactiveState
Non-reactive state.
Definition: CD_KMCDualState.H:123
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:41
void define(const size_t a_numReactiveSpecies, const size_t a_numNonReactiveSpecies) noexcept
Define function constructor.
Definition: CD_KMCDualStateImplem.H:33
virtual ~KMCDualState()
Destructor.
Definition: CD_KMCDualStateImplem.H:28
KMCDualState(KMCDualState &)=default
Copy constructor.
KMCDualState & operator=(const KMCDualState &&)=delete
Disallowed move assignement.
State m_reactiveState
Reactive state.
Definition: CD_KMCDualState.H:118
KMCDualState & operator=(const KMCDualState &)=default
Copy assignment constructor.
KMCDualState(KMCDualState &&)=delete
Disallowed move constructor.
State & getReactiveState() noexcept
Get modifiable reactive state.
Definition: CD_KMCDualStateImplem.H:66