| [fea945] | 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 | 
 | 
|---|
| [fe8253] | 18 | #include "CodePatterns/Range.hpp"
 | 
|---|
| [fea945] | 19 | #include "LinkedCell/LinkedCell_View.hpp"
 | 
|---|
 | 20 | 
 | 
|---|
| [fe8253] | 21 | class LinkedCell_ControllerTest;
 | 
|---|
| [c80643] | 22 | class IPointCloud;
 | 
|---|
| [fe8253] | 23 | 
 | 
|---|
| [fea945] | 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 |    *
 | 
|---|
| [fe8253] | 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
 | 
|---|
| [fea945] | 39 |    * to a present LinkedCell instance.
 | 
|---|
 | 40 |    *
 | 
|---|
 | 41 |    */
 | 
|---|
 | 42 |   class LinkedCell_Controller
 | 
|---|
 | 43 |   {
 | 
|---|
| [fe8253] | 44 |     //!> grant unit tests access to internal parts
 | 
|---|
 | 45 |     friend class ::LinkedCell_ControllerTest;
 | 
|---|
| [fea945] | 46 |   public:
 | 
|---|
 | 47 |     LinkedCell_Controller(const Box &_domain);
 | 
|---|
 | 48 |     ~LinkedCell_Controller();
 | 
|---|
 | 49 | 
 | 
|---|
| [c80643] | 50 |     LinkedCell_View getView(const double distance, IPointCloud &set);
 | 
|---|
| [fea945] | 51 | 
 | 
|---|
 | 52 |   private:
 | 
|---|
 | 53 |     const LinkedCell_Model * getBestModel(const double distance) const;
 | 
|---|
| [fe8253] | 54 |     const range<double> getHeuristicRange(const double distance) const;
 | 
|---|
 | 55 |     void insertNewModel(const double edgelength, LinkedCell_Model*& instance);
 | 
|---|
| [fea945] | 56 | 
 | 
|---|
 | 57 |   private:
 | 
|---|
 | 58 |     //!> typedef for the (edge length, model) map
 | 
|---|
 | 59 |     typedef std::map<double, LinkedCell_Model* > MapEdgelengthModel;
 | 
|---|
 | 60 | 
 | 
|---|
 | 61 |     //!> internal map of present LinkedCell_Model instances by their egde length
 | 
|---|
 | 62 |     MapEdgelengthModel ModelsMap;
 | 
|---|
 | 63 | 
 | 
|---|
| [fe8253] | 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 | 
 | 
|---|
| [fea945] | 70 |     //!> internal reference to domain required for constructing LinkedCell_Model instances.
 | 
|---|
 | 71 |     const Box &domain;
 | 
|---|
 | 72 |   };
 | 
|---|
 | 73 | 
 | 
|---|
 | 74 | }
 | 
|---|
 | 75 | 
 | 
|---|
 | 76 | #endif /* LINKEDCELL_CONTROLLER_HPP_ */
 | 
|---|