Skip to content

Commit

Permalink
fixes in python tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rath3t committed Mar 8, 2024
1 parent 26fb449 commit 081099d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
10 changes: 7 additions & 3 deletions ikarus/python/test/linearelastictest.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,14 @@ def volumeLoad(x, lambdaVal):
def neumannLoad(x, lambdaVal):
return np.array([lambdaVal * 0, lambdaVal])

neumannVertices = np.zeros(grid.size(2) * 2, dtype=bool)
assert len(neumannVertices) == len(flatBasis)
neumannVertices = np.zeros(grid.size(2), dtype=bool)

flatBasis.interpolate(neumannVertices, lambda x: True if x[1] > 0.9 else False)
def loadTopEdgePredicate(x):
return True if x[1] > 0.999 else False

indexSet = grid.indexSet
for v in grid.vertices:
neumannVertices[indexSet.index(v)]=loadTopEdgePredicate(v.geometry.center)

boundaryPatch = iks.utils.boundaryPatch(grid, neumannVertices)

Expand Down
10 changes: 7 additions & 3 deletions ikarus/python/test/nonlinearelastictest.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,14 @@ def volumeLoad(x, lambdaVal):
def neumannLoad(x, lambdaVal):
return np.array([lambdaVal * 0, lambdaVal])

neumannVertices = np.zeros(grid.size(2) * 2, dtype=bool)
assert len(neumannVertices) == len(flatBasis)
neumannVertices = np.zeros(grid.size(2), dtype=bool)

flatBasis.interpolate(neumannVertices, lambda x: True if x[1] > 0.9 else False)
def loadTopEdgePredicate(x):
return True if x[1] > 0.9 else False

indexSet = grid.indexSet
for v in grid.vertices:
neumannVertices[indexSet.index(v)]=loadTopEdgePredicate(v.geometry.center)

boundaryPatch = iks.utils.boundaryPatch(grid, neumannVertices)

Expand Down

0 comments on commit 081099d

Please sign in to comment.