Computer Assited Medical Intervention Tool Kit  version 5.0
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-2021 Univ. Grenoble Alpes, CNRS, Grenoble INP, 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
StructuralComponent::getNumberOfStructures
unsigned int getNumberOfStructures() const
get the number of structures
Definition: StructuralComponent.h:252
AtomIterator.h
Atom
An atom has an unique index in the physical model object, a 3D position, and different basic properti...
Definition: Atom.h:49
a
#define a
PhysicalModel::getAtom
Atom * getAtom(const unsigned int id)
Get the atom that has the global index given in parameters.
Definition: PhysicalModel.h:385
StructuralComponent
A structural component is composed either by cell or by atoms.
Definition: StructuralComponent.h:52
AtomIterator::AtomIterator
AtomIterator(PhysicalModel *pml, std::string targetList)
constructor
Definition: AtomIterator.cpp:29
AtomIterator::~AtomIterator
~AtomIterator()=default
destructor
PhysicalModel
This is the main class of this project. Following a nice concept, a physical model is able to represe...
Definition: PhysicalModel.h:86
Load.h
AtomIterator::operator++
void operator++()
redefinition of ++ operator, advance iterator to next atom
Definition: AtomIterator.cpp:84
Cell
A cell has an unique index in the physical model object, is composed by atoms, and different basic pr...
Definition: Cell.h:46
PhysicalModel::getComponentByName
Component * getComponentByName(const std::string n)
get a structural or multi component by its name.
Definition: PhysicalModel.cpp:553
TargetList::getIndexedTarget
int getIndexedTarget(const unsigned int) const
get an indexed target
Definition: TargetList.cpp:142
AtomIterator::next
void next()
if iteration is not finished, advance to next atom
Definition: AtomIterator.cpp:72
TargetList::indexedTargets
bool indexedTargets() const
return true only if the list of target are indexes
Definition: TargetList.cpp:265
StructuralComponent::getStructure
Structure * getStructure(const unsigned int) const
get a structure by its index (fisrt structure is at index 0)
Definition: StructuralComponent.h:220
PhysicalModel.h
AtomIterator::currentAtom
Atom * currentAtom()
return current atom
Definition: AtomIterator.cpp:79
AtomIterator::atoms
std::vector< Atom * > atoms
atoms list
Definition: AtomIterator.h:86
AtomIterator::end
bool end()
return true if iterator is over the last atom
Definition: AtomIterator.cpp:67
AtomIterator
Allow iteration over a set of atoms given by a target list (component name or index list)
Definition: AtomIterator.h:40
AtomIterator::index
unsigned int index
current atom index
Definition: AtomIterator.h:88
TargetList::getNumberOfTargets
unsigned int getNumberOfTargets() const
get the nr of indevidual targets
Definition: TargetList.cpp:132
AtomIterator::begin
void begin()
place iterator on first atom
Definition: AtomIterator.cpp:62
TargetList::getNamedTarget
std::string getNamedTarget(const unsigned int) const
get a named target
Definition: TargetList.cpp:152
TargetList
Manage a list of targets, can be created/modified using either an integer, a name,...
Definition: TargetList.h:45