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

BfldLoanPool.h

Go to the documentation of this file.
00001 
00002 // $Id: BfldLoanPool.h,v 1.20 2009/09/16 16:55:44 rhatcher Exp $
00003 //
00004 // BfldLoanPool
00005 //
00006 // A singleton class to instantiate BfldMesh (rectangular grids and
00007 // Voronoi diagrams) and BfldMaps.
00008 //
00009 // It does NOT -construct- them in the sense of turning an FEA node
00010 // list into a Voronoi diagram or running ANSYS, but rather simply
00011 // supplies methods for getting a copy of the appropriate structure
00012 // (presumably by reading it from a file or using data from the database).
00013 //
00014 // This version is *NOT* thread safe!!!
00015 //
00016 // Author:  R. Hatcher 2000.06.20
00017 //
00019 #ifndef BFLDLOANPOOL_H
00020 #define BFLDLOANPOOL_H
00021 
00022 #include "TObjArray.h"
00023 #include "BField/BfldGrid.h"
00024 #include "Validity/VldContext.h"
00025 #include "Configurable/CfgConfigurable.h"
00026 
00027 class BfldMesh;
00028 class BfldMap;
00029 class BfldCache;
00030 
00031 class BfldLoanPool : public TObject, public CfgConfigurable {
00032 
00033 public:
00034 
00035    static BfldLoanPool*    Instance();
00036    virtual void            Config();
00037    virtual const Registry& DefaultConfig() const;
00038    virtual void            SetConfigFromEnvironment();
00039 
00040    BfldMap    *GetMap(BfldGrid::Grid_t grid, Int_t variant);
00041    BfldMesh   *GetMesh(BfldGrid::Grid_t grid, Int_t variant);
00042    BfldCache  *GetCache(VldContext& vldc);
00043 
00044    // cache unpacked values for quick lookup
00045    Int_t     GetDefaultRequireInZTest()     const {return fInZTest;           }
00046    Int_t     GetDefaultDoLocalTransform()   const {return fDoLocalTransform;  }
00047    Int_t     GetDefaultDoBHCorrection()     const {return fDoBHCorrection;    }
00048    Int_t     GetDefaultDoSlotCorrection()   const {return fDoSlotCorrection;  }
00049    Int_t     GetDefaultDoInterPlaneField()  const {return fDoInterPlaneField; }
00050    Int_t     GetDefaultDoSMGapAndEndField() const {return fDoSMGapAndEndField;}
00051    Int_t     GetDefaultUseDCSCoilDir()      const {return fUseDCSCoilDir;     }
00052    Int_t     GetDefaultUseDCSCurrent()      const {return fUseDCSCurrent;     }
00053    Int_t     GetDefaultGapLineSrc()         const {return fGapLineSrc;        }
00054 
00055    Int_t     GetDefaultApplyBdotScale()     const {return fApplyBdotScale;    }
00056    Double_t  GetDefaultZTolerance()         const {return fZTolerance;        }
00057 
00058    Double_t  GetDefaultNoFieldBeyondZ()     const {return fNoFieldBeyondZ;    }
00059 
00060    Int_t     GetForceUseEverywhere()       const {return fForceUseEverywhere; }
00061    Int_t     GetIgnoreUseEverywhere()      const {return fIgnoreUseEverywhere;}
00062 
00063    void ClearPool(Bool_t cache = true, Bool_t map = false, Bool_t mesh = false);
00064    void Print(Option_t *option = "") const;
00065 
00066 private:
00067    BfldLoanPool();  // ctor - this is a singleton class make it private
00068    BfldLoanPool(const BfldLoanPool &bfl); // don't write copy ctor but
00069                                             // don't let user call it either
00070    virtual ~BfldLoanPool();
00071    // Helper class to handle deletion of singleton
00072    struct Cleaner {
00073       void ClassIsUsed() { }; // dummy method to keep compilers quiet
00074       ~Cleaner() {
00075          if (BfldLoanPool::fgInstance!=0) {
00076             delete BfldLoanPool::fgInstance;
00077             BfldLoanPool::fgInstance = 0;
00078          }
00079       }
00080    };
00081    friend struct Cleaner;
00082 
00083    static BfldLoanPool *fgInstance;        // only copy of self
00084 
00085    // These structures are _owned_ by BfldLoanPool and it is
00086    // responsible for deleting them as necessary
00087    // Intially the will be just one, but later one could start
00088    // managing a list of each if necessary.
00089    
00090    TObjArray       fBfldMeshList;
00091    TObjArray       fBfldMapList;
00092    TObjArray       fBfldCacheList;
00093    
00094    Int_t           fMaxUnrefCaches;
00095 
00096    // various configuration flags pulled from the Configuration
00097    // to avoid repeated string lookups (unpack on new config)
00098 
00099    Int_t           fInZTest;
00100    Int_t           fDoLocalTransform;
00101    Int_t           fDoBHCorrection;
00102    Int_t           fDoSlotCorrection;
00103    Int_t           fDoInterPlaneField;
00104    Int_t           fDoSMGapAndEndField;
00105    Int_t           fUseDCSCoilDir;
00106    Int_t           fUseDCSCurrent;
00107    Int_t           fGapLineSrc;
00108    Int_t           fApplyBdotScale;
00109 
00110    Double_t        fZTolerance;
00111    Double_t        fNoFieldBeyondZ;
00112 
00113    Int_t           fForceUseEverywhere;
00114    Int_t           fIgnoreUseEverywhere;
00115 
00116    ClassDef(BfldLoanPool,4)
00117 
00118 };
00119 
00120 #endif // BFLDLOANPOOL_H

Generated on Mon Feb 15 11:06:25 2010 for loon by  doxygen 1.3.9.1