Commit 9e3dd671 authored by Lynn Garren's avatar Lynn Garren
Browse files

Merge branch 'release/CLHEP_2_3_4_5'

parents 9bb586c9 c5e201b7
......@@ -31,7 +31,7 @@ clhep_ensure_out_of_source_build()
# use cmake 3.2 or later
cmake_minimum_required(VERSION 3.2)
# Project setup
project(CLHEP VERSION 2.3.4.4)
project(CLHEP VERSION 2.3.4.5)
# - needed for (temporary) back compatibility
set(VERSION ${PROJECT_VERSION})
......
==============================
18.09.17 Release CLHEP-2.3.4.5
==============================
2017-09-18 Lynn Garren <garren@fnal.gov>
* support c++17 and c++1z (see CLHEP-144)
code contributed by Chris Green
==============================
21.03.17 Release CLHEP-2.3.4.4
==============================
......
==============================
18.09.17 Release CLHEP-2.3.4.5
==============================
==============================
21.03.17 Release CLHEP-2.3.4.4
==============================
==============================
......
==============================
18.09.17 Release CLHEP-2.3.4.5
==============================
==============================
21.03.17 Release CLHEP-2.3.4.4
==============================
==============================
......
==============================
18.09.17 Release CLHEP-2.3.4.5
==============================
==============================
21.03.17 Release CLHEP-2.3.4.4
==============================
==============================
......
==============================
18.09.17 Release CLHEP-2.3.4.5
==============================
==============================
21.03.17 Release CLHEP-2.3.4.4
==============================
==============================
......
==============================
18.09.17 Release CLHEP-2.3.4.5
==============================
==============================
21.03.17 Release CLHEP-2.3.4.4
==============================
==============================
......
==============================
18.09.17 Release CLHEP-2.3.4.5
==============================
==============================
21.03.17 Release CLHEP-2.3.4.4
==============================
==============================
......
==============================
18.09.17 Release CLHEP-2.3.4.5
==============================
==============================
21.03.17 Release CLHEP-2.3.4.4
==============================
==============================
......
......@@ -97,8 +97,8 @@ void seed_vielbein(rng_state_t* X, unsigned int i); // seeds with the i-th unit
// FUNCTIONS FOR GETTING RANDOM NUMBERS
#ifdef __MIXMAX_C
myuint get_next(rng_state_t* X); // returns 64-bit int, which is between 1 and 2^61-1 inclusive
double get_next_float(rng_state_t* X); // returns double precision floating point number in (0,1]
myuint clhep_get_next(rng_state_t* X); // returns 64-bit int, which is between 1 and 2^61-1 inclusive
double clhep_get_next_float(rng_state_t* X); // returns double precision floating point number in (0,1]
#endif //__MIXMAX_C
void fill_array(rng_state_t* X, unsigned int n, double *array); // fastest method: set n to a multiple of N (e.g. n=256)
......@@ -166,8 +166,8 @@ void branch_inplace( rng_state_t* Xin, myID_t* ID ); // almost the same as apply
#ifndef __MIXMAX_C // c++ can put code into header files, why cant we? (with the inline declaration, should be safe from duplicate-symbol error)
#define get_next(X) GET_BY_MACRO(X)
#define get_next_float(X) get_next_float_BY_MACRO(X)
#define clhep_get_next(X) GET_BY_MACRO(X)
#define clhep_get_next_float(X) clhep_get_next_float_BY_MACRO(X)
#endif // __MIXMAX_C
......@@ -186,8 +186,8 @@ inline myuint GET_BY_MACRO(rng_state_t* X) {
}
inline double get_next_float_BY_MACRO(rng_state_t* X){
int64_t Z=(int64_t)get_next(X);
inline double clhep_get_next_float_BY_MACRO(rng_state_t* X){
int64_t Z=(int64_t)clhep_get_next(X);
#if defined(__x86_64__) && defined(__SSE__) && defined(__AVX__) && defined(USE_INLINE_ASM)
double F;
__asm__ __volatile__( "pxor %0, %0;"
......@@ -236,12 +236,12 @@ static const gsl_rng_type mixmax_type =
unsigned long gsl_get_next(void *vstate) {
rng_state_t* X= (rng_state_t*)vstate;
return (unsigned long)get_next(X);
return (unsigned long)clhep_get_next(X);
}
double gsl_get_next_float(void *vstate) {
rng_state_t* X= (rng_state_t*)vstate;
return ( (double)get_next(X)) * INV_MERSBASE;
return ( (double)clhep_get_next(X)) * INV_MERSBASE;
}
void seed_for_gsl(void *vstate, unsigned long seed){
......
......@@ -180,7 +180,7 @@ void MixMaxRng::setSeeds(const long* Seeds, int seedNum)
double MixMaxRng::flat()
{
return get_next_float(fRngState);
return clhep_get_next_float(fRngState);
}
void MixMaxRng::flatArray(const int size, double* vect )
......@@ -191,8 +191,8 @@ void MixMaxRng::flatArray(const int size, double* vect )
MixMaxRng::operator unsigned int()
{
return static_cast<unsigned int>(get_next(fRngState));
// get_next returns a 64-bit integer, of which the lower 61 bits
return static_cast<unsigned int>(clhep_get_next(fRngState));
// clhep_get_next returns a 64-bit integer, of which the lower 61 bits
// are random and upper 3 bits are zero
}
......
......@@ -79,12 +79,12 @@ myuint iterate_raw_vec(myuint* Y, myuint sumtotOld){
return MOD_MERSENNE(MOD_MERSENNE(sumtot) + (ovflow <<3 ));
}
myuint get_next(rng_state_t* X) {
myuint clhep_get_next(rng_state_t* X) {
return GET_BY_MACRO(X);
}
double get_next_float(rng_state_t* X){
return get_next_float_BY_MACRO(X);
double clhep_get_next_float(rng_state_t* X){
return clhep_get_next_float_BY_MACRO(X);
}
void fill_array(rng_state_t* X, unsigned int n, double *array)
......@@ -167,7 +167,7 @@ rng_state_t* rng_copy(myuint *Y)
/* copy the vector stored at Y, and return pointer to the newly allocated and initialized state.
It is the user's responsibility to make sure that Y is properly allocated with rng_alloc,
then pass Y->V or it can also be an array -- such as myuint Y[N+1] and Y[1]...Y[N] have been set to legal values [0 .. MERSBASE-1]
Partial sums on this new state are recalculated, and counter set to zero, so that when get_next is called,
Partial sums on this new state are recalculated, and counter set to zero, so that when clhep_get_next is called,
it will output the initial vector before any new numbers are produced, call iterate(X) if you want to advance right away */
rng_state_t* X = rng_alloc();
myuint sumtot=0,ovflow=0;
......
==============================
18.09.17 Release CLHEP-2.3.4.5
==============================
==============================
21.03.17 Release CLHEP-2.3.4.4
==============================
==============================
......
==============================
18.09.17 Release CLHEP-2.3.4.5
==============================
==============================
21.03.17 Release CLHEP-2.3.4.4
==============================
==============================
......
==============================
18.09.17 Release CLHEP-2.3.4.5
==============================
2017-09-18 Lynn Garren <garren@fnal.gov>
* test: remove unused test .cc files to avoid confusion
==============================
21.03.17 Release CLHEP-2.3.4.4
==============================
......
// ======================================================================
//
// Test compilability and basic functionality of Utility/memory.h
//
// Author: W. E. Brown, 2010-03-19, adapted from the boost library's
// shared_ptr and related functionality whose internal attributions bear
// the following various notices:
//
// Copyright (c) 2002, 2003 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
//
// ======================================================================
#include "CLHEP/Utility/memory.h"
#include <cassert>
#include <map>
#include <vector>
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 6)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#elif __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#endif
using namespace CLHEP;
using CLHEP::shared_ptr;
using CLHEP::weak_ptr;
#if defined(_MSC_VER) && (_MSC_VER >= 1310)
# pragma warning (disable : 4675) // suppress ADL warning
#endif
namespace n_element_type
{
void
f(int &)
{ }
void
test()
{
typedef shared_ptr<int>::element_type T;
T t;
f(t);
}
} // namespace n_element_type
namespace n_constructors
{
class incomplete;
void
default_constructor()
{
{
shared_ptr<int> pi;
assert(pi? false: true);
assert(!pi);
assert(pi.get() == 0);
assert(pi.use_count() == 0);
}
{
shared_ptr<void> pv;
assert(pv? false: true);
assert(!pv);
assert(pv.get() == 0);
assert(pv.use_count() == 0);
}
{
shared_ptr<incomplete> px;
assert(px? false: true);
assert(!px);
assert(px.get() == 0);
assert(px.use_count() == 0);
}
}
struct A
{
int dummy;
};
struct X
{
static long instances;
X()
{
++instances;
}
~X()
{
--instances;
}
private:
X(X const &);
X & operator= (X const &);
};
long X::instances = 0;
// virtual inheritance stresses the implementation
struct Y
: public A
, public virtual X
{
static long instances;
Y()
{
++instances;
}
~Y()
{
--instances;
}
private:
Y(Y const &);
Y & operator= (Y const &);
};
long Y::instances = 0;
template< class T >
void
pc0_test(T * p)
{
assert(p == 0);
shared_ptr<T> pt(p);
assert(pt? false: true);
assert(!pt);
assert(pt.get() == 0);
assert(pt.use_count() == 1);
assert(pt.unique());
}
void
pointer_constructor()
{
pc0_test(static_cast<int*>(0));
pc0_test(static_cast<int const*>(0));
pc0_test(static_cast<int volatile*>(0));
pc0_test(static_cast<int const volatile*>(0));
{
shared_ptr<int const> pi(static_cast<int*>(0));
assert(pi? false: true);
assert(!pi);
assert(pi.get() == 0);
assert(pi.use_count() == 1);
assert(pi.unique());
}
{
shared_ptr<int volatile> pi(static_cast<int*>(0));
assert(pi? false: true);
assert(!pi);
assert(pi.get() == 0);
assert(pi.use_count() == 1);
assert(pi.unique());
}
{
shared_ptr<void> pv(static_cast<int*>(0));
assert(pv? false: true);
assert(!pv);
assert(pv.get() == 0);
assert(pv.use_count() == 1);
assert(pv.unique());
}
{
shared_ptr<void const> pv(static_cast<int*>(0));
assert(pv? false: true);
assert(!pv);
assert(pv.get() == 0);
assert(pv.use_count() == 1);
assert(pv.unique());
}
pc0_test(static_cast<X*>(0));
pc0_test(static_cast<X const*>(0));
pc0_test(static_cast<X volatile*>(0));
pc0_test(static_cast<X const volatile*>(0));
{
shared_ptr<X const> px(static_cast<X*>(0));
assert(px? false: true);
assert(!px);
assert(px.get() == 0);
assert(px.use_count() == 1);
assert(px.unique());
}
{
shared_ptr<X> px(static_cast<Y*>(0));
assert(px? false: true);
assert(!px);
assert(px.get() == 0);
assert(px.use_count() == 1);
assert(px.unique());
}
{
shared_ptr<X const> px(static_cast<Y*>(0));
assert(px? false: true);
assert(!px);
assert(px.get() == 0);
assert(px.use_count() == 1);
assert(px.unique());
}
{
shared_ptr<void> pv(static_cast<X*>(0));
assert(pv? false: true);
assert(!pv);
assert(pv.get() == 0);
assert(pv.use_count() == 1);
assert(pv.unique());
}
{
shared_ptr<void const> pv(static_cast<X*>(0));
assert(pv? false: true);
assert(!pv);
assert(pv.get() == 0);
assert(pv.use_count() == 1);
assert(pv.unique());
}
{
int * p = new int(7);
shared_ptr<int> pi(p);
assert(pi? true: false);
assert(!!pi);
assert(pi.get() == p);
assert(pi.use_count() == 1);
assert(pi.unique());
assert(*pi == 7);
}
{
int * p = new int(7);
shared_ptr<int const> pi(p);
assert(pi? true: false);
assert(!!pi);
assert(pi.get() == p);
assert(pi.use_count() == 1);
assert(pi.unique());
assert(*pi == 7);
}
{
int * p = new int(7);
shared_ptr<void> pv(p);
assert(pv? true: false);
assert(!!pv);
assert(pv.get() == p);
assert(pv.use_count() == 1);
assert(pv.unique());
}
{
int * p = new int(7);
shared_ptr<void const> pv(p);
assert(pv? true: false);
assert(!!pv);
assert(pv.get() == p);
assert(pv.use_count() == 1);
assert(pv.unique());
}
assert(X::instances == 0);
{
X * p = new X;
shared_ptr<X> px(p);
assert(px? true: false);
assert(!!px);
assert(px.get() == p);
assert(px.use_count() == 1);
assert(px.unique());
assert(X::instances == 1);
}
assert(X::instances == 0);
{
X * p = new X;
shared_ptr<X const> px(p);
assert(px? true: false);
assert(!!px);
assert(px.get() == p);
assert(px.use_count() == 1);
assert(px.unique());
assert(X::instances == 1);
}
assert(X::instances == 0);
{
X * p = new X;
shared_ptr<void> pv(p);
assert(pv? true: false);
assert(!!pv);
assert(pv.get() == p);
assert(pv.use_count() == 1);
assert(pv.unique());
assert(X::instances == 1);
}
assert(X::instances == 0);
{
X * p = new X;
shared_ptr<void const> pv(p);
assert(pv? true: false);
assert(!!pv);
assert(pv.get() == p);
assert(pv.use_count() == 1);
assert(pv.unique());
assert(X::instances == 1);
}
assert(X::instances == 0);
assert(Y::instances == 0);
{
Y * p = new Y;
shared_ptr<X> px(p);
assert(px? true: false);
assert(!!px);
assert(px.get() == p);
assert(px.use_count() == 1);
assert(px.unique());
assert(X::instances == 1);
assert(Y::instances == 1);
}
assert(X::instances == 0);
assert(Y::instances == 0);
{
Y * p = new Y;
shared_ptr<X const> px(p);
assert(px? true: false);
assert(!!px);
assert(px.get() == p);
assert(px.use_count() == 1);
assert(px.unique());
assert(X::instances == 1);
assert(Y::instances == 1);
}
assert(X::instances == 0);
assert(Y::instances == 0);
}
int m = 0;
// don't generate warnings about unused parameter inside assert
void
deleter(int * p)
{
assert(p == 0);
}
void
deleter2(int * p )
{
assert(p == &m);
++*p;
}
// don't generate warnings about unused parameter inside assert
struct deleter3
{
void operator()(incomplete * p )
{
assert(p == 0);
}
};
incomplete * p0 = 0;
void
deleter_constructor()
{
{
shared_ptr<int> pi(static_cast<int*>(0), deleter);
assert(pi? false: true);
assert(!pi);
assert(pi.get() == 0);
assert(pi.use_count() == 1);