source: src/LinkedCell/LinkedCell_Controller.hpp@ ff4fff9

CombiningParticlePotentialParsing
Last change on this file since ff4fff9 was 1d2d01e, checked in by Frederik Heber <heber@…>, 12 years ago

Fixing minimum sensible length for LinkedCell_Controller.

  • we did use the minimum sensible length for getBestModel() but not for the actual creation.
  • extracted code into function getSensibleMinimumLength().
  • fixed (and documented) formula for calculating min_distance.
  • we also can now also deal with systems that are mostly 2d or 1d.
  • Property mode set to 100644
File size: 2.4 KB
Line 
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/Observer/Observer.hpp"
19#include "CodePatterns/Range.hpp"
20#include "LinkedCell/LinkedCell_View.hpp"
21
22class LinkedCell_ControllerTest;
23class IPointCloud;
24
25namespace LinkedCell {
26
27 class LinkedCell_Model;
28
29 /** This is the controller in the MVC ansatz for the LinkedCell structure.
30 *
31 * \sa linkedcell
32 *
33 * The Controller contains multiple models (i.e. LinkedCell instances) and he
34 * takes care that the view (the interface) can give its functionality with
35 * low computational complexity.
36 *
37 * Here, it contains multiple LinkedCell models, each with different edge
38 * lengths of the inherent mesh. You request a LinkedCell instance from the
39 * controller, but you basically just receive a const interface reference
40 * to a present LinkedCell instance.
41 *
42 */
43 class LinkedCell_Controller : public Observer
44 {
45 //!> grant unit tests access to internal parts
46 friend class ::LinkedCell_ControllerTest;
47 public:
48 LinkedCell_Controller(const Box &_domain);
49 ~LinkedCell_Controller();
50
51 LinkedCell_View getView(const double distance, IPointCloud &set);
52
53 void update(Observable *publisher);
54 void recieveNotification(Observable *publisher, Notification_ptr notification);
55 void subjectKilled(Observable *publisher);
56
57 private:
58 const LinkedCell_Model * getBestModel(const double distance) const;
59 const range<double> getHeuristicRange(const double distance) const;
60 void insertNewModel(const double edgelength, const LinkedCell_Model* instance);
61 void updateModels();
62
63 double getMinimumSensibleLength(double distance) const;
64
65 private:
66 //!> typedef for the (edge length, model) map
67 typedef std::map<double, const LinkedCell_Model* > MapEdgelengthModel;
68
69 //!> internal map of present LinkedCell_Model instances by their egde length
70 MapEdgelengthModel ModelsMap;
71
72 //!> lower threshold below which no new instances are generated.
73 static double lower_threshold;
74
75 //!> upper threshold above which no new instances are generated.
76 static double upper_threshold;
77
78 //!> internal reference to domain required for constructing LinkedCell_Model instances.
79 const Box &domain;
80 };
81
82}
83
84#endif /* LINKEDCELL_CONTROLLER_HPP_ */
Note: See TracBrowser for help on using the repository browser.