1 | /*
|
---|
2 | * LinkedCell_Controller.hpp
|
---|
3 | *
|
---|
4 | * Created on: Nov 15, 2011
|
---|
5 | * Author: heber
|
---|
6 | */
|
---|
7 |
|
---|
8 | #ifndef LINKEDCELL_CONTROLLER_HPP_
|
---|
9 | #define LINKEDCELL_CONTROLLER_HPP_
|
---|
10 |
|
---|
11 | // include config.h
|
---|
12 | #ifdef HAVE_CONFIG_H
|
---|
13 | #include <config.h>
|
---|
14 | #endif
|
---|
15 |
|
---|
16 | #include <map>
|
---|
17 |
|
---|
18 | #include "CodePatterns/Range.hpp"
|
---|
19 | #include "LinkedCell/LinkedCell_View.hpp"
|
---|
20 |
|
---|
21 | class LinkedCell_ControllerTest;
|
---|
22 | class IPointCloud;
|
---|
23 |
|
---|
24 | namespace LinkedCell {
|
---|
25 |
|
---|
26 | class LinkedCell_Model;
|
---|
27 |
|
---|
28 | /** This is the controller in the MVC ansatz for the LinkedCell structure.
|
---|
29 | *
|
---|
30 | * \sa linkedcell
|
---|
31 | *
|
---|
32 | * The Controller contains multiple models (i.e. LinkedCell instances) and he
|
---|
33 | * takes care that the view (the interface) can give its functionality with
|
---|
34 | * low computational complexity.
|
---|
35 | *
|
---|
36 | * Here, it contains multiple LinkedCell models, each with different edge
|
---|
37 | * lengths of the inherent mesh. You request a LinkedCell instance from the
|
---|
38 | * controller, but you basically just receive a const interface reference
|
---|
39 | * to a present LinkedCell instance.
|
---|
40 | *
|
---|
41 | */
|
---|
42 | class LinkedCell_Controller
|
---|
43 | {
|
---|
44 | //!> grant unit tests access to internal parts
|
---|
45 | friend class ::LinkedCell_ControllerTest;
|
---|
46 | public:
|
---|
47 | LinkedCell_Controller(const Box &_domain);
|
---|
48 | ~LinkedCell_Controller();
|
---|
49 |
|
---|
50 | LinkedCell_View getView(const double distance, IPointCloud &set);
|
---|
51 |
|
---|
52 | private:
|
---|
53 | const LinkedCell_Model * getBestModel(const double distance) const;
|
---|
54 | const range<double> getHeuristicRange(const double distance) const;
|
---|
55 | void insertNewModel(const double edgelength, const LinkedCell_Model* instance);
|
---|
56 |
|
---|
57 | private:
|
---|
58 | //!> typedef for the (edge length, model) map
|
---|
59 | typedef std::map<double, const LinkedCell_Model* > MapEdgelengthModel;
|
---|
60 |
|
---|
61 | //!> internal map of present LinkedCell_Model instances by their egde length
|
---|
62 | MapEdgelengthModel ModelsMap;
|
---|
63 |
|
---|
64 | //!> lower threshold below which no new instances are generated.
|
---|
65 | static double lower_threshold;
|
---|
66 |
|
---|
67 | //!> upper threshold above which no new instances are generated.
|
---|
68 | static double upper_threshold;
|
---|
69 |
|
---|
70 | //!> internal reference to domain required for constructing LinkedCell_Model instances.
|
---|
71 | const Box &domain;
|
---|
72 | };
|
---|
73 |
|
---|
74 | }
|
---|
75 |
|
---|
76 | #endif /* LINKEDCELL_CONTROLLER_HPP_ */
|
---|