Skip to content

Commit

Permalink
getting rid of repeated function definition
Browse files Browse the repository at this point in the history
  • Loading branch information
ralberd committed Jan 14, 2024
1 parent 24b4f32 commit 2b15305
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions optimism/inverse/MechanicsInverse.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,9 @@
ResidualInverseFunctions = namedtuple('ResidualInverseFunctions',
['residual_jac_coords_vjp'])

def _compute_quadrature_point_field_gradient(u, shapeGrad):
dg = np.tensordot(u, shapeGrad, axes=[0,0])
return dg

def _compute_element_field_gradient(U, elemShapeGrads, elemConnectivity, modify_element_gradient):
elemNodalDisps = U[elemConnectivity]
elemGrads = vmap(_compute_quadrature_point_field_gradient, (None, 0))(elemNodalDisps, elemShapeGrads)
elemGrads = vmap(FunctionSpace.compute_quadrature_point_field_gradient, (None, 0))(elemNodalDisps, elemShapeGrads)
elemGrads = modify_element_gradient(elemGrads)
return elemGrads

Expand Down

0 comments on commit 2b15305

Please sign in to comment.