chombo-discharge
CD_RtIteratorImplem.H
Go to the documentation of this file.
1 /* chombo-discharge
2  * Copyright © 2021 SINTEF Energy Research.
3  * Please refer to Copyright.txt and LICENSE in the chombo-discharge root directory.
4  */
5 
12 #ifndef CD_RtIteratorImplem_H
13 #define CD_RtIteratorImplem_H
14 
15 // Our includes
16 #include <CD_RtIterator.H>
17 #include <CD_NamespaceHeader.H>
18 
22 template <class T>
24 {
25  CH_TIME("RtIterator::RtIterator");
26 
27  m_solvers = a_layout.getSolvers();
28  m_species = a_layout.getSpecies();
29  m_num = m_solvers.size();
30 
31  this->reset();
32 }
33 
34 template <class T>
36 {
37  CH_TIME("RtIterator::~RtIterator");
38 }
39 
40 template <class T>
41 int
43 {
44  return m_num;
45 }
46 
47 template <class T>
48 int
50 {
51  return m_isolver;
52 }
53 
54 template <class T>
55 void
57 {
58  m_isolver = 0;
59 }
60 
61 template <class T>
62 bool
64 {
65  return (m_isolver < m_num);
66 }
67 
68 template <class T>
69 void
71 {
72  m_isolver++;
73 }
74 
75 template <class T>
76 RefCountedPtr<T>&
78 {
79  CH_assert(m_isolver < m_num);
80  return m_solvers[m_isolver];
81 }
82 template <class T>
83 RefCountedPtr<RtSpecies>&
85 {
86  CH_assert(m_isolver < m_num);
87  return m_species[m_isolver];
88 }
89 
90 #include <CD_NamespaceFooter.H>
91 
92 #endif
Iterator class for RtLayout.
virtual RefCountedPtr< T > & operator()()
Get the solver pointed to by the iterator.
Definition: CD_RtIteratorImplem.H:77
virtual int index() const
Get current solver number/index.
Definition: CD_RtIteratorImplem.H:49
virtual ~RtIterator()
Destructor (does nothing)
Definition: CD_RtIteratorImplem.H:35
virtual void operator++()
Incrementation operator. Cycles to next solver.
Definition: CD_RtIteratorImplem.H:70
virtual void reset()
Reset iterator to first solver.
Definition: CD_RtIteratorImplem.H:56
virtual int getNumberOfSolvers()
Get number of solvers.
Definition: CD_RtIteratorImplem.H:42
virtual bool ok()
Check if we can cycle further through the solvers.
Definition: CD_RtIteratorImplem.H:63
RtIterator()=delete
Empty constructor.
virtual RefCountedPtr< RtSpecies > & getSpecies()
Get current species pointed to by the iterator.
Definition: CD_RtIteratorImplem.H:84
Class for holding a set of RtSolvers. T must derive from RtSolver.
Definition: CD_RtLayout.H:27
virtual Vector< RefCountedPtr< T > > & getSolvers()
Get solvers.
Definition: CD_RtLayoutImplem.H:397
virtual Vector< RefCountedPtr< RtSpecies > > & getSpecies()
Get species.
Definition: CD_RtLayoutImplem.H:404