21 #ifndef ophidian_DENSITY_H
22 #define ophidian_DENSITY_H
24 #include <boost/geometry/index/rtree.hpp>
26 #include "placement.h"
27 #include "floorplan.h"
34 using point = geometry::point<double>;
35 using box = geometry::box<point>;
36 using rtree_node = std::pair<box, entity_system::entity>;
37 using rtree = boost::geometry::index::rtree<rtree_node, boost::geometry::index::rstar<16>>;
48 unsigned m_skipped_bins;
52 : m_floorplan(floorplan), m_placement(placement), m_bins(m_bins_system), m_skipped_bins(0) {
53 for (
auto row : m_floorplan->rows_system()) {
54 point row_origin = m_floorplan->
row_origin(row);
56 box row_box(row_origin, {row_origin.x() + row_dimensions.x(), row_origin.y() + row_dimensions.y()});
57 m_rows_rtree.insert(std::make_pair(row_box, row));
63 entity_system::entity bin_insert(point position, point dimension,
double movable_utilization = 0.0,
double fixed_utilization = 0.0,
double free_space = 0.0);
65 std::size_t bin_count() {
66 return m_bins_system.
size();
69 point bin_position(entity_system::entity bin) {
70 return m_bins.position(bin);
73 point bin_dimension(entity_system::entity bin) {
74 return m_bins.dimension(bin);
77 double bin_movable_utilization(entity_system::entity bin) {
78 return m_bins.movable_utilization(bin);
81 double bin_fixed_utilization(entity_system::entity bin) {
82 return m_bins.fixed_utilization(bin);
85 double bin_free_space(entity_system::entity bin) {
86 return m_bins.free_space(bin);
89 double bin_area(entity_system::entity bin) {
90 double area = m_bins.dimension(bin).x() * m_bins.dimension(bin).y();
94 void bin_movable_utilization(entity_system::entity bin,
double movable_utilization);
95 void bin_fixed_utilization(entity_system::entity bin,
double fixed_utilization);
96 void bin_free_space(entity_system::entity bin,
double free_space);
98 const bins & bins_properties()
const {
103 return m_bins_system;
106 void intersecting_bins(box region, std::vector<entity_system::entity> &
bins);
108 void build_density_map(point max_bin_dimensions, std::vector<double> &utilizations,
double bin_area_threshold = 0.2,
double free_space_threshold = 0.2);
110 unsigned skipped_bins() {
return m_skipped_bins; }
116 #endif //ophidian_DENSITY_H
point row_origin(entity_system::entity row) const
Row origin getter.
Definition: floorplan.h:192
Placement class.
Definition: placement.h:35
point row_dimensions(entity_system::entity row) const
Row dimensions getter.
Definition: floorplan.cpp:91
entity_system class.
Definition: entity_system.h:40
Definition: density_map.h:33
std::size_t size() const
Returns the size of the system.
Definition: entity_system.h:82
Floorplan class.
Definition: floorplan.h:37