Import Geant4 3.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 15:55:53 +02:00
parent e7d7193284
commit cfcb558cfe
3050 changed files with 91703 additions and 48310 deletions
+32 -152
View File
@@ -5,44 +5,27 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ThreeMat.cc,v 1.2 1999/12/15 14:50:02 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
// $Id: G4ThreeMat.cc,v 1.5 2000/11/08 14:22:11 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
/* G4ThreeMat.cc,v 1.5 1993/08/02 22:21:27 atwood Exp */
// File: G4ThreeMat.cc
// Author: Alan Breakstone
// Contents -------------------------------------------------------------
// ----------------------------------------------------------------------
// GEANT 4 class source file
//
// G4ThreeMat::G4ThreeMat()
// G4ThreeMat::G4ThreeMat( G4double a[3][3] )
// operator<<( G4std::ostream&, const G4ThreeMat& m );
// G4ThreeMat::PrintOn( G4std::ostream& os ) const
// operator==( const G4ThreeMat& m )
// G4ThreeMat::operator=( const G4ThreeMat& m )
// G4ThreeMat::operator-()
// G4ThreeMat::operator+=( const G4ThreeMat& m2 )
// G4ThreeMat::operator-=( const G4ThreeMat& m2 )
// operator+( const G4ThreeMat& m1, const G4ThreeMat& m2 )
// operator-( const G4ThreeMat& m1, const G4ThreeMat& m2 )
// operator*( G4double x, const G4ThreeMat& m )
// operator*( const G4ThreeMat& m, const G4ThreeVec& v )
// operator*( const G4ThreeMat& m1, const G4ThreeMat& m2 )
// G4ThreeMat::Determinant()
// G4ThreeMat.cc
//
// End ------------------------------------------------------------------
// ----------------------------------------------------------------------
#include "G4ThreeMat.hh"
G4ThreeMat::G4ThreeMat()
{
// default (null) constructor
for ( int i = 0; i < 3 ; i++ )
for ( G4int i = 0; i < 3 ; i++ )
{
row[i] = G4Vector3D( 0., 0., 0. );
column[i] = G4Vector3D( 0., 0., 0. );
for ( int j = 0; j < 3 ; j++ )
for ( G4int j = 0; j < 3 ; j++ )
element[i][j] = 0.;
}
}
@@ -51,31 +34,42 @@ G4ThreeMat::G4ThreeMat()
G4ThreeMat::G4ThreeMat( G4double a[3][3] )
{
// constructor to make matrix from array
for ( int i = 0; i < 3 ; i++ )
for ( G4int i = 0; i < 3 ; i++ )
{
row[i] = G4Vector3D( a[i][0], a[i][1], a[i][2] );
column[i] = G4Vector3D( a[0][i], a[1][i], a[2][i] );
for ( int j = 0; j < 3 ; j++ )
for ( G4int j = 0; j < 3 ; j++ )
element[i][j] = a[i][j];
}
}
G4ThreeMat::~G4ThreeMat()
{
}
G4ThreeMat::G4ThreeMat( const G4ThreeMat& m )
{
// copy constructor
for ( int i = 0; i < 3 ; i++ )
for ( G4int i = 0; i < 3 ; i++ )
{
row[i] = m.row[i];
column[i] = m.column[i];
for ( int j = 0; j < 3 ; j++ )
for ( G4int j = 0; j < 3 ; j++ )
element[i][j] = m.element[i][j];
}
}
const char* G4ThreeMat::NameOf() const
{
return "G4ThreeMat";
}
G4std::ostream& operator<<( G4std::ostream& os, const G4ThreeMat& m )
{
// overwrite output operator << to Print out G4ThreeMat objects
@@ -98,7 +92,7 @@ void G4ThreeMat::PrintOn( G4std::ostream& os ) const
<< element[2][1] << "\t"
<< element[2][2] << " ]\n";
/*
for ( int i = 0; i < 3; i++ ) {
for ( G4int i = 0; i < 3; i++ ) {
os << "row [" << i << "] " << row[i] << "\n"
<< "column[" << i << "] " << column[i] << "\n";
}
@@ -106,11 +100,11 @@ void G4ThreeMat::PrintOn( G4std::ostream& os ) const
}
int G4ThreeMat::operator==( const G4ThreeMat& m )
G4int G4ThreeMat::operator==( const G4ThreeMat& m ) const
{
for ( int i = 0; i < 3 ; i++ )
for ( G4int i = 0; i < 3 ; i++ )
{
for ( int j = 0; j < 3 ; j++ )
for ( G4int j = 0; j < 3 ; j++ )
{
if ( element[i][j] != m.element[i][j] )
return 0;
@@ -121,136 +115,22 @@ int G4ThreeMat::operator==( const G4ThreeMat& m )
}
void G4ThreeMat::operator=( const G4ThreeMat& m )
G4ThreeMat& G4ThreeMat::operator=( const G4ThreeMat& m )
{
// assignment operator
for ( int i = 0; i < 3 ; i++ )
if (&m == this) return *this;
for ( G4int i = 0; i < 3 ; i++ )
{
row[i] = m.row[i];
column[i] = m.column[i];
for ( int j = 0; j < 3 ; j++ )
for ( G4int j = 0; j < 3 ; j++ )
element[i][j] = m.element[i][j];
}
}
G4ThreeMat G4ThreeMat::operator-()
{
// unary - operator, change Sign of all elements
G4double a[3][3];
for ( int i = 0; i < 3 ; i++ )
{
for ( int j = 0; j < 3 ; j++ )
a[i][j] = -element[i][j];
}
return G4ThreeMat( a );
}
G4ThreeMat G4ThreeMat::operator+=( const G4ThreeMat& m2 )
{
// overload += operator
for ( int i = 0; i < 3 ; i++ )
{
this->row[i] += m2.row[i];
this->column[i] += m2.column[i];
for ( int j = 0; j < 3 ; j++ )
this->element[i][j] += m2.element[i][j];
}
return *this;
}
G4ThreeMat G4ThreeMat::operator-=( const G4ThreeMat& m2 )
{
// overload -= operator
for ( int i = 0; i < 3 ; i++ )
{
this->row[i] -= m2.row[i];
this->column[i] -= m2.column[i];
for ( int j = 0; j < 3 ; j++ )
this->element[i][j] -= m2.element[i][j];
}
return *this;
}
G4ThreeMat operator+( const G4ThreeMat& m1, const G4ThreeMat& m2 )
{
// overload binary + operator
G4double a[3][3];
for ( int i = 0; i < 3 ; i++ )
{
for ( int j = 0; j < 3 ; j++ )
a[i][j] = m1.element[i][j] + m2.element[i][j];
}
return G4ThreeMat( a );
}
G4ThreeMat operator-( const G4ThreeMat& m1, const G4ThreeMat& m2 )
{
// overload binary - operator
G4double a[3][3];
for ( int i = 0; i < 3 ; i++ )
{
for ( int j = 0; j < 3 ; j++ )
a[i][j] = m1.element[i][j] - m2.element[i][j];
}
return G4ThreeMat( a );
}
G4ThreeMat operator*( G4double x, const G4ThreeMat& m )
{
// overload binary * operator for constant Times matrix
G4double a[3][3];
for ( int i = 0; i < 3 ; i++ ){
for ( int j = 0; j < 3 ; j++ ) {
a[i][j] = x * m.element[i][j];
}
}
return G4ThreeMat( a );
}
G4Vector3D operator*( const G4ThreeMat& m, const G4Vector3D& v )
{
// overload binary * operator for matrix Times vector
G4double a[3];
for ( int i = 0; i < 3 ; i++ ){
a[i] = m.row[i] * v;
}
return G4Vector3D( a[0], a[1], a[2] );
}
G4ThreeMat operator*( const G4ThreeMat& m1, const G4ThreeMat& m2 )
{
// overload binary * operator for matrix Times matrix
G4double a[3][3];
for ( int i = 0; i < 3 ; i++ ){
for ( int j = 0; j < 3 ; j++ ) {
a[i][j] = m1.row[i] * m2.column[j];
}
}
return G4ThreeMat( a );
}
G4double G4ThreeMat::Determinant()
G4double G4ThreeMat::Determinant() const
{
// Determinant of a three by three matrix
return element[0][0] * ( element[1][1] * element[2][2]