|
13 | 13 |
|
14 | 14 | from .future import FutureField, FutureLockedField |
15 | 15 | from .field import Field, LockedField |
| 16 | +from .operators import Copy |
16 | 17 | from ..tools.cache import CachedAttribute |
17 | 18 | from ..tools.general import OrderedSet |
18 | 19 | from ..tools.general import oscillate |
@@ -127,22 +128,19 @@ def evaluate_handlers(self, handlers, id=None, **kw): |
127 | 128 | # Attempt evaluation |
128 | 129 | tasks = self.attempt_tasks(tasks, id=id) |
129 | 130 |
|
130 | | - # # Transform all outputs to coefficient layout to dealias |
131 | | - ## D3 note: need to worry about this for redundent tasks? |
132 | | - # outputs = OrderedSet([t['out'] for h in handlers for t in h.tasks]) |
133 | | - # self.require_coeff_space(outputs) |
134 | | - |
135 | | - # # Copy redundant outputs so processing is independent |
136 | | - # outputs = set() |
137 | | - # for handler in handlers: |
138 | | - # for task in handler.tasks: |
139 | | - # if task['out'] in outputs: |
140 | | - # task['out'] = task['out'].copy() |
141 | | - # else: |
142 | | - # outputs.add(task['out']) |
| 131 | + # Transform all outputs to coefficient layout to dealias |
143 | 132 | outputs = OrderedSet([t['out'] for h in handlers for t in h.tasks if not isinstance(t['out'], LockedField)]) |
144 | 133 | self.require_coeff_space(outputs) |
145 | 134 |
|
| 135 | + # Copy redundant outputs so processing is independent |
| 136 | + outputs = set() |
| 137 | + for handler in handlers: |
| 138 | + for task in handler.tasks: |
| 139 | + if task['out'] in outputs: |
| 140 | + task['out'] = task['out'].copy() |
| 141 | + else: |
| 142 | + outputs.add(task['out']) |
| 143 | + |
146 | 144 | # Process |
147 | 145 | for handler in handlers: |
148 | 146 | handler.process(**kw) |
@@ -285,10 +283,9 @@ def add_task(self, task, layout='g', name=None, scales=None): |
285 | 283 | # Create operator |
286 | 284 | if isinstance(task, str): |
287 | 285 | op = FutureField.parse(task, self.vars, self.dist) |
| 286 | + elif isinstance(task, Field): |
| 287 | + op = Copy(task) |
288 | 288 | else: |
289 | | - # op = FutureField.cast(task, self.domain) |
290 | | - # op = Cast(task) |
291 | | - # TODO: figure out if we need to copying here |
292 | 289 | op = task |
293 | 290 | # Check scales |
294 | 291 | if isinstance(op, (LockedField, FutureLockedField)): |
|
0 commit comments