summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Mastbaum <mastbaum@hep.upenn.edu>2012-04-26 13:23:12 -0400
committertlatorre <tlatorre@uchicago.edu>2021-05-09 08:42:39 -0700
commitc5882fe78ca2a4c08784a03c589c4af2a12604e8 (patch)
tree2b5437ba4b16ecb7675b9b0aa6bc40d382777f4b
parent21f9525f4dc83a7d6aac13529c92e010bb046ce9 (diff)
downloadchroma-c5882fe78ca2a4c08784a03c589c4af2a12604e8.tar.gz
chroma-c5882fe78ca2a4c08784a03c589c4af2a12604e8.tar.bz2
chroma-c5882fe78ca2a4c08784a03c589c4af2a12604e8.zip
update python-side gpu structs to reflect cuda changes
this fixes hybrid rendering mode
-rw-r--r--chroma/cuda/geometry_types.h2
-rw-r--r--chroma/cuda/photon.h4
-rw-r--r--chroma/geometry.py6
-rw-r--r--chroma/gpu/geometry.py30
4 files changed, 36 insertions, 6 deletions
diff --git a/chroma/cuda/geometry_types.h b/chroma/cuda/geometry_types.h
index 7db7359..ab54dfa 100644
--- a/chroma/cuda/geometry_types.h
+++ b/chroma/cuda/geometry_types.h
@@ -37,10 +37,10 @@ struct Surface
unsigned int model;
unsigned int n;
unsigned int reemission_n;
+ unsigned int transmissive;
float step;
float wavelength0;
float thickness;
- bool transmissive;
};
struct Triangle
diff --git a/chroma/cuda/photon.h b/chroma/cuda/photon.h
index 26aa3e1..68ea92c 100644
--- a/chroma/cuda/photon.h
+++ b/chroma/cuda/photon.h
@@ -359,7 +359,7 @@ propagate_complex(Photon &p, State &s, curandState &rng, Surface* surface, bool
float uniform_sample = curand_uniform(&rng);
- /* thin film optical model, adapted from RAT PMT optical model by P. Jones */
+ // thin film optical model, adapted from RAT PMT optical model by P. Jones
cuFloatComplex n1 = make_cuFloatComplex(s.refractive_index1, 0.0f);
cuFloatComplex n2 = make_cuFloatComplex(n2_eta, n2_k);
cuFloatComplex n3 = make_cuFloatComplex(s.refractive_index2, 0.0f);
@@ -503,7 +503,7 @@ propagate_complex(Photon &p, State &s, curandState &rng, Surface* surface, bool
p.history |= SURFACE_TRANSMIT;
return CONTINUE;
}
-} // propagate_at_photocathode
+} // propagate_complex
__device__ int
propagate_at_wls(Photon &p, State &s, curandState &rng, Surface *surface, bool use_weights=false)
diff --git a/chroma/geometry.py b/chroma/geometry.py
index 3c85f37..0b5c2a2 100644
--- a/chroma/geometry.py
+++ b/chroma/geometry.py
@@ -168,8 +168,9 @@ vacuum.set('scattering_length', 1e6)
class Surface(object):
"""Surface optical properties."""
- def __init__(self, name='none'):
+ def __init__(self, name='none', model=0):
self.name = name
+ self.model = model
self.set('detect', 0)
self.set('absorb', 0)
@@ -182,6 +183,9 @@ class Surface(object):
self.set('reemission_wavelength', 0)
self.set('reemission_cdf', 0)
+ self.thickness = 0.0
+ self.transmissive = 0
+
def set(self, name, value, wavelengths=standard_wavelengths):
if np.iterable(value):
if len(value) != len(wavelengths):
diff --git a/chroma/gpu/geometry.py b/chroma/gpu/geometry.py
index f2156b0..9622584 100644
--- a/chroma/gpu/geometry.py
+++ b/chroma/gpu/geometry.py
@@ -81,24 +81,50 @@ class GPUGeometry(object):
detect_gpu = ga.to_gpu(detect)
absorb = interp_material_property(wavelengths, surface.absorb)
absorb_gpu = ga.to_gpu(absorb)
+ reemit = interp_material_property(wavelengths, surface.reemit)
+ reemit_gpu = ga.to_gpu(reemit)
+ reflect = interp_material_property(wavelengths, surface.reflect)
+ reflect_gpu = ga.to_gpu(reflect)
reflect_diffuse = interp_material_property(wavelengths, surface.reflect_diffuse)
reflect_diffuse_gpu = ga.to_gpu(reflect_diffuse)
reflect_specular = interp_material_property(wavelengths, surface.reflect_specular)
reflect_specular_gpu = ga.to_gpu(reflect_specular)
+ eta = interp_material_property(wavelengths, surface.eta)
+ eta_gpu = ga.to_gpu(eta)
+ k = interp_material_property(wavelengths, surface.k)
+ k_gpu = ga.to_gpu(k)
+
+ reemission_wavelength = interp_material_property(wavelengths, surface.reemission_wavelength)
+ reemission_wavelength_gpu = ga.to_gpu(reemission_wavelength)
+ reemission_cdf = interp_material_property(wavelengths, surface.reemission_cdf)
+ reemission_cdf_gpu = ga.to_gpu(reemission_cdf)
self.surface_data.append(detect_gpu)
self.surface_data.append(absorb_gpu)
+ self.surface_data.append(reemit_gpu)
+ self.surface_data.append(reflect_gpu)
self.surface_data.append(reflect_diffuse_gpu)
self.surface_data.append(reflect_specular_gpu)
+ self.surface_data.append(eta)
+ self.surface_data.append(k)
+ self.surface_data.append(reemission_wavelength)
+ self.surface_data.append(reemission_cdf)
surface_gpu = \
make_gpu_struct(surface_struct_size,
- [detect_gpu, absorb_gpu,
+ [detect_gpu, absorb_gpu, reemit_gpu, reflect_gpu,
reflect_diffuse_gpu,
reflect_specular_gpu,
+ eta_gpu, k_gpu,
+ reemission_wavelength_gpu,
+ reemission_cdf_gpu,
+ np.uint32(surface.model),
np.uint32(len(wavelengths)),
+ np.uint32(len(reemission_wavelength_gpu)),
+ np.uint32(surface.transmissive),
np.float32(wavelength_step),
- np.float32(wavelengths[0])])
+ np.float32(wavelengths[0]),
+ np.float32(surface.thickness)])
self.surface_ptrs.append(surface_gpu)