Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

BfldMap Class Reference

#include <BfldMap.h>

Inheritance diagram for BfldMap:

BfldRefCnt BfldMapRect2d BfldMapVoronoi List of all members.

Public Member Functions

 BfldMap ()
 BfldMap (BfldGrid::Grid_t grid, Int_t variant)
virtual ~BfldMap ()
virtual TVector3 GetBField (Int_t generator)
virtual TVector3 GetRawField (Int_t generator)
BfldGrid::Grid_t GetGrid () const
Int_t GetVariant () const
Float_t GetGeneratedCoilCurrent () const

Protected Member Functions

void ResizeVectors (UInt_t size)
void AddGenerator (UInt_t generator, Double_t bx, Double_t by, Double_t bz=0.0)
void AddGenerator (UInt_t generator, TVector3 &bfld)

Protected Attributes

BfldGrid::Grid_t fGrid
Int_t fVariant
Bool_t fIs3d
Float_t fGeneratedCoilCurrent
Bool_t fFilledOkay
std::string fDataSource
UInt_t fNumGenerators
std::vector< Float_t > fBx
std::vector< Float_t > fBy
std::vector< Float_t > fBz

Constructor & Destructor Documentation

BfldMap::BfldMap  ) 
 

Definition at line 21 of file BfldMap.cxx.

00022   : fGrid(BfldGrid::kUndefined)
00023   , fVariant(-1)
00024   , fIs3d(false)
00025   , fGeneratedCoilCurrent(0.0)
00026   , fFilledOkay(false)
00027   , fNumGenerators(0)
00028 {
00029   // default ctor
00030 }

BfldMap::BfldMap BfldGrid::Grid_t  grid,
Int_t  variant
 

Definition at line 33 of file BfldMap.cxx.

00034   : fGrid(grid)
00035   , fVariant(variant)
00036   , fIs3d(false)
00037   , fGeneratedCoilCurrent(0.0)
00038   , fFilledOkay(false)
00039   , fNumGenerators(0)
00040 {
00041 
00042 }

BfldMap::~BfldMap  )  [virtual]
 

Definition at line 45 of file BfldMap.cxx.

References fFilledOkay, fGrid, and fVariant.

00046 {
00047    fGrid       = BfldGrid::kUndefined;
00048    fVariant    = -1;
00049    fFilledOkay = false;
00050 
00051 }


Member Function Documentation

void BfldMap::AddGenerator UInt_t  generator,
TVector3 &  bfld
[protected]
 

Definition at line 134 of file BfldMap.cxx.

References AddGenerator().

00135 {
00136    // add a field vector for generator point
00137    AddGenerator(generator,bfld.x(),bfld.y(),bfld.z());
00138 }

void BfldMap::AddGenerator UInt_t  generator,
Double_t  bx,
Double_t  by,
Double_t  bz = 0.0
[protected]
 

Definition at line 112 of file BfldMap.cxx.

References fBx, fBy, fBz, fIs3d, fNumGenerators, and ResizeVectors().

Referenced by AddGenerator(), BfldMapRect2d::BfldMapRect2d(), and BfldMapVoronoi::BfldMapVoronoi().

00114 {
00115    // add a field vector for generator point
00116 
00117   // Check if the third component is non-zero
00118   // If so, and we haven't done so already make sure there's
00119   // enough space in the fBz vector
00120   bool hasbz = ( bz != 0.0 );
00121   if ( hasbz && ! fIs3d ) { fIs3d = true; fBz.resize(fNumGenerators); }
00122   // Make sure all arrays can hold this next entry
00123   // If we're expanding, be generous with an extra 128 to avoid 
00124   // multiple single expansions.
00125   if ( generator >= fNumGenerators ) ResizeVectors(generator+128);
00126   // Store the components of the generator's data
00127   fBx[generator] = bx;
00128   fBy[generator] = by;
00129   if ( hasbz ) fBz[generator] = bz;
00130 
00131 }

TVector3 BfldMap::GetBField Int_t  generator  )  [virtual]
 

Definition at line 55 of file BfldMap.cxx.

References GetRawField().

Referenced by BfldHandlerRect2d::GetBFieldMeshCoord().

00056 {
00057    // Return just a simple copy of the vector at this generator point
00058    // BfldMap probably isn't the place to do the slot, B-H, etc.
00059    // corrections anyway because:
00060    //  (1) we don't have the necessary info to do more than 
00061    //      simple linear scaling by the current ratio
00062    //  (2) it's expensive to do this *before* interpolating
00063    //      and probably no more correct
00064    //MAXMSG("Bfld",Msg::kDebug,5) 
00065    //  << "BfldMap::GetBField is same as GetRawField (no scaling)!"
00066    //  << endl;
00067 
00068    return GetRawField(generator);
00069 
00070 }

Float_t BfldMap::GetGeneratedCoilCurrent  )  const [inline]
 

Definition at line 74 of file BfldMap.h.

Referenced by BField::GetBField().

00075                                      { return fGeneratedCoilCurrent; }

BfldGrid::Grid_t BfldMap::GetGrid  )  const [inline]
 

Definition at line 72 of file BfldMap.h.

Referenced by BfldLoanPool::GetMap(), BfldLoanPool::Print(), and BfldHandlerVoronoi::SetMap().

00072 { return fGrid; }

TVector3 BfldMap::GetRawField Int_t  generator  )  [virtual]
 

Definition at line 73 of file BfldMap.cxx.

References fBx, fBy, fBz, fFilledOkay, fNumGenerators, and MAXMSG.

Referenced by GetBField().

00074 {
00075    // Return a copy of the vector at this generator point
00076 
00077    if ( fFilledOkay &&
00078         generator >= 0 && (UInt_t)generator <= fNumGenerators ) {
00079      if (fIs3d) {
00080        return TVector3(fBx[generator],fBy[generator],fBz[generator]);
00081      }
00082      else {
00083        return TVector3(fBx[generator],fBy[generator],0.0);
00084      }
00085    }
00086 
00087    MAXMSG("Bfld",Msg::kDebug,20)
00088      << "BfldMap::GetRawField no raw field for generator " 
00089      << generator << " of " << fNumGenerators << endl;
00090    return TVector3(0.,0.,0.);
00091 
00092 }

Int_t BfldMap::GetVariant  )  const [inline]
 

Definition at line 73 of file BfldMap.h.

Referenced by BfldHandlerRect2d::GetBFieldMeshCoord(), BfldLoanPool::GetMap(), and BfldLoanPool::Print().

00073 { return fVariant; }

void BfldMap::ResizeVectors UInt_t  size  )  [protected]
 

Definition at line 95 of file BfldMap.cxx.

References fBx, fBy, fBz, and fNumGenerators.

Referenced by AddGenerator(), BfldMapRect2d::BfldMapRect2d(), and BfldMapVoronoi::BfldMapVoronoi().

00096 {
00097    // Allocate whatever's holding the data if necessary
00098    // Make sure we can add a generator value
00099 
00100    // When using vector<Double_t> or vector<Float_t> x,y,z
00101    // then we have to resize and make sure everything is hunky dory
00102    if ( size > fNumGenerators ) {
00103      fBx.resize(size);
00104      fBy.resize(size);
00105      if ( fIs3d ) fBz.resize(size);
00106      fNumGenerators = size;
00107    }
00108 
00109 }


Member Data Documentation

std::vector<Float_t> BfldMap::fBx [protected]
 

Definition at line 63 of file BfldMap.h.

Referenced by AddGenerator(), GetRawField(), and ResizeVectors().

std::vector<Float_t> BfldMap::fBy [protected]
 

Definition at line 64 of file BfldMap.h.

Referenced by AddGenerator(), GetRawField(), and ResizeVectors().

std::vector<Float_t> BfldMap::fBz [protected]
 

Definition at line 65 of file BfldMap.h.

Referenced by AddGenerator(), GetRawField(), and ResizeVectors().

std::string BfldMap::fDataSource [protected]
 

Definition at line 60 of file BfldMap.h.

Bool_t BfldMap::fFilledOkay [protected]
 

Definition at line 59 of file BfldMap.h.

Referenced by GetRawField(), and ~BfldMap().

Float_t BfldMap::fGeneratedCoilCurrent [protected]
 

Definition at line 58 of file BfldMap.h.

BfldGrid::Grid_t BfldMap::fGrid [protected]
 

Definition at line 54 of file BfldMap.h.

Referenced by ~BfldMap().

Bool_t BfldMap::fIs3d [protected]
 

Definition at line 56 of file BfldMap.h.

Referenced by AddGenerator().

UInt_t BfldMap::fNumGenerators [protected]
 

Definition at line 62 of file BfldMap.h.

Referenced by AddGenerator(), GetRawField(), and ResizeVectors().

Int_t BfldMap::fVariant [protected]
 

Definition at line 55 of file BfldMap.h.

Referenced by ~BfldMap().


The documentation for this class was generated from the following files:
Generated on Mon Feb 15 11:08:48 2010 for loon by  doxygen 1.3.9.1