BLFieldMap.cc File Reference

#include <fstream>
#include <string.h>
#include <ctype.h>
#include "G4ElectroMagneticField.hh"
#include "BLAssert.hh"
#include "BLFieldMap.hh"
#include "BLCommand.hh"
#include "BTSpline1D.hh"

Classes

class  InputFile
 class InputFile handles input file I/O More...
class  FieldMapImpl
 class FieldMapImpl -- base class for a FieldMap implementation More...
class  GridImpl
 class GridImpl -- class for a Grid FieldMap implementation More...
class  CylinderImpl
 class CylinderImpl -- class for a Cylinder FieldMap implementation More...
class  TimeImpl
 class TimeImpl -- class implementation of a time dependence. More...

Defines

#define COMPONENT(C)

Functions

static void argDouble (G4double &var, const char *name, BLArgumentMap &namedArgs)
 argDouble handles an argument with a value of G4double
static void argInt (G4int &var, const char *name, BLArgumentMap &namedArgs)
 argInt handles an argument with a value of G4int
static G4String d2string (G4double v)
 d2string converts a double to a G4String
static G4String i2string (int v)
 i2string converts an int to a G4String


Define Documentation

#define COMPONENT (  ) 

Value:

G4double C = 0.0;                                       \
        if(map##C) C =  map##C[m]*f0 + map##C[m+1]*f1 +         \
                map##C[m+nX]*f2 + map##C[m+nX+1]*f3 +           \
                map##C[m+nY*nX]*f4 + map##C[m+nY*nX+1]*f5 +     \
                map##C[m+nY*nX+nX]*f6 + map##C[m+nY*nX+nX+1]*f7;

Referenced by GridImpl::getFieldValue().


Function Documentation

static void argDouble ( G4double &  var,
const char *  name,
BLArgumentMap namedArgs 
) [static]

argDouble handles an argument with a value of G4double

References BLCommand::printError().

Referenced by CylinderImpl::CylinderImpl(), GridImpl::GridImpl(), BLFieldMap::readFile(), and TimeImpl::readTime().

00217 {
00218         if(namedArgs.count(name) == 0) return;
00219         char *q;
00220         const char *p=namedArgs[name].c_str();
00221         G4double v = strtod(p,&q);
00222         if(p == q || *q != '\0') {
00223                 BLCommand::printError("Invalid value for '%s' in BLFieldMap",
00224                                                                 name);
00225                 return;
00226         }
00227         var = v;
00228 }

static void argInt ( G4int &  var,
const char *  name,
BLArgumentMap namedArgs 
) [static]

argInt handles an argument with a value of G4int

References BLCommand::printError().

Referenced by CylinderImpl::CylinderImpl(), GridImpl::GridImpl(), and BLFieldMap::readFile().

00233 {
00234         if(namedArgs.count(name) == 0) return;
00235         char *q;
00236         const char *p=namedArgs[name].c_str();
00237         G4int v = strtol(p,&q,0);
00238         if(p == q || *q != '\0') {
00239                 BLCommand::printError("Invalid value for '%s' in BLFieldMap",
00240                                                                 name);
00241                 return;
00242         }
00243         var = v;
00244 }

static G4String d2string ( G4double  v  )  [static]

d2string converts a double to a G4String

Referenced by BLFieldMap::createCylinderMap(), and BLFieldMap::createGridMap().

00248 {
00249         char tmp[32];
00250         sprintf(tmp,"%.8g",v);
00251         return G4String(tmp);
00252 }

static G4String i2string ( int  v  )  [static]

i2string converts an int to a G4String

Referenced by BLFieldMap::createCylinderMap(), and BLFieldMap::createGridMap().

00256 {
00257         char tmp[32];
00258         sprintf(tmp,"%d",v);
00259         return G4String(tmp);
00260 }

g4beamline