56 G4PhysCollection::clear();
63 G4PhysCollection::resize(siz, vec);
75 fOut.open(fileName, std::ios::out | std::ios::binary);
79 fOut.open(fileName, std::ios::out);
86 G4cerr <<
"G4PhysicsTable::StorePhysicsTable():";
94 std::size_t tableSize = size();
97 fOut.write((
char*) (&tableSize),
sizeof tableSize);
101 fOut << tableSize <<
G4endl;
105 for(
const auto itr : *
this)
107 G4int vType = itr->GetType();
110 fOut.write((
char*) (&vType),
sizeof vType);
116 itr->Store(fOut, ascii);
128 fIn.open(fileName, std::ios::in);
147 fIn.open(fileName, std::ios::in | std::ios::binary);
151 fIn.open(fileName, std::ios::in);
158 G4cerr <<
"G4PhysicsTable::RetrievePhysicsTable():";
169 std::size_t tableSize = 0;
172 fIn.read((
char*) (&tableSize),
sizeof tableSize);
182 for(std::size_t idx = 0; idx < tableSize; ++idx)
187 fIn.read((
char*) (&vType),
sizeof vType);
197 G4cerr <<
"G4PhysicsTable::RetrievePhysicsTable():";
198 G4cerr <<
" Illegal Physics Vector type: " << vType <<
" in: ";
208 G4cerr <<
"G4PhysicsTable::RetrievePhysicsTable():";
209 G4cerr <<
" Rrror in retreiving " << idx
210 <<
"-th Physics Vector from file: ";
218 G4PhysCollection::push_back(pVec);
230 for(
auto itr = right.cbegin(); itr != right.cend(); ++itr)
232 out << std::setw(8) << i <<
"-th Vector ";
233 out <<
": Type " <<
G4int((*itr)->GetType());
254 size_t tableSize = G4PhysCollection::size();
256 for(std::size_t idx = 0; idx < tableSize; ++idx)
std::ostream & operator<<(std::ostream &out, G4PhysicsTable &right)
@ T_G4PhysicsLinearVector
G4GLOB_DLL std::ostream G4cerr
void resize(std::size_t, G4PhysicsVector *vec=nullptr)
G4bool GetFlag(std::size_t i) const
G4bool RetrievePhysicsTable(const G4String &filename, G4bool ascii=false, G4bool spline=false)
G4bool ExistPhysicsTable(const G4String &fileName) const
G4bool StorePhysicsTable(const G4String &filename, G4bool ascii=false)
G4PhysicsVector * CreatePhysicsVector(G4int type, G4bool spline)
virtual ~G4PhysicsTable()
G4bool Retrieve(std::ifstream &fIn, G4bool ascii=false)