Commit Graph

71 Commits

Author SHA1 Message Date
Clement Jamin bce43fbb8e Improved the way parallelism is handle in Mesh_3/Triangulation_3
Added a better support for parallelism in Triangulation_3.
Simplified how to enable/disable concurrency in Mesh_3.
Moved the Compact_container stategies to a new file.
2013-02-15 18:07:43 +01:00
Clement Jamin c4859681e3 Removed the "localization ids" related code.
It was an old, unused and slow.
2013-02-06 18:57:36 +01:00
Clement Jamin dc5e90b8cc Clean-up + some debugging functions + comments 2013-02-02 06:53:43 +01:00
Clement Jamin 7efd61b6db Removed some data race conditions in the parallel perturber.
Note: the code needs some clean-up
2013-01-08 08:59:17 +01:00
Clement Jamin 11a2a1c68a Merge from Mesh_3-improvements-GF 2012-11-21 17:49:59 +01:00
Clement Jamin ab4d97c1e5 The global optimizers are now parallel (needs some intense testing now) 2012-11-21 16:16:47 +01:00
Laurent Rineau 4509b5bbe2 Merge branch 'master' into improvements
Conflicts:
	Mesh_3/include/CGAL/Mesh_3/mesh_standard_facet_criteria.h
2012-11-14 12:17:29 +01:00
Sébastien Loriot 825bfe6144 make create_star_3 non recursive only after 100 recursive calls.
The speed observed on random data set produced by simple_2.cpp is equivalent
to the original recursive version and faster than the version better this commit
2012-10-30 13:42:47 +00:00
Clément Jamin 1ca7174e01 Merge from Mesh_3-improvements-GF
+ some bugfixes (most of them are related to the parallel version)

This version works (sequential and parallel) as long as the following macros are NOT defined:
* CGAL_COMPACT_MESH_VERTEX_CELL
* CGAL_INTRUSIVE_LIST
* FORCE_STRUCTURAL_FILTERING
2012-10-16 14:02:16 +00:00
Jane Tournois 3555cf3cb2 make just_incident_cells_3 the default use of incident_cells(v)
replace macro CGAL_JUST_INCIDENT_CELLS with CGAL_TDS_3_NOT_JUST_INCIDENT_CELLS (and reverse use), and comment it in config.h
2012-08-28 09:01:47 +00:00
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
Clément Jamin b268598665 Replace LINKED_WITH_TBB by CGAL_LINKED_WITH_TBB. 2012-06-13 09:33:08 +00:00
Clément Jamin b948543cc6 Use of a Tag (template parameter) to activate/deactivate concurrency in Mesh_3, instead of #ifdef macros. 2012-06-09 08:52:37 +00:00
Clément Jamin 5a628edd4e - New worksharing technique: we use a coarse version of the mesh to split the space.
- Some clean-up (removed g_global_mutex)
2012-05-03 16:05:36 +00:00
Clément Jamin 7d1d94f42e Merge from next 2012-04-24 16:24:13 +00:00
Clément Jamin 4adf775814 Bugfix for sequential Mesh_3 using lazy refinement queue. 2012-04-13 15:18:22 +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
Clément Jamin a520f3cbf0 Corrected a rare race condition.
The few bad facets that are created during the "cell refinement" step are treated immediately inside the thread which created them.
2012-03-29 15:05:28 +00:00
Clément Jamin 4ccf8e0447 First working parallel version. It's not faster than the sequential one, but not slower neither (depends if you're optimistic or not). The good news is that we found all (?) the sections to protect or to make thread-local. 2012-03-22 17:07:03 +00:00
Clément Jamin d284cf0e22 Lazy removal of cells from the refinement queue 2012-02-13 11:47:24 +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