Major cleanup before integration in CloudCompare

This commit is contained in:
Daniel Girardeau-Montaut
2023-05-20 20:07:18 +02:00
parent 8b2a5ee849
commit d0a153ee2f
17 changed files with 3646 additions and 4306 deletions
+8 -12
View File
@@ -217,7 +217,6 @@ void cut_pursuit(const uint32_t n_nodes, const uint32_t n_edges, const uint32_t
ite_nod++;
}
delete cp;
return;
}
@@ -244,20 +243,18 @@ void cut_pursuit(const uint32_t n_nodes, const uint32_t n_edges, const uint32_t
CP::CutPursuit<T> * cp = create_CP(mode, verbose);
set_speed(cp, speed, weight_decay, verbose);
set_up_CP(cp, n_nodes, n_edges, nObs, observation, Eu, Ev
,edgeWeight, nodeWeight);
set_up_CP(cp, n_nodes, n_edges, nObs, observation, Eu, Ev, edgeWeight, nodeWeight);
cp->parameter.reg_strenth = lambda;
cp->parameter.cutoff = cutoff;
//-------run the optimization------------------------------------------
cp->run();
cp->compute_reduced_graph();
//------------resize the vectors-----------------------------
uint32_t n_nodes_red = boost::num_vertices(cp->reduced_graph);
in_component.resize(n_nodes);
components.resize(n_nodes_red);
uint32_t n_nodes_red = static_cast<uint32_t>(boost::num_vertices(cp->reduced_graph));
in_component.resize(n_nodes);
components.resize(n_nodes_red);
//------------write the solution-----------------------------
VertexAttributeMap<T> vertex_attribute_map = boost::get(
boost::vertex_bundle, cp->main_graph);
VertexAttributeMap<T> vertex_attribute_map = boost::get(boost::vertex_bundle, cp->main_graph);
VertexIterator<T> ite_nod = boost::vertices(cp->main_graph).first;
for(uint32_t ind_nod = 0; ind_nod < n_nodes; ind_nod++ )
{
@@ -271,11 +268,11 @@ void cut_pursuit(const uint32_t n_nodes, const uint32_t n_edges, const uint32_t
VertexIndexMap<T> vertex_index_map = get(boost::vertex_index, cp->main_graph);
for(uint32_t ind_nod_red = 0; ind_nod_red < n_nodes_red; ind_nod_red++ )
{
uint32_t component_size = cp->components[ind_nod_red].size();
size_t component_size = cp->components[ind_nod_red].size();
components[ind_nod_red] = std::vector<uint32_t>(component_size, 0);
for(uint32_t ind_nod = 0; ind_nod < component_size; ind_nod++ )
for(size_t ind_nod = 0; ind_nod < component_size; ind_nod++ )
{
components[ind_nod_red][ind_nod] = vertex_index_map(cp->components[ind_nod_red][ind_nod]);
components[ind_nod_red][ind_nod] = static_cast<uint32_t>(vertex_index_map(cp->components[ind_nod_red][ind_nod]));
}
}
ite_nod = boost::vertices(cp->main_graph).first;
@@ -285,7 +282,6 @@ void cut_pursuit(const uint32_t n_nodes, const uint32_t n_edges, const uint32_t
ite_nod++;
}
delete cp;
return;
}
//===========================================================================