Changeset 1196 for trunk/source/materials/src/G4OpticalSurface.cc
- Timestamp:
- Nov 25, 2009, 5:13:58 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/materials/src/G4OpticalSurface.cc
r986 r1196 25 25 // 26 26 // 27 // $Id: G4OpticalSurface.cc,v 1.1 2 2008/12/11 10:23:54 gcosmoExp $28 // GEANT4 tag $Name: geant4-09-0 2-ref-02$27 // $Id: G4OpticalSurface.cc,v 1.15 2009/11/20 00:57:51 gum Exp $ 28 // GEANT4 tag $Name: geant4-09-03-cand-01 $ 29 29 // 30 30 // … … 66 66 polish = right.polish; 67 67 theMaterialPropertiesTable = right.theMaterialPropertiesTable; 68 AngularDistribution = right.AngularDistribution; 68 69 } 69 70 return *this; … … 92 93 polish = 0.0; 93 94 } 95 else if ( model == LUT ) { 96 sigma_alpha = value; 97 polish = 0.0; 98 } 94 99 else { 95 100 G4Exception("G4OpticalSurface::G4OpticalSurface ==> " 96 101 "Constructor called with INVALID model."); 97 102 } 98 } 99 100 G4OpticalSurface::G4OpticalSurface() 101 : G4SurfaceProperty() 102 { 103 104 AngularDistribution = NULL; 105 106 if (type == dielectric_LUT) { 107 AngularDistribution = 108 new float[incidentIndexMax*thetaIndexMax*phiIndexMax]; 109 ReadFile(); 110 } 103 111 } 104 112 105 113 G4OpticalSurface::~G4OpticalSurface() 106 114 { 115 if (AngularDistribution) delete AngularDistribution; 107 116 } 108 117 … … 143 152 G4cout << polish << G4endl; 144 153 } 154 else if (theModel == LUT ){ 155 G4cout << sigma_alpha << G4endl; 156 } 145 157 else { 146 158 G4cout << sigma_alpha << G4endl; … … 148 160 G4cout << G4endl; 149 161 } 162 163 void G4OpticalSurface::SetType(const G4SurfaceType& type) 164 { 165 theType = type; 166 if (type == dielectric_LUT) { 167 if (!AngularDistribution) AngularDistribution = 168 new float[incidentIndexMax*thetaIndexMax*phiIndexMax]; 169 ReadFile(); 170 } 171 } 172 173 void G4OpticalSurface::SetFinish(const G4OpticalSurfaceFinish finish) 174 { 175 theFinish = finish; 176 if (theType == dielectric_LUT) { 177 if (!AngularDistribution) AngularDistribution = 178 new float[incidentIndexMax*thetaIndexMax*phiIndexMax]; 179 ReadFile(); 180 } 181 } 182 183 void G4OpticalSurface::ReadFile() 184 { 185 G4String readFileName = " "; 186 187 if (theFinish == polishedlumirrorglue) { 188 readFileName = "PolishedLumirrorGlue.dat"; 189 } 190 else if (theFinish == polishedlumirrorair) { 191 readFileName = "PolishedLumirror.dat"; 192 } 193 else if (theFinish == polishedteflonair) { 194 readFileName = "PolishedTeflon.dat"; 195 } 196 else if (theFinish == polishedtioair) { 197 readFileName = "PolishedTiO.dat"; 198 } 199 else if (theFinish == polishedtyvekair) { 200 readFileName = "PolishedTyvek.dat"; 201 } 202 else if (theFinish == polishedvm2000glue) { 203 readFileName = "PolishedVM2000Glue.dat"; 204 } 205 else if (theFinish == polishedvm2000air) { 206 readFileName = "PolishedVM2000.dat"; 207 } 208 else if (theFinish == etchedlumirrorglue) { 209 readFileName = "EtchedLumirrorGlue.dat"; 210 } 211 else if (theFinish == etchedlumirrorair) { 212 readFileName = "EtchedLumirror.dat"; 213 } 214 else if (theFinish == etchedteflonair) { 215 readFileName = "EtchedTeflon.dat"; 216 } 217 else if (theFinish == etchedtioair) { 218 readFileName = "EtchedTiO.dat"; 219 } 220 else if (theFinish == etchedtyvekair) { 221 readFileName = "EtchedTyvek.dat"; 222 } 223 else if (theFinish == etchedvm2000glue) { 224 readFileName = "EtchedVM2000Glue.dat"; 225 } 226 else if (theFinish == etchedvm2000air) { 227 readFileName = "EtchedVM2000.dat"; 228 } 229 else if (theFinish == groundlumirrorglue) { 230 readFileName = "GroundLumirrorGlue.dat"; 231 } 232 else if (theFinish == groundlumirrorair) { 233 readFileName = "GroundLumirror.dat"; 234 } 235 else if (theFinish == groundteflonair) { 236 readFileName = "GroundTeflon.dat"; 237 } 238 else if (theFinish == groundtioair) { 239 readFileName = "GroundTiO.dat"; 240 } 241 else if (theFinish == groundtyvekair) { 242 readFileName = "GroundTyvek.dat"; 243 } 244 else if (theFinish == groundvm2000glue) { 245 readFileName = "GroundVM2000Glue.dat"; 246 } 247 else if (theFinish == groundvm2000air) { 248 readFileName = "GroundVM2000.dat"; 249 } 250 251 if (readFileName == " ") return; 252 253 char* path = getenv("G4REALSURFACEDATA"); 254 if (!path) { 255 G4String excep = 256 "G4OpBoundaryProcess - G4REALSURFACEDATA environment variable not set"; 257 G4Exception(excep); 258 } 259 G4String pathString(path); 260 261 readFileName = pathString + "/" + readFileName; 262 263 // Open LUT with Material and Integer Angle 264 FILE* readFileHandle; 265 266 readFileHandle = fopen(readFileName,"r"); 267 268 if (readFileHandle!=NULL) { 269 for (int i=0;i<incidentIndexMax*thetaIndexMax*phiIndexMax;i++) { 270 fscanf(readFileHandle,"%6f", &AngularDistribution[i]); 271 } 272 G4cout << "LUT - data file: " << readFileName << " read in! " << G4endl; 273 } 274 else { 275 G4String excep = "LUT - data file: " + readFileName + " not found"; 276 G4Exception(excep); 277 } 278 fclose(readFileHandle); 279 }
Note: See TracChangeset
for help on using the changeset viewer.