본문 바로가기

YADE

O.interactions의 이해

YADE에서 Sphere간의 Contact list는 O.interactions에 정보가 저장되어 있다.

In [43]: type(O.interactions)
Out[43]: yade.wrapper.InteractionContainer

확인해 보면, O.interactions는 C로 만들어 Python으로 wrapping된 custom container이다.

custom container의 attribute는 다음과 같이 확인 가능하다.

In [36]: dir(O.interactions)
Out[36]: 
['__class__',
 '__delattr__',
 '__dict__',
 '__dir__',
 '__doc__',
 '__eq__',
 '__format__',
 '__ge__',
 '__getattribute__',
 '__getitem__',
 '__gt__',
 '__hash__',
 '__init__',
 '__init_subclass__',
 '__instance_size__',
 '__iter__',
 '__le__',
 '__len__',
 '__lt__',
 '__module__',
 '__ne__',
 '__new__',
 '__reduce__',
 '__reduce_ex__',
 '__repr__',
 '__setattr__',
 '__sizeof__',
 '__str__',
 '__subclasshook__',
 '__weakref__',
 'all',
 'clear',
 'countReal',
 'erase',
 'eraseNonReal',
 'has',
 'nth',
 'serializeSorted',
 'withBody',
 'withBodyAll']

여기서 double underscore "__"가 붙어 있는 attribute들은 class 밖에서 변경이 불가능하도록 되어 있는 private한 변수 또는 함수라 하겠다. 이들에 대한 정보를 보려면,

In [42]: O.interactions.__len__()
Out[42]: 2524

이렇게 할 수 있다.

 

'YADE' 카테고리의 다른 글

MPI의 이해  (0) 2023.04.13
matplotlib.pyplot 사용법  (0) 2023.02.07
YADE의 Material  (0) 2023.01.25
Interaction 확인방법  (0) 2023.01.11
Body의 종류 확인방법  (0) 2023.01.11