Commit Graph

53 Commits

Author SHA1 Message Date
Jane Tournois abc1515741 r70387, r70573, r70574 from Mesh_3-experimental-GF
Add incident_cells_3(Vertex_handle, std::vector<Cell_handle>)

This function avoids the construction of two additional std::vectors.
The performance gain is between 30% (g++) and 50% (VC++)
for points on surfaces as well as for points filling space.

We at the same time change the implementation of the function
incident_cells(Vertex_handle, OutputIterator).
In order to save one additional std::vector,
the cells are reported in bfs and not in dfs order
2012-07-31 14:44:45 +00:00
Laurent Rineau 95bec3999c Use Unique_has_map instead of std::map (patch from Andreas Fabri)
The gain on copies of T2 or T3 is the following:


afabri@klimt /cygdrive/c/cgal/next/Triangulation_3/benchmark/Triangulation_3
$ ./copy 1000000 2
36.806 sec

afabri@klimt /cygdrive/c/cgal/next/Triangulation_3/benchmark/Triangulation_3
$ ./copy 1000000 2
4.865 sec

The benchmarck copy.cpp is the following (not commited):

#define  CGAL_T3_HASH
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Delaunay_triangulation_3.h>
#include <CGAL/Timer.h>
#include <CGAL/point_generators_3.h>


#include <iostream>
#include <fstream>
#include <string>
#include <vector>

typedef CGAL::Exact_predicates_inexact_constructions_kernel  K;
typedef CGAL::Delaunay_triangulation_3<K> Delaunay;
typedef K::Point_3                                     Point;
typedef CGAL::Creator_uniform_3<double,Point>  Creator;



int main(int argc, char **argv)
{
  int n=1000000;
  int rep=100;
  if (argc>=2)
    n=atoi(argv[1]);
  if (argc>=3)
    rep=atoi(argv[2]);
  std::vector<Point> points;
  points.reserve(n);  
  CGAL::Random_points_in_sphere_3<Point,Creator> g(1);
  CGAL::copy_n( g, n, std::back_inserter(points));
  Delaunay original;
  original.insert(points.begin(),points.end());
  
  double res = 0;
  for (int r=0;r<rep;++r){
    CGAL::Timer t;    t.start();
    Delaunay delaunay=original;
    t.stop();
    res+=t.time();
  }

  std::cout << res << std::endl;
            
  return 0;
}
2012-03-30 12:37:19 +00:00
Laurent Rineau 8f59fd9592 Turn QPL into LGPLv3+ 2012-01-13 16:33:35 +00:00
Laurent Rineau 1fb7632ec3 Fix a bug in finite_adjacent_vertices when dimension()==1.
When tr.dimension()==1, tr.finite_adjacent_vertices(...) and
tr.finite_incident_edges(...) returned infinite things.
2011-07-28 16:53:11 +00:00
Laurent Rineau 96162627aa Merge the following small features in trunk:
https://cgal.geometryfactory.com/CGAL/Members/wiki/Features/Small_Features/Remove_cluster
  https://cgal.geometryfactory.com/CGAL/Members/wiki/Features/Small_Features/Structural_filtering

Merge also a partial support of:
  https://cgal.geometryfactory.com/CGAL/Members/wiki/Features/Small_Features/Rt::vertices_inside_conflict_zone
    (vertices_inside_conflict_zone" is added in Regular_triangulation_3,  without documenting it)
2010-12-10 17:02:10 +00:00
Sébastien Loriot dfa20899ef derecursion of create_star_3:
I remade a benchmark and finally when using boost::thread_specific_ptr,
using a std::vector is faster than the dedicated vector-class I previously
use.
I also retry using a tuple instead of a dedicated class to store variables
useful for the emulated recursion but tuple is (on my machine) slower.

benchmark results are the following (points are randomly taken in a sphere,
time is in seconds and is the mean of 10 idendical runs)

nb points              |   1000        100000    100000    1000000   10000000
-----------------------------------------------------------------------------
trunk version          | 0.0088       0.0928     0.9865    10.216     102.99 
with vector            | 0.0096       0.0900     0.9817    10.075     102.24 
with vector and tuple  | 0.0100       0.0948     0.9981    10.219     104.58 
recursive version      | 0.0080       0.0936     0.9732    10.141     102.33
2010-11-24 07:27:04 +00:00
Sébastien Loriot 9567810ef8 add macro CGAL_TDS_USE_OLD_CREATE_STAR_3 in TDS_3.h so that user can
still use the old recursive version of create_star_3.
2010-06-28 14:06:14 +00:00
Sébastien Loriot bb39c7d194 bug in Facet_extractor: missing * and ++ 2010-06-25 12:58:37 +00:00
Laurent Rineau 0625b6c6bd int -> std::size_t|size_type 2010-06-24 13:27:44 +00:00
Andreas Fabri 1e12152c5f int size_t fixes 2010-06-24 12:50:37 +00:00
Andreas Fabri b456cdb994 int -> size_type/std::size_t 2010-06-21 20:31:19 +00:00
Andreas Fabri f555a82e17 int -> size_type/std::size_t 2010-06-21 14:16:24 +00:00
Andreas Fabri c79a1ebbf6 int -> size_type/std::size_t 2010-06-21 14:12:02 +00:00
Sébastien Loriot 4d0e30fd74 add comments 2010-06-16 15:04:30 +00:00
Sébastien Loriot cf43255df7 Remove recursive call of create_star_3:
--create an internally used vector that can reserve its size when constructed
  --create an internally used class to store information required to emulated the call stack
  --the stack used to emulate the call stack is a static thread-safe vector of the function (thus a memory overhead) 
These choices have been made so that the running time of the triangulation is still the same.
2010-06-16 12:27:22 +00:00
Sébastien Loriot 52317dd49f add python script (replace_CGAL_NAMESPACE.py) to replace CGAL_BEGIN_NAMESPACE and CGAL_END_NAMESPACE
by namespace CGAL { and } //namespace CGAL. in all .h and .cpp files
in a directory.
Apply it to all packages in the trunk
Remove macro definition from the config.h file.
2010-06-09 07:37:13 +00:00
Laurent Rineau 7e87099363 Merge the branch /branches/candidate-packages/Triangulation_3
- Work from:
    Pedro Machado Manhaes de Castro <Pedro.Machado@sophia.inria.fr>
    Olivier Devillers <Olivier.Devillers@sophia.inria.fr>
- The work is:
    - displacement for 3D triangulation (Olivier and Pedro)
         https://cgal.geometryfactory.com/CGAL/Members/wiki/Features/Move_T2T3
2010-05-31 08:48:09 +00:00
Sylvain Pion 033d3ce790 Use Compact_container::owns_dereferencable() in order to speed up is_vertex,
is_edge, is_facet and is_cell.
In passing, fix bugs as the end iterators/handles were incorrectly treated !
2010-01-23 17:30:58 +00:00
Sylvain Pion 266a053335 More debugging aid : add an is_simplex() function to [expensive] check that
the handle passed to locate() belongs to the triangulation.
2010-01-14 23:20:18 +00:00
Sylvain Pion 516f8d5eee Same as revision 51948 on CGAL-3.5-branch :
Rename following the converging convention to prevent future incompatibility :
  - Vertex_container -> Vertex_range
  - Face_container   -> Face_range
  - Cell_container   -> Cell_range
2009-09-15 17:12:03 +00:00
Sylvain Pion 7aa8c1535a Move internal files under CGAL/internal/ and their code under CGAL::internal:: . 2009-08-26 12:52:38 +00:00
Sylvain Pion 443277dab0 Pass Cell_handle and Vertex_handle by value instead of by const&. This undoes :
r19107 | afabri | 2003-10-17 10:49:19 +0200 (Ven 17 oct 2003) | 2 lignes
    Added const& for gaining performance

which was justified at the time by the fact that on VC++, handles encapsulated iterators.
2009-08-17 15:11:03 +00:00
Sylvain Pion 919321e300 Give the TDS the ability to store a more general Cell_data in cells,
than just an implicit access to a conflict_flag.
2009-08-11 20:05:42 +00:00
Sylvain Pion 7f61ffff50 Add a Rebind_vertex and a Rebind_cell to the TDS that allow to get new TDS types
with changes vertex/cell types.  Documented as advanced in the TDS concept.
2009-08-04 14:32:30 +00:00
Sylvain Pion 8fdac12e77 Add insert_in_hole() function overloads (in T3 and TDS_3) taking an additional
Vertex_handle argument that specifies the vertex to be used for the new vertex
(instead of creating a new one internally).
2009-08-04 13:48:07 +00:00
Sylvain Pion 395b1d569e Remove white spaces at end of lines. 2009-08-04 13:36:15 +00:00
Sylvain Pion 7df2a2df3b Remover short name macros. See PR 1551. 2009-04-21 18:34:14 +00:00
Sylvain Pion 62aac76768 Actually, much better naming (Range concept like) :
vertex_container() -> vertices()
cell_container()   -> cells()
2009-04-10 15:23:53 +00:00
Sylvain Pion 525ac5818a Add vertex_container() and cell_container() to the TDS. 2009-04-10 15:05:43 +00:00
Monique Teillaud ba9b7b7143 incident_vertices(vertex) renamed as adjacent_vertices()
old name left for backward compatibility (and old functions still tested)
2009-04-08 10:06:32 +00:00
Laurent Rineau 6108848419 Test and fix the input/output operator of CGAL::Triangulation_3
*in binary mode*.
2008-11-14 11:59:14 +00:00
Camille Wormser 182c824db5 Iterative version of the incident_...(vertex) methods.
See Andreas' e-mail:

> I just had a look at the code. The problem is that it calls
> incident_cells, which is implemented recursively, and for a
> vertex with many incident cells, as in your case the infinite
> vertex, the stack is full.
> 
> We have to put it on our todo list.

I did it for 3D only because the degenerate 2D case should be 
handled by the circulator anyway.

I did not add the test which explodes the call stack (in case we plug
the recursive version): too slow for a testsuite. But incident_... 
methods are used everywhere in the code anyway.
2008-11-14 04:27:18 +00:00
Sylvain Pion 4aa1cb057a Remove my email adress from header files. 2008-10-11 20:21:08 +00:00
Camille Wormser a6d18262ae adds (finite_) incident_facets(Vertex) for the 2D case,
deprecates the usage of (finite_) incident_cells in the 2D case.
2008-06-05 02:51:51 +00:00
Camille Wormser 8d16e7529b removed an unused parameter (warning in some platforms of the test suite) 2008-04-21 13:12:30 +00:00
Laurent Rineau ed75d4f3f4 Remove an unused parameter.
People should compile their code with -O2 -Wextra, to see those warnings.
2008-04-21 07:41:52 +00:00
Camille Wormser 952afd12d8 removed unused code 2008-04-20 06:11:56 +00:00
Camille Wormser 646258adb8 finished rewriting the incident_*(vertex):
- all the code is factored around visit_incident_cells.
- incident_edges has been added
- finite versions of all incident_*(vertex) have been added
  thanks to a Filter template parameter
2008-04-20 05:48:13 +00:00
Sylvain Pion c3ee0c0087 Remove CGAL_T2_USE_ITERATOR_AS_HANDLE and CGAL_T3_USE_ITERATOR_AS_HANDLE
as they are now always defined and things work.
2008-04-03 12:14:58 +00:00
Camille Wormser 049a65f766 adds incident_edges and factors all incident_* code
by wrapping everything around a visit_incident_cells
method.
2008-04-01 14:44:18 +00:00
Sylvain Pion 6a9740d043 Remove obsolete workarounds for __sgi. 2008-01-20 23:09:58 +00:00
Sylvain Pion e8591b3b32 Change Counting_output_iterator to store a pointer to the counter, instead of
the counter itself.  It fixes a problem with g++ 4.3 since std::copy now
performs the assignments on *copies* of the output iterator.
See : http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34595
2007-12-26 17:34:36 +00:00
Andreas Fabri 0bd68b0c98 Let's see what happens when VC++ uses iterators as handles 2007-11-08 10:27:05 +00:00
Sylvain Pion ef264999b3 Renaming of Compact_container's construct_insert() to emplace() to match C++0x.
It breaks backward compat, but I doubt many people use Compact_container directly.
Make it use variadic templates, while at it.
2007-10-20 20:51:59 +00:00
Monique Teillaud 49098985b5 more precondition fixes 2006-10-04 10:00:09 +00:00
Monique Teillaud 8bc4a07695 same here, even if it was not reported... 2006-10-04 08:34:56 +00:00
Monique Teillaud 3a10264858 precondition n>6 fixed to n>=6
(reported on cgal-discuss)
2006-10-04 08:11:42 +00:00
Nico Kruithof 7ce6d89b94 Adding the simplex class to the Triangulation_3 package. 2006-08-09 15:25:13 +00:00
Andreas Fabri 833035d00c Fixed min max problem 2006-07-31 23:06:40 +00:00
Laurent Rineau 7f053b6b83 - fixed operators << and >> for triangulations, if the stream is in binary
mode
- fixed only if dimension()==3. If dimension()<3, tds.print_cells() should
  be corrected. The handling of the dimension is ugly (copy-pasting). I
  prefere not to fix that code.

Note 1: Test suite is ok.
Note 2: binary i/o operators are tested in Mesh_3
2006-07-12 00:00:48 +00:00