Message: FieldManager handling Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None FieldManager handling 

Forum: Multithreading
Date: 06 Nov, 2012
From: Andrea Di Simone <Andrea Di Simone>

Hi all,

I have a question concerning the handling of the FieldManagers in the mt version. I see from the example and documentation that A01MagneticField and its manager are made thread-private.

Unfortunately, my setup is much more complicated. I have an auxiliary class that reads the configuration of the (many different) magnetic fields from file, then navigates through the whole geometry tree and creates the fields as appropriate. Here is an example of the code that is executed each time a "magnetic" volume is found:

if(theLogicalVolume==theVolumeIAmInterestedIn){

    BDSQuadMagField* Quadrupolar_Field = new BDSQuadMagField(some_gradient);

    G4Mag_UsualEqRhs* Quadrupolar_Equation = new     G4Mag_UsualEqRhs(Quadrupolar_Field);

    G4MagIntegratorStepper* Quadrupolar_Stepper = new G4ClassicalRK4(Quadrupolar_Equation);

    G4ChordFinder* Quadrupolar_ChordFinder = 
			new G4ChordFinder(Quadrupolar_Field,1.0e-6*mm,Quadrupolar_Stepper);

    G4FieldManager* Quadrupolar_FieldMgr = 
			new G4FieldManager(Quadrupolar_Field,Quadrupolar_ChordFinder);  

    theLogicalVolume->SetFieldManager(Quadrupolar_FieldMgr,true);

}

Of course I have a number of different field types, not just quads.

My first question is: I understand from the example that the field and field manager must be made thread private. What about the stepper and chord finder?

As this happens at runtime (geometry is read from GDML, magnetic fields from some ascii files), there is no way I can possibly "static __thread" the fields and initialize them at file scope, like in the example. Do you have any suggestion on how to do this?

Thanks for your help,

Andrea.

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 Feedback: Re: FieldManager handling   (Andrea Dotti - 06 Nov, 2012)
(_ None: Re: FieldManager handling   (Andrea Di Simone - 06 Nov, 2012)
(_ Warning: Re: FieldManager handling   (Andrea Dotti - 06 Nov, 2012)
(_ None: Re: FieldManager handling   (Andrea Di Simone - 06 Nov, 2012)
(_ Feedback: Re: FieldManager handling   (Andrea Dotti - 06 Nov, 2012)
(_ None: Re: FieldManager handling   (Andrea Di Simone - 07 Nov, 2012)
 Add Message Add Message
to: "FieldManager handling"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews