Commit bd8b096b authored by Lynn Garren's avatar Lynn Garren
Browse files

Merge branch 'release/CLHEP_2_4_1_3'

parents 7062c532 daac2fa5
...@@ -31,7 +31,7 @@ clhep_ensure_out_of_source_build() ...@@ -31,7 +31,7 @@ clhep_ensure_out_of_source_build()
# use cmake 3.2 or later # use cmake 3.2 or later
cmake_minimum_required(VERSION 3.2) cmake_minimum_required(VERSION 3.2)
# Project setup # Project setup
project(CLHEP VERSION 2.4.1.2) project(CLHEP VERSION 2.4.1.3)
# - needed for (temporary) back compatibility # - needed for (temporary) back compatibility
set(VERSION ${PROJECT_VERSION}) set(VERSION ${PROJECT_VERSION})
......
==============================
21.10.19 Release CLHEP-2.4.1.3
==============================
2019-10-18 Evgueni Tcherniaev <evgueni.tcherniaev.@cern.ch>
* Vector/Vector/*.h: added move constructor and move assignment
* Geometry/Geometry/*.h: added move constructor and move assignment
============================== ==============================
20.06.19 Release CLHEP-2.4.1.2 20.06.19 Release CLHEP-2.4.1.2
============================== ==============================
......
============================== ==============================
21.10.19 Release CLHEP-2.4.1.3
==============================
==============================
20.06.19 Release CLHEP-2.4.1.2 20.06.19 Release CLHEP-2.4.1.2
============================== ==============================
============================== ==============================
......
============================== ==============================
21.10.19 Release CLHEP-2.4.1.3
==============================
==============================
20.06.19 Release CLHEP-2.4.1.2 20.06.19 Release CLHEP-2.4.1.2
============================== ==============================
============================== ==============================
......
============================== ==============================
21.10.19 Release CLHEP-2.4.1.3
==============================
==============================
20.06.19 Release CLHEP-2.4.1.2 20.06.19 Release CLHEP-2.4.1.2
============================== ==============================
============================== ==============================
......
============================== ==============================
21.10.19 Release CLHEP-2.4.1.3
==============================
==============================
20.06.19 Release CLHEP-2.4.1.2 20.06.19 Release CLHEP-2.4.1.2
============================== ==============================
============================== ==============================
......
============================== ==============================
21.10.19 Release CLHEP-2.4.1.3
==============================
==============================
20.06.19 Release CLHEP-2.4.1.2 20.06.19 Release CLHEP-2.4.1.2
============================== ==============================
============================== ==============================
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#define BASIC_VECTOR3D_H #define BASIC_VECTOR3D_H
#include <iosfwd> #include <iosfwd>
#include <type_traits>
#include "CLHEP/Geometry/defs.h" #include "CLHEP/Geometry/defs.h"
#include "CLHEP/Vector/ThreeVector.h" #include "CLHEP/Vector/ThreeVector.h"
...@@ -52,19 +53,24 @@ namespace HepGeom { ...@@ -52,19 +53,24 @@ namespace HepGeom {
BasicVector3D(T x1, T y1, T z1) { v_[0] = x1; v_[1] = y1; v_[2] = z1; } BasicVector3D(T x1, T y1, T z1) { v_[0] = x1; v_[1] = y1; v_[2] = z1; }
/** /**
* Copy constructor. * Copy constructor. */
* Note: BasicVector3D<double> has constructors BasicVector3D(const BasicVector3D<T> &) = default;
* from BasicVector3D<double> (provided by compiler) and
* from BasicVector3D<float> (defined in this file); /**
* BasicVector3D<float> has only the last one. * Constructor for BasicVector3D<double> from BasicVector3D<float>. */
*/ template<typename U = T,
typename = typename std::enable_if<!std::is_same<U,float>::value >::type>
BasicVector3D(const BasicVector3D<float> & v) { BasicVector3D(const BasicVector3D<float> & v) {
v_[0] = v.x(); v_[1] = v.y(); v_[2] = v.z(); v_[0] = v.x(); v_[1] = v.y(); v_[2] = v.z();
} }
/**
* Move constructor. */
BasicVector3D(BasicVector3D<T> &&) = default;
/** /**
* Destructor. */ * Destructor. */
virtual ~BasicVector3D() {} virtual ~BasicVector3D() = default;
// ------------------------- // -------------------------
// Interface to "good old C" // Interface to "good old C"
...@@ -92,6 +98,9 @@ namespace HepGeom { ...@@ -92,6 +98,9 @@ namespace HepGeom {
/** /**
* Assignment. */ * Assignment. */
BasicVector3D<T> & operator= (const BasicVector3D<T> &) = default; BasicVector3D<T> & operator= (const BasicVector3D<T> &) = default;
/**
* Move assignment. */
BasicVector3D<T> & operator= (BasicVector3D<T> &&) = default;
/** /**
* Addition. */ * Addition. */
BasicVector3D<T> & operator+=(const BasicVector3D<T> & v) { BasicVector3D<T> & operator+=(const BasicVector3D<T> & v) {
...@@ -246,7 +255,7 @@ namespace HepGeom { ...@@ -246,7 +255,7 @@ namespace HepGeom {
// --------------- // ---------------
/** /**
* Gets pseudo-rapidity: -ln(std::tan(theta/2)) */ * Gets pseudo-rapidity: -ln(tan(theta/2)) */
T pseudoRapidity() const; T pseudoRapidity() const;
/** /**
* Gets pseudo-rapidity. */ * Gets pseudo-rapidity. */
......
...@@ -45,7 +45,7 @@ namespace HepGeom { ...@@ -45,7 +45,7 @@ namespace HepGeom {
public: public:
/** /**
* Default constructor. */ * Default constructor. */
Normal3D() {} Normal3D() = default;
/** /**
* Constructor from three numbers. */ * Constructor from three numbers. */
...@@ -58,7 +58,11 @@ namespace HepGeom { ...@@ -58,7 +58,11 @@ namespace HepGeom {
/** /**
* Copy constructor. */ * Copy constructor. */
Normal3D(const Normal3D<float> & v) : BasicVector3D<float>(v) {} Normal3D(const Normal3D<float> &) = default;
/**
* Move constructor. */
Normal3D(Normal3D<float> &&) = default;
/** /**
* Constructor from BasicVector3D<float>. */ * Constructor from BasicVector3D<float>. */
...@@ -66,20 +70,23 @@ namespace HepGeom { ...@@ -66,20 +70,23 @@ namespace HepGeom {
/** /**
* Destructor. */ * Destructor. */
~Normal3D() {} ~Normal3D() = default;
/** /**
* Assignment. */ * Assignment. */
Normal3D<float> & operator=(const Normal3D<float> & v) { Normal3D<float> & operator=(const Normal3D<float> &) = default;
set(v.x(),v.y(),v.z()); return *this;
}
/** /**
* Assignment from BasicVector3D<float>. */ * Assignment from BasicVector3D<float>. */
Normal3D<float> & operator=(const BasicVector3D<float> & v) { Normal3D<float> & operator=(const BasicVector3D<float> & v) {
set(v.x(),v.y(),v.z()); return *this; this->BasicVector3D<float>::operator=(v);
return *this;
} }
/**
* Move assignment. */
Normal3D<float> & operator=(Normal3D<float> &&) = default;
/** /**
* Transformation by Transform3D. */ * Transformation by Transform3D. */
Normal3D<float> & transform(const Transform3D & m); Normal3D<float> & transform(const Transform3D & m);
...@@ -103,7 +110,7 @@ namespace HepGeom { ...@@ -103,7 +110,7 @@ namespace HepGeom {
public: public:
/** /**
* Default constructor. */ * Default constructor. */
Normal3D() {} Normal3D() = default;
/** /**
* Constructor from three numbers. */ * Constructor from three numbers. */
...@@ -121,7 +128,11 @@ namespace HepGeom { ...@@ -121,7 +128,11 @@ namespace HepGeom {
/** /**
* Copy constructor. */ * Copy constructor. */
Normal3D(const Normal3D<double> & v) : BasicVector3D<double>(v) {} Normal3D(const Normal3D<double> &) = default;
/**
* Move constructor. */
Normal3D(Normal3D<double> &&) = default;
/** /**
* Constructor from BasicVector3D<float>. */ * Constructor from BasicVector3D<float>. */
...@@ -133,7 +144,7 @@ namespace HepGeom { ...@@ -133,7 +144,7 @@ namespace HepGeom {
/** /**
* Destructor. */ * Destructor. */
~Normal3D() {} ~Normal3D() = default;
/** /**
* Constructor from CLHEP::Hep3Vector. * Constructor from CLHEP::Hep3Vector.
...@@ -152,22 +163,26 @@ namespace HepGeom { ...@@ -152,22 +163,26 @@ namespace HepGeom {
/** /**
* Assignment. */ * Assignment. */
Normal3D<double> & operator=(const Normal3D<double> & v) { Normal3D<double> & operator=(const Normal3D<double> &) = default;
set(v.x(),v.y(),v.z()); return *this;
}
/** /**
* Assignment from BasicVector3D<float>. */ * Assignment from BasicVector3D<float>. */
Normal3D<double> & operator=(const BasicVector3D<float> & v) { Normal3D<double> & operator=(const BasicVector3D<float> & v) {
set(v.x(),v.y(),v.z()); return *this; this->BasicVector3D<double>::operator=(v);
return *this;
} }
/** /**
* Assignment from BasicVector3D<double>. */ * Assignment from BasicVector3D<double>. */
Normal3D<double> & operator=(const BasicVector3D<double> & v) { Normal3D<double> & operator=(const BasicVector3D<double> & v) {
set(v.x(),v.y(),v.z()); return *this; this->BasicVector3D<double>::operator=(v);
return *this;
} }
/**
* Move assignment. */
Normal3D<double> & operator=(Normal3D<double> &&) = default;
/** /**
* Transformation by Transform3D. */ * Transformation by Transform3D. */
Normal3D<double> & transform(const Transform3D & m); Normal3D<double> & transform(const Transform3D & m);
......
...@@ -54,23 +54,33 @@ namespace HepGeom { ...@@ -54,23 +54,33 @@ namespace HepGeom {
a_ = n.x(); b_ = n.y(); c_ = n.z(); d_ = -n*p1; a_ = n.x(); b_ = n.y(); c_ = n.z(); d_ = -n*p1;
} }
/** Copy constructor. /**
* Plane3D<double> has two constructors: * Copy constructor. */
* from Plane3D<double> (provided by compiler) and Plane3D(const Plane3D<T> &) = default;
* from Plane3D<float> (defined in this file).
* Plane3D<float> has only the last one. /**
*/ * Constructor for Plane3D<double> from Plane3D<float>. */
template<typename U = T,
typename = typename std::enable_if<!std::is_same<U,float>::value >::type>
Plane3D(const Plane3D<float> & p) Plane3D(const Plane3D<float> & p)
: a_(p.a_), b_(p.b_), c_(p.c_), d_(p.d_) {} : a_(p.a_), b_(p.b_), c_(p.c_), d_(p.d_) {}
/**
* Move constructor. */
Plane3D(Plane3D<T> &&) = default;
/** /**
* Destructor. */ * Destructor. */
~Plane3D() {}; ~Plane3D() = default;
/** /**
* Assignment. */ * Assignment. */
Plane3D<T> & operator=(const Plane3D<T> &) = default; Plane3D<T> & operator=(const Plane3D<T> &) = default;
/**
* Move assignment. */
Plane3D<T> & operator=(Plane3D<T> &&) = default;
/** /**
* Returns the a-coefficient in the plane equation: a*x+b*y+c*z+d=0. */ * Returns the a-coefficient in the plane equation: a*x+b*y+c*z+d=0. */
T a() const { return a_; } T a() const { return a_; }
......
...@@ -45,7 +45,7 @@ namespace HepGeom { ...@@ -45,7 +45,7 @@ namespace HepGeom {
public: public:
/** /**
* Default constructor. */ * Default constructor. */
Point3D() {} Point3D() = default;
/** /**
* Constructor from three numbers. */ * Constructor from three numbers. */
...@@ -58,7 +58,11 @@ namespace HepGeom { ...@@ -58,7 +58,11 @@ namespace HepGeom {
/** /**
* Copy constructor. */ * Copy constructor. */
Point3D(const Point3D<float> & v) : BasicVector3D<float>(v) {} Point3D(const Point3D<float> &) = default;
/**
* Move constructor. */
Point3D(Point3D<float> &&) = default;
/** /**
* Constructor from BasicVector3D<float>. */ * Constructor from BasicVector3D<float>. */
...@@ -66,20 +70,23 @@ namespace HepGeom { ...@@ -66,20 +70,23 @@ namespace HepGeom {
/** /**
* Destructor. */ * Destructor. */
~Point3D() {} ~Point3D() = default;
/** /**
* Assignment. */ * Assignment. */
Point3D<float> & operator=(const Point3D<float> & v) { Point3D<float> & operator=(const Point3D<float> &) = default;
set(v.x(),v.y(),v.z()); return *this;
}
/** /**
* Assignment from BasicVector3D<float>. */ * Assignment from BasicVector3D<float>. */
Point3D<float> & operator=(const BasicVector3D<float> & v) { Point3D<float> & operator=(const BasicVector3D<float> & v) {
set(v.x(),v.y(),v.z()); return *this; this->BasicVector3D<float>::operator=(v);
return *this;
} }
/**
* Move assignment. */
Point3D<float> & operator=(Point3D<float> &&) = default;
/** /**
* Returns distance to the origin squared. */ * Returns distance to the origin squared. */
float distance2() const { return mag2(); } float distance2() const { return mag2(); }
...@@ -124,7 +131,7 @@ namespace HepGeom { ...@@ -124,7 +131,7 @@ namespace HepGeom {
public: public:
/** /**
* Default constructor. */ * Default constructor. */
Point3D() {} Point3D() = default;
/** /**
* Constructor from three numbers. */ * Constructor from three numbers. */
...@@ -142,7 +149,11 @@ namespace HepGeom { ...@@ -142,7 +149,11 @@ namespace HepGeom {
/** /**
* Copy constructor. */ * Copy constructor. */
Point3D(const Point3D<double> & v) : BasicVector3D<double>(v) {} Point3D(const Point3D<double> &) = default;
/**
* Move constructor. */
Point3D(Point3D<double> &&) = default;
/** /**
* Constructor from BasicVector3D<float>. */ * Constructor from BasicVector3D<float>. */
...@@ -154,7 +165,7 @@ namespace HepGeom { ...@@ -154,7 +165,7 @@ namespace HepGeom {
/** /**
* Destructor. */ * Destructor. */
~Point3D() {} ~Point3D() = default;
/** /**
* Constructor from CLHEP::Hep3Vector. * Constructor from CLHEP::Hep3Vector.
...@@ -173,22 +184,26 @@ namespace HepGeom { ...@@ -173,22 +184,26 @@ namespace HepGeom {
/** /**
* Assignment. */ * Assignment. */
Point3D<double> & operator=(const Point3D<double> & v) { Point3D<double> & operator=(const Point3D<double> &) = default;
set(v.x(),v.y(),v.z()); return *this;
}
/** /**
* Assignment from BasicVector3D<float>. */ * Assignment from BasicVector3D<float>. */
Point3D<double> & operator=(const BasicVector3D<float> & v) { Point3D<double> & operator=(const BasicVector3D<float> & v) {
set(v.x(),v.y(),v.z()); return *this; this->BasicVector3D<double>::operator=(v);
return *this;
} }
/** /**
* Assignment from BasicVector3D<double>. */ * Assignment from BasicVector3D<double>. */
Point3D<double> & operator=(const BasicVector3D<double> & v) { Point3D<double> & operator=(const BasicVector3D<double> & v) {
set(v.x(),v.y(),v.z()); return *this; this->BasicVector3D<double>::operator=(v);
return *this;
} }
/**
* Move assignment. */
Point3D<double> & operator=(Point3D<double> &&) = default;
/** /**
* Returns distance to the origin squared. */ * Returns distance to the origin squared. */
double distance2() const { return mag2(); } double distance2() const { return mag2(); }
...@@ -224,7 +239,6 @@ namespace HepGeom { ...@@ -224,7 +239,6 @@ namespace HepGeom {
} /* namespace HepGeom */ } /* namespace HepGeom */
#ifdef ENABLE_BACKWARDS_COMPATIBILITY #ifdef ENABLE_BACKWARDS_COMPATIBILITY
// backwards compatibility will be enabled ONLY in CLHEP 1.9 // backwards compatibility will be enabled ONLY in CLHEP 1.9
#include "CLHEP/config/CLHEP.h" #include "CLHEP/config/CLHEP.h"
......
...@@ -229,17 +229,23 @@ namespace HepGeom { ...@@ -229,17 +229,23 @@ namespace HepGeom {
/** /**
* Copy constructor. */ * Copy constructor. */
Transform3D(const Transform3D & mt) Transform3D(const Transform3D & mt) = default;
: xx_(mt.xx_), xy_(mt.xy_), xz_(mt.xz_), dx_(mt.dx_),
yx_(mt.yx_), yy_(mt.yy_), yz_(mt.yz_), dy_(mt.dy_),
zx_(mt.zx_), zy_(mt.zy_), zz_(mt.zz_), dz_(mt.dz_) {}
/** /**
* Destructor. * Move constructor. */
* Virtual for now as some persistency mechanism needs that, Transform3D(Transform3D && mt) = default;
* in future releases this might go away again.
*/ /**
~Transform3D() { /* nop */ } * Destructor. */
~Transform3D() = default;
/**
* Assignment. */
Transform3D & operator=(const Transform3D & mt) = default;
/**
* Move assignment. */
Transform3D & operator=(Transform3D && mt) = default;
/** /**
* Returns object of the helper class for C-style subscripting r[i][j] */ * Returns object of the helper class for C-style subscripting r[i][j] */
...@@ -285,15 +291,6 @@ namespace HepGeom { ...@@ -285,15 +291,6 @@ namespace HepGeom {
* Gets dz-element of the transformation matrix. */ * Gets dz-element of the transformation matrix. */
double dz() const { return dz_; } double dz() const { return dz_; }
/**
* Assignment. */
Transform3D & operator=(const Transform3D &mt) {
xx_= mt.xx_; xy_= mt.xy_; xz_= mt.xz_; dx_= mt.dx_;
yx_= mt.yx_; yy_= mt.yy_; yz_= mt.yz_; dy_= mt.dy_;
zx_= mt.zx_; zy_= mt.zy_; zz_= mt.zz_; dz_= mt.dz_;
return *this;
}
/** /**
* Sets the Identity transformation. */ * Sets the Identity transformation. */
void setIdentity() { void setIdentity() {
......
...@@ -45,7 +45,7 @@ namespace HepGeom { ...@@ -45,7 +45,7 @@ namespace HepGeom {
public: public:
/** /**
* Default constructor. */ * Default constructor. */
Vector3D() {} Vector3D() = default;