diff --git a/ikarus/python/test/linearelastictest.py b/ikarus/python/test/linearelastictest.py index e309b114b..70c15b19f 100644 --- a/ikarus/python/test/linearelastictest.py +++ b/ikarus/python/test/linearelastictest.py @@ -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) diff --git a/ikarus/python/test/nonlinearelastictest.py b/ikarus/python/test/nonlinearelastictest.py index 5c13d806e..5a3ffcc57 100644 --- a/ikarus/python/test/nonlinearelastictest.py +++ b/ikarus/python/test/nonlinearelastictest.py @@ -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)