From c0916fb8d663232baefa9dc8476eaf9745d0fafd Mon Sep 17 00:00:00 2001 From: Philipp Arras <parras@mpa-garching.mpg.de> Date: Thu, 29 Nov 2018 15:12:57 +0200 Subject: [PATCH] Add DomainTuple support to GeometryRemover --- nifty5/operators/simple_linear_operators.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/nifty5/operators/simple_linear_operators.py b/nifty5/operators/simple_linear_operators.py index e69012d96..8804713a8 100644 --- a/nifty5/operators/simple_linear_operators.py +++ b/nifty5/operators/simple_linear_operators.py @@ -131,6 +131,9 @@ class GeometryRemover(LinearOperator): ---------- domain: Domain, tuple of Domain, or DomainTuple: the full input domain of the operator. + space: int, optional + The index of the subdomain on which the operator should act + If None, it acts on all spaces Notes ----- @@ -139,10 +142,14 @@ class GeometryRemover(LinearOperator): is carried out. """ - def __init__(self, domain): + def __init__(self, domain, space=None): self._domain = DomainTuple.make(domain) - target_list = [UnstructuredDomain(dom.shape) for dom in self._domain] - self._target = DomainTuple.make(target_list) + if space is not None: + tgt = [dom for dom in self._domain] + tgt[space] = UnstructuredDomain(self._domain[space].shape) + else: + tgt = [UnstructuredDomain(dom.shape) for dom in self._domain] + self._target = DomainTuple.make(tgt) self._capability = self.TIMES | self.ADJOINT_TIMES def apply(self, x, mode): -- GitLab