split example visualizaiton pipeline

This commit is contained in:
ykcheungab
2026-06-18 13:47:16 +08:00
parent fbee1c37ed
commit f19f092b64
42 changed files with 3067 additions and 702 deletions
+6 -3
View File
@@ -17,7 +17,10 @@ class MaskedSparseSolver:
if rhs.size == 0:
return numpy.zeros_like(f, dtype=numpy.float32)
sol_active = domain.factor(rhs) # (N,) reduced-system potential
# MaskedDomain builds a positive diagonal / negative off-diagonal stencil
# for (-Laplace). Negate the direct solve result so the masked sparse path
# matches the FFT solver convention used elsewhere: Laplace(u) = rhs.
sol_active = -domain.factor(rhs) # (N,) reduced-system potential
return domain.scatter(sol_active, f)
def solve_pair(self, f0, f1, domain: MaskedDomain):
@@ -28,9 +31,9 @@ class MaskedSparseSolver:
return empty, empty.copy()
try:
sol_pair = domain.factor(rhs_pair) # (N, 2) reduced-system potentials
sol_pair = -domain.factor(rhs_pair) # (N, 2) reduced-system potentials
except Exception:
sol_pair = numpy.column_stack(
sol_pair = -numpy.column_stack(
[domain.factor(rhs_pair[:, 0]), domain.factor(rhs_pair[:, 1])]
)
return domain.scatter_pair(sol_pair, f0)