# Path: pyparticles/utils/pypart_global.py
# def test_pyopencl():
#     try :
#         import pyopencl
#     except :
#         return False
#     else :
#         return True


import numpy as np
import pyparticles.pset.particles_set as ps
import pyparticles.pset.opencl_context as occ 
import pyparticles.ode.euler_solver as els
import pyparticles.ode.leapfrog_solver as lps
import pyparticles.ode.runge_kutta_solver as rks
import pyparticles.ode.stormer_verlet_solver as svs
import pyparticles.ode.midpoint_solver as mds
import pyparticles.forces.const_force as cf
import pyparticles.forces.drag as dr
import pyparticles.forces.multiple_force as mf
import pyparticles.animation.animated_ogl as aogl
import pyparticles.pset.default_boundary as db
from pyparticles.utils.pypart_global import test_pyopencl




def default_pos( pset , indx ):
    
    t = default_pos.sim_time.time
    
    pset.X[indx,:] = 0.01 * np.random.rand( len(indx) , pset.dim ).astype( pset.dtype )
    
    fs = 1.0 / ( 1.0 + np.exp( -( t*4.0 - 2.0 ) ) ) 
    
    alpha = 2.0 * np.pi * np.random.rand( len(indx) ).astype( pset.dtype ) 
    
    vel_x = 2.0 * fs * np.cos( alpha )
    vel_y = 2.0 * fs * np.sin( alpha )
        
    pset.V[indx,0] = vel_x  
    pset.V[indx,1] = vel_y 
    pset.V[indx,2] = 10.0 * fs + 1.0 * fs * ( np.random.rand( len(indx)) )


def fountain():
    """
    Fountain demo
    """
    steps = 10000000
    dt = 0.005
    pcnt = 100000

    fl = True

# Path: pyparticles/utils/pypart_global.py
# def test_pyopencl():
#     try :
#         import pyopencl
#     except :
#         return False
#     else :
#         return True


# Path: pyparticles/demo/fountain.py
import numpy as np
import pyparticles.pset.particles_set as ps
import pyparticles.pset.opencl_context as occ 
import pyparticles.ode.euler_solver as els
import pyparticles.ode.leapfrog_solver as lps
import pyparticles.ode.runge_kutta_solver as rks
import pyparticles.ode.stormer_verlet_solver as svs
import pyparticles.ode.midpoint_solver as mds
import pyparticles.forces.const_force as cf
import pyparticles.forces.drag as dr
import pyparticles.forces.multiple_force as mf
import pyparticles.animation.animated_ogl as aogl
import pyparticles.pset.default_boundary as db
from pyparticles.utils.pypart_global import test_pyopencl




def default_pos( pset , indx ):
    
    t = default_pos.sim_time.time
    
    pset.X[indx,:] = 0.01 * np.random.rand( len(indx) , pset.dim ).astype( pset.dtype )
    
    fs = 1.0 / ( 1.0 + np.exp( -( t*4.0 - 2.0 ) ) ) 
    
    alpha = 2.0 * np.pi * np.random.rand( len(indx) ).astype( pset.dtype ) 
    
    vel_x = 2.0 * fs * np.cos( alpha )
    vel_y = 2.0 * fs * np.sin( alpha )
        
    pset.V[indx,0] = vel_x  
    pset.V[indx,1] = vel_y 
    pset.V[indx,2] = 10.0 * fs + 1.0 * fs * ( np.random.rand( len(indx)) )


def fountain():
    """
    Fountain demo
    """
    steps = 10000000
    dt = 0.005
    pcnt = 100000

    fl = True

    if test_pyopencl() :
