Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/examples/extended/field/field04/src/F04GlobalField.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /examples/extended/field/field04/src/F04GlobalField.cc (Version 11.3.0) and /examples/extended/field/field04/src/F04GlobalField.cc (Version 9.6.p2)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 //                                             << 
 27 /// \file field/field04/src/F04GlobalField.cc      26 /// \file field/field04/src/F04GlobalField.cc
 28 /// \brief Implementation of the F04GlobalFiel     27 /// \brief Implementation of the F04GlobalField class
 29 //                                                 28 //
                                                   >>  29 //
                                                   >>  30 #include <time.h>
 30                                                    31 
 31 #include "F04GlobalField.hh"                   <<  32 #include "Randomize.hh"
 32                                                <<  33 #include "G4TransportationManager.hh"
 33 #include "F04FocusSolenoid.hh"                 << 
 34 #include "F04SimpleSolenoid.hh"                << 
 35                                                    34 
 36 #include "G4CashKarpRKF45.hh"                  << 
 37 #include "G4ClassicalRK4.hh"                   << 
 38 #include "G4ExplicitEuler.hh"                      35 #include "G4ExplicitEuler.hh"
 39 #include "G4ImplicitEuler.hh"                      36 #include "G4ImplicitEuler.hh"
 40 #include "G4SimpleHeum.hh"                     << 
 41 #include "G4SimpleRunge.hh"                        37 #include "G4SimpleRunge.hh"
                                                   >>  38 #include "G4SimpleHeum.hh"
                                                   >>  39 #include "G4ClassicalRK4.hh"
                                                   >>  40 #include "G4CashKarpRKF45.hh"
 42 #include "G4SystemOfUnits.hh"                      41 #include "G4SystemOfUnits.hh"
 43 #include "G4TransportationManager.hh"          << 
 44 #include "Randomize.hh"                        << 
 45                                                << 
 46 #include <ctime>                               << 
 47                                                    42 
 48 //....oooOO0OOooo........oooOO0OOooo........oo <<  43 #include "F04GlobalField.hh"
 49                                                    44 
 50 G4ThreadLocal F04GlobalField* F04GlobalField:: <<  45 F04GlobalField* F04GlobalField::fObject = 0;
 51                                                    46 
 52 //....oooOO0OOooo........oooOO0OOooo........oo     47 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 53                                                    48 
 54 F04GlobalField::F04GlobalField(F04DetectorCons <<  49 F04GlobalField::F04GlobalField() : G4ElectroMagneticField(),
                                                   >>  50                              fMinStep(0.01*mm), fDeltaChord(3.0*mm),
                                                   >>  51                              fDeltaOneStep(0.01*mm), fDeltaIntersection(0.1*mm),
                                                   >>  52                              fEpsMin(2.5e-7*mm), fEpsMax(0.05*mm),
                                                   >>  53                              fEquation(0), fFieldManager(0),
                                                   >>  54                              fFieldPropagator(0), fStepper(0), fChordFinder(0)
                                                   >>  55 //F04GlobalField::F04GlobalField() : G4MagneticField(),
                                                   >>  56 //                           fMinStep(0.01*mm), fDeltaChord(3.0*mm),
                                                   >>  57 //                           fDeltaOneStep(0.01*mm), fDeltaIntersection(0.1*mm),
                                                   >>  58 //                           fEpsMin(2.5e-7*mm), fEpsMax(0.05*mm),
                                                   >>  59 //                           fEquation(0), fFieldManager(0),
                                                   >>  60 //                           fFieldPropagator(0), fStepper(0), fChordFinder(0)
 55 {                                                  61 {
 56   fFieldMessenger = new F04FieldMessenger(this <<  62   fFieldMessenger = new F04FieldMessenger(this);
 57                                                    63 
 58   fFields = new FieldList();                       64   fFields = new FieldList();
 59                                                    65 
                                                   >>  66   fStepperType = 4 ;       // ClassicalRK4 is default stepper
                                                   >>  67 
 60   //  set object                                   68   //  set object
                                                   >>  69 
 61   fObject = this;                                  70   fObject = this;
 62                                                    71 
 63   ConstructField();                            <<  72   UpdateField();
 64 }                                                  73 }
 65                                                    74 
 66 //....oooOO0OOooo........oooOO0OOooo........oo     75 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 67                                                    76 
 68 F04GlobalField::~F04GlobalField()                  77 F04GlobalField::~F04GlobalField()
 69 {                                                  78 {
 70   Clear();                                         79   Clear();
 71                                                    80 
 72   delete fFields;                              << 
 73                                                << 
 74   delete fFieldMessenger;                          81   delete fFieldMessenger;
 75                                                    82 
 76   delete fEquation;                            <<  83   if (fEquation)        delete fEquation;
 77   delete fStepper;                             <<  84   if (fFieldManager)    delete fFieldManager;
 78   delete fChordFinder;                         <<  85   if (fFieldPropagator) delete fFieldPropagator;
                                                   >>  86   if (fStepper)         delete fStepper;
                                                   >>  87   if (fChordFinder)     delete fChordFinder;
 79 }                                                  88 }
 80                                                    89 
 81 //....oooOO0OOooo........oooOO0OOooo........oo     90 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 82                                                    91 
 83 void F04GlobalField::ConstructField()          <<  92 void F04GlobalField::UpdateField()
 84 {                                                  93 {
                                                   >>  94   fFirst = true;
                                                   >>  95 
                                                   >>  96   fNfp = 0;
                                                   >>  97   fFp = 0;
                                                   >>  98 
 85   Clear();                                         99   Clear();
 86                                                   100 
 87   //  Construct equ. of motion of particles th    101   //  Construct equ. of motion of particles through B fields
 88   //  fEquation = new G4Mag_EqRhs(this);       << 102 //  fEquation = new G4Mag_EqRhs(this);
 89   //  Construct equ. of motion of particles th    103   //  Construct equ. of motion of particles through e.m. fields
 90   //  fEquation = new G4EqMagElectricField(thi << 104 //  fEquation = new G4EqMagElectricField(this);
 91   //  Construct equ. of motion of particles in    105   //  Construct equ. of motion of particles including spin through B fields
 92   //  fEquation = new G4Mag_SpinEqRhs(this);   << 106 //  fEquation = new G4Mag_SpinEqRhs(this);
 93   //  Construct equ. of motion of particles in    107   //  Construct equ. of motion of particles including spin through e.m. fields
 94   fEquation = new G4EqEMFieldWithSpin(this);      108   fEquation = new G4EqEMFieldWithSpin(this);
 95                                                   109 
 96   //  Get transportation, field, and propagato    110   //  Get transportation, field, and propagator managers
 97   G4TransportationManager* transportManager =  << 111   G4TransportationManager* transportManager =
                                                   >> 112          G4TransportationManager::GetTransportationManager();
 98                                                   113 
 99   fFieldManager = GetGlobalFieldManager();        114   fFieldManager = GetGlobalFieldManager();
100                                                   115 
101   fFieldPropagator = transportManager->GetProp    116   fFieldPropagator = transportManager->GetPropagatorInField();
102                                                   117 
103   //  Need to SetFieldChangesEnergy to account    118   //  Need to SetFieldChangesEnergy to account for a time varying electric
104   //  field (r.f. fields)                         119   //  field (r.f. fields)
105   fFieldManager->SetFieldChangesEnergy(true);     120   fFieldManager->SetFieldChangesEnergy(true);
106                                                   121 
107   //  Set the field                               122   //  Set the field
108   fFieldManager->SetDetectorField(this);          123   fFieldManager->SetDetectorField(this);
109                                                   124 
110   //  Choose a stepper for integration of the     125   //  Choose a stepper for integration of the equation of motion
111   SetStepper();                                   126   SetStepper();
112                                                   127 
113   //  Create a cord finder providing the (glob    128   //  Create a cord finder providing the (global field, min step length,
114   //  a pointer to the stepper)                   129   //  a pointer to the stepper)
115   fChordFinder = new G4ChordFinder((G4Magnetic << 130   fChordFinder = new G4ChordFinder((G4MagneticField*)this,fMinStep,fStepper);
116                                                   131 
117   // Set accuracy parameters                      132   // Set accuracy parameters
118   fChordFinder->SetDeltaChord(fDeltaChord);    << 133   fChordFinder->SetDeltaChord( fDeltaChord );
119                                                   134 
120   fFieldManager->SetAccuraciesWithDeltaOneStep    135   fFieldManager->SetAccuraciesWithDeltaOneStep(fDeltaOneStep);
121                                                   136 
122   fFieldManager->SetDeltaIntersection(fDeltaIn    137   fFieldManager->SetDeltaIntersection(fDeltaIntersection);
123                                                   138 
124   fFieldPropagator->SetMinimumEpsilonStep(fEps    139   fFieldPropagator->SetMinimumEpsilonStep(fEpsMin);
125   fFieldPropagator->SetMaximumEpsilonStep(fEps    140   fFieldPropagator->SetMaximumEpsilonStep(fEpsMax);
126                                                   141 
127   G4cout << "Accuracy Parameters:"             << 142   G4cout << "Accuracy Parameters:" <<
128          << " MinStep=" << fMinStep << " Delta << 143             " MinStep=" << fMinStep <<
129          << " DeltaOneStep=" << fDeltaOneStep  << 144             " DeltaChord=" << fDeltaChord <<
130   G4cout << "                    "             << 145             " DeltaOneStep=" << fDeltaOneStep << G4endl;
131          << " DeltaIntersection=" << fDeltaInt << 146   G4cout << "                    " <<
132          << " EpsMax=" << fEpsMax << G4endl;   << 147             " DeltaIntersection=" << fDeltaIntersection <<
                                                   >> 148             " EpsMin=" << fEpsMin <<
                                                   >> 149             " EpsMax=" << fEpsMax <<  G4endl;
133                                                   150 
134   fFieldManager->SetChordFinder(fChordFinder);    151   fFieldManager->SetChordFinder(fChordFinder);
135                                                   152 
136   G4double l = 0.0;                            << 
137   G4double B1 = fDetectorConstruction->GetCapt << 
138   G4double B2 = fDetectorConstruction->GetCapt << 
139                                                << 
140   G4LogicalVolume* logicCaptureMgnt = fDetecto << 
141   G4ThreeVector captureMgntCenter = fDetectorC << 
142                                                << 
143   auto focusSolenoid = new F04FocusSolenoid(B1 << 
144   focusSolenoid->SetHalf(true);                << 
145                                                << 
146   G4double B = fDetectorConstruction->GetTrans << 
147                                                << 
148   G4LogicalVolume* logicTransferMgnt = fDetect << 
149   G4ThreeVector transferMgntCenter = fDetector << 
150                                                << 
151   auto simpleSolenoid = new F04SimpleSolenoid( << 
152                                                << 
153   simpleSolenoid->SetColor("1,0,1");           << 
154   simpleSolenoid->SetColor("0,1,1");           << 
155   simpleSolenoid->SetMaxStep(1.5 * mm);        << 
156   simpleSolenoid->SetMaxStep(2.5 * mm);        << 
157                                                << 
158   if (fFields) {                               << 
159     if (fFields->size() > 0) {                 << 
160       FieldList::iterator i;                   << 
161       for (i = fFields->begin(); i != fFields- << 
162         (*i)->Construct();                     << 
163       }                                        << 
164     }                                          << 
165   }                                            << 
166 }                                              << 
167                                                << 
168 //....oooOO0OOooo........oooOO0OOooo........oo << 
169                                                << 
170 F04GlobalField* F04GlobalField::GetObject(F04D << 
171 {                                              << 
172   if (!fObject) new F04GlobalField(det);       << 
173   return fObject;                              << 
174 }                                                 153 }
175                                                   154 
176 //....oooOO0OOooo........oooOO0OOooo........oo    155 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
177                                                   156 
178 F04GlobalField* F04GlobalField::GetObject()       157 F04GlobalField* F04GlobalField::GetObject()
179 {                                                 158 {
180   if (fObject) return fObject;                 << 159   if (!fObject) new F04GlobalField();
181   return nullptr;                              << 160   return fObject;
182 }                                                 161 }
183                                                   162 
184 //....oooOO0OOooo........oooOO0OOooo........oo    163 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
185                                                   164 
186 void F04GlobalField::SetStepper()                 165 void F04GlobalField::SetStepper()
187 {                                                 166 {
188   delete fStepper;                             << 167   if(fStepper) delete fStepper;
189                                                   168 
190   switch (fStepperType) {                      << 169   switch ( fStepperType )
                                                   >> 170   {
191     case 0:                                       171     case 0:
192       //      fStepper = new G4ExplicitEuler(  << 172 //      fStepper = new G4ExplicitEuler( fEquation, 8 ); // no spin tracking
193       fStepper = new G4ExplicitEuler(fEquation << 173       fStepper = new G4ExplicitEuler( fEquation, 12 ); // with spin tracking
194       G4cout << "G4ExplicitEuler is called" <<    174       G4cout << "G4ExplicitEuler is called" << G4endl;
195       break;                                      175       break;
196     case 1:                                       176     case 1:
197       //      fStepper = new G4ImplicitEuler(  << 177 //      fStepper = new G4ImplicitEuler( fEquation, 8 ); // no spin tracking
198       fStepper = new G4ImplicitEuler(fEquation << 178       fStepper = new G4ImplicitEuler( fEquation, 12 ); // with spin tracking
199       G4cout << "G4ImplicitEuler is called" <<    179       G4cout << "G4ImplicitEuler is called" << G4endl;
200       break;                                      180       break;
201     case 2:                                       181     case 2:
202       //      fStepper = new G4SimpleRunge( fE << 182 //      fStepper = new G4SimpleRunge( fEquation, 8 ); // no spin tracking
203       fStepper = new G4SimpleRunge(fEquation,  << 183       fStepper = new G4SimpleRunge( fEquation, 12 ); // with spin tracking
204       G4cout << "G4SimpleRunge is called" << G    184       G4cout << "G4SimpleRunge is called" << G4endl;
205       break;                                      185       break;
206     case 3:                                       186     case 3:
207       //      fStepper = new G4SimpleHeum( fEq << 187 //      fStepper = new G4SimpleHeum( fEquation, 8 ); // no spin tracking
208       fStepper = new G4SimpleHeum(fEquation, 1 << 188       fStepper = new G4SimpleHeum( fEquation, 12 ); // with spin tracking
209       G4cout << "G4SimpleHeum is called" << G4    189       G4cout << "G4SimpleHeum is called" << G4endl;
210       break;                                      190       break;
211     case 4:                                       191     case 4:
212       //      fStepper = new G4ClassicalRK4( f << 192 //      fStepper = new G4ClassicalRK4( fEquation, 8 ); // no spin tracking
213       fStepper = new G4ClassicalRK4(fEquation, << 193       fStepper = new G4ClassicalRK4( fEquation, 12 ); // with spin tracking
214       G4cout << "G4ClassicalRK4 (default) is c    194       G4cout << "G4ClassicalRK4 (default) is called" << G4endl;
215       break;                                      195       break;
216     case 5:                                       196     case 5:
217       //      fStepper = new G4CashKarpRKF45(  << 197 //      fStepper = new G4CashKarpRKF45( fEquation, 8 ); // no spin tracking
218       fStepper = new G4CashKarpRKF45(fEquation << 198       fStepper = new G4CashKarpRKF45( fEquation, 12 ); // with spin tracking
219       G4cout << "G4CashKarpRKF45 is called" <<    199       G4cout << "G4CashKarpRKF45 is called" << G4endl;
220       break;                                      200       break;
221     default:                                   << 201     default: fStepper = 0;
222       fStepper = nullptr;                      << 
223   }                                               202   }
224 }                                                 203 }
225                                                   204 
226 //....oooOO0OOooo........oooOO0OOooo........oo    205 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
227                                                   206 
228 G4FieldManager* F04GlobalField::GetGlobalField    207 G4FieldManager* F04GlobalField::GetGlobalFieldManager()
229 {                                                 208 {
230   return G4TransportationManager::GetTransport << 209   return G4TransportationManager::GetTransportationManager()
                                                   >> 210                                 ->GetFieldManager();
231 }                                                 211 }
232                                                   212 
233 //....oooOO0OOooo........oooOO0OOooo........oo    213 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
234                                                   214 
235 void F04GlobalField::GetFieldValue(const G4dou    215 void F04GlobalField::GetFieldValue(const G4double* point, G4double* field) const
236 {                                                 216 {
237   // NOTE: this routine dominates the CPU time    217   // NOTE: this routine dominates the CPU time for tracking.
238   // Using the simple array fFp[] instead of f << 218   // Using the simple array fFp[] instead of fields[] 
239   // directly sped it up                          219   // directly sped it up
240                                                   220 
241   field[0] = field[1] = field[2] = field[3] =     221   field[0] = field[1] = field[2] = field[3] = field[4] = field[5] = 0.0;
242                                                   222 
243   // protect against Geant4 bug that calls us     223   // protect against Geant4 bug that calls us with point[] NaN.
244   if (point[0] != point[0]) return;            << 224   if(point[0] != point[0]) return;
245                                                   225 
246   // (can't use fNfp or fFp, as they may chang    226   // (can't use fNfp or fFp, as they may change)
247   if (fFirst) ((F04GlobalField*)this)->SetupAr << 227   if (fFirst) ((F04GlobalField*)this)->SetupArray();   // (cast away const)
248                                                   228 
249   for (int i = 0; i < fNfp; ++i) {             << 229   for (int i=0; i<fNfp; ++i) {
250     const F04ElementField* p = fFp[i];         << 230       const F04ElementField* p = fFp[i];
251     if (p->IsInBoundingBox(point)) {           << 231       if (p->IsInBoundingBox(point)) {
252       p->AddFieldValue(point, field);          << 232          p->AddFieldValue(point,field);
253     }                                          << 233       }
254   }                                               234   }
                                                   >> 235 
255 }                                                 236 }
256                                                   237 
257 //....oooOO0OOooo........oooOO0OOooo........oo    238 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
258                                                   239 
259 void F04GlobalField::Clear()                      240 void F04GlobalField::Clear()
260 {                                                 241 {
261   if (fFields) {                                  242   if (fFields) {
262     if (fFields->size() > 0) {                 << 243      if (fFields->size()>0) {
263       FieldList::iterator i;                   << 244         FieldList::iterator i;
264       for (i = fFields->begin(); i != fFields- << 245         for (i=fFields->begin(); i!=fFields->end(); ++i) delete *i;
265         delete *i;                             << 246         fFields->clear();
266       fFields->clear();                        << 247      }
267     }                                          << 
268   }                                               248   }
269                                                   249 
270   delete[] fFp;                                << 250   if (fFp) delete[] fFp;
                                                   >> 251 
271   fFirst = true;                                  252   fFirst = true;
                                                   >> 253 
272   fNfp = 0;                                       254   fNfp = 0;
273   fFp = nullptr;                               << 255   fFp = NULL;
274 }                                                 256 }
275                                                   257 
276 //....oooOO0OOooo........oooOO0OOooo........oo    258 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
277                                                   259 
278 void F04GlobalField::SetupArray()                 260 void F04GlobalField::SetupArray()
279 {                                                 261 {
280   fFirst = false;                                 262   fFirst = false;
281   fNfp = fFields->size();                         263   fNfp = fFields->size();
282   fFp = new const F04ElementField*[fNfp + 1];  << 264   fFp = new const F04ElementField* [fNfp+1]; // add 1 so it's never 0
283   for (int i = 0; i < fNfp; ++i)               << 265   for (int i=0; i<fNfp; ++i) fFp[i] = (*fFields)[i];
284     fFp[i] = (*fFields)[i];                    << 
285 }                                                 266 }
286                                                   267