Page 1 of 1

createVoxelization() and getPosition(), getVelocity() and other functions

Posted: Tue Jan 30, 2018 5:13 am
by duke3d
Hi everyone :)

Recently I tried createVoxelization(). It makes searching neighbors work really fast. However, there is a problem which makes utilization of this function useless :(
Here is part of my code:

FramesPre:

defDist = scene.getGlobalVariableValue("defDist")
search_dist = defDist * 3.0
pList = dom.getParticles()

DY_Domain01.createVoxelization()
print ("Voxelization() is ON!")
for particle in pList:
pPos = particle.getPosition()
pId = particle.getId()
#scene.message(str(pPos))
nList = dom.getNeighbors(pPos, search_dist)
#print(str(len(nList)))
if (len(nList) > 0 ):
#print("IF condition started")
#print(str(len(nList)))
Frc = 0.0
n = Vector.new(0.0, 0.0, 0.0)
#print("!!!2nd cycle FOR started!!!")
for nparticle in nList:
npPos = nparticle.getPosition()
#dist = (npPos-pPos)
#dist_m = dist.module()
k = 0.0

#print("!!!2nd cycle FOR ended!!!")

DY_Domain01.destroyVoxelization()
print ("!Voxelization() is OFF!")

The problem is for nparticle in nList: part. Every time I call any function like getId() or getPosition() (and other get-functions) Realflow crushes. Other things like print(), scene.message() or different calculations work.The problem occurs only with particles in a list of neighboring particles. Calling any get-functions for other particles in mentioned section of the code cause no crushes.

Any ideas what is going on or how to fix it?

Thanks guys,
Andrey

Re: createVoxelization() and getPosition(), getVelocity() and other functions

Posted: Tue Jan 30, 2018 12:13 pm
by Thomas Schlick
This is starting to kill me, really. I've been able to reproduce this issue and it's definitely something serious. I've also tried to loop through neighbours with an alternative method, but it's also crashing with as long createVoxelization() is being used.

As I've said in my previous post, createVoxelization() may cause errors and if you observe problems please don't use it. That's the only workaround right now - even if it's slower.

Re: createVoxelization() and getPosition(), getVelocity() and other functions

Posted: Wed Jan 31, 2018 5:07 am
by duke3d
Just some observation:
When createVoxelization() is used with standard particles it cause no crashes, but (I have this kind of BUT too often in last few weeks :))) ) it slows down searching process dramatically O.o
Without createVoxelization(), searching Standard particles works much faster then searching Dyverso particles with usage of createVoxelization().