BornAgain
1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
IterationStrategy.h
Go to the documentation of this file.
1
// ************************************************************************** //
2
//
3
// BornAgain: simulate and fit scattering at grazing incidence
4
//
5
//! @file Param/Node/IterationStrategy.h
6
//! @brief Defines class IterationStrategy and children.
7
//!
8
//! @homepage http://www.bornagainproject.org
9
//! @license GNU General Public License v3 or higher (see COPYING)
10
//! @copyright Forschungszentrum Jülich GmbH 2018
11
//! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12
//
13
// ************************************************************************** //
14
15
#ifndef BORNAGAIN_CORE_PARAMETRIZATION_ITERATIONSTRATEGY_H
16
#define BORNAGAIN_CORE_PARAMETRIZATION_ITERATIONSTRATEGY_H
17
18
class
INode
;
19
class
IteratorMemento
;
20
21
//! Abstract base class for tree traversal strategies, for use in INodeVisitor.
22
//!
23
//! For definition of different strategies see https://en.wikipedia.org/wiki/Tree_traversal.
24
25
class
IterationStrategy
26
{
27
public
:
28
virtual
IterationStrategy
* clone()
const
= 0;
29
30
virtual
IteratorMemento
first(
const
INode
* p_root) = 0;
31
virtual
void
next(
IteratorMemento
& iterator_stack)
const
= 0;
32
virtual
bool
isDone(
IteratorMemento
& iterator_stack)
const
= 0;
33
};
34
35
//! Traverse tree; visit parents before their children.
36
class
PreorderStrategy
:
public
IterationStrategy
37
{
38
public
:
39
PreorderStrategy
();
40
41
virtual
PreorderStrategy
* clone()
const
;
42
43
virtual
IteratorMemento
first(
const
INode
* p_root);
44
virtual
void
next(
IteratorMemento
& iterator_stack)
const
;
45
virtual
bool
isDone(
IteratorMemento
& iterator_stack)
const
;
46
};
47
48
//! Traverse tree; visit children before their parents.
49
class
PostorderStrategy
:
public
IterationStrategy
50
{
51
public
:
52
PostorderStrategy
();
53
54
virtual
PostorderStrategy
* clone()
const
;
55
56
virtual
IteratorMemento
first(
const
INode
* p_root);
57
virtual
void
next(
IteratorMemento
& iterator_stack)
const
;
58
virtual
bool
isDone(
IteratorMemento
& iterator_stack)
const
;
59
};
60
61
#endif
// BORNAGAIN_CORE_PARAMETRIZATION_ITERATIONSTRATEGY_H
INode
Base class for tree-like structures containing parameterized objects.
Definition:
INode.h:49
IterationStrategy
Abstract base class for tree traversal strategies, for use in INodeVisitor.
Definition:
IterationStrategy.h:26
IteratorMemento
Holds all iterator states encountered for SampleTreeIterator.
Definition:
NodeIterator.h:56
PostorderStrategy
Traverse tree; visit children before their parents.
Definition:
IterationStrategy.h:50
PreorderStrategy
Traverse tree; visit parents before their children.
Definition:
IterationStrategy.h:37
Param
Node
IterationStrategy.h
Generated by
1.9.1