62 : Name(name),SymbolName(symbol),Value(value)
66 size_t nbCat = theUnitsTable.size();
68 while ((i<nbCat)&&(theUnitsTable[i]->
GetName()!=category)) { i++; }
75 (theUnitsTable[CategoryIndex]->GetUnitsList()).push_back(
this);
79 theUnitsTable[i]->UpdateNameMxLen((
G4int)name.length());
80 theUnitsTable[i]->UpdateSymbMxLen((
G4int)symbol.length());
103 SymbolName = right.SymbolName;
105 CategoryIndex = right.CategoryIndex;
129 return theUnitsTable;
140 for (
size_t j=0;j<units.size();j++)
142 name=units[j]->GetName(); symbol=units[j]->GetSymbol();
143 if(str==name||str==symbol)
144 {
return units[j]->GetValue(); }
147 std::ostringstream message;
148 message <<
"The unit '" << str <<
"' does not exist in the Units Table.";
149 G4Exception(
"G4UnitDefinition::GetValueOf()",
"InvalidUnit",
162 for (
size_t j=0;j<units.size();j++)
164 name=units[j]->GetName(); symbol=units[j]->GetSymbol();
165 if(str==name||str==symbol)
166 {
return theUnitsTable[i]->GetName(); }
169 std::ostringstream message;
170 message <<
"The unit '" << str <<
"' does not exist in the Units Table.";
171 G4Exception(
"G4UnitDefinition::GetCategory()",
"InvalidUnit",
181 G4int nameL = theUnitsTable[CategoryIndex]->GetNameMxLen();
182 G4int symbL = theUnitsTable[CategoryIndex]->GetSymbMxLen();
183 G4cout << std::setw(nameL) << Name <<
" ("
184 << std::setw(symbL) << SymbolName <<
") = " << Value <<
G4endl;
334 G4cout <<
"\n ----- The Table of Units ----- \n";
335 for(
size_t i=0;i<theUnitsTable.size();i++)
337 theUnitsTable[i]->PrintCategory();
345 for (
size_t i=0;i<theUnitsTable.size();i++)
347 delete theUnitsTable[i];
349 theUnitsTable.clear();
355 : Name(name),UnitsList(),NameMxLen(0),SymbMxLen(0)
363 for(
size_t i=0;i<UnitsList.size();i++)
384 UnitsList = right.UnitsList;
385 NameMxLen = right.NameMxLen;
386 SymbMxLen = right.SymbMxLen;
410 for(
size_t i=0;i<UnitsList.size();i++)
411 { UnitsList[i]->PrintDefinition(); }
421 size_t nbCat = theUnitsTable.size();
423 while ((i<nbCat)&&(theUnitsTable[i]->GetName()!=category)) { i++; }
426 G4cout <<
" G4BestUnit: the category " << category
427 <<
" does not exist !!" <<
G4endl;
428 G4Exception(
"G4BestUnit::G4BestUnit()",
"InvalidCall",
445 size_t nbCat = theUnitsTable.size();
447 while ((i<nbCat)&&(theUnitsTable[i]->GetName()!=category)) { i++; }
450 G4cerr <<
" G4BestUnit: the category " << category
451 <<
" does not exist." <<
G4endl;
452 G4Exception(
"G4BestUnit::G4BestUnit()",
"InvalidCall",
456 Value[0] = value.
x();
457 Value[1] = value.
y();
458 Value[2] = value.
z();
470 std::ostringstream oss;
482 G4int len = theUnitsTable[a.IndexOfCategory]->GetSymbMxLen();
484 G4int ksup(-1), kinf(-1);
490 std::fabs(a.Value[1])),
491 std::fabs(a.Value[2]));
493 for (
size_t k=0; k<List.size(); k++)
495 G4double unit = List[k]->GetValue();
497 {
if(unit>umax) {umax=unit; ksup=k;}}
499 {
if(unit<umin) {umin=unit; kinf=k;}}
503 if ((ratio>=1.)&&(ratio<rsup)) {rsup=ratio; ksup=k;}
504 if ((ratio< 1.)&&(ratio>rinf)) {rinf=ratio; kinf=k;}
509 if(index==-1) { index=kinf; }
510 if(index==-1) { index=0; }
512 for (
G4int j=0; j<a.nbOfVals; j++)
513 { flux << a.Value[j]/(List[
index]->GetValue()) <<
" "; }
515 std::ios::fmtflags oldform = flux.flags();
518 flux << std::setw(len) << List[
index]->GetSymbol();