File indexing completed on 2025-08-06 08:17:57
0001 #include "ParticleFlowElementContainer.h"
0002
0003 #include "ParticleFlowElement.h"
0004
0005 #include <cstdlib>
0006 #include <iostream>
0007 #include <utility>
0008
0009 ParticleFlowElementContainer::ConstRange
0010 ParticleFlowElementContainer::getParticleFlowElements() const
0011 {
0012 return make_pair(_pflowElementMap.begin(), _pflowElementMap.end());
0013 }
0014
0015 ParticleFlowElementContainer::Range
0016 ParticleFlowElementContainer::getParticleFlowElements()
0017 {
0018 return make_pair(_pflowElementMap.begin(), _pflowElementMap.end());
0019 }
0020
0021 void ParticleFlowElementContainer::AddParticleFlowElement(int index, ParticleFlowElement *pflowElement)
0022 {
0023 _pflowElementMap[index] = pflowElement;
0024 }
0025
0026 ParticleFlowElement *
0027 ParticleFlowElementContainer::getParticleFlowElement(int index)
0028 {
0029 ConstIterator it = _pflowElementMap.find(index);
0030 if (it != _pflowElementMap.end())
0031 {
0032 return it->second;
0033 }
0034 return nullptr;
0035 }
0036
0037 const ParticleFlowElement *
0038 ParticleFlowElementContainer::getParticleFlowElement(int index) const
0039 {
0040 ConstIterator it = _pflowElementMap.find(index);
0041 if (it != _pflowElementMap.end())
0042 {
0043 return it->second;
0044 }
0045 return nullptr;
0046 }
0047
0048 int ParticleFlowElementContainer::isValid() const
0049 {
0050 return (!_pflowElementMap.empty());
0051 }
0052
0053 void ParticleFlowElementContainer::Reset()
0054 {
0055 while (_pflowElementMap.begin() != _pflowElementMap.end())
0056 {
0057 delete _pflowElementMap.begin()->second;
0058 _pflowElementMap.erase(_pflowElementMap.begin());
0059 }
0060 }
0061
0062 void ParticleFlowElementContainer::identify(std::ostream &os) const
0063 {
0064 os << "ParticleFlowElementContainer, number of elements: " << size() << std::endl;
0065 }