Ok for first version.

This commit is contained in:
Guillaume Damiand 2014-11-14 17:22:06 +01:00
parent b92bcae1a9
commit ef550fd3bb
17 changed files with 348 additions and 362 deletions

View File

@ -9,7 +9,7 @@ else()
cmake_minimum_required(VERSION 2.6.2)
endif()
add_definitions(-DCGAL_HEADER_ONLY)
# add_definitions(-DCGAL_HEADER_ONLY)
# option for branch build

View File

@ -68,7 +68,7 @@ protected:
public:
typedef Random_generator_base<T> This;
Random_generator_base() : _rnd( get_default_random()) {}
Random_generator_base() : _rnd( CGAL::get_default_random() ) {}
Random_generator_base( double range, Random& rnd)
: Generator_base<T>( range), _rnd( rnd) {}
Random_generator_base( const T& item, double range, Random& rnd)
@ -83,7 +83,7 @@ class Random_double_in_interval : public Random_generator_base<double> {
public:
typedef Random_double_in_interval This;
Random_double_in_interval(double a = 1, Random& rnd = get_default_random())
Random_double_in_interval(double a = 1, Random& rnd = CGAL::get_default_random())
// g is an input iterator creating points of type `P' uniformly
// distributed in the half-open square with side length a,
// centered around the origin, i.e. \forall p = `*g': -\frac{a}{2}

View File

@ -36,7 +36,7 @@ class Random_points_in_disc_2 : public Random_generator_base<P>{
void generate_point();
public:
typedef Random_points_in_disc_2<P,Creator> This;
Random_points_in_disc_2( double r = 1, Random& rnd = get_default_random())
Random_points_in_disc_2( double r = 1, Random& rnd = CGAL::get_default_random())
// g is an input iterator creating points of type `P' uniformly
// distributed in the open disc with radius r, i.e. |`*g'| < r .
// Two random numbers are needed from `rnd' for each point.
@ -71,7 +71,7 @@ class Random_points_on_circle_2 : public Random_generator_base<P> {
void generate_point();
public:
typedef Random_points_on_circle_2<P,Creator> This;
Random_points_on_circle_2( double r = 1, Random& rnd = get_default_random())
Random_points_on_circle_2( double r = 1, Random& rnd = CGAL::get_default_random())
// g is an input iterator creating points of type `P' uniformly
// distributed on the circle with radius r, i.e. |`*g'| == r . A
// single random number is needed from `rnd' for each point.
@ -105,7 +105,7 @@ class Random_points_in_square_2 : public Random_generator_base<P> {
void generate_point();
public:
typedef Random_points_in_square_2<P,Creator> This;
Random_points_in_square_2( double a = 1, Random& rnd = get_default_random())
Random_points_in_square_2( double a = 1, Random& rnd = CGAL::get_default_random())
// g is an input iterator creating points of type `P' uniformly
// distributed in the half-open square with side length a,
// centered around the origin, i.e. \forall p = `*g': -\frac{a}{2}
@ -141,7 +141,7 @@ class Random_points_on_square_2 : public Random_generator_base<P> {
void generate_point();
public:
typedef Random_points_on_square_2<P,Creator> This;
Random_points_on_square_2( double a = 1, Random& rnd = get_default_random())
Random_points_on_square_2( double a = 1, Random& rnd = CGAL::get_default_random())
// g is an input iterator creating points of type `P' uniformly
// distributed on the boundary of the square with side length a,
// centered around the origin, i.e. \forall p = `*g': one
@ -194,7 +194,7 @@ class Random_points_in_iso_rectangle_2 : public Random_generator_base<P> {
void generate_point();
public:
typedef Random_points_in_iso_rectangle_2<P,Creator> This;
Random_points_in_iso_rectangle_2( const P&p, const P& q, Random& rnd = get_default_random())
Random_points_in_iso_rectangle_2( const P&p, const P& q, Random& rnd = CGAL::get_default_random())
: Random_generator_base<P>( 1.0 , rnd)
{
left = (std::min)(to_double(p.x()), to_double(q.x()));
@ -238,7 +238,7 @@ public:
typedef Random_points_on_segment_2<P,Creator> This;
Random_points_on_segment_2( const P& p = P( -1, 0),
const P& q = P( 1, 0),
Random& rnd = get_default_random())
Random& rnd = CGAL::get_default_random())
// g is an input iterator creating points of type `P' uniformly
// distributed on the segment from p to q except q, i.e. `*g' ==
// \lambda p + (1-\lambda)\, q where 0 <= \lambda < 1 . A single
@ -423,7 +423,7 @@ void perturb_points_2( ForwardIterator first,
double xeps,
double yeps)
{
perturb_points_2( first, last, xeps, yeps, get_default_random());
perturb_points_2( first, last, xeps, yeps, CGAL::get_default_random());
}
template <class ForwardIterator>
@ -431,7 +431,7 @@ void perturb_points_2( ForwardIterator first,
ForwardIterator last,
double xeps)
{
perturb_points_2( first, last, xeps, xeps, get_default_random());
perturb_points_2( first, last, xeps, xeps, CGAL::get_default_random());
}
template <class RandomAccessIterator, class OutputIterator, class Creator>
OutputIterator random_collinear_points_2(
@ -489,7 +489,7 @@ OutputIterator random_collinear_points_2(
OutputIterator first2)
{
return random_collinear_points_2( first, last, n, first2,
get_default_random());
CGAL::get_default_random());
}

View File

@ -36,7 +36,7 @@ class Random_points_in_sphere_3 : public Random_generator_base<P> {
void generate_point();
public:
typedef Random_points_in_sphere_3<P,Creator> This;
Random_points_in_sphere_3( double r = 1, Random& rnd = get_default_random())
Random_points_in_sphere_3( double r = 1, Random& rnd = CGAL::get_default_random())
// g is an input iterator creating points of type `P' uniformly
// distributed in the open sphere with radius r, i.e. |`*g'| < r .
// Three random numbers are needed from `rnd' for each point
@ -75,7 +75,7 @@ class Random_points_on_sphere_3 : public Random_generator_base<P> {
void generate_point();
public:
typedef Random_points_on_sphere_3<P,Creator> This;
Random_points_on_sphere_3( double r = 1, Random& rnd = get_default_random())
Random_points_on_sphere_3( double r = 1, Random& rnd = CGAL::get_default_random())
// g is an input iterator creating points of type `P' uniformly
// distributed on the sphere with radius r, i.e. |`*g'| == r . A
// two random numbers are needed from `rnd' for each point.
@ -113,7 +113,7 @@ class Random_points_in_cube_3 : public Random_generator_base<P>{
void generate_point();
public:
typedef Random_points_in_cube_3<P,Creator> This;
Random_points_in_cube_3( double a = 1, Random& rnd = get_default_random())
Random_points_in_cube_3( double a = 1, Random& rnd = CGAL::get_default_random())
: Random_generator_base<P>( a, rnd) { generate_point(); }
This& operator++() {
generate_point();

View File

@ -32,73 +32,6 @@
namespace CGAL {
#ifdef CGAL_HAS_THREADS
#ifdef CGAL_HEADER_ONLY
inline boost::thread_specific_ptr<int>& get_static_prime_int_()
{
static boost::thread_specific_ptr<int> prime_int_;
return prime_int_;
}
inline boost::thread_specific_ptr<double>& get_static_prime_()
{
static boost::thread_specific_ptr<double> prime_;
return prime_;
}
inline boost::thread_specific_ptr<double>& get_static_prime_inv_()
{
static boost::thread_specific_ptr<double> prime_inv_;
return prime_inv_;
}
#else // CGAL_HEADER_ONLY
inline boost::thread_specific_ptr<int>& get_static_prime_int_()
{ return Residue::prime_int_; }
inline boost::thread_specific_ptr<double>& get_static_prime_()
{ return Residue::prime_; }
inline boost::thread_specific_ptr<double>& get_static_prime_inv_()
{ return Residue::prime_inv_; }
#endif // CGAL_HEADER_ONLY
#else // CGAL_HAS_THREADS
#ifdef CGAL_HEADER_ONLY
inline int& get_static_prime_int()
{
static int prime_int = 67111067;
return prime_int;
}
inline double& get_static_prime()
{
static double prime = 67111067.0;
return prime;
}
inline double& get_static_prime_inv()
{
static double prime_inv = 1/67111067.0;
return prime_inv;
}
#else // CGAL_HEADER_ONLY
inline int& get_static_prime_int()
{ return Residue::prime_int; }
inline double& get_static_prime()
{ return Residue::prime; }
inline double& get_static_prime_inv()
{ return Residue::prime_inv; }
#endif // CGAL_HEADER_ONLY
#endif // CGAL_HAS_THREADS
#ifdef CGAL_HEADER_ONLY
inline double& get_static_CST_CUT()
{
static double CST_CUT = std::ldexp( 3., 51 );
return CST_CUT;
}
#else // CGAL_HEADER_ONLY
inline double& get_static_CST_CUT()
{ return Residue::CST_CUT; }
#endif // CGAL_HEADER_ONLY
class Residue;
Residue operator + (const Residue&);
@ -107,6 +40,20 @@ Residue operator - (const Residue&);
std::ostream& operator << (std::ostream& os, const Residue& p);
std::istream& operator >> (std::istream& is, Residue& p);
#ifdef CGAL_HAS_THREADS
#ifdef CGAL_HEADER_ONLY
#else // CGAL_HEADER_ONLY
#endif // CGAL_HEADER_ONLY
#else // CGAL_HAS_THREADS
#ifdef CGAL_HEADER_ONLY
#else // CGAL_HEADER_ONLY
#endif // CGAL_HEADER_ONLY
#endif // CGAL_HAS_THREADS
/*! \ingroup CGAL_Modular_traits
* \brief This class represents the Field Z mod p.
*
@ -127,16 +74,46 @@ public:
typedef Residue NT;
private:
#ifndef CGAL_HEADER_ONLY
#ifdef CGAL_HEADER_ONLY
static const double& get_static_CST_CUT()
{
static const double CST_CUT = std::ldexp( 3., 51 );
return CST_CUT;
}
#else // CGAL_HEADER_ONLY
CGAL_EXPORT static const double CST_CUT;
static const double& get_static_CST_CUT()
{ return Residue::CST_CUT; }
#endif // CGAL_HEADER_ONLY
#ifdef CGAL_HAS_THREADS
#ifndef CGAL_HEADER_ONLY
#ifdef CGAL_HEADER_ONLY
static boost::thread_specific_ptr<int>& get_static_prime_int_()
{
static boost::thread_specific_ptr<int> prime_int_;
return prime_int_;
}
static boost::thread_specific_ptr<double>& get_static_prime_()
{
static boost::thread_specific_ptr<double> prime_;
return prime_;
}
static boost::thread_specific_ptr<double>& get_static_prime_inv_()
{
static boost::thread_specific_ptr<double> prime_inv_;
return prime_inv_;
}
#else // CGAL_HEADER_ONLY
CGAL_EXPORT static boost::thread_specific_ptr<int> prime_int_;
CGAL_EXPORT static boost::thread_specific_ptr<double> prime_;
CGAL_EXPORT static boost::thread_specific_ptr<double> prime_inv_;
static boost::thread_specific_ptr<int>& get_static_prime_int_()
{ return Residue::prime_int_; }
static boost::thread_specific_ptr<double>& get_static_prime_()
{ return Residue::prime_; }
static boost::thread_specific_ptr<double>& get_static_prime_inv_()
{ return Residue::prime_inv_; }
#endif // CGAL_HEADER_ONLY
static void init_class_for_thread(){
@ -167,10 +144,33 @@ private:
}
#else // CGAL_HAS_THREADS
#ifndef CGAL_HEADER_ONLY
#ifdef CGAL_HEADER_ONLY
static int& get_static_prime_int()
{
static int prime_int = 67111067;
return prime_int;
}
static double& get_static_prime()
{
static double prime = 67111067.0;
return prime;
}
static double& get_static_prime_inv()
{
static double prime_inv = 1/67111067.0;
return prime_inv;
}
#else //
CGAL_EXPORT static int prime_int;
CGAL_EXPORT static double prime;
CGAL_EXPORT static double prime_inv;
static int& get_static_prime_int()
{ return Residue::prime_int; }
static double& get_static_prime()
{ return Residue::prime; }
static double& get_static_prime_inv()
{ return Residue::prime_inv; }
#endif // CGAL_HEADER_ONLY
static int get_prime_int(){ return get_static_prime_int();}
static double get_prime() { return get_static_prime();}

View File

@ -28,7 +28,7 @@
namespace CGAL {
namespace internal {
#ifndef CGAL_HEADER_ONLY
CGAL_EXPORT extern int primes[2000];
CGAL_EXPORT extern const int primes[2000];
#endif // CGAL_HEADER_ONLY
static inline

View File

@ -321,7 +321,7 @@ on their Pluecker coefficient tuples.}*/
template <typename Tag, typename R>
std::ostream& operator<<(std::ostream& os, const Pluecker_line_3<Tag,R>& l)
{
switch( os.iword(CGAL::IO::mode) ) {
switch( get_mode(os) ) {
case CGAL::IO::ASCII :
for (unsigned i=0; i<6; ++i) os << l[i] << " ";
return os;

File diff suppressed because it is too large Load Diff

View File

@ -157,8 +157,8 @@ SM_io_parser(std::ostream& iout, const Base& D)
en(this->number_of_shalfedges()),
ln(this->number_of_shalfloops()),
fn(this->number_of_sfaces())
{ verbose = (out.iword(CGAL::IO::mode) != CGAL::IO::ASCII &&
out.iword(CGAL::IO::mode) != CGAL::IO::BINARY);
{ verbose = (get_mode(out) != CGAL::IO::ASCII &&
get_mode(out) != CGAL::IO::BINARY);
}

View File

@ -39,7 +39,6 @@ struct Check_FPU_rounding_mode_is_restored {
~Check_FPU_rounding_mode_is_restored()
{
std::cout<<"DELETE ~Check_FPU_rounding_mode_is_restored()"<<std::endl;
CGAL_assertion_msg( FPU_get_cw() == mode,
"The default FPU rounding mode has not been restored "
" before the exit of the program. "

View File

@ -50,8 +50,16 @@ private:
int interv;
bool running;
#ifndef CGAL_HEADER_ONLY
#ifdef CGAL_HEADER_ONLY
inline bool& get_static_realtimer_m_failed()
{
static bool m_failed = false;
return m_failed;
}
#else // CGAL_HEADER_ONLY
static bool m_failed;
static bool& get_static_realtimer_m_failed()
{ return Real_timer::m_failed; }
#endif // CGAL_HEADER_ONLY
double get_real_time() const; // in seconds

View File

@ -42,21 +42,6 @@
# include <sys/time.h>
#endif
#ifdef CGAL_HEADER_ONLY
namespace {
inline bool& get_static_realtimer_m_failed()
{
static bool m_failed = false;
return m_failed;
}
} // namespace
#else // CGAL_HEADER_ONLY
namespace {
inline bool& get_static_realtimer_m_failed()
{ return Real_timer::m_failed; }
} // namespace
#endif // CGAL_HEADER_ONLY
namespace CGAL {
// Member functions for Real_timer

View File

@ -48,8 +48,16 @@ private:
int interv;
bool running;
#ifndef CGAL_HEADER_ONLY
#ifdef CGAL_HEADER_ONLY
static bool& get_static_timer_m_failed()
{
static bool m_failed = false;
return m_failed;
}
#else // CGAL_HEADER_ONLY
static bool m_failed;
static bool& get_static_timer_m_failed()
{ return CGAL::Timer::m_failed; }
#endif // CGAL_HEADER_ONLY
double user_process_time() const; // in seconds

View File

@ -57,21 +57,6 @@
// For the numerical limits
#include <cfloat>
#ifdef CGAL_HEADER_ONLY
namespace {
inline bool& get_static_timer_m_failed()
{
static bool m_failed = false;
return m_failed;
}
} // namespace
#else // CGAL_HEADER_ONLY
namespace {
inline bool& get_static_timer_m_failed()
{ return Timer::m_failed; }
} // namespace
#endif // CGAL_HEADER_ONLY
namespace CGAL {
// Member functions for Timer

View File

@ -228,6 +228,17 @@ public:
CGAL_EXPORT extern Random default_random;
#endif // CGAL_HEADER_ONLY
#ifdef CGAL_HEADER_ONLY
inline Random& get_default_random()
{
static Random default_random;
return default_random;
}
#else // CGAL_HEADER_ONLY
inline Random& get_default_random()
{ return default_random; }
#endif // CGAL_HEADER_ONLY
} //namespace CGAL
#ifdef CGAL_HEADER_ONLY

View File

@ -33,17 +33,6 @@
namespace CGAL {
#ifdef CGAL_HEADER_ONLY
inline Random& get_default_random()
{
static Random default_random;
return default_random;
}
#else // CGAL_HEADER_ONLY
inline Random& get_default_random()
{ return Random::default_random; }
#endif // CGAL_HEADER_ONLY
// Class implementation (continued)
// ================================

View File

@ -1,16 +1,7 @@
CGAL:
Clement:
#include "/home/gdamiand/sources/CGAL/Kinetic_data_structures/src/CGAL/JAMA_numeric_solver.cpp"
#include "/home/gdamiand/sources/CGAL/Kinetic_data_structures/src/CGAL/KDS_Log.cpp"
#include "/home/gdamiand/sources/CGAL/Kinetic_data_structures/src/CGAL/numeric_solvers_support.cpp"
#include "/home/gdamiand/sources/CGAL/Kinetic_data_structures/src/CGAL/Turkowski_numeric_solver.cpp"
#include "/home/gdamiand/sources/CGAL/Modular_arithmetic/src/CGAL/Residue_type.cpp"
Guillaume
CGAL:
DONE #include "/home/gdamiand/sources/CGAL/STL_Extension/src/CGAL/assertions.cpp" // variables globales
DONE #include "/home/gdamiand/sources/CGAL/Stream_support/src/CGAL/io.cpp" // variable statique de classe
DONE #include "/home/gdamiand/sources/CGAL/Stream_support/src/CGAL/Color.cpp" // constantes globales
@ -21,6 +12,7 @@ DONE #include "/home/gdamiand/sources/CGAL/Profiling_tools/src/CGAL/Timer.cpp" /
DONE #include "/home/gdamiand/sources/CGAL/Profiling_tools/src/CGAL/Real_timer.cpp" // variable statique de classe
DONE #include "/home/gdamiand/sources/CGAL/Random_numbers/src/CGAL/Random.cpp" // variable globale; utilisée directement (donc pb pour header only) -> we need to replace the use of CGAL::default_random by CGAL::get_default_random().
DONE #include "/home/gdamiand/sources/CGAL/Modular_arithmetic/src/CGAL/primes.cpp" // constante globale
DONE #include "/home/gdamiand/sources/CGAL/Modular_arithmetic/src/CGAL/Residue_type.cpp" // variables globales (! version multi-thread !)
DONE #include "/home/gdamiand/sources/CGAL/Geomview/src/CGAL/Geomview_stream.cpp"
DONE #include "/home/gdamiand/sources/CGAL/Intersections_2/src/CGAL/Bbox_2_intersections.cpp"
@ -42,6 +34,15 @@ DONE #include "/home/gdamiand/sources/CGAL/GraphicsView/src/CGAL_Qt4/GraphicsVie
DONE #include "/home/gdamiand/sources/CGAL/GraphicsView/src/CGAL_Qt4/DemosMainWindow.cpp"
DONE #include "/home/gdamiand/sources/CGAL/GraphicsView/src/CGAL_Qt4/GraphicsViewNavigation.cpp"
Clement:
CGAL:
#include "/home/gdamiand/sources/CGAL/Kinetic_data_structures/src/CGAL/JAMA_numeric_solver.cpp"
#include "/home/gdamiand/sources/CGAL/Kinetic_data_structures/src/CGAL/KDS_Log.cpp"
#include "/home/gdamiand/sources/CGAL/Kinetic_data_structures/src/CGAL/numeric_solvers_support.cpp"
#include "/home/gdamiand/sources/CGAL/Kinetic_data_structures/src/CGAL/Turkowski_numeric_solver.cpp"
CGAL_Core:
#include "/home/gdamiand/sources/CGAL/CGAL_Core/src/CGAL_Core/CoreIO.cpp"