def Transition(self,xp,eikonal,vg,orb): t = [] for surf in self.surfaces: t.append(surf.GlobalDetect(xp,eikonal,vg)) for idx,surf in enumerate(self.surfaces): impact = self.SelectRaysForSurface(t,idx) if impact.shape[0]>0: xps,eiks,vgs = ray_kernel.ExtractRays(impact,xp,eikonal,vg) surf.Propagate(xps,eiks,vgs,vol_obj=self) ray_kernel.UpdateRays(impact,xp,eikonal,vg,xps,eiks,vgs) self.UpdateOrbits(xp,eikonal,orb)
def Propagate(self, xp, eikonal, vg, orb={'idx': 0}, vol_obj=0): '''Propagate rays through a surface mesh. The medium on either side must be uniform.''' self.RaysGlobalToLocal(xp, eikonal, vg) dt, impact = self.Detect(xp, vg) dts = dt[impact, ...] simps = self.simplices[impact] xps, eiks, vgs = ray_kernel.ExtractRays(impact, xp, eikonal, vg) # propagate bundles one at a time for bundle in range(xps.shape[0]): dt1 = dts[[bundle], ...] xp1, eik1, vg1 = ray_kernel.ExtractRays([bundle], xps, eiks, vgs) ray_kernel.FullStep(dt1, xp1, eik1, vg1) simplex = self.GetTriangle(simps[bundle]) simplex.RaysGlobalToLocal(xp1, eik1, vg1) simplex.Deflect(xp1, eik1, vg1, vol_obj) simplex.SafetyNudge(xp1, vg1) simplex.RaysLocalToGlobal(xp1, eik1, vg1) ray_kernel.UpdateRays([bundle], xps, eiks, vgs, xp1, eik1, vg1) ray_kernel.UpdateRays(impact, xp, eikonal, vg, xps, eiks, vgs) self.RaysLocalToGlobal(xp, eikonal, vg) self.UpdateOrbits(xp, eikonal, orb)
def Propagate(self, xp, eikonal, vg, orb={'idx': 0}, vol_obj=0): '''The main function to propagate ray bundles through the surface. Rays are left slightly downstream of the surface.''' self.RaysGlobalToLocal(xp, eikonal, vg) dt, impact = self.Detect(xp, vg) if impact.shape[0] > 0: dts = dt[impact, ...] xps, eiks, vgs = ray_kernel.ExtractRays(impact, xp, eikonal, vg) ray_kernel.FullStep(dts, xps, eiks, vgs) self.Deflect(xps, eiks, vgs, vol_obj) self.SafetyNudge(xps, vgs) ray_kernel.UpdateRays(impact, xp, eikonal, vg, xps, eiks, vgs) self.RaysLocalToGlobal(xp, eikonal, vg) self.UpdateOrbits(xp, eikonal, orb) return impact.shape[0]
def Propagate(self, xp, eikonal, vg, orb={'idx': 0}): self.RaysGlobalToLocal(xp, eikonal, vg) dt, impact = self.Detect(xp, vg) xps, eiks, vgs = ray_kernel.ExtractRays(impact, xp, eikonal, vg) ray_kernel.FullStep(dt[impact, ...], xps, eiks, vgs) ray_kernel.UpdateRays(impact, xp, eikonal, vg, xps, eiks, vgs) # Frequency filtering sel = np.intersect1d(self.SelectBand(xp), impact) self.xps = np.copy(xp[sel, 0, :]) self.eiks = np.copy(eikonal[sel, ...]) self.micro_action = ray_kernel.GetMicroAction(xp, eikonal, vg) self.transversality = ray_kernel.GetTransversality(xp, eikonal) self.hits = impact.shape[0] self.filtered_hits = sel.shape[0] self.RaysLocalToGlobal(xp, eikonal, vg) self.UpdateOrbits(xp, eikonal, orb) return impact.shape[0]