Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] skin surfaces : subdivision is *very* slow, is this normal ?

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] skin surfaces : subdivision is *very* slow, is this normal ?


Chronological Thread 
  • From: "Nico Kruithof" <>
  • To:
  • Subject: Re: [cgal-discuss] skin surfaces : subdivision is *very* slow, is this normal ?
  • Date: Sun, 30 Nov 2008 21:06:17 +0100
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:references; b=DKOCFzauX/4scw1LKmoIimbTqDjOIYzecfCMBZ1anOZYTKMwsSEOOfV6jYemstOAH7 LrETklXCDYnjJxw0F+x8sBGfx5Jsz0Ss+BJev274vWUIW9dm7u00YzuxdvDhh2C5p93e 1GI5hX/EoqSF8fKArcEbY49TdNbg0v9BB5Ywg=

Hi Benjamin,

I tried your include change, but couldn't see the performance
decrease. Could you have a look at my test program? There is an
enhancement of the polyhedron datastructure in which I add
back-pointers to the Skin_surface_3 object to improve performance.
Maybe you saw something going wrong there. To get the pointers you
should use

typedef CGAL::Polyhedron_3<K,
CGAL::Skin_surface_polyhedral_items_3<Skin_surface_3> > Polyhedron;

The optimization used is based on the templates.

Bests,
Nico

On Fri, Nov 21, 2008 at 10:02 AM, Benjamin schwarz
<>
wrote:
> Hello list,
>
> I am currently testing the skin package provided in CGAL (thanks a
> lot Nico). My computations seem far less efficient than those
> exhibited in the CGAL manual or in Nico's papers. I guess I did
> something wrong. Maybe another magic compilation variable like
> -DNDEBUG ?
>
> I pasted the code a few lines below. It only consists in reading
> atom, skin it, get a coarse mesh and refine this mesh twice. The times
> for these four steps on a 28 atoms molecule :
>
> create skin in : 0.16001
> mesh skin0 in : 0.012001
> mesh skin1 in : 11.7727
> mesh skin2 in : 11.7887
>
> Is this normal ?
>
> My computer is a bit old : laptop 1.6GHz
> under linux debian lenny
> latest cgal installed through dpkg (thanks Sylvain)
> gcc version 4.3.2 (Debian 4.3.2-1)
>
> Compilation lines :
>
> g++ -Wall -frounding-math -g -O2 -I/usr/include/qt3 -DCGAL_USE_F2C
> -DCGAL_USE_F2C -I /home/schwarz/include -O2 -DNDEBUG -c -o
> test-skins.o test-skins.cpp
>
> g++ -o test-skins test-skins.o -lCGAL -lCGALcore++ -lCGALQt
> -lCGALimageIO -lCGALPDB -lqt-mt -llapack -lGL -lGLU -llapack -lf77blas
> -lcblas -latlas -lz -lmpfr -lgmpxx -lgmp -lX11
> -lboost_program_options-mt -lm -O2 -lm
>
> ----------My code------------
> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
> #include <CGAL/Polyhedron_incremental_builder_3.h>
> #include <CGAL/Polyhedron_3.h>
> #include <CGAL/IO/Geomview_stream.h>
> #include <CGAL/IO/Polyhedron_geomview_ostream.h>
>
> //#include "skin_surface_writer.h"
>
> #include <CGAL/Skin_surface_3.h>
> #include <CGAL/Polyhedron_3.h>
> #include <CGAL/mesh_skin_surface_3.h>
> #include <CGAL/subdivide_skin_surface_mesh_3.h>
>
> #include <CGAL/Timer.h>
>
> #include <list>
>
> #include <iostream>
> #include <fstream>
>
> typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
> typedef CGAL::Skin_surface_traits_3<K> Traits;
> typedef CGAL::Skin_surface_3<Traits> Skin_surface_3;
> typedef Skin_surface_3::FT FT;
> typedef Skin_surface_3::Weighted_point Weighted_point;
>
> typedef K::Point_3 Point;
> typedef K::Vector_3 Vector;
> typedef CGAL::Polyhedron_3<K> Polyhedron;
> typedef Polyhedron::Halfedge_handle
> Halfedge_handle;
>
>
> int main(int argc, char **argv) {
> std::list<Weighted_point> l;
> double shrinkfactor = 0.5;
> CGAL::Timer ben_t;
>
> // first command line arg is a "x y z w" formated file
> std::ifstream in(argv[1],std::ios::in);
> int i=0;
> double x,y,z,w;
> while (in>>x) {++i;
> std::cerr<<"-->"<<x<<std::endl;
> in >> y; in >> z; in >> w;
> l.push_back(Weighted_point(Point(x,y,z),w));
> }
> std::cerr<<"got "<<i<<" atoms"<<std::endl;
>
>
> Polyhedron p;
>
> CGAL::Geomview_stream gv(CGAL::Bbox_3(-100, -100, -100, 100, 100, 100));
> gv.set_bg_color(CGAL::Color(0, 200, 200));
> gv.clear();
>
> int geomId=0;
> double time_coarse = ben_t.time(); ben_t.start();
> Skin_surface_3 skin_surface(l.begin(), l.end(), shrinkfactor);
> ben_t.stop();time_coarse = ben_t.time() - time_coarse;
>
> double time_meshcoarse = ben_t.time(); ben_t.start();
> CGAL::mesh_skin_surface_3(skin_surface, p);
> ben_t.stop();time_meshcoarse = ben_t.time() - time_coarse;
>
> std::cout<<"skin mesh..."<<std::endl;
> std::cerr<<" done"<<std::endl;
> gv<<CGAL::Color(100,100,100);
> gv<<p;
> gv<<"(name-object g"<<++geomId<<" skin0)";
>
> std::cout<<"mesh subdivide 1..."<<std::endl;
> double time_subdiv1 = ben_t.time(); ben_t.start();
> CGAL::subdivide_skin_surface_mesh_3(skin_surface, p, 1);
> ben_t.stop();time_subdiv1 = ben_t.time() - time_coarse;
>
> gv<<CGAL::Color(100,100,200);
> gv<<p;
> gv<<"(name-object g"<<++geomId<<" skin1)";
>
> double time_subdiv2 = ben_t.time(); ben_t.start();
> CGAL::mesh_skin_surface_3(skin_surface, p);
> ben_t.stop();time_subdiv2 = ben_t.time() - time_coarse;
>
> gv<<CGAL::Color(100,100,200);
> gv<<p;
> gv<<"(name-object g"<<++geomId<<" skin2)";
>
> std::cout<<std::endl;
> std::cout<<"create skin in : "<<time_coarse<<std::endl;
> std::cout<<"mesh skin0 in : "<<time_meshcoarse<<std::endl;
> std::cout<<"mesh skin1 in : "<<time_subdiv1<<std::endl;
> std::cout<<"mesh skin2 in : "<<time_subdiv2<<std::endl;
> std::cout<<"press a key to finish"<<std::endl;
> char c;std::cin>>c;
> std::cout<<c<<std::endl;
> return 0;
> }
>
>
> --
>
> --Benjamin SCHWARZ
> ____________________________________________________
> IGBMC
> Département de Biologie et de Génomique Structurales
> Parc d'Innovation, 1 rue Laurent Fries
> BP 10142, 67404 ILLKIRCH CEDEX, France
>
> E-mail :
>
> Phone : 03 88 65 57 95
> ____________________________________________________
> --
> You are currently subscribed to cgal-discuss.
> To unsubscribe or access the archives, go to
> https://lists-sop.inria.fr/wws/info/cgal-discuss
>
#if 1
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Skin_surface_3.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/mesh_skin_surface_3.h>
#include <CGAL/subdivide_skin_surface_mesh_3.h>
#include "skin_surface_writer.h"
#include <list>
#include <fstream>

#else
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Polyhedron_incremental_builder_3.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/IO/Geomview_stream.h>
#include <CGAL/IO/Polyhedron_geomview_ostream.h>
#include "skin_surface_writer.h"
#include <CGAL/Skin_surface_3.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/mesh_skin_surface_3.h>
#include <CGAL/subdivide_skin_surface_mesh_3.h>
#endif

#include <CGAL/Timer.h>
#include <list>
#include <iostream>
#include <fstream>


typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Skin_surface_traits_3<K> Traits;
typedef CGAL::Skin_surface_3<Traits> Skin_surface_3;
typedef Skin_surface_3::FT FT;
typedef Skin_surface_3::Weighted_point Weighted_point;
typedef Weighted_point::Point Bare_point;
typedef CGAL::Polyhedron_3<K,
CGAL::Skin_surface_polyhedral_items_3<Skin_surface_3> > Polyhedron;

int main() {
std::list<Weighted_point> l;
FT shrinkfactor = 0.5;

CGAL::Timer timer;
Weighted_point wp;
std::ifstream in("data/molecule_tunnel.cin");
while (in >> wp)
l.push_front(wp);

Polyhedron p;

Skin_surface_3 skin_surface(l.begin(), l.end(), shrinkfactor);
CGAL::mesh_skin_surface_3(skin_surface, p);

std::cout << "subdividing ..." << std::endl;
{
CGAL::Timer timer;

timer.start();
CGAL::subdivide_skin_surface_mesh_3(skin_surface, p);
timer.stop();
std::cout << "Elapsed time: " << timer.time() << std::endl;
}

std::ofstream out("mesh.off");
out << p;

return 0;
}




Archive powered by MHonArc 2.6.16.

Top of Page