Skip to content

addFluidModel python function error #329

@GUT2060

Description

@GUT2060

Hi ,
I'm trying to add a fluid model to the simulation directly using vectors of positions and velocities here is a snap of a code example :

`import pysplishsplash as sph
 import pysplishsplash.Utilities as sph_utils
----------------------------------------------
base = sph.Exec.SimulatorBase()
base.init(sceneFile=sph.Extras.Scenes.Empty)

# Create an imgui simulator
gui = sph.GUI.Simulator_GUI_imgui(base)
base.setGui(gui)

p,v = sph_utils.VecVector3r(),sph_utils.VecVector3r()
p.append([0.0,0.0,0.0])
p.append([1.0,1.0,1.0])
v.append([0.0,0.0,0.0])
v.append([0.0,0.0,0.0])
p_id = [1,1]

sim = sph.Simulation.getCurrent()
sim.setParticleRadius(powder.sample_radius)
sim.addFluidModel('Fluid', p, v, p_id, int(0))`

# init the simulation
base.initSimulation()
base.runSimulation()
base.cleanup()

the script however crashes without error; after some debugging it turned out that the line of the c++ code:
m_pointSetIndex = neighborhoodSearch->add_point_set(&getPosition(0)[0], nFluidParticles, true, true, true, this);
in the initModel(...) function part of addFluidModel(...) is causing the crash.

any idea on why is this happening and how to fix it ?
Thanks !

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions