Skip to content

Commit

Permalink
remove unecessary changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ig-dolci committed May 8, 2024
1 parent 12c7197 commit 04cdf77
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions firedrake/adjoint_utils/blocks/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,9 @@ def evaluate_tlm(self):
return
output = self.get_outputs()[0]
fs = output.output.function_space()
f = firedrake.Function(fs)
f = type(output.output)(fs)
output.add_tlm_output(
firedrake.Function.assign(f.sub(self.idx), tlm_input)
type(output.output).assign(f.sub(self.idx), tlm_input)
)

def evaluate_hessian_component(self, inputs, hessian_inputs, adj_inputs,
Expand All @@ -271,7 +271,7 @@ def evaluate_hessian_component(self, inputs, hessian_inputs, adj_inputs,
def recompute_component(self, inputs, block_variable, idx, prepared):
sub_func = inputs[0]
parent_in = inputs[1]
parent_out = firedrake.Function(parent_in)
parent_out = type(parent_in)(parent_in)
parent_out.sub(self.idx).assign(sub_func)
return maybe_disk_checkpoint(parent_out)

Expand Down
18 changes: 9 additions & 9 deletions firedrake/adjoint_utils/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ def wrapper(self, *args, **kwargs):
output = subfunctions(self, *args, **kwargs)

if annotate:
output = tuple(firedrake.Function(output[i].function_space(),
output[i],
block_class=SubfunctionBlock,
_ad_floating_active=True,
_ad_args=[self, i],
_ad_output_args=[i],
output_block_class=FunctionMergeBlock,
_ad_outputs=[self],
ad_block_tag=ad_block_tag)
output = tuple(type(self)(output[i].function_space(),
output[i],
block_class=SubfunctionBlock,
_ad_floating_active=True,
_ad_args=[self, i],
_ad_output_args=[i],
output_block_class=FunctionMergeBlock,
_ad_outputs=[self],
ad_block_tag=ad_block_tag)
for i in range(len(output)))
return output
return wrapper
Expand Down

0 comments on commit 04cdf77

Please sign in to comment.