Beispiel #1
0
        /// <summary>
        /// Class that keeps a photon's data as it moves through the tissue
        /// </summary>
        /// <param name="p">Position</param>
        /// <param name="d">Direction</param>
        /// <param name="tissue">Tissue></param>
        /// <param name="currentTissueRegionIndex">integer index within ITissue definition indicating photon's current position</param>
        /// <param name="generator">Random Number Generator</param>
        public Photon(
            Position p,
            Direction d,
            ITissue tissue,
            int currentTissueRegionIndex,
            Random generator)
        {
            DP = new PhotonDataPoint(
                p,
                d,
                1.0,     // weight
                0.0,     // total time
                PhotonStateType.Alive);
            //PreviousDP = null;

            History = new PhotonHistory(tissue.Regions.Count);
            History.AddDPToHistory(DP);  // add initial datapoint
            S     = 0.0;
            SLeft = 0.0;
            CurrentRegionIndex = currentTissueRegionIndex;
            // flag to determin whether passing through specular or not
            // the following assumes tissues considered are slabs, only ones we have coded to date
            // todo: make more general to handle other types of tissues
            _firstTimeEnteringDomain = true;
            if (CurrentRegionIndex >= 1) // photon does not go through specular
            {
                _firstTimeEnteringDomain = false;
            }
            CurrentTrackIndex = 0;
            _tissue           = tissue;
            SetAbsorbAction(_tissue.AbsorptionWeightingType);
            SetScatterAction(_tissue.PhaseFunctionType);
            _rng = generator;
            _russianRouletteWeightThreshold = _tissue.RussianRouletteWeightThreshold;
        }
Beispiel #2
0
        public static UnmanagedHistory ToUnmanagedHistory(this PhotonHistory histptr)
        {
            UnmanagedHistory unmanagedHistory = new UnmanagedHistory();

            //UnmanagedIO.Assign1DPointer(ref histptr.xh, ref unmanagedHistory.xh);
            //UnmanagedIO.Assign1DPointer(ref histptr.yh, ref unmanagedHistory.yh);
            //UnmanagedIO.Assign1DPointer(ref histptr.zh, ref unmanagedHistory.zh);
            //UnmanagedIO.Assign1DPointer(ref histptr.uxh, ref unmanagedHistory.uxh);
            //UnmanagedIO.Assign1DPointer(ref histptr.uyh, ref unmanagedHistory.uyh);
            //UnmanagedIO.Assign1DPointer(ref histptr.uzh, ref unmanagedHistory.uzh);
            //UnmanagedIO.Assign1DPointer(ref histptr.weight, ref unmanagedHistory.weight);
            //UnmanagedIO.Assign1DPointer(ref histptr.pert_wt, ref unmanagedHistory.pert_wt);
            //UnmanagedIO.Assign1DPointer(ref histptr.path_length, ref unmanagedHistory.path_length);
            //UnmanagedIO.Assign1DPointer(ref histptr.boundary_col, ref unmanagedHistory.boundary_col);
            //unmanagedHistory.num_pts_stored = histptr.num_pts_stored;
            //unmanagedHistory.cum_path_length = histptr.cum_path_length;
            return(unmanagedHistory);
        }