12 #ifndef CD_CdrIteratorImplem_H
13 #define CD_CdrIteratorImplem_H
17 #include <CD_NamespaceHeader.H>
22 CH_TIME(
"CdrIterator<T>::CdrIterator(CdrLayout<T>, SpeciesIteration)");
27 m_numSolvers = m_solvers.size();
38 CH_TIME(
"CdrIterator<T>::~CdrIterator()");
45 CH_TIME(
"CdrIterator<T>::getNumberOfSolvers()");
47 CH_assert(m_isDefined);
56 CH_TIME(
"CdrIterator<T>::index()");
58 CH_assert(m_isDefined);
67 CH_TIME(
"CdrIterator<T>::reset()");
69 CH_assert(m_isDefined);
78 CH_TIME(
"CdrIterator<T>::ok()");
80 CH_assert(m_isDefined);
82 return (m_isolver < m_numSolvers);
89 CH_TIME(
"CdrIterator<T>::operator++()");
91 CH_assert(m_isDefined);
93 if (m_mode == SpeciesIteration::All) {
99 for (
int isolver = m_isolver; this->ok(); ++isolver) {
100 const RefCountedPtr<CdrSpecies>& species = m_species[isolver];
102 if (m_mode == SpeciesIteration::Charged) {
103 if (species->getChargeNumber() != 0) {
108 else if (m_mode == SpeciesIteration::Negative) {
109 if (species->getChargeNumber() < 0) {
114 else if (m_mode == SpeciesIteration::Positive) {
115 if (species->getChargeNumber() > 0) {
120 else if (m_mode == SpeciesIteration::Neutral) {
121 if (species->getChargeNumber() == 0) {
134 CH_TIME(
"CdrIterator<T>::operator()");
136 CH_assert(m_isDefined);
137 CH_assert(m_isolver < m_numSolvers);
139 return m_solvers[m_isolver];
143 RefCountedPtr<CdrSpecies>&
146 CH_TIME(
"CdrIterator<T>::getSpecies()");
148 CH_assert(m_isDefined);
149 CH_assert(m_isolver < m_numSolvers);
151 return m_species[m_isolver];
154 #include <CD_NamespaceFooter.H>
Declaration of an iterator class for CdrLayout (for iterating through subsets of solvers).
virtual void reset()
Reset iterator.
Definition: CD_CdrIteratorImplem.H:65
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
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
virtual Vector< RefCountedPtr< T > > & getSolvers()
Get solvers.
Definition: CD_CdrLayoutImplem.H:366
virtual Vector< RefCountedPtr< CdrSpecies > > & getSpecies()
Get species.
Definition: CD_CdrLayoutImplem.H:378