aboutsummaryrefslogtreecommitdiff
path: root/src/Makefile
blob: f1b4f0d4de23764183eb648aa7b4abd20654d552 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
release_hdr := $(shell sh -c './mkreleasehdr.sh')

CFLAGS=-fdiagnostics-color -O2 -Wall -g -DSWAP_BYTES
LDLIBS=-fdiagnostics-color -lm -lgsl -lgslcblas -lnlopt_cxx -lstdc++

all: test test-vector test-likelihood fit test-charge test-path calculate-csda-range test-time-pdf test-zebra test-find-peaks

Makefile.dep:
	-$(CC) -MM *.c > Makefile.dep

-include Makefile.dep

calculate_limits: calculate_limits.c

solid_angle.o: solid_angle.c

test: test.o solid_angle.o optics.o muon.o vector.o quantum_efficiency.o pdg.o scattering.o misc.o mt19937ar.o sno_charge.o path.o random.o pmt_response.o db.o dict.o siphash.o electron.o proton.o likelihood.o pmt.o quad.o find_peaks.o util.o

test-vector: test-vector.o vector.o mt19937ar.o

test-likelihood: test-likelihood.o muon.o random.o optics.o quantum_efficiency.o mt19937ar.o pdg.o vector.o solid_angle.o scattering.o pmt_response.o db.o dict.o siphash.o misc.o util.o

test-path: test-path.o mt19937ar.o vector.o path.o random.o misc.o

test-charge: test-charge.o sno_charge.o misc.o vector.o

test-time-pdf: test-time-pdf.o zebra.o likelihood.o pmt.o vector.o misc.o muon.o optics.o quantum_efficiency.o solid_angle.o pdg.o scattering.o zdab_utils.o pack2b.o sno_charge.o db.o dqxx.o dict.o siphash.o path.o pmt_response.o release.o electron.o proton.o util.o

test-zebra: test-zebra.o zebra.o pack2b.o

fit: fit.o zebra.o likelihood.o pmt.o vector.o misc.o muon.o optics.o quantum_efficiency.o solid_angle.o pdg.o scattering.o zdab_utils.o pack2b.o sno_charge.o db.o dqxx.o dict.o siphash.o path.o pmt_response.o release.o electron.o proton.o find_peaks.o quad.o dc.o sort.o util.o

test-find-peaks: test-find-peaks.o zebra.o likelihood.o pmt.o vector.o misc.o muon.o optics.o quantum_efficiency.o solid_angle.o pdg.o scattering.o zdab_utils.o pack2b.o sno_charge.o db.o dqxx.o dict.o siphash.o path.o pmt_response.o release.o electron.o proton.o find_peaks.o util.o quad.o

calculate-csda-range: calculate-csda-range.o

clean:
	rm -f *.o calculate_limits test test-vector test-likelihood fit test-charge test-path calculate-csda-range test-time-pdf test-zebra test-find-peaks Makefile.dep

.PHONY: all clean
span>neg_origin_inv_dir, inv_dir, g, root, min_distance)) return -1; unsigned int child_ptr_stack[STACK_SIZE]; unsigned int nchild_ptr_stack[STACK_SIZE]; child_ptr_stack[0] = root.child; nchild_ptr_stack[0] = root.nchild; int curr = 0; unsigned int count = 0; unsigned int tri_count = 0; while (curr >= 0) { unsigned int first_child = child_ptr_stack[curr]; unsigned int nchild = nchild_ptr_stack[curr]; curr--; for (unsigned int i=first_child; i < first_child + nchild; i++) { Node node = get_node(g, i); count++; if (intersect_node(neg_origin_inv_dir, inv_dir, g, node, min_distance)) { if (node.nchild == 0) { /* leaf node */ // This node wraps a triangle if (node.child != last_hit_triangle) { // Can't hit same triangle twice in a row tri_count++; Triangle t = get_triangle(g, node.child); if (intersect_triangle(origin, direction, t, distance)) { if (triangle_index == -1 || distance < min_distance) { triangle_index = node.child; min_distance = distance; } // if hit triangle is closer than previous hits } // if hit triangle } // if not hitting same triangle as last step } else { curr++; child_ptr_stack[curr] = node.child; nchild_ptr_stack[curr] = node.nchild; } // leaf or internal node? } // hit node? if (curr >= STACK_SIZE) { printf("warning: intersect_mesh() aborted; node > tail\n"); break; } } // loop over children, starting with first_child } // while nodes on stack //if (blockIdx.x == 0 && threadIdx.x == 0) { // printf("node count: %d\n", count); // printf("triangle count: %d\n", tri_count); //} return triangle_index; } extern "C" { __global__ void distance_to_mesh(int nthreads, float3 *_origin, float3 *_direction, Geometry *g, float *_distance) { __shared__ Geometry sg; if (threadIdx.x == 0) sg = *g; __syncthreads(); int id = blockIdx.x*blockDim.x + threadIdx.x; if (id >= nthreads) return; g = &sg; float3 origin = _origin[id]; float3 direction = _direction[id]; direction /= norm(direction); float distance; int triangle_index = intersect_mesh(origin, direction, g, distance); if (triangle_index != -1) _distance[id] = distance; } __global__ void color_solids(int first_triangle, int nthreads, int *solid_id_map, bool *solid_hit, unsigned int *solid_colors, Geometry *g) { int id = blockIdx.x*blockDim.x + threadIdx.x; if (id >= nthreads) return; int triangle_id = first_triangle + id; int solid_id = solid_id_map[triangle_id]; if (solid_hit[solid_id]) g->colors[triangle_id] = solid_colors[solid_id]; } } // extern "C" #endif