コード例 #1
0
ファイル: abaqus.py プロジェクト: puwe/DAMASK
 def __init__(self,version='',solver=''):                                                          # example version string: 6.12-2, solver: std or exp
   self.solver='Abaqus'
   if version =='':
     version = damask.Environment().options['ABAQUS_VERSION']
   else:
     self.version = version
   
   if solver.lower() in ['','std','standard']:
     self.solver = 'std'
   elif solver.lower() in ['exp','explicit']:
     self.solver = 'exp'
   else:
     raise Exception('unknown Abaqus solver %'%solver)
コード例 #2
0
ファイル: abaqus.py プロジェクト: puwe/DAMASK
 def return_run_command(self,model):
   import subprocess
   import re
   env=damask.Environment()
   shortVersion = re.sub('[\.,-]', '',self.version)
   try:
     cmd='abq'+shortVersion
     subprocess.check_output(['abq'+shortVersion,'information=release'])
   except OSError:                                                                                 # link to abqXXX not existing
     cmd='abaqus'
     process = subprocess.Popen(['abaqus','information=release'],stdout = subprocess.PIPE,stderr = subprocess.PIPE)
     detectedVersion = process.stdout.readlines()[1].split()[1]
     if self.version != detectedVersion:
       raise Exception('found Abaqus version %s, but requested %s'%(detectedVersion,self.version))
   return '%s -job %s -user %s/code/DAMASK_abaqus_%s interactive'%(cmd,model,env.rootDir(),self.solver)
コード例 #3
0
ファイル: symlink_Code.py プロジェクト: puwe/DAMASK
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import os, sys
import damask

bin_link = { \
            '.' : [
                    'DAMASK_spectral.exe',
                    'DAMASK_FEM.exe'
                  ],
           }

MarcReleases = [2011, 2012, 2013, 2013.1, 2014, 2014.2, 2015]

damaskEnv = damask.Environment()
baseDir = damaskEnv.relPath('code/')
binDir = damaskEnv.options['DAMASK_BIN']

if not os.path.isdir(binDir):
    os.mkdir(binDir)

for dir in bin_link:
    for file in bin_link[dir]:
        src = os.path.abspath(os.path.join(baseDir, dir, file))
        if os.path.exists(src):
            sym_link = os.path.abspath(os.path.join(binDir,\
                                                    {True: dir,
                                                     False:os.path.splitext(file)[0]}[file == '']))
            if os.path.lexists(sym_link): os.remove(sym_link)
            os.symlink(src, sym_link)
コード例 #4
0
ファイル: test.py プロジェクト: puwe/DAMASK
 def fileInRoot(self, dir, file):
     """Path to a file in the root directory of DAMASK."""
     return os.path.join(damask.Environment().rootDir(), dir, file)