chombo-discharge
Loading...
Searching...
No Matches
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// Chombo includes
16#include <CH_Timer.H>
17
18// Our includes
19#include <CD_KMCSingleState.H>
20#include <CD_NamespaceHeader.H>
21
22template <typename T>
24{
25 CH_TIME("KMCSingleState::KMCSingleState");
26
27 m_state.resize(a_numSpecies);
28}
29
30template <typename T>
32{
33 CH_TIME("KMCSingleState::~KMCSingleState");
34}
35
36template <typename T>
37inline bool
39{
40 CH_TIME("KMCSingleState::isValidState");
41
42 bool isValid = true;
43
44 for (const auto& p : m_state) {
45 if (p < 0) {
46 isValid = false;
47
48 break;
49 }
50 }
51
52 return isValid;
53}
54
55template <typename T>
56inline T&
58{
59 CH_assert(a_idx < m_state.size());
60
61 return m_state[a_idx];
62}
63
64template <typename T>
65inline const T&
66KMCSingleState<T>::operator[](const size_t a_idx) const noexcept
67{
68 CH_assert(a_idx < m_state.size());
69
70 return m_state[a_idx];
71}
72
73template <typename T>
74inline std::vector<T>
76{
77 return m_state;
78}
79
80template <typename T>
81inline void
86
87template <typename T>
88inline typename KMCSingleState<T>::State&
90{
91 return m_state;
92}
93
94template <typename T>
95inline const typename KMCSingleState<T>::State&
97{
98 return m_state;
99}
100
101#include <CD_NamespaceFooter.H>
102
103#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:57
virtual ~KMCSingleState()
Destructor.
Definition CD_KMCSingleStateImplem.H:31
KMCSingleState()=delete
Disallowed weak construction.
void linearIn(const std::vector< T > &a_linearizedState) noexcept
Linearize the input buffer.
Definition CD_KMCSingleStateImplem.H:82
State & getState() noexcept
Get modifiable state.
Definition CD_KMCSingleStateImplem.H:89
std::vector< T > linearOut() const noexcept
Linearize the state onto an output vector.
Definition CD_KMCSingleStateImplem.H:75
bool isValidState() const noexcept
Check if state is a valid state.
Definition CD_KMCSingleStateImplem.H:38
Base class for a tracer particle solver. This solver can advance particles in a pre-defined velocity ...
Definition CD_TracerParticleSolver.H:37
TracerParticleSolver()
Default constructor.
Definition CD_TracerParticleSolverImplem.H:25