Commit 52dce14a authored by Matthieu Constant's avatar Matthieu Constant
Browse files

fluid.py

parent 10bfbb51
......@@ -36,7 +36,7 @@ class StrongBoundary(Structure):
class fluid_problem :
def __init__(self, mesh_file_name, g, mu, rho, epsilon, strong_boundaries, noGrains):
def __init__(self, mesh_file_name, g, mu, rho, epsilon, strong_boundaries, noGrains, n_fluids):
nsb = len(strong_boundaries)
class Bnd :
def __init__(self, b) :
......@@ -48,11 +48,17 @@ class fluid_problem :
v[:] = self._b(x)
else :
v[:] = self._b
def np2c(a) :
tmp = numpy.require(a,"float","C")
r = c_void_p(tmp.ctypes.data)
r.tmp = tmp
return r
asb = (StrongBoundary*nsb)(*[StrongBoundary(i[0].encode(),i[1],BNDCB(Bnd(i[2]).apply)) for i in strong_boundaries])
self.asb = asb
lib.fluid_problem_new.restype = c_void_p
self._fp = c_void_p(lib.fluid_problem_new(mesh_file_name.encode(), c_double(g), c_double(mu), c_double(rho), c_double(epsilon), nsb, asb, c_int(noGrains)))
self._fp = c_void_p(lib.fluid_problem_new(mesh_file_name.encode(), c_double(g), np2c(mu), np2c(rho), c_double(epsilon), nsb, asb, c_int(noGrains), c_int(n_fluids)))
if self._fp == None :
raise NameError("cannot create fluid problem")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment