Line data Source code
1 : // Copyright (C) 2015 Technische Universitaet Muenchen 2 : // This file is part of the Mamico project. For conditions of distribution 3 : // and use, please see the copyright notice in Mamico's main folder, or at 4 : // www5.in.tum.de/mamico 5 : #ifndef _MOLECULARDYNAMICS_COUPLING_INTERFACE_MOLECULEITERATOR_H_ 6 : #define _MOLECULARDYNAMICS_COUPLING_INTERFACE_MOLECULEITERATOR_H_ 7 : 8 : #include "coupling/interface/Molecule.h" 9 : 10 : namespace coupling { 11 : namespace interface { 12 : template <class LinkedCell, unsigned int dim> class MoleculeIterator; 13 : } 14 : } // namespace coupling 15 : 16 : /** This class provides some iterator scheme for traversing the molecules within 17 : *a linked cell. 18 : * @brief some iterator scheme for traversing the molecules within a linked 19 : *cell. 20 : * @tparam LinkedCell cell type 21 : * @tparam dim Number of dimensions; it can be 1, 2 or 3 22 : * @author Philipp Neumann 23 : */ 24 : template <class LinkedCell, unsigned int dim> class coupling::interface::MoleculeIterator { 25 : protected: 26 : LinkedCell& _cell; 27 : 28 : public: 29 : /** Constructor */ 30 0 : MoleculeIterator(LinkedCell& cell) : _cell(cell) {} 31 : 32 : /** Destructor */ 33 0 : virtual ~MoleculeIterator() {} 34 : 35 : /** sets the iterator to the first element */ 36 : virtual void begin() = 0; 37 : 38 : /** @returns true, if the iterator should continue the molecule traversal, 39 : * false otherwise. */ 40 : virtual bool continueIteration() const = 0; 41 : 42 : /** sets the iterator to the next molecule */ 43 : virtual void next() = 0; 44 : 45 : /** @returns a reference to the molecule that this iterator currently points 46 : * to */ 47 : virtual coupling::interface::Molecule<dim>& get() = 0; 48 : 49 : /** @returns a const reference to the current molecule for pure reading 50 : * purposes */ 51 : virtual const coupling::interface::Molecule<dim>& getConst() = 0; 52 : }; 53 : 54 : #endif // _MOLECULARDYNAMICS_COUPLING_INTERFACE_MOLECULEITERATOR_H_