You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Speed up initialization of boundary conditions onto the grid #85
Before the electric potential is calculated via SOR, the initial boundary conditions are applied onto the grid
and some constant weights (needed in the SOR) are precalculated. This also happens after each grid refinement.
If there are many objects in the world, e.g. highly pixelated detectors, and the grid becomes finer and finer,
these precalculations actually can take quite some time.
There are some ways to improve this:
Get rid of unnecessary point conversions
The time critical part is the lookup to which object each individual point belongs: the in-method.
Right now, we only parse the grid point in form of the coordinate system of the world, e.g. cylindrical coordinates, to this method. Depending on the geometry of the object, the parsed point might be converted into the other coordinate system, e.g. cartesian. And this several times. We should do this just once and parse the point in both forms to the in methods.
Clustering of objects
Divide the grid in subgrids and add an external additinal loop running over those subgrids (in parallel).
But before executing this loop, all objects should be assigned to all subgrids in which they might be located.
Thus, in each subgrid there are less objects to be checked reducing the calls of in.
This might also be used in order to speed up the charge drift.
Per-object bounding-sphere culling (commit d55919c): every classification
loop now skips the CSG in tree walk for grid points provably outside a
conservative bounding sphere of the object (primitive extremum + set-algebra
for union/difference/intersection). Point classification on a 3.4M-point BEGe
grid drops 2.2 s → 1.1 s with bit-identical potentials, point types and
impurity scales. This is a lightweight take on the "clustering of objects"
idea — per-object bounding volume against the point instead of subgrid
assignment — with none of the bookkeeping.
Single coordinate conversion (commit 8d04cb3): the culling already needs
the Cartesian form of each cylindrical grid point; it is now passed to the
containment test too, so primitives no longer re-convert the CylindricalPoint —
the first unchecked item of this issue, for the classification loops.
Honest numbers: after culling this is only ~2 % further (culled points never
reach the tree walk), so the box is checked mostly structurally; it matters
more for many-object detectors.
Remaining from the original list, still open:
The conversion is still performed once per object sweep, not once per grid
point — sharing it requires inverting the loop nesting (objects outer → points
outer), which would also fix the current thread oversubscription when several
classification passes run.
True spatial clustering/subgrids would further help highly pixelated
detectors, where many objects' spheres overlap each grid region — and could,
as noted here originally, speed up charge drift too.
Activity
oschulz commentedon Jul 19, 2026
Status update from the 2026-07 review branch:
loop now skips the CSG
intree walk for grid points provably outside aconservative bounding sphere of the object (primitive
extremum+ set-algebrafor union/difference/intersection). Point classification on a 3.4M-point BEGe
grid drops 2.2 s → 1.1 s with bit-identical potentials, point types and
impurity scales. This is a lightweight take on the "clustering of objects"
idea — per-object bounding volume against the point instead of subgrid
assignment — with none of the bookkeeping.
the Cartesian form of each cylindrical grid point; it is now passed to the
containment test too, so primitives no longer re-convert the CylindricalPoint —
the first unchecked item of this issue, for the classification loops.
Honest numbers: after culling this is only ~2 % further (culled points never
reach the tree walk), so the box is checked mostly structurally; it matters
more for many-object detectors.
Remaining from the original list, still open:
point — sharing it requires inverting the loop nesting (objects outer → points
outer), which would also fix the current thread oversubscription when several
classification passes run.
detectors, where many objects' spheres overlap each grid region — and could,
as noted here originally, speed up charge drift too.
Convert cylindrical grid points to Cartesian once per containment test
Cull grid-point containment tests with bounding spheres
Cull grid-point containment tests with bounding spheres
fhagemann commentedon Nov 17, 2026
Check whether the
bounding_sphereimplementation in #644 is considered a fix for this.