Warning, file /include/Geant4/G4QSSDriver.icc was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029 template <class T>
0030 G4QSSDriver<T>::G4QSSDriver(T* pStepper) : G4InterpolationDriver<T, true>(0, pStepper)
0031 {
0032
0033 this->fSteppers.resize(1);
0034 }
0035
0036 template <class T>
0037 void G4QSSDriver<T>::OnStartTracking()
0038 {
0039 Base::OnStartTracking();
0040 if (! initializedOnFirstRun)
0041 {
0042 G4double dqRel = G4QSSMessenger::instance()->Get_dQRel();
0043 G4double dQMin = G4QSSMessenger::instance()->Get_dQMin();
0044 if (dqRel == 0) { dqRel = 0.001; }
0045 if (dQMin == 0) { dQMin = 0.0001; }
0046 this->SetPrecision(dqRel, dQMin);
0047
0048 initializedOnFirstRun = true;
0049 }
0050 }
0051
0052 template <class T>
0053 void G4QSSDriver<T>::OnComputeStep(const G4FieldTrack* track)
0054 {
0055 Base::OnComputeStep(track);
0056 }
0057
0058 template <class T>
0059 void G4QSSDriver<T>::SetPrecision(G4double dq_rel, G4double dq_min)
0060 {
0061 G4cout << "Setting QSS precision parameters: "
0062 << "dQRel = " << dq_rel << " - "
0063 << "dQMin = " << dq_min << G4endl;
0064
0065 for (const auto& item : this->fSteppers)
0066 {
0067 item.stepper->SetPrecision(dq_rel, dq_min);
0068 }
0069 }
0070
0071 template <class T>
0072 G4double G4QSSDriver<T>::AdvanceChordLimited(
0073 G4FieldTrack& track, G4double hstep, G4double epsStep, G4double chordDistance)
0074 {
0075
0076
0077 ++this->fTotalStepsForTrack;
0078 this->fLastStepper = this->fSteppers.begin();
0079
0080 const G4double preCurveLength = track.GetCurveLength();
0081 G4double postCurveLength = preCurveLength;
0082 auto it = this->fSteppers.begin();
0083
0084 it->stepper->reset(const_cast<const G4FieldTrack*>(&track));
0085
0086 field_utils::State yBegin, y;
0087 track.DumpToArray(yBegin);
0088 track.DumpToArray(y);
0089
0090 G4double hdid = OneGoodStep(it, y, this->fdydx, hstep, epsStep, preCurveLength, &track);
0091 postCurveLength += hdid;
0092
0093 G4double dChordStep = this->DistChord(yBegin, preCurveLength, y, postCurveLength);
0094
0095
0096 hdid = this->FindNextChord(
0097 yBegin, preCurveLength, y, postCurveLength, dChordStep, chordDistance);
0098
0099 track.LoadFromArray(y, this->fSteppers[0].stepper->GetNumberOfVariables());
0100 track.SetCurveLength(preCurveLength + hdid);
0101
0102 return hdid;
0103 }
0104
0105 template <class T>
0106 G4double G4QSSDriver<T>::OneGoodStep(typename G4InterpolationDriver<T, true>::StepperIterator it,
0107 field_utils::State& y, field_utils::State& dydx, G4double& hstep, G4double ,
0108 G4double curveLength, G4FieldTrack* )
0109 {
0110 G4double yerr[G4FieldTrack::ncompSVEC], ytemp[G4FieldTrack::ncompSVEC];
0111 it->stepper->Stepper(y, dydx, hstep, ytemp, yerr);
0112 G4double h = it->stepper->GetLastStepLength();
0113
0114
0115 it->begin = curveLength;
0116 it->end = curveLength + h;
0117 it->inverseLength = 1. / h;
0118
0119 field_utils::copy(y, ytemp);
0120
0121 return h;
0122 }