BLFieldMap.cc File Reference

#include <fstream>
#include <string.h>
#include <ctype.h>
#include <assert.h>
#include "G4ElectroMagneticField.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().

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

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().

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

static G4String d2string ( G4double  v  )  [static]

d2string converts a double to a G4String

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

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

static G4String i2string ( int  v  )  [static]

i2string converts an int to a G4String

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

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

g4beamline