chombo-discharge
CD_CdrIterator.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_CdrIterator_H
13 #define CD_CdrIterator_H
14 
15 // Our includes
16 #include <CD_CdrLayout.H>
17 #include <CD_NamespaceHeader.H>
18 
25 template <class T>
27 {
28 public:
32  enum class SpeciesIteration
33  {
34  All,
35  Charged,
36  Negative,
37  Positive,
38  Neutral
39  };
40 
44  CdrIterator() = delete;
45 
51  CdrIterator(CdrLayout<T>& a_layout, const SpeciesIteration a_mode = SpeciesIteration::All);
52 
56  virtual ~CdrIterator();
57 
61  virtual int
63 
67  virtual int
68  index() const;
69 
73  virtual void
74  reset();
75 
79  virtual bool
80  ok() const;
81 
85  virtual void
86  operator++();
87 
91  virtual RefCountedPtr<T>&
92  operator()();
93 
97  virtual RefCountedPtr<CdrSpecies>&
98  getSpecies();
99 
100 protected:
105 
109  int m_isolver;
110 
115 
120 
124  Vector<RefCountedPtr<T>> m_solvers;
125 
129  Vector<RefCountedPtr<CdrSpecies>> m_species;
130 };
131 
132 #include <CD_NamespaceFooter.H>
133 
134 #include <CD_CdrIteratorImplem.H>
135 
136 #endif
Implementation of CdrIterator.H.
Declaration of a class that holds a set of CdrSolvers (to cut down on typing).
Iterator class for CdrLayout. This allows iteration through solvers (or subsets of solvers).
Definition: CD_CdrIterator.H:27
virtual void reset()
Reset iterator.
Definition: CD_CdrIteratorImplem.H:65
Vector< RefCountedPtr< T > > m_solvers
Cdr solvers.
Definition: CD_CdrIterator.H:124
bool m_isDefined
Defined or not.
Definition: CD_CdrIterator.H:119
Vector< RefCountedPtr< CdrSpecies > > m_species
Cdr species.
Definition: CD_CdrIterator.H:129
virtual bool ok() const
Ok or not.
Definition: CD_CdrIteratorImplem.H:76
virtual int index() const
Get current solver number (i.e. index in CdrLayouts solvers).
Definition: CD_CdrIteratorImplem.H:54
virtual RefCountedPtr< CdrSpecies > & getSpecies()
Return the current species.
Definition: CD_CdrIteratorImplem.H:144
virtual RefCountedPtr< T > & operator()()
Return the current solver.
Definition: CD_CdrIteratorImplem.H:132
virtual void operator++()
Increment. This is different for different iteration modes.
Definition: CD_CdrIteratorImplem.H:87
CdrIterator()=delete
Disallowed weak construction. Always use the full constructor.
SpeciesIteration
Enum class for iterating through subsets of species.
Definition: CD_CdrIterator.H:33
int m_numSolvers
Number of solvers.
Definition: CD_CdrIterator.H:114
SpeciesIteration m_mode
Which species to iterate over.
Definition: CD_CdrIterator.H:104
virtual ~CdrIterator()
Destructor (does nothing).
Definition: CD_CdrIteratorImplem.H:36
virtual int getNumberOfSolvers()
Get number of solvers.
Definition: CD_CdrIteratorImplem.H:43
Class for holding a set of CdrSolvers.
Definition: CD_CdrLayout.H:37