Computer Assisted Medical Intervention Tool Kit  version 5.2
AtomIterator.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * $CAMITK_LICENCE_BEGIN$
3  *
4  * CamiTK - Computer Assisted Medical Intervention ToolKit
5  * (c) 2001-2024 Univ. Grenoble Alpes, CNRS, Grenoble INP - UGA, TIMC, 38000 Grenoble, France
6  *
7  * Visit http://camitk.imag.fr for more information
8  *
9  * This file is part of CamiTK.
10  *
11  * CamiTK is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * CamiTK is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Lesser General Public License version 3 for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
22  *
23  * $CAMITK_LICENCE_END$
24  ****************************************************************************/
25 
26 
27 #ifndef TOOLS_ATOMITERATOR_H
28 #define TOOLS_ATOMITERATOR_H
29 
30 #include <Load.h>
31 #include <PhysicalModel.h>
32 #include <cstring>
40 class AtomIterator {
41 
42 public:
43 
45  AtomIterator(PhysicalModel* pml, std::string targetList);
47  ~AtomIterator() = default;
48 
50  void begin();
52  bool end();
54  void next();
56  Atom* currentAtom();
57 
59  void operator++();
60 
61 private:
63  std::vector<Atom*> atoms;
65  unsigned int index;
66 
67 };
68 
69 #endif // TOOLS_ATOMITERATOR_H
Allow iteration over a set of atoms given by a target list (component name or index list)
Definition: AtomIterator.h:40
~AtomIterator()=default
destructor
Atom * currentAtom()
return current atom
Definition: AtomIterator.cpp:79
void begin()
place iterator on first atom
Definition: AtomIterator.cpp:62
void next()
if iteration is not finished, advance to next atom
Definition: AtomIterator.cpp:72
AtomIterator(PhysicalModel *pml, std::string targetList)
constructor
Definition: AtomIterator.cpp:29
void operator++()
redefinition of ++ operator, advance iterator to next atom
Definition: AtomIterator.cpp:84
bool end()
return true if iterator is over the last atom
Definition: AtomIterator.cpp:67
An atom has an unique index in the physical model object, a 3D position, and different basic properti...
Definition: Atom.h:49
This is the main class of this project.
Definition: PhysicalModel.h:86