Skip to content

Commit

Permalink
Merge pull request #306 from sblauth/fix/change_order
Browse files Browse the repository at this point in the history
Change order of post_callback and gradient norm computation
  • Loading branch information
sblauth authored Sep 13, 2023
2 parents b6292d7 + 4d5ef90 commit 8f36a06
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions cashocs/_pde_problems/shape_gradient_problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,6 @@ def solve(self) -> List[fenics.Function]:
self.p_laplace_projector.solve()
self.has_solution = True

self.gradient_norm_squared = self.form_handler.scalar_product(
self.db.function_db.gradient, self.db.function_db.gradient
)

else:
self.form_handler.assembler.assemble(
self.form_handler.fe_shape_derivative_vector
Expand All @@ -153,12 +149,12 @@ def solve(self) -> List[fenics.Function]:

self.has_solution = True

self.gradient_norm_squared = self.form_handler.scalar_product(
self.db.function_db.gradient, self.db.function_db.gradient
)

self.db.callback.call_post()

self.gradient_norm_squared = self.form_handler.scalar_product(
self.db.function_db.gradient, self.db.function_db.gradient
)

return self.db.function_db.gradient


Expand Down

0 comments on commit 8f36a06

Please sign in to comment.