Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

Photin.cxx

Go to the documentation of this file.
00001 // -*- C++ -*-  $Id: Photin.cxx,v 1.1 2000/09/01 20:20:16 burnett Exp $
00002 //
00003 // This file is part of Gismo 2
00004 //
00005 #include "Photin.h"
00006 
00007 void Photin::readPEGS(std::istream& fin, int m, int iray1)
00008 {
00009    mge = m;
00010 
00011    fin >> ebinda >> ge0 >> ge1;
00012 
00013    gmfp0 = new float[mge];
00014    gmfp1 = new float[mge];
00015    gbr10 = new float[mge];
00016    gbr11 = new float[mge];
00017    gbr20 = new float[mge];
00018    gbr21 = new float[mge];
00019 
00020    int i;
00021    for (i=0; i< mge; i++)
00022    {
00023       fin >> gmfp0[i] >> gmfp1[i]
00024           >> gbr10[i] >> gbr11[i]
00025           >> gbr20[i] >> gbr21[i] ;
00026    }
00027 
00028    // optional Rayleigh scattering input
00029 
00030    if (iray1)
00031    {
00032       fin >> ngr >> rco0 >> rco1;
00033       cohe0 = new float[mge];
00034       cohe1 = new float[mge];
00035       rsct0 = new float[ngr];
00036       rsct1 = new float[ngr];
00037 
00038       for (i=0; i<ngr; i++)  fin >> rsct0[i] >> rsct1[i];
00039       for (i=0; i<mge; i++)  fin >> cohe0[i] >> cohe1[i];
00040    }else
00041           ngr = 0;
00042 
00043     
00044 }
00045 
00046 // Following is equivalent to the EGS4 macros
00047 //        $set interval xxx,rco;
00048 //        $evaluate x2 using rsct(xxx);
00049 
00050 float Photin::rsct(float xxx)const
00051 {
00052     int lxxx=static_cast<int>(rco1*xxx+rco0 -1);
00053     return rsct1[lxxx]*xxx+rsct0[lxxx];
00054 }
00055 
00056 void Photin::rescale(float dfact)
00057 {
00058    for (int i=0; i<mge; i++)
00059    {
00060       gmfp0[i] *= dfact;
00061       gmfp1[i] *= dfact;
00062    }
00063 }
00064 
00065 Photin::~Photin()
00066 {
00067     if( mge==0) return;
00068     delete [] gmfp0;
00069     delete [] gmfp1;
00070     delete [] gbr10;
00071     delete [] gbr11;
00072     delete [] gbr20;
00073     delete [] gbr21;
00074     if( ngr ) {
00075         delete [] cohe0;
00076         delete [] cohe1;
00077         delete [] rsct0;
00078         delete [] rsct1;
00079     }
00080 
00081 }

Generated at Wed Nov 21 12:20:26 2001 by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000