aclocal.m4 | ●●●●● patch | view | raw | blame | history | |
python/trisurf/__pycache__/trisurf.cpython-34.pyc | patch | view | raw | blame | history | |
python/trisurf/trisurf.py | ●●●●● patch | view | raw | blame | history | |
python/tsmgr | ●●●●● patch | view | raw | blame | history |
aclocal.m4
@@ -180,61 +180,6 @@ fi[]dnl ])# PKG_CHECK_MODULES # PKG_INSTALLDIR(DIRECTORY) # ------------------------- # Substitutes the variable pkgconfigdir as the location where a module # should install pkg-config .pc files. By default the directory is # $libdir/pkgconfig, but the default can be changed by passing # DIRECTORY. The user can override through the --with-pkgconfigdir # parameter. AC_DEFUN([PKG_INSTALLDIR], [m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) m4_pushdef([pkg_description], [pkg-config installation directory @<:@]pkg_default[@:>@]) AC_ARG_WITH([pkgconfigdir], [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, [with_pkgconfigdir=]pkg_default) AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) m4_popdef([pkg_default]) m4_popdef([pkg_description]) ]) dnl PKG_INSTALLDIR # PKG_NOARCH_INSTALLDIR(DIRECTORY) # ------------------------- # Substitutes the variable noarch_pkgconfigdir as the location where a # module should install arch-independent pkg-config .pc files. By # default the directory is $datadir/pkgconfig, but the default can be # changed by passing DIRECTORY. The user can override through the # --with-noarch-pkgconfigdir parameter. AC_DEFUN([PKG_NOARCH_INSTALLDIR], [m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) m4_pushdef([pkg_description], [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) AC_ARG_WITH([noarch-pkgconfigdir], [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, [with_noarch_pkgconfigdir=]pkg_default) AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) m4_popdef([pkg_default]) m4_popdef([pkg_description]) ]) dnl PKG_NOARCH_INSTALLDIR # PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, # [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # ------------------------------------------- # Retrieves the value of the pkg-config variable for the given module. AC_DEFUN([PKG_CHECK_VAR], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl _PKG_CONFIG([$1], [variable="][$3]["], [$2]) AS_VAR_COPY([$1], [pkg_cv_][$1]) AS_VAR_IF([$1], [""], [$5], [$4])dnl ])# PKG_CHECK_VAR # Copyright (C) 2002-2013 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation @@ -318,9 +263,10 @@ # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- @@ -787,8 +733,7 @@ END AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) fi fi ]) fi]) dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further python/trisurf/__pycache__/trisurf.cpython-34.pycBinary files differ
python/trisurf/trisurf.py
@@ -5,8 +5,9 @@ import base64 import zlib import io import os from itertools import islice import mmap ''' This is a trisurf instance manager written in python @@ -33,7 +34,6 @@ print("Error reading or parsing tape file!\n") exit(1) def setTape(self, string): self.config=configobj.ConfigObj(io.StringIO(string)) return @@ -41,12 +41,118 @@ def getValue(self,key): return self.config[key] def __str__(self): retval="" for key,val in self.config.iteritems(): retval=retval+str(key)+" = "+str(val)+"\n" return retval class Directory: def __init__(self, maindir=".", simdir=""): self.maindir=maindir self.simdir=simdir return def fullpath(self): return os.path.join(self.maindir,self.simdir) def exists(self): path=self.fullpath() if(os.path.exists(path)): return 1 else: return 0 def make(self): try: os.makedirs(self.fullpath()) except: print("Cannot make directory "+self.fullpath()+"\n") exit(1) return def makeifnotexist(self): if(self.exists()==0): self.make() return def remove(self): if(self.exists()): try: os.rmdir(self.fullpath()) except: print("Cannot remove directory "+self.fullpath()+ "\n") exit(1) return def goto(self): try: os.chdir(self.fullpath()) except: print("Cannot go to directory "+self.fullpath()+"\n") return class Statistics: def __init__(self,path,filename="statistics.csv"): self.path=path self.filename=filename self.fullname=os.path.join(path,filename) self.read() return def __str__(self): return(str(self.fullname)) def exists(self): if(os.path.isfile(self.fullname)): return True else: return False def mapcount(self): f = open(self.fullname, "r+") buf = mmap.mmap(f.fileno(), 0) lines = 0 readline = buf.readline while readline(): lines += 1 return lines def read(self): if(self.exists()): nlines=self.mapcount() try: with open(self.fullname, "r+") as fin: i=0; for line in fin: if(i==1): print (line) if(i==nlines-1): print (line) i=i+1 except: print("Cannot read statistics file in "+self.fullname+"\n") exit(1) else: print("File "+self.fullname+" does not exists.\n") exit(1) class Runner: ''' Class Runner consists of a single running or terminated instance of the trisurf ''' def __init__(self, subdir='run0', tape='', snapshot=''): self.subdir=subdir if(tape!=''): self.initFromTape(tape) if(snapshot!=''): self.initFromSnapshot(snapshot) return def initFromTape(self, tape): self.tape=Tape() self.tape.readTape(tape) @@ -61,29 +167,49 @@ root = tree.getroot() tapetxt=root.find('tape') version=root.find('trisurfversion') #print("Reading snapshot made from: "+version.text) self.tape=Tape() #print(tapetxt.text) self.tape.setTape(tapetxt.text) def __init__(self, subdir='run0', tape='', snapshot=''): self.subdir=subdir if(tape!=''): self.initFromTape(tape) if(snapshot!=''): self.initFromSnapshot(snapshot) return def getStatus(self): pass return 0 def start(self): pass if(self.getStatus()==0): self.Dir=Directory(maindir=self.maindir,simdir=self.subdir) self.Dir.makeifnotexist() self.Dir.goto() print("Starting trisurf-ng executable at "+self.Dir.fullpath()+"\n") else: print("Process already running. Not starting\n") return def stop(self): pass def setMaindir(self,prefix,variables): maindir="./" for p,v in zip(prefix,variables): if(v=="xk0"): tv=str(round(float(self.tape.config[v]))) else: tv=self.tape.config[v] maindir=maindir+p+tv self.maindir=maindir return def setSubdir(self, subdir="run0"): self.subdir=subdir return def getStatistics(self, statfile="statistics.csv"): self.statistics=Statistics("", statfile) # we are already in the running directory, so local path is needed! return def __str__(self): return("Running instance") if(self.getStatus()==0): str=" not running." else: str=" running." return(self.Dir.fullpath()+str) python/tsmgr
@@ -5,6 +5,11 @@ run1=trisurf.Runner(snapshot='snapshot.vtu') run1.setMaindir(("N","k","V","Np","Nm"),("nshell","xk0","constvolswitch","npoly","nmono")) run1.start() #run print(run1) #print(run1.tape.config) print(run1.tape.getValue('nshell')) run1.getStatistics() print(run1.statistics) #print(run1.tape) #print(run1.tape.getValue('nshell'))