chombo-discharge
CD_KMCSingleStateImplem.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_KMCSingleStateImplem_H
13 #define CD_KMCSingleStateImplem_H
14 
15 // Our includes
16 #include <CD_KMCSingleState.H>
17 #include <CD_NamespaceHeader.H>
18 
19 template <typename T>
20 KMCSingleState<T>::KMCSingleState(const size_t a_numSpecies) noexcept
21 {
22  m_state.resize(a_numSpecies);
23 }
24 
25 template <typename T>
27 {}
28 
29 template <typename T>
30 inline bool
32 {
33  bool isValid = true;
34 
35  for (const auto& p : m_state) {
36  if (p < 0) {
37  isValid = false;
38 
39  break;
40  }
41  }
42 
43  return isValid;
44 }
45 
46 template <typename T>
47 inline T&
48 KMCSingleState<T>::operator[](const size_t a_idx) noexcept
49 {
50  CH_assert(a_idx < m_state.size());
51 
52  return m_state[a_idx];
53 }
54 
55 template <typename T>
56 inline const T&
57 KMCSingleState<T>::operator[](const size_t a_idx) const noexcept
58 {
59  CH_assert(a_idx < m_state.size());
60 
61  return m_state[a_idx];
62 }
63 
64 template <typename T>
65 inline typename KMCSingleState<T>::State&
67 {
68  return m_state;
69 }
70 
71 template <typename T>
72 inline const typename KMCSingleState<T>::State&
74 {
75  return m_state;
76 }
77 
78 #include <CD_NamespaceFooter.H>
79 
80 #endif
Declaration of a simple state vector for running Kinetic Monte Carlo for plasma problems.
T & operator[](const size_t a_idx) noexcept
Get the population of the input index.
Definition: CD_KMCSingleStateImplem.H:48
virtual ~KMCSingleState()
Destructor.
Definition: CD_KMCSingleStateImplem.H:26
KMCSingleState()=delete
Disallowed weak construction.
State & getState() noexcept
Get modifiable state.
Definition: CD_KMCSingleStateImplem.H:66
bool isValidState() const noexcept
Check if state is a valid state.
Definition: CD_KMCSingleStateImplem.H:31