chombo-discharge
CD_ItoIterator.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_ItoIterator_H
13 #define CD_ItoIterator_H
14 
15 #include <CD_ItoLayout.H>
16 #include <CD_NamespaceHeader.H>
17 
22 template <class T>
24 {
25 public:
29  enum class SpeciesIteration
30  {
31  All,
32  Charged,
33  Negative,
34  Positive,
35  Neutral
36  };
37 
41  ItoIterator() = delete;
42 
48  ItoIterator(ItoLayout<T>& a_layout, const SpeciesIteration a_mode = SpeciesIteration::All);
49 
53  virtual ~ItoIterator();
54 
59  virtual int
61 
66  virtual int
67  index() const;
68 
72  virtual void
73  reset();
74 
79  virtual bool
80  ok();
81 
85  virtual void
86  operator++();
87 
91  virtual RefCountedPtr<T>&
92  operator()();
93 
97  virtual RefCountedPtr<ItoSpecies>&
98  getSpecies();
99 
100 protected:
105 
110 
115 
120 
124  Vector<RefCountedPtr<T>> m_solvers;
125 
129  Vector<RefCountedPtr<ItoSpecies>> m_species;
130 };
131 
132 #include <CD_NamespaceFooter.H>
133 
134 #include <CD_ItoIteratorImplem.H>
135 
136 #endif
Implementation of CD_ItoIterator.H.
Declaration of a class that holds a set of ItoSolvers.
"Iterator" class for going through solvers in an ItoLayout.
Definition: CD_ItoIterator.H:24
int m_numSolvers
Number of solvers.
Definition: CD_ItoIterator.H:114
virtual void operator++()
Increment. This is different for different iteration modes.
Definition: CD_ItoIteratorImplem.H:78
virtual bool ok()
Ok or not.
Definition: CD_ItoIteratorImplem.H:71
virtual RefCountedPtr< T > & operator()()
Get current solver.
Definition: CD_ItoIteratorImplem.H:125
virtual ~ItoIterator()
Destructor (does nothing)
Definition: CD_ItoIteratorImplem.H:37
virtual int index() const
Get current solver number.
Definition: CD_ItoIteratorImplem.H:53
virtual RefCountedPtr< ItoSpecies > & getSpecies()
Get current species.
Definition: CD_ItoIteratorImplem.H:135
Vector< RefCountedPtr< ItoSpecies > > m_species
Solver species.
Definition: CD_ItoIterator.H:129
bool m_isDefined
Defined or not.
Definition: CD_ItoIterator.H:119
Vector< RefCountedPtr< T > > m_solvers
Solvers.
Definition: CD_ItoIterator.H:124
int m_isolver
Current solver pointed to by the iterator.
Definition: CD_ItoIterator.H:109
virtual void reset()
Reset iterator to the first solver.
Definition: CD_ItoIteratorImplem.H:62
virtual int getNumberOfSolvers()
Get number of solvers.
Definition: CD_ItoIteratorImplem.H:44
ItoIterator()=delete
Disallowed constructor – use the full constructor.
SpeciesIteration m_mode
Which species to iterate over.
Definition: CD_ItoIterator.H:104
SpeciesIteration
Enum which specifies which species to iterate through.
Definition: CD_ItoIterator.H:30
Class for holding a set of ItoSolvers.
Definition: CD_ItoLayout.H:30