Commit a209df7b authored by Andreas Pfeiffer's avatar Andreas Pfeiffer
Browse files

fixed problem with conversion of BasicVector3D to Hep3Vector (savannah bug ID...

fixed problem with conversion of BasicVector3D to Hep3Vector (savannah bug ID 6740), added test for this bug
parent b586d377
Thu Mar 10 2005 Andreas Pfeiffer <andreas.pfeiffer@cern.ch>
* Geometry/BasicVector3D.h : added operator to convert to Hep3Vector
for backward compatibility (savannah bug id 6740)
* Geometry/config.in, Geometry/test/testBug6740.cc, Geometry/test/testBug6740.sh,
Geometry/test/testBug6740.output, Geometry/test/Makefile.am: added test for bug ID 6740
2005-02-18 Lynn Garren <garren@fnal.gov>
* configure.in, Makefile.am: Stop using libtool.
......
Thu Mar 10 2005 Andreas Pfeiffer <andreas.pfeiffer@cern.ch>
* Geometry/BasicVector3D.h : added operator to convert to Hep3Vector
for backward compatibility (savannah bug id 6740)
* Geometry/config.in, Geometry/test/testBug6740.cc, Geometry/test/testBug6740.sh,
Geometry/test/testBug6740.output, Geometry/test/Makefile.am: added test for bug ID 6740
2005-02-01 Andreas PFEIFFER <andreas.pfeiffer@cern.ch>
* Geometry/BasicVector3D.h : changed template specialisations for
......
// -*- C++ -*-
// $Id: BasicVector3D.h,v 1.3.2.5 2005/02/02 16:32:46 pfeiffer Exp $
// $Id: BasicVector3D.h,v 1.3.2.6 2005/03/10 22:23:19 pfeiffer Exp $
// ---------------------------------------------------------------------------
//
// This file is a part of the CLHEP - a Class Library for High Energy Physics.
......@@ -14,6 +14,7 @@
#include <iosfwd>
#include "CLHEP/Geometry/defs.h"
#include "CLHEP/Vector/ThreeVector.h"
namespace HepGeom {
/**
......@@ -77,6 +78,13 @@ namespace HepGeom {
* Conversion (cast) to ordinary const array. */
operator const T * () const { return v_; }
/**
* Conversion (cast) to CLHEP::Hep3Vector.
* This operator is needed only for backward compatibility and
* in principle should not exit.
*/
operator CLHEP::Hep3Vector () const { return CLHEP::Hep3Vector(x(),y(),z()); }
// -----------------------------
// General arithmetic operations
// -----------------------------
......@@ -393,7 +401,7 @@ namespace HepGeom {
*/
inline BasicVector3D<float>
operator*(const BasicVector3D<float> & v, double a) {
return BasicVector3D<float>(v.x()*float(a), v.y()*float(a), v.z()*float(a));
return BasicVector3D<float>(v.x()*static_cast<float>(a), v.y()*static_cast<float>(a), v.z()*static_cast<float>(a));
}
/**
......@@ -411,7 +419,7 @@ namespace HepGeom {
*/
inline BasicVector3D<float>
operator*(double a, const BasicVector3D<float> & v) {
return BasicVector3D<float>(float(a)*v.x(), float(a)*v.y(), float(a)*v.z());
return BasicVector3D<float>(static_cast<float>(a)*v.x(), static_cast<float>(a)*v.y(), static_cast<float>(a)*v.z());
}
/**
......@@ -420,7 +428,7 @@ namespace HepGeom {
*/
inline BasicVector3D<float>
operator/(const BasicVector3D<float> & v, double a) {
return BasicVector3D<float>(v.x()/float(a), v.y()/float(a), v.z()/float(a));
return BasicVector3D<float>(v.x()/static_cast<float>(a), v.y()/static_cast<float>(a), v.z()/static_cast<float>(a));
}
/**
......
......@@ -60,7 +60,7 @@ AC_CONFIG_FILES([Geometry-config], [chmod +x Geometry-config])
# Test driver program/script:
AC_CONFIG_FILES([test/testBasicVector3D.sh], [chmod +x test/testBasicVector3D.sh])
AC_CONFIG_FILES([test/testBug6740.sh], [chmod +x test/testBug6740.sh])
# ----------------------------------------------------------------------
# Capture post-install information:
......
......@@ -13,24 +13,30 @@ endif
# Identify executables needed during testing:
check_PROGRAMS = \
testBasicVector3D
testBasicVector3D \
testBug6740
check_SCRIPTS = \
testBasicVector3D.sh
testBasicVector3D.sh \
testBug6740.sh
# Identify test(s) to run when 'make check' is requested:
TESTS = \
testBasicVector3D.sh
testBasicVector3D.sh \
testBug6740.sh
# Identify the test(s) for which failure is the intended outcome:
XFAIL_TESTS =
# Identify the dependencies on a per-test basis:
testBasicVector3D_SOURCES = testBasicVector3D.cc
testBug6740_SOURCES = testBug6740.cc
# Identify input data file(s) and prototype output file(s):
EXTRA_DIST = \
testBasicVector3D.input testBasicVector3D.output
testBasicVector3D.input testBasicVector3D.output \
testBug6740.sh
# Identify generated file(s) to be removed when 'make clean' is requested:
CLEANFILES =
CLEANFILES = \
testBug6740.sh
#include <iostream>
#include "CLHEP/Geometry/Point3D.h"
#include "CLHEP/Vector/ThreeVector.h"
int main(int, char **) {
Hep3Vector d(10,0,0);
HepPoint3D a(0,0,0);
HepPoint3D pv(1,1,1);
Hep3Vector dist = a-pv; // this does not compile anymore
Hep3Vector Cross = dist.cross(d.unit());
std::cout << Cross.mag() << std::endl;
}
#! /bin/sh
# @configure_input@
./testBug6740@EXEEXT@ \
| @DIFF_Q@ - @srcdir@/testBug6740.output > /dev/null
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment