Optimization of the configuration layer:

The values of StaticPrintConfig derived objects were searched by a name
walking through a huge chained if.
Now they are being mapped with a std::map.
Also initialization of StaticPrintConfig classes from their ConfigOptionDef
defaults is done by maintaining a single global definition of each
StaticPrintConfig derived class, and a new instance is initialized
from this static copy.

Also the ConfigOption instances are casted using static_cast
wherever possible, and their types are verified by a virtual type() method.
This approach avoids insiginificant performance penalty of a dynamic_cast.

Also the compare and clone methods were added to ConfigOption,
and the cloning & compare work on binary values, not by serialization.
This commit is contained in:
bubnikv 2017-10-17 16:01:18 +02:00
parent a91d7cb2f7
commit 3731820c48
14 changed files with 1475 additions and 934 deletions

View file

@ -948,7 +948,7 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::top_contact_
slices_margin_cached,
// How much to offset the extracted contour outside of the grid.
m_object_config->support_material_spacing.value + m_support_material_flow.spacing(),
Geometry::deg2rad(m_object_config->support_material_angle));
Geometry::deg2rad(m_object_config->support_material_angle.value));
// 1) infill polygons, expand them by half the extrusion width + a tiny bit of extra.
new_layer.polygons = support_grid_pattern.extract_support(m_support_material_flow.scaled_spacing()/2 + 5);
// 2) Contact polygons will be projected down. To keep the interface and base layers to grow, return a contour a tiny bit smaller than the grid cells.
@ -1155,7 +1155,7 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::bottom_conta
trimming,
// How much to offset the extracted contour outside of the grid.
m_object_config->support_material_spacing.value + m_support_material_flow.spacing(),
Geometry::deg2rad(m_object_config->support_material_angle));
Geometry::deg2rad(m_object_config->support_material_angle.value));
tbb::task_group task_group_inner;
// 1) Cache the slice of a support volume. The support volume is expanded by 1/2 of support material flow spacing
// to allow a placement of suppot zig-zag snake along the grid lines.
@ -2471,8 +2471,8 @@ void PrintObjectSupportMaterial::generate_toolpaths(
LoopInterfaceProcessor loop_interface_processor(1.5 * m_support_material_interface_flow.scaled_width());
loop_interface_processor.n_contact_loops = this->has_contact_loops() ? 1 : 0;
float base_angle = Geometry::deg2rad(float(m_object_config->support_material_angle));
float interface_angle = Geometry::deg2rad(float(m_object_config->support_material_angle + 90.));
float base_angle = Geometry::deg2rad(float(m_object_config->support_material_angle.value));
float interface_angle = Geometry::deg2rad(float(m_object_config->support_material_angle.value + 90.));
coordf_t interface_spacing = m_object_config->support_material_interface_spacing.value + m_support_material_interface_flow.spacing();
coordf_t interface_density = std::min(1., m_support_material_interface_flow.spacing() / interface_spacing);
coordf_t support_spacing = m_object_config->support_material_spacing.value + m_support_material_flow.spacing();
@ -2763,7 +2763,7 @@ void PrintObjectSupportMaterial::generate_toolpaths(
if (base_layer.layer->bottom_z < EPSILON) {
// Base flange (the 1st layer).
filler = filler_interface.get();
filler->angle = Geometry::deg2rad(float(m_object_config->support_material_angle + 90.));
filler->angle = Geometry::deg2rad(float(m_object_config->support_material_angle.value + 90.));
density = 0.5f;
flow = m_first_layer_flow;
// use the proper spacing for first layer as we don't need to align