Subject: CGAL users discussion list
List archive
- From: Bruno Silva <>
- To: "" <>
- Subject: RE: [cgal-discuss] Speeding Up Arrangement Insertion
- Date: Fri, 5 Nov 2021 12:37:38 +0000
- Accept-language: pt-BR, en-US
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=B4Hhq2q4EEUCjSVuuZIHL8HA6kzPu0N5s3/gxkbkMpU=; b=hNTXJgcfCaQ7MiySXxa55cJod7ZQoWpkKwZSie8HAy+XltmWCj0yaQiZzBXCajgUyQsCutsyEpNq707bMVA9eZZemSLESBJtKxVA6KIBKi1nNF2x5MbOGrqhCvnlYY8BmSqqG7SqglpOIm5Lz7EVZm210PoS+6zVCbd3qyUIB4qSEqo6IzrzzAHEpOOiKpJzz7BRu1tf31ciCGdT1F/HRH54Uwitp2N+MaEM1ugTElM8kmV2pBUapA0p4d/WwGjTE/7+jTz1oOgmHYbRikc9e+oeRu6Bxa4UADYaGIcOD+hmn+4kcmIdwJykC7Srs/rQXav4qy93KtFaHEi71FDv5A==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fNhWvMtN0luq33abIU9WZpjfjPaY+izASNFVLVW8aERdJ5wOrL8CoYpAGFUIj7Qm4tvGISuQtlV/bSPVLih9jkJs2VolpEYE1cKbJ3TeXk9YXjB81yOgbzhDROLbFeD+WnNkT9vSeusrmjnJWZUOlbA2OPsOEik6tQ3bNwMcdAFtxho1UbBVME3nBN/RHW7SbrnNhLDYLwwj/KqaiXm6mlX4qK9hQ5jgqtzF5mBK9CsbysIV9EqgwSOtmnLEeev4lFl0/SCaWhODfBBdeXJPH9Ylvgx3XAHWynRTnO6vJT+scxZ8X155S0dyBQV2cXmdhJ6R6gxhDXdH3mZ0TRnDkg==
- Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None ; spf=Pass ; spf=Pass
- Ironport-hdrordr: A9a23:Ilz0NaN2afca8MBcTlmjsMiBIKoaSvp037By7TEUdfRUGvb1qyncpoV96faUskdgZJhOo7C90cW7K080sKQFhLX5Xo3SLzUO2lHYT72KhLGKq1bd8m/Fh4xgPMxbHJSWfeeQMbEMt6jHCWeDfurIi+P3lpxAzd2utkuFYzsaE52JtWpCe32m+m4afng9OXJ4eaDsmvau6VebCAsqhnbXPAh5Y8HT48DOnIjrJQULHQIj9WC1/E2Vwa+/DhyRxBtbTD9V27cl9gH+4n3E2pk=
- Ironport-phdr: A9a23:TVNP+hz/QOVp4wzXCzK8zFBlVkEcU1XcAAcZ59Idhq5Udez7ptK+ZhSZtKwm0QCBdL6YwsoMs/DRvaHkVD5Iyre6m1dGTqZxUQQYg94dhQ0qDZ3NI0T6KPn3c35yR5waBxdq8H6hLEdaBtv1aUHMrX2u9z4SHQj0ORZoKujvFYPekdi72/q29pHObAlFhDiwaq5uIRurqgncqtMYipZ4JKYrzRvJrHpIe+BIym5tOFmegRXy6Nqu8ZB66yhftO4v+MBGUaXhYqQ3VqdYAyg8M2A0/8Lkqx/ORhaS63QGU2UWlh1IAxXZ7Bz/Q5z8vDf2uvZ71SKHO8D9ULI6Vim476pzSBHmljoJNyI3/m/UhMx/jr5Urx26qhNl34LYfJuYOOZicq/De94RWGpPXtxWVyxEGo6xcpEPD/cHPeZfsoLzuloOrR+gBQa2GejizSRHhmXr3a081OQuCRvG0xYlH9ILt3TUqs/5NKkWUe+v16TIzTLDb+9T2Tjn6YjIdgotru2LXbJ1aMfcz1QkGAzZgFuKs4PlIy+V2foXs2id9+duWu2ihm0ppgxxoDWiycQhh5TNi48Wzl3J9Cp0zYUpKdO4S0N3f9CpHpVeuiybOIV4QsMsTmJntis41rELtoC2cS4Xw5opwB7fbuaI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VpejCi4K
- Suggested_attachment_session_id: 9f5e8bfb-04e5-ff50-b60b-7a5ae7bd5ef1
Hi Andreas,
Now, I've put this code on gist.github.com:
https://gist.github.com/BrunoRammon/c2850f4aef513571ba27e69773c5d3eb
GitHub Gist: instantly share code, notes, and snippets.
gist.github.com
|
Best,
Bruno
De: <> em nome de Andreas Fabri <>
Enviado: sexta-feira, 5 de novembro de 2021 06:51
Para: Bruno Silva ( via cgal-discuss Mailing List) <>
Assunto: Re: [cgal-discuss] Speeding Up Arrangement Insertion
Enviado: sexta-feira, 5 de novembro de 2021 06:51
Para: Bruno Silva ( via cgal-discuss Mailing List) <>
Assunto: Re: [cgal-discuss] Speeding Up Arrangement Insertion
Hello,
Ideally, you put code on gist.github.com
Best,
Andreas
On 11/5/2021 12:39 PM, Bruno Silva ( via cgal-discuss Mailing List) wrote:
Just sending the code once again with some small changes:
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>#include <CGAL/Arr_naive_point_location.h>#include <CGAL/Arr_non_caching_segment_basic_traits_2.h>#include <CGAL/Segment_2.h>#include <CGAL/Arr_segment_traits_2.h>#include <CGAL/Arrangement_2.h>#include <CGAL/Delaunay_triangulation_2.h>#include <CGAL/Constrained_Delaunay_triangulation_2.h>
typedef CGAL::Exact_predicates_exact_constructions_kernel K1;typedef CGAL::Arr_segment_traits_2<K1> Traits_2;typedef CGAL::Arrangement_2<Traits_2> Arrangement_2;typedef CGAL::Delaunay_triangulation_2<K1> Delaunay2;typedef CGAL::Constrained_Delaunay_triangulation_2<K1, CGAL::Default, Itag> CDT2;typedef Traits_2::Point_2 Point_2;typedef Traits_2::X_monotone_curve_2 Segment_2;typedef CGAL::Arr_naive_point_location<Arrangement_2> WalkPL_2;
int main(){ExternalDataSet datas("data1.txt","data2.txt");Arrangement_2 arr;WalkPL_2 walkPL(arr);
// first step of insertionsstd::chrono::steady_clock::time_point begin = std::chrono::steady_clock::now();
std::vector<Segment_2> segmentSet1 = datas.externalData(0);CGAL::insert_non_intersecting_curves(arr, segmentSet1.begin(), segmentSet1.end());segmentSet1.clear();
std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now();if (verbose) std::cout << "Time spent - First Insertion: " << std::setprecision(6) << std::chrono::duration_cast<std::chrono::microseconds>(end - begin).count()/1.0e+6 << std::fixed << " sec." << std::endl;//Second step of insertionsbegin = std::chrono::steady_clock::now();
std::vector<Segment_2> segmentSet2 = datas.externalData(1);// #pragma omp parallel for if(_parallelOptimization)for(auto seg = segmentSet2.begin(); seg < segmentSet2.end(); ++seg){CGAL::insert(arr, *seg, walkPL);}segmentSet2.clear();
end = std::chrono::steady_clock::now();if (verbose) std::cout << "Time spent - Second Insertion: " << std::setprecision(6) << std::chrono::duration_cast<std::chrono::microseconds>(end - begin).count()/1.0e+6 << std::fixed << " sec." << std::endl;CDT2 cdt;// Constrained Delaunay package to triangulate the arrangementbegin = std::chrono::steady_clock::now();for (auto it = arr.edges_begin(); it != arr.edges_end(); ++it) {cdt.insert(it->source()->point(), it->target()->point());}end = std::chrono::steady_clock::now();if (verbose) std::cout << "Time spent - Creation of the Constrained Delaunay Triangulation: " << std::setprecision(6) << std::chrono::duration_cast<std::chrono::microseconds>(end - begin).count()/1.0e+6 << std::fixed << " sec." << std::endl;}
-------
Att,
Bruno Rammon Silva Souza
De: Bruno Silva
Enviado: sexta-feira, 5 de novembro de 2021 06:20
Para:
Assunto: Speeding Up Arrangement InsertionHi everyone,
I'm having a problem with efficiency when computing arrangements by CGAL. Thus, I would like to know whether there's any way to improve the efficiency of this.
The code is:#include <CGAL/Exact_predicates_exact_constructions_kernel.h>#include <CGAL/Arr_naive_point_location.h>#include <CGAL/Arr_non_caching_segment_basic_traits_2.h>#include <CGAL/Segment_2.h>#include <CGAL/Arr_segment_traits_2.h>#include <CGAL/Arrangement_2.h>#include <CGAL/Delaunay_triangulation_2.h>#include <CGAL/Constrained_Delaunay_triangulation_2.h>
typedef CGAL::Exact_predicates_exact_constructions_kernel K1;typedef CGAL::Arr_segment_traits_2<K1> Traits_2;typedef CGAL::Arrangement_2<Traits_2> Arrangement_2;typedef CGAL::Delaunay_triangulation_2<K1> Delaunay2;typedef CGAL::Constrained_Delaunay_triangulation_2<K1, CGAL::Default, Itag> CDT2;typedef Traits_2::Point_2 Point_2;typedef Traits_2::X_monotone_curve_2 Segment_2;typedef CGAL::Arr_naive_point_location<Arrangement_2> WalkPL_2;
int main(){ExternalDataSet datas("data1.txt","data2.txt");
std::chrono::steady_clock::time_point begin = std::chrono::steady_clock::now();
std::vector<Segment_2> segmentSet1 = datas.externalData(0);CGAL::insert_non_intersecting_curves(arr, segmentSet1.begin(), segmentSet1.end());segmentSet1.clear();std::chrono::steady_clock::time_point
end = std::chrono::steady_clock::now();if (verbose) std::cout << "Time spent - First Insertion: " << std::setprecision(6) << std::chrono::duration_cast<std::chrono::microseconds>(end - begin).count()/1.0e+6 << std::fixed << " sec." << std::endl;
// Insertion of the second set of segmentsbegin = std::chrono::steady_clock::now();
std::vector<Segment_2> segmentSet2 = datas.externalData(1);// #pragma omp parallel for //Parllellization is not working!!
for(auto seg = segments1.begin(); seg < segments1.end(); ++seg){CGAL::insert(arr, *seg, walkPL);}segmentSet2.clear();end = std::chrono::steady_clock::now();if (verbose) std::cout << "Time spent - Second Insertion: " << std::setprecision(6) << std::chrono::duration_cast<std::chrono::microseconds>(end - begin).count()/1.0e+6 << std::fixed << " sec." << std::endl;// Section 2 - It is using the constrained Delaunay package to triangulate the arrangement vertices and constrained edgesbegin = std::chrono::steady_clock::now();
for (auto it = arr.edges_begin(); it != arr.edges_end(); ++it) {CDT.insert(it->source()->point(), it->target()->point());}end = std::chrono::steady_clock::now();if (verbose) std::cout << "Time spent - Creation of the Constrained Delaunay Triangulation: " << std::setprecision(6) << std::chrono::duration_cast<std::chrono::microseconds>(end - begin).count()/1.0e+6 << std::fixed << " sec." << std::endl;}
I have two distinct sets of segments (std::vector<Segment_2> segmentSet1 and std::vector<Segment_2> segmentSet2 ) that comes up from external data. The segments in segmentSet1 don't intersect with others segments in this set. This is also true for the segments in segmentSet2. However, the segments in segmentSet1 certainly intersects with the segments in segmentSet2.
I insert the first set of segments by the function CGAL::insert_non_intersecting_curves(arr, segmentSet1.begin(), segmentSet1.end()). The insertions of the second set of segments are performed by the function CGAL::insert(arr, *seg, walkPL). The efficiency first intersection is pretty good, but the second one is very inefficient. After these insertions, a Constrained Delaunay Triangulation is created.
I would like to know whether there is a way to improve the efficiency of this second insection. I've tried without success to perform a parallelization of the loop in the second insertion.
Is there any way to parallelize this for-loop for the second insertion? Or should I try another approach to improve the overall efficiency?
-------
Best,
Bruno Souza
--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss
-- Andreas Fabri, PhD Chief Officer, GeometryFactory Editor, The CGAL Project
--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss
- [cgal-discuss] Speeding Up Arrangement Insertion, Bruno Silva, 11/05/2021
- RE: [cgal-discuss] Speeding Up Arrangement Insertion, Bruno Silva, 11/05/2021
- Re: [cgal-discuss] Speeding Up Arrangement Insertion, Andreas Fabri, 11/05/2021
- RE: [cgal-discuss] Speeding Up Arrangement Insertion, Bruno Silva, 11/05/2021
- Re: [cgal-discuss] Speeding Up Arrangement Insertion, Guillaume Damiand, 11/05/2021
- Re: [cgal-discuss] Speeding Up Arrangement Insertion, Efi Fogel, 11/09/2021
- Re: [cgal-discuss] Speeding Up Arrangement Insertion, Guillaume Damiand, 11/05/2021
- RE: [cgal-discuss] Speeding Up Arrangement Insertion, Bruno Silva, 11/05/2021
- Re: [cgal-discuss] Speeding Up Arrangement Insertion, Andreas Fabri, 11/05/2021
- RE: [cgal-discuss] Speeding Up Arrangement Insertion, Bruno Silva, 11/05/2021
Archive powered by MHonArc 2.6.19+.