CGAL / cgal

The public CGAL repository, see the README below
https://github.com/CGAL/cgal#readme
Other
4.94k stars 1.38k forks source link

Efficiency issues about CGAL::Face_filtered_graph classes. #8355

Open fynkxo opened 3 months ago

fynkxo commented 3 months ago

Issue Details

Efficiency issues about CGAL::Face_filtered_graph classes.

The code is as follows. The time statistics results are attached in the figure. From the results, we can see that the Face_filtered_graph construction took a huge amount of time.The same seems to be true in the class CGAL::copy face graph.

Source Code

for (decltype(NumberComponents)i = 0; i < NumberComponents; i++)
    {
        std::shared_ptr<boost::timer::auto_cpu_timer> t{new boost::timer::auto_cpu_timer()};
        std::cout << "Construct: \n";
        CGAL::Face_filtered_graph<Mesh> subMesh{mesh,i,fccmap};
                t.reset(new boost::timer::auto_cpu_timer);
                std::cout << "Calculate:\n";
        double volumeOrigin = PMP::volume(subMesh);
        double volume = std::abs(volumeOrigin);

            double x1 = INFINITY, x2 = -INFINITY;
            double y1 = INFINITY, y2 = -INFINITY;
            double z1 = INFINITY, z2 = -INFINITY;
            auto iter = CGAL::vertices(subMesh);
            while (iter.first != iter.second)
            {
                ++iter.first;
                K::Point_3 v = mesh.point(*iter.first);
                double x = v.x();
                double y = v.y();
                double z = v.z();
                x1 = std::min(x1, x);
                x2 = std::max(x2, x);
                y1 = std::min(y1, y);
                y2 = std::max(y2, y);
                z1 = std::min(z1, z);
                z2 = std::max(z2, z);
            }

            volumes.push_back(volume);
            volumesOrigin.push_back(volumeOrigin);
            bboxes.push_back(CGAL::Bbox_3(x1, y1, z1, x2, y2, z2));
    }

Environment

Refer to drawing:

QQ截图20240715180021

sloriot commented 3 months ago

The time alone are not really meaningful. Indeed if the mesh is made of several millions of vertices, the timing would be perfectly fine I guess. Could you please share a complete example we can compile and run to reproduce the runtime that seem too long to you?

fynkxo commented 3 months ago