split example visualizaiton pipeline
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user