Python wrapper for running instances of trisurf-ng
Samo Penic
2019-08-15 d5ddc0a56d9f52f27fb6edcc2fa1caf66fdb9eb0
Fixed argtypes in wrapper
1 files modified
57 ■■■■■ changed files
trisurf/wrapper.py 57 ●●●●● patch | view | raw | blame | history
trisurf/wrapper.py
@@ -214,26 +214,26 @@
#function call wrappers
def create_vesicle_from_tape(tape):
    """Using pointer for tape, it creates a vesicle, returning pointer to it."""
    ts.create_vesicle_from_tape.argtype=POINTER(ts_tape)
    ts.create_vesicle_from_tape.argtypes=POINTER(ts_tape)
    ts.create_vesicle_from_tape.restype=POINTER(ts_vesicle)
    return ts.create_vesicle_from_tape(tape)
def parsetape(filename='tape'):
    """Loads tape with  filename (if not given it defaults to 'tape'). It returns a pointer to structure for tape"""
    ts.parsetape.restype=POINTER(ts_tape)
    ts.parsetape.argtype=[c_char_p]
    ts.parsetape.argtypes=[c_char_p]
    return ts.parsetape(filename.encode('ascii'))
def parseDump(filename):
    """Loads a vtu file with 'filename' and creates a vesicle returning pointer to it"""
    ts.parseDump.argtype=[c_char_p]
    ts.parseDump.argtypes=[c_char_p]
    ts.parseDump.restype=POINTER(ts_vesicle)
    vesicle=ts.parseDump(filename.encode('ascii'))
    return vesicle
def single_timestep(vesicle):
    """Makes a single timestep in simulations. Returns a tuple of vmsrt and bfrt (vertex move success rate and bond flip success rate)"""
    ts.single_timestep.argtype=[POINTER(ts_vesicle),POINTER(c_double),POINTER(c_double)]
    ts.single_timestep.argtypes=[POINTER(ts_vesicle),POINTER(c_double),POINTER(c_double)]
    vmsrt=c_double(0.0)
    bfsrt=c_double(0.0)
    ts.single_timestep(vesicle,byref(vmsrt),byref(bfsrt))
@@ -241,25 +241,25 @@
def write_vertex_xml_file(vesicle,timestep_no=0):
    """Writes a vesicle into file with filename 'timestep_XXXXXX.vtu', where XXXXXX is a leading zeroed number given with timestep_no parameter (defaults to 0 if not given"""
    ts.write_vertex_xml_file.argtypes=[POINTER(ts_vesicle),c_int]
    ts.write_vertex_xml_file.argtypess=[POINTER(ts_vesicle),c_int]
    ts.write_vertex_xml_file(vesicle,c_int(timestep_no))
def vesicle_free(vesicle):
    """Free memory of the whole vesicle"""
    ts.vesicle_free.argtype=[POINTER(ts_vesicle)]
    ts.vesicle_free.argtypes=[POINTER(ts_vesicle)]
    ts.vesicle_free(vesicle)
def vesicle_volume(vesicle):
    ts.vesicle_volume.argtype=[POINTER(ts_vesicle)]
    ts.vesicle_volume.argtypes=[POINTER(ts_vesicle)]
    ts.vesicle_volume(vesicle)
def vesicle_area(vesicle):
    ts.vesicle_area.argtype=[POINTER(ts_vesicle)]
    ts.vesicle_area.argtypes=[POINTER(ts_vesicle)]
    ts.vesicle_area(vesicle)
def gyration_eigen(vesicle):
    ts.gyration_eigen.argtype=[POINTER(ts_vesicle), POINTER(c_double), POINTER(c_double), POINTER(c_double)]
    ts.gyration_eigen.argtypes=[POINTER(ts_vesicle), POINTER(c_double), POINTER(c_double), POINTER(c_double)]
    l1=c_double(0.0)
    l2=c_double(0.0)
    l3=c_double(0.0)
@@ -267,7 +267,7 @@
    return (l1.value, l2.value, l3.value)
def vesicle_meancurvature(vesicle):
    ts.vesicle_meancurvature.argtype=[POINTER(ts_vesicle)]
    ts.vesicle_meancurvature.argtypes=[POINTER(ts_vesicle)]
    ts.vesicle_meancurvature.restype=c_double
    return ts.vesicle_meancurvature(vesicle)
@@ -277,43 +277,56 @@
    return ret
def clusterize_vesicle(vesicle, cluster_list):
    ts.clusterize_vesicle.argtype=[POINTER(ts_vesicle), POINTER(ts_cluster_list)]
    ts.clusterize_vesicle.argtypes=[POINTER(ts_vesicle), POINTER(ts_cluster_list)]
    ts.clusterize_vesicle(vesicle, cluster_list)
def cluster_list_free(cluster_list):
    """Free memory of cluster list"""
    ts.cluster_list_free.argtype=[POINTER(ts_cluster_list)]
    ts.cluster_list_free.argtypes=[POINTER(ts_cluster_list)]
    ts.cluster_list_free(cluster_list)
def stretchenergy(vesicle, triangle):
    ts.stretchenergy.argtype=[POINTER(ts_vesicle), POINTER(ts_triangle)]
    ts.stretchenergy.argtypes=[POINTER(ts_vesicle), POINTER(ts_triangle)]
    ts.stretchenergy(vesicle,triangle)
def get_absolute_ulm2(vesicle,l,m):
    ts.get_absolute_ulm2.argtype=[POINTER(ts_vesicle), c_double, c_double]
    ts.get_absolute_ulm2.argtypes=[POINTER(ts_vesicle), c_double, c_double]
    ts.get_absolute_ulm2.restype=c_double
    ret=ts.get_absolute_ulm2(vesicle,l,m)
    return ret
def getR0(vesicle):
    ts.getR0.argtype=[POINTER(ts_vesicle)]
    ts.getR0.argtypes=[POINTER(ts_vesicle)]
    ts.getR0.restype=c_double
    r0=ts.getR0(vesicle)
    return r0
def preparationSh(vesicle,r0):
    ts.preparationSh.argtype=[POINTER(ts_vesicle), c_double]
    ts.preparationSh(vesicle,float(r0))
    ts.preparationSh.argtypes=[POINTER(ts_vesicle), c_double]
    ts.preparationSh(vesicle,r0)
def calculateUlmComplex(vesicle):
    ts.calculateUlmComplex.argtype=[POINTER(ts_vesicle)]
    ts.calculateUlmComplex.argtypes=[POINTER(ts_vesicle)]
    ts.calculateUlmComplex(vesicle)
def solve_for_ulm2(vesicle):
    ts.solve_for_ulm2.argtype=[POINTER(ts_vesicle)]
    ts.solve_for_ulm2(vesicle)
def Ulm2Complex2String(vesicle):
    ts.Ulm2Complex2String.argtypes=[POINTER(ts_vesicle)]
    ts.Ulm2Complex2String.restype=c_char_p
    string=ts.Ulm2Complex2String(vesicle)
    return string
def freeUlm2String(string):
    ts.freeUlm2String.argtypes=[c_char_p]
    ts.freeUlm2String(string)
#This function seems not to exist!!!
#def solve_for_ulm2(vesicle):
#    ts.solve_for_ulm2.argtypes=[POINTER(ts_vesicle)]
#    ts.solve_for_ulm2(vesicle)
def mean_curvature_and_energy(vesicle):
    ts.mean_curvature_and_energy.argtype=[POINTER(ts_vesicle)]
    ts.mean_curvature_and_energy.argtypes=[POINTER(ts_vesicle)]
    ts.mean_curvature_and_energy(vesicle)