#include <G4CachedMagneticField.hh>
Inheritance diagram for G4CachedMagneticField:
Public Member Functions | |
G4CachedMagneticField (G4MagneticField *, G4double distanceConst) | |
virtual | ~G4CachedMagneticField () |
G4CachedMagneticField (const G4CachedMagneticField &r) | |
G4CachedMagneticField & | operator= (const G4CachedMagneticField &p) |
virtual void | GetFieldValue (const G4double Point[4], G4double *Bfield) const |
G4double | GetConstDistance () const |
void | SetConstDistance (G4double dist) |
G4int | GetCountCalls () const |
G4int | GetCountEvaluations () const |
void | ClearCounts () |
void | ReportStatistics () |
Protected Attributes | |
G4int | fCountCalls |
G4int | fCountEvaluations |
Definition at line 48 of file G4CachedMagneticField.hh.
G4CachedMagneticField::G4CachedMagneticField | ( | G4MagneticField * | , | |
G4double | distanceConst | |||
) |
Definition at line 33 of file G4CachedMagneticField.cc.
References ClearCounts().
00035 : G4MagneticField(), 00036 fLastLocation(DBL_MAX,DBL_MAX,DBL_MAX), 00037 fLastValue(DBL_MAX,DBL_MAX,DBL_MAX), 00038 fCountCalls(0), fCountEvaluations(0) 00039 { 00040 fpMagneticField= pMagField; 00041 fDistanceConst= distance; 00042 00043 // G4cout << " Cached-B-Field constructor> Distance = " << distance << G4endl; 00044 this->ClearCounts(); 00045 }
G4CachedMagneticField::~G4CachedMagneticField | ( | ) | [virtual] |
G4CachedMagneticField::G4CachedMagneticField | ( | const G4CachedMagneticField & | r | ) |
Definition at line 59 of file G4CachedMagneticField.cc.
References ClearCounts(), fDistanceConst, fLastLocation, fLastValue, and fpMagneticField.
00060 : G4MagneticField() 00061 { 00062 fpMagneticField= rightCMF.fpMagneticField; 00063 fDistanceConst = rightCMF.fDistanceConst; 00064 fLastLocation = rightCMF.fLastLocation; 00065 fLastValue = rightCMF.fLastValue; 00066 this->ClearCounts(); 00067 }
void G4CachedMagneticField::ClearCounts | ( | ) | [inline] |
Definition at line 68 of file G4CachedMagneticField.hh.
References fCountCalls, and fCountEvaluations.
Referenced by G4CachedMagneticField().
00068 { fCountCalls = 0; fCountEvaluations=0; }
G4double G4CachedMagneticField::GetConstDistance | ( | ) | const [inline] |
G4int G4CachedMagneticField::GetCountCalls | ( | ) | const [inline] |
Definition at line 66 of file G4CachedMagneticField.hh.
References fCountCalls.
00066 { return fCountCalls; }
G4int G4CachedMagneticField::GetCountEvaluations | ( | ) | const [inline] |
Definition at line 67 of file G4CachedMagneticField.hh.
References fCountEvaluations.
00067 { return fCountEvaluations; }
void G4CachedMagneticField::GetFieldValue | ( | const G4double | Point[4], | |
G4double * | Bfield | |||
) | const [virtual] |
Implements G4MagneticField.
Definition at line 75 of file G4CachedMagneticField.cc.
References fCountCalls, fCountEvaluations, and G4MagneticField::GetFieldValue().
00077 { 00078 G4ThreeVector newLocation( Point[0], Point[1], Point[2] ); 00079 00080 // G4cout << "Cache-B-field called at " << newLocation << G4endl; 00081 00082 G4double distSq= (newLocation-fLastLocation).mag2(); 00083 fCountCalls++; 00084 if( distSq < fDistanceConst*fDistanceConst ) { 00085 Bfield[0] = fLastValue.x(); 00086 Bfield[1] = fLastValue.y(); 00087 Bfield[2] = fLastValue.z(); 00088 }else{ 00089 // G4CachedMagneticField* thisNonC= const_cast<G4CachedMagneticField*>(this); 00090 fpMagneticField->GetFieldValue( Point, Bfield ); 00091 // G4cout << " Evaluating. " << G4endl; 00092 fCountEvaluations++; 00093 // thisNonC-> 00094 fLastLocation= G4ThreeVector( Point[0], Point[1], Point[2] ); 00095 // thisNonC-> 00096 fLastValue= G4ThreeVector( Bfield[0], Bfield[1], Bfield[2] ); 00097 } 00098 }
G4CachedMagneticField & G4CachedMagneticField::operator= | ( | const G4CachedMagneticField & | p | ) |
void G4CachedMagneticField::ReportStatistics | ( | ) |
Definition at line 52 of file G4CachedMagneticField.cc.
References fCountCalls, fCountEvaluations, G4cout, and G4endl.
00053 { 00054 G4cout << " Cached field: " << G4endl 00055 << " Number of calls: " << fCountCalls << G4endl 00056 << " Number of evaluations : " << fCountEvaluations << G4endl; 00057 }
void G4CachedMagneticField::SetConstDistance | ( | G4double | dist | ) | [inline] |
G4int G4CachedMagneticField::fCountCalls [mutable, protected] |
Definition at line 80 of file G4CachedMagneticField.hh.
Referenced by ClearCounts(), GetCountCalls(), GetFieldValue(), and ReportStatistics().
G4int G4CachedMagneticField::fCountEvaluations [mutable, protected] |
Definition at line 80 of file G4CachedMagneticField.hh.
Referenced by ClearCounts(), GetCountEvaluations(), GetFieldValue(), and ReportStatistics().