Import Geant4 0.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 15:09:25 +02:00
parent b97f8d0df7
commit aaa409b6ee
2922 changed files with 55107 additions and 81674 deletions
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4MagErrorStepper.cc,v 2.3 1998/11/12 16:17:33 japost Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4MagErrorStepper.cc,v 1.5 1999/04/19 17:20:30 japost Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
#include "G4MagErrorStepper.hh"
#include "G4ThreeVector.hh"
@@ -16,45 +16,42 @@ void
G4MagErrorStepper::Stepper( const G4double yInput[],
const G4double dydx[],
const G4double hstep,
G4double yOut[],
G4double yErr[] )
G4double yOutput[],
G4double yError [] )
{
const G4int nvar = 6 ;
const G4int nvar = this->GetNumberOfVariables() ;
G4int i;
// correction for Richardson Extrapolation.
G4double correction = 1. / ( (1 << IntegratorOrder()) -1 );
G4double yTemp[7], dydxTemp[6], yIn[7] ;
// Saving yInput because yInput and yOutput can be aliases for same array
// Saving yInput because yInput and yOut can be aliases for same array
for(i=0;i<nvar;i++) yInitial[i]=yInput[i];
for(i=0;i<nvar;i++) yIn[i]=yInput[i];
G4double h = hstep * 0.5;
G4double halfStep = hstep * 0.5;
// Do two half steps
DumbStepper(yIn,dydx,h,yTemp);
RightHandSide(yTemp,dydxTemp) ;
DumbStepper(yTemp,dydxTemp,h,yOut);
DumbStepper (yInitial, dydx, halfStep, yMiddle);
RightHandSide(yMiddle, dydxMid);
DumbStepper (yMiddle, dydxMid, halfStep, yOutput);
// Store midpoint, chord calculation
yMidPoint = G4ThreeVector( yTemp[0], yTemp[1], yTemp[2]);
fMidPoint = G4ThreeVector( yMiddle[0], yMiddle[1], yMiddle[2]);
// Do a full Step
h = hstep ;
DumbStepper(yIn,dydx,h,yTemp);
DumbStepper(yInitial, dydx, hstep, yOneStep);
for(i=0;i<nvar;i++) {
yErr[i] = yOut[i] - yTemp[i] ;
yOut[i] += yErr[i]*correction ; // Provides by 1 increased
// order of accuracy
// Richardson Extrapolation
yError [i] = yOutput[i] - yOneStep[i] ;
yOutput[i] += yError[i]*correction ; // Provides accuracy increased
// by 1 order via the
// Richardson Extrapolation
}
yInitial = G4ThreeVector( yIn[0], yIn[1], yIn[2]);
yFinal = G4ThreeVector( yOut[0], yOut[1], yOut[2]);
fInitialPoint = G4ThreeVector( yInitial[0], yInitial[1], yInitial[2]);
fFinalPoint = G4ThreeVector( yOutput[0], yOutput[1], yOutput[2]);
return ;
}
@@ -67,7 +64,7 @@ G4MagErrorStepper::DistChord() const
// Soon: must check whether h/R > 2 pi !!
// Method below is good only for < 2 pi
return G4LineSection::Distline( yMidPoint, yInitial, yFinal );
return G4LineSection::Distline( fMidPoint, fInitialPoint, fFinalPoint );
// This is a class method that gives distance of Mid
// from the Chord between the Initial and Final points.
}