inducer / inducer/meshmode

[Direct Connection] Group Contributions (probably) should not be summed

Open
#355 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
34
Forks
25
Avg merge
3h 37m
Merged PRs (30d)
2

Description

I was looking at the generated expression for the direct connection expression and it is of the form:
```c
_pt_temp_1[idof_ensm0 + 4 * iel_ensm0 + 1024 * iface_ensm0] =
(from_el_present[iel_ensm0 + 256 * iface_ensm0] ?
normal_1_b_all[from_el_indices[iel_ensm0 + 256 * iface_ensm0]] * 0.5 * (_pt_part_ph_id_0[4 * from_el_indices[iel_ensm0 + 256 * iface_ensm0] + _pt_data_3[idof_ensm0 + 4 * iel_ensm0 + 1024 * iface_ensm0]] + -1.0 * _pt_part_ph_id_0[4 * from_el_indices[iel_ensm0 + 256 * iface_ensm0] + _pt_data_3[idof_ensm0 + 4 * iel_ensm0 + 1024 * iface_ensm0]])
: 0.0)
+ (from_el_present_0[iel_ensm0 + 256 * iface_ensm0] ?
_pt_part_ph_id_1[4 * from_el_indices_0[iel_ensm0 + 256 * iface_ensm0] + _pt_data_4[idof_ensm0 + 4 * iel_ensm0 + 1024 * iface_ensm0]] * normal_1_b_face_restr_interior[from_el_indices_0[iel_ensm0 + 256 * iface_ensm0]]
: 0.0)
+ (from_el_present_1[iel_ensm0 + 256 * iface_ensm0] ?
cse[4 * from_el_indices_2[iel_ensm0 + 256 * iface_ensm0] + _pt_data_6[idof_ensm0 + 4 * iel_ensm0 + 1024 * iface_ensm0]] * normal_1_b_BTAG_PARTITION[from_el_indices_2[iel_ensm0 + 256 * iface_ensm0]]
: 0.0);
```
i.e. it is of the form `(A if B else 0) + (C if D else 0) + (E if F else 0)`, but I think the optimized way of writing this would be `A if B else (C if D else (E if F else 0))`, notice how this could save us some conditional computation i.e. global memory reads.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.