#include <G4LatticeReader.hh>
Definition at line 42 of file G4LatticeReader.hh.
◆ G4LatticeReader()
G4LatticeReader::G4LatticeReader |
( |
G4int |
vb = 0 | ) |
|
Definition at line 54 of file G4LatticeReader.cc.
55 : verboseLevel(vb), psLatfile(0), pLattice(0), fMapPath(""),
56 fToken(""), fValue(0.), fMap(""), fsPol(""), fPol(-1), fNX(0), fNY(0) {;}
◆ ~G4LatticeReader()
G4LatticeReader::~G4LatticeReader |
( |
| ) |
|
◆ CloseFile()
void G4LatticeReader::CloseFile |
( |
| ) |
|
|
protected |
◆ MakeLattice()
Definition at line 65 of file G4LatticeReader.cc.
65 {
66 if (verboseLevel)
G4cout <<
"G4LatticeReader " << filename <<
G4endl;
67
70 msg << "Unable to open " << filename;
71 G4Exception(
"G4LatticeReader::MakeLattice",
"Lattice001",
73 return 0;
74 }
75
77
79 while (!psLatfile->eof()) {
81 }
83
84 if (!goodLattice) {
86 msg << "Error reading lattice from " << filename;
87 G4Exception(
"G4LatticeReader::MakeLattice",
"Lattice002",
89 delete pLattice;
90 pLattice = 0;
91 }
92
93 return pLattice;
94}
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
G4GLOB_DLL std::ostream G4cout
G4bool OpenFile(const G4String &filepath)
Referenced by G4LatticeManager::LoadLattice().
◆ OpenFile()
Definition at line 99 of file G4LatticeReader.cc.
99 {
100 if (verboseLevel)
101 G4cout <<
"G4LatticeReader::OpenFile " << filename <<
G4endl;
102
104 psLatfile = new std::ifstream(filepath);
105 if (!psLatfile->good()) {
106 filepath = fDataDir + "/" + filename;
107 psLatfile->open(filepath);
108 if (!psLatfile->good()) {
110 return false;
111 }
112 if (verboseLevel>1)
G4cout <<
" Found file " << filepath <<
G4endl;
113 }
114
115
116 size_t lastdir = filepath.
last(
'/');
117 if (lastdir == std::string::npos) fMapPath = ".";
118 else fMapPath = filepath(0,lastdir);
119
120 return true;
121}
std::size_t last(char) const
Referenced by MakeLattice().
◆ ProcessConstants()
G4bool G4LatticeReader::ProcessConstants |
( |
| ) |
|
|
protected |
Definition at line 184 of file G4LatticeReader.cc.
184 {
186 *psLatfile >> beta >> gamma >>
lambda >> mu;
187 if (verboseLevel>1)
188 G4cout <<
" ProcessConstants " << beta <<
" " << gamma
190
192 return psLatfile->good();
193}
void SetDynamicalConstants(G4double Beta, G4double Gamma, G4double Lambda, G4double Mu)
Referenced by ProcessToken().
◆ ProcessMap()
G4bool G4LatticeReader::ProcessMap |
( |
| ) |
|
|
protected |
Definition at line 231 of file G4LatticeReader.cc.
231 {
233 G4cerr <<
"G4LatticeReader: Unable to process mapfile directive." <<
G4endl;
234 return false;
235 }
236
237 return pLattice->
LoadMap(fNX, fNY, fPol, fMap);
238}
G4GLOB_DLL std::ostream G4cerr
G4bool LoadMap(G4int, G4int, G4int, G4String)
Referenced by ProcessToken().
◆ ProcessNMap()
G4bool G4LatticeReader::ProcessNMap |
( |
| ) |
|
|
protected |
Definition at line 240 of file G4LatticeReader.cc.
240 {
242 G4cerr <<
"G4LatticeReader: Unable to process mapfile directive." <<
G4endl;
243 return false;
244 }
245
246 return pLattice->
Load_NMap(fNX, fNY, fPol, fMap);
247}
G4bool Load_NMap(G4int, G4int, G4int, G4String)
Referenced by ProcessToken().
◆ ProcessToken()
G4bool G4LatticeReader::ProcessToken |
( |
| ) |
|
|
protected |
Definition at line 134 of file G4LatticeReader.cc.
134 {
135 fToken = "";
136 *psLatfile >> fToken;
137 if (fToken.empty() || psLatfile->eof()) return true;
138
139 if (verboseLevel>1)
G4cout <<
" ProcessToken " << fToken <<
G4endl;
140
141 fToken.toLower();
147}
G4bool ProcessValue(const G4String &name)
G4bool ProcessConstants()
Referenced by MakeLattice().
◆ ProcessValue()
Definition at line 158 of file G4LatticeReader.cc.
158 {
159 *psLatfile >> fValue;
160 if (verboseLevel>1)
G4cout <<
" ProcessValue " << fValue <<
G4endl;
161
163
164
165
166
167
168
173 else if (name ==
"ldos") pLattice->
SetLDOS(fValue);
174 else if (name ==
"stdos") pLattice->
SetSTDOS(fValue);
175 else if (name ==
"ftdos") pLattice->
SetFTDOS(fValue);
176 else {
178 good = false;
179 }
180
181 return good;
182}
void SetLDOS(G4double LDOS)
void SetAnhDecConstant(G4double a)
void SetFTDOS(G4double FTDOS)
void SetSTDOS(G4double STDOS)
void SetScatteringConstant(G4double b)
const char * name(G4int ptype)
Referenced by ProcessToken().
◆ ReadMapInfo()
G4bool G4LatticeReader::ReadMapInfo |
( |
| ) |
|
|
protected |
Definition at line 197 of file G4LatticeReader.cc.
197 {
198 *psLatfile >> fMap >> fsPol >> fNX >> fNY;
199 if (verboseLevel>1)
200 G4cout <<
" ReadMapInfo " << fMap <<
" " << fsPol
201 <<
" " << fNX <<
" " << fNY <<
G4endl;
202
204 G4cerr <<
"G4LatticeReader: Invalid map theta dimension " << fNX <<
G4endl;
205 return false;
206 }
207
209 G4cerr <<
"G4LatticeReader: Invalid map phi dimension " << fNY <<
G4endl;
210 return false;
211 }
212
213
214 fMap = fMapPath + "/" + fMap;
215
216
218 fPol = ( (fsPol=="l") ? 0 :
219 (fsPol=="st") ? 1 :
220 (fsPol=="ft") ? 2 :
221 -1 );
222
223 if (fPol<0 || fPol>2) {
224 G4cerr <<
"G4LatticeReader: Invalid polarization code " << fsPol <<
G4endl;
225 return false;
226 }
227
228 return true;
229}
Referenced by ProcessMap(), and ProcessNMap().
◆ SetVerboseLevel()
void G4LatticeReader::SetVerboseLevel |
( |
G4int |
vb | ) |
|
|
inline |
◆ SkipComments()
G4bool G4LatticeReader::SkipComments |
( |
| ) |
|
|
protected |
Definition at line 151 of file G4LatticeReader.cc.
151 {
152 psLatfile->ignore(std::numeric_limits<std::streamsize>::max(), '\n');
153 return true;
154}
Referenced by ProcessToken().
The documentation for this class was generated from the following files: