teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

コード

2018/12/29 11:13

投稿

aine_
aine_

スコア22

title CHANGED
File without changes
body CHANGED
@@ -24,6 +24,18 @@
24
24
  where( z <= 0 )[0]) )
25
25
  ```
26
26
  しかしこのようにした場合ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()と表示されてしまいます。
27
+ また、
28
+ ```python
29
+ indices = concatenate( (where(y>=0.5 , x < 1.0)[0],
30
+ where(y<=-0.5 , x < 1.0)[0],
31
+ where( y <= -3.0 , x >= 1.0)[0],
32
+ where( y >= 3.0 , x >= 1.0)[0],
33
+ where( x >= 3.0 )[0],
34
+ where( x <= 0 )[0],
35
+ where( z <= 0 )[0]) )
36
+ ```
37
+ とした場合はValueError: either both or neither of x and y should be given
38
+ となります。T字とするのは不可能なのでしょうか?
27
39
  どのようにすればよいのでしょうか?
28
40
  一応オープンソースであるため以下にコード全体も貼っておきます。
29
41
  長方形の水槽に水を置いた場合の挙動をシミュレーションするモデルの設計となっています。

1

コード編集

2018/12/29 11:13

投稿

aine_
aine_

スコア22

title CHANGED
File without changes
body CHANGED
@@ -143,6 +143,7 @@
143
143
  obstacle = pa.extract_particles(oa)
144
144
  obstacle.set_name('obstacle')
145
145
 
146
+ #上に乗せた部分はここです。cw2などは編集しました。
146
147
  indices = concatenate( (where(y>=0.5 and x < 1.0)[0],
147
148
  where(y<=-0.5 and x < 1.0)[0],
148
149
  where( y <= -cw2 and x >= 1.0)[0],