Note this class is derived from BLCoil, where the variables are defined and the real work is done.
Public Member Functions | |
BLCMDcoil () | |
Default constructor. Defines the command, args, etc. | |
virtual | ~BLCMDcoil () |
Destructor. | |
BLCMDcoil (const BLCMDcoil &r) | |
Copy constructor. | |
G4String | commandName () |
commandName() returns "coil". | |
int | command (BLArgumentVector &argv, BLArgumentMap &namedArgs) |
command() implements the coil command. | |
void | defineNamedArgs () |
defineNamedArgs() defines the arguments to the command. |
BLCMDcoil::BLCMDcoil | ( | ) |
Default constructor. Defines the command, args, etc.
References BLCMDTYPE_ELEMENT, BLCommand::registerCommand(), BLCommand::setDescription(), and BLCommand::setSynopsis().
Referenced by command().
00049 : BLCommand(), BLCoil() 00050 { 00051 // register the commandName(), and its synopsis and description. 00052 registerCommand(BLCMDTYPE_ELEMENT); 00053 setSynopsis("defines a coil (part of a solenoid)"); 00054 setDescription("A coil is a geometrical tube that can carry current\n" 00055 "when part of a solenoid. The field is computed for a set\n" 00056 "of nSheets infinitely-thin current sheets evenly spread\n" 00057 "radially. The solenoid specifies the actual current.\n" 00058 "For tracking the computation is too slow, so a field map\n" 00059 "on a grid in r and z is computed and written to filename\n" 00060 "(defaults to coilname.dat).\n" 00061 "While there are lots of parameters specifying the field map\n" 00062 "it is recommended to simply accept the defaults for all\n" 00063 "but innerRadius, outerRadius, length, material, and\n" 00064 "possibly tolerance. The other parameters will be determined\n" 00065 "so that the largest error is less than tolerance times the\n" 00066 "value of Bz at the center of the coil.\n" 00067 "If mapFile is given, the file is read in BLFieldMap format.\n" 00068 "The cache file contains the parameters, and is a field map " 00069 "in a binary format; it is automatically regenerated if any " 00070 "parameter changes.\n\n" 00071 "Note that maxR and maxZ are by default determined to be large " 00072 "enough so that the field falls below tolerance; this can be " 00073 "quote large."); 00074 }
BLCMDcoil::BLCMDcoil | ( | const BLCMDcoil & | r | ) |
G4String BLCMDcoil::commandName | ( | ) | [inline, virtual] |
int BLCMDcoil::command | ( | BLArgumentVector & | argv, | |
BLArgumentMap & | namedArgs | |||
) | [virtual] |
command() implements the coil command.
Implements BLCommand.
References BLCMDcoil(), BLCoil::generateFieldMap(), BLCommand::getMaterial(), BLCommand::handleNamedArgs(), BLCoil::mapCoil, BLCoil::printCoil(), and BLCommand::printError().
00085 { 00086 if(argv.size() != 1) { 00087 printError("coil: Invalid command, must have name"); 00088 return -1; 00089 } 00090 00091 if(argv[0] == "default") { 00092 return defaultCoil.handleNamedArgs(namedArgs); 00093 } 00094 00095 BLCMDcoil *t = new BLCMDcoil(defaultCoil); 00096 t->name = argv[0]; 00097 int retval = t->handleNamedArgs(namedArgs); 00098 00099 if(t->filename == "") 00100 t->filename = t->name + ".dat"; 00101 00102 // check material exists 00103 if(t->material.size() > 0) getMaterial(t->material,false); 00104 00105 t->printCoil(); 00106 00107 // add this coil to the list, and compute its fieldMap 00108 mapCoil[t->name] = t; 00109 t->generateFieldMap(); 00110 00111 return retval; 00112 }
void BLCMDcoil::defineNamedArgs | ( | ) | [virtual] |
defineNamedArgs() defines the arguments to the command.
Reimplemented from BLCommand.
References BLCommand::argDouble(), BLCommand::argInt(), BLCommand::argString(), BLCoil::dR, BLCoil::dZ, BLCoil::exactComputation, BLCoil::filename, BLCoil::innerRadius, BLCoil::length, BLCoil::mapFile, BLCoil::material, BLCoil::maxR, BLCoil::maxZ, BLCoil::nSheets, BLCoil::outerRadius, and BLCoil::tolerance.
00115 { 00116 argDouble(innerRadius,"innerRadius","Inside radius of the coil (mm)",mm,"",false); 00117 argDouble(outerRadius,"outerRadius","Outside radius of the coil (mm)",mm,"",false); 00118 argDouble(length,"length","Length of the coil along z (mm)",mm,"",false); 00119 argString(material,"material","The material of the conductor (default=Cu)",false); 00120 argDouble(tolerance,"tolerance","The acceptable tolerance of the map.",1,"",false); 00121 argInt(nSheets,"nSheets","Number of sheets used in the computation",false); 00122 argDouble(maxR,"maxR","Maxmum r value for the map (automatically determined by default).",mm,"",false); 00123 argDouble(maxZ,"maxZ","Maxmum z value for the map (automatically determined by default).",mm,"",false); 00124 argDouble(dR,"dR","R interval between points of the map (automatically determined by default).",mm,"",false); 00125 argDouble(dZ,"dZ","Z interval between points of the map (automatically determined by default).",mm,"",false); 00126 argString(filename,"filename","Filename for cache; deaults to name.dat.",false); 00127 argString(mapFile,"mapFile","Filename for map (e.g. from TOSCA).",false); 00128 argInt(exactComputation,"exactComputation","Set nonzero to use the exact computation without any field map (0)."); 00129 }