Merge branch 'development' into cmake

Conflicts:
	code/Makefile
This commit is contained in:
Martin Diehl 2016-05-21 14:56:57 +02:00
commit 0810295fe9
164 changed files with 650 additions and 815 deletions

View File

@ -1 +1 @@
v2.0.0-219-g297d5ca v2.0.0-262-gbd1beb4

View File

@ -1,4 +1,3 @@
### $Id$ ###
[all] [all]
(output) phase (output) phase
(output) texture (output) texture

View File

@ -1,2 +1 @@
### $Id$ ###
[none] [none]

View File

@ -1,4 +1,3 @@
### $Id$ ###
[aLittleSomething] [aLittleSomething]
(output) f (output) f
(output) p (output) p

View File

@ -1,4 +1,3 @@
### $Id$ ###
damage nonlocal damage nonlocal
initialDamage 1.0 initialDamage 1.0
(output) damage (output) damage

View File

@ -1,4 +1,3 @@
### $Id$ ###
hydrogenflux cahnhilliard hydrogenflux cahnhilliard
initialHydrogenConc 0.0 initialHydrogenConc 0.0
(output) hydrogenconc (output) hydrogenconc

View File

@ -1,4 +1,3 @@
### $Id$ ###
[Parallel3] [Parallel3]
type isostrain type isostrain
Ngrains 3 Ngrains 3

View File

@ -1,4 +1,3 @@
### $Id$ ###
[SX] [SX]
type isostrain type isostrain
Ngrains 1 Ngrains 1

View File

@ -1,4 +1,3 @@
### $Id$ ###
[Taylor2] [Taylor2]
type isostrain type isostrain
Ngrains 2 Ngrains 2

View File

@ -1,4 +1,3 @@
### $Id$ ###
[directSX] [directSX]
type none type none

View File

@ -1,3 +1,2 @@
### $Id$ ###
porosity phasefield porosity phasefield
(output) porosity (output) porosity

View File

@ -1,4 +1,3 @@
### $Id$ ###
[8Grains] [8Grains]
type RGC type RGC
Ngrains 8 Ngrains 8

View File

@ -1,4 +1,3 @@
### $Id$ ###
thermal conduction thermal conduction
initialT 300.0 initialT 300.0
(output) temperature (output) temperature

View File

@ -1,4 +1,3 @@
### $Id$ ###
vacancyflux cahnhilliard vacancyflux cahnhilliard
initialVacancyConc 1e-6 initialVacancyConc 1e-6
(output) vacancyconc (output) vacancyconc

View File

@ -1,4 +1,3 @@
### $Id$ ###
[SX] [SX]
type isostrain type isostrain
Ngrains 1 Ngrains 1

View File

@ -1,3 +1,2 @@
### $Id$ ###
(kinematics) vacancy_strain (kinematics) vacancy_strain
vacancy_strain_coeff 0.006 vacancy_strain_coeff 0.006

View File

@ -1,3 +1,2 @@
### $Id$ ###
(kinematics) thermal_expansion (kinematics) thermal_expansion
thermal_expansion11 0.00231 thermal_expansion11 0.00231

View File

@ -1,3 +1,2 @@
### $Id$ ###
(kinematics) hydrogen_strain (kinematics) hydrogen_strain
hydrogen_strain_coeff 0.06 hydrogen_strain_coeff 0.06

View File

@ -1,4 +1,3 @@
### $Id$ ###
[DP_Steel] [DP_Steel]
/elementhomogeneous/ /elementhomogeneous/
crystallite 1 crystallite 1

View File

@ -1,4 +1,3 @@
### $Id$ ###
[ElementHomogeneous] [ElementHomogeneous]
/elementhomogeneous/ # put this flag to set ips identical in one element (something like reduced integration) /elementhomogeneous/ # put this flag to set ips identical in one element (something like reduced integration)
crystallite 1 crystallite 1

View File

@ -1,3 +1,2 @@
### $Id$ ###
damage_diffusion11 1.0 damage_diffusion11 1.0
damage_mobility 0.001 damage_mobility 0.001

View File

@ -1,4 +1,3 @@
### $Id$ ###
[TWIP_Steel_FeMnC] [TWIP_Steel_FeMnC]
elasticity hooke elasticity hooke

View File

@ -1,4 +1,3 @@
### $Id$ ###
[Tungsten] [Tungsten]
elasticity hooke elasticity hooke

View File

@ -1,4 +1,3 @@
### $Id$ ###
hydrogenflux_diffusion11 1.0 hydrogenflux_diffusion11 1.0
hydrogenflux_mobility11 1.0 hydrogenflux_mobility11 1.0
hydrogenVolume 1e-28 hydrogenVolume 1e-28

View File

@ -1,4 +1,3 @@
### $Id$ ###
[Aluminum_Isotropic] [Aluminum_Isotropic]
# Kuo, J. C., Mikrostrukturmechanik von Bikristallen mit Kippkorngrenzen. Shaker-Verlag 2004. http://edoc.mpg.de/204079 # Kuo, J. C., Mikrostrukturmechanik von Bikristallen mit Kippkorngrenzen. Shaker-Verlag 2004. http://edoc.mpg.de/204079

View File

@ -1,4 +1,3 @@
### $Id$ ###
[IsotropicVolumePreservation] [IsotropicVolumePreservation]
elasticity hooke elasticity hooke

View File

@ -1,4 +1,3 @@
### $Id$ ###
[Orthorombic] [Orthorombic]
elasticity hooke elasticity hooke

View File

@ -1,4 +1,3 @@
### $Id$ ###
[Aluminum] [Aluminum]
elasticity hooke elasticity hooke

View File

@ -1,4 +1,3 @@
### $Id$ ###
[Aluminum] [Aluminum]
elasticity hooke elasticity hooke
plasticity phenopowerlaw plasticity phenopowerlaw

View File

@ -1,4 +1,3 @@
### $Id$ ###
# Tasan et.al. 2015 Acta Materalia # Tasan et.al. 2015 Acta Materalia
# Tasan et.al. 2015 International Journal of Plasticity # Tasan et.al. 2015 International Journal of Plasticity
# Diehl et.al. 2015 Meccanica # Diehl et.al. 2015 Meccanica

View File

@ -1,4 +1,3 @@
### $Id$ ###
# Tasan et.al. 2015 Acta Materalia # Tasan et.al. 2015 Acta Materalia
# Tasan et.al. 2015 International Journal of Plasticity # Tasan et.al. 2015 International Journal of Plasticity
# Diehl et.al. 2015 Meccanica # Diehl et.al. 2015 Meccanica

View File

@ -1,4 +1,3 @@
### $Id$ ###
# parameters fitted by D. Ma to: # parameters fitted by D. Ma to:

View File

@ -1,4 +1,3 @@
### $Id$ ###
[cpTi-alpha] [cpTi-alpha]
plasticity phenopowerlaw plasticity phenopowerlaw
elasticity hooke elasticity hooke

View File

@ -1,4 +1,3 @@
### $Id$ ###
[Aluminum] [Aluminum]
elasticity hooke elasticity hooke
plasticity phenopowerlaw plasticity phenopowerlaw

View File

@ -1,3 +1,2 @@
### $Id$ ###
porosity_diffusion11 1.0 porosity_diffusion11 1.0
porosity_mobility 0.001 porosity_mobility 0.001

View File

@ -1,4 +1,3 @@
### $Id$ ###
thermal_conductivity11 237.0 thermal_conductivity11 237.0
specific_heat 910.0 specific_heat 910.0
mass_density 2700.0 mass_density 2700.0

View File

@ -1,4 +1,3 @@
### $Id$ ###
vacancyflux_diffusion11 1.0 vacancyflux_diffusion11 1.0
vacancyflux_mobility11 1.0 vacancyflux_mobility11 1.0
vacancyFormationEnergy 1e-19 vacancyFormationEnergy 1e-19

View File

@ -1,4 +1,3 @@
### $Id$ ###
(source) damage_isoBrittle (source) damage_isoBrittle
isobrittle_criticalStrainEnergy 1400000.0 isobrittle_criticalStrainEnergy 1400000.0
isobrittle_atol 0.01 isobrittle_atol 0.01

View File

@ -1,3 +1,2 @@
### $Id$ ###
(source) thermal_dissipation (source) thermal_dissipation
dissipation_ColdWorkCoeff 0.95 dissipation_ColdWorkCoeff 0.95

View File

@ -1,4 +1,3 @@
### $Id$ ###
(source) vacancy_irradiation (source) vacancy_irradiation
irradiation_cascadeprobability 0.00001 irradiation_cascadeprobability 0.00001
irradiation_cascadevolume 1000.0 irradiation_cascadevolume 1000.0

View File

@ -1,3 +1,2 @@
### $Id$ ###
(source) vacancy_phenoplasticity (source) vacancy_phenoplasticity
phenoplasticity_ratecoeff 0.01 phenoplasticity_ratecoeff 0.01

View File

@ -1,4 +1,3 @@
### $Id$ ###
[FiberExample] [FiberExample]
axes x y -z # model coordinate x-, y-, z-axes correspond to which axes during texture measurement? this was a left handed coordinate system! axes x y -z # model coordinate x-, y-, z-axes correspond to which axes during texture measurement? this was a left handed coordinate system!
# fiber axis in spherical coordinates: alpha crystal system, beta sample system # fiber axis in spherical coordinates: alpha crystal system, beta sample system

View File

@ -1,3 +1,2 @@
### $Id$ ###
[001] [001]
(gauss) phi1 0.000 Phi 0.000 phi2 0.000 scatter 0.000 fraction 1.000 (gauss) phi1 0.000 Phi 0.000 phi2 0.000 scatter 0.000 fraction 1.000

View File

@ -1,3 +1,2 @@
### $Id$ ###
[101] [101]
(gauss) phi1 0.000 Phi 45.000 phi2 90.000 scatter 0.000 fraction 1.000 (gauss) phi1 0.000 Phi 45.000 phi2 90.000 scatter 0.000 fraction 1.000

View File

@ -1,3 +1,2 @@
### $Id$ ###
[111] [111]
(gauss) phi1 0.000 Phi 54.7356 phi2 45.000 scatter 0.000 fraction 1.000 (gauss) phi1 0.000 Phi 54.7356 phi2 45.000 scatter 0.000 fraction 1.000

View File

@ -1,3 +1,2 @@
### $Id$ ###
[123] [123]
(gauss) phi1 209.805 Phi 29.206 phi2 63.435 scatter 0.000 fraction 1.000 (gauss) phi1 209.805 Phi 29.206 phi2 63.435 scatter 0.000 fraction 1.000

View File

@ -1,3 +1,2 @@
### $Id$ ###
[RandomSingleCrystals] [RandomSingleCrystals]
(random) scatter 0.000 fraction 1.000 (random) scatter 0.000 fraction 1.000

View File

@ -1,4 +1,3 @@
### $Id$ ###
[Rolling] [Rolling]
hybridIA rollingTexture.linearODF hybridIA rollingTexture.linearODF
symmetry orthotropic # or monoclinic symmetry orthotropic # or monoclinic

View File

@ -1,4 +1,3 @@
### $Id$ ###
### debugging parameters ### ### debugging parameters ###
# example: # example:

View File

@ -1,4 +1,3 @@
### $Id$ ###
### numerical parameters ### ### numerical parameters ###
# The material.config file needs to specify five parts: # The material.config file needs to specify five parts:

View File

@ -1,4 +1,3 @@
### $Id$ ###
### numerical parameters ### ### numerical parameters ###
relevantStrain 1.0e-7 # strain increment considered significant (used by crystallite to determine whether strain inc is considered significant) relevantStrain 1.0e-7 # strain increment considered significant (used by crystallite to determine whether strain inc is considered significant)

View File

@ -1,7 +1,3 @@
#####################
# $Id$
#####################
#-------------------# #-------------------#
<homogenization> <homogenization>
#-------------------# #-------------------#

View File

@ -1,7 +1,3 @@
#####################
# $Id$
#####################
#-------------------# #-------------------#
<homogenization> <homogenization>
#-------------------# #-------------------#

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os,sys,glob,string,subprocess,shlex import os,sys,glob,subprocess,shlex
from damask import Environment from damask import Environment
from damask import version as DAMASKVERSION from damask import version as DAMASKVERSION
@ -47,9 +47,13 @@ compileOptions = ' -DSpectral -DFLOAT=8 -DINT=4 -I%s/lib -DDAMASKVERSION=\\\\\"\
#--- this saves the path of libraries to core.so, hence it is known during runtime ---------------- #--- this saves the path of libraries to core.so, hence it is known during runtime ----------------
if options['F90'] == 'gfortran': if options['F90'] == 'gfortran':
LDFLAGS = '-shared -Wl,-undefined,dynamic_lookup' # solved error: Undefined symbols for architecture x86_64: "_PyArg_ParseTupleAndKeywords" as found on https://lists.macosforge.org/pipermail/macports-dev/2013-May/022735.html # solved error: Undefined symbols for architecture x86_64: "_PyArg_ParseTupleAndKeywords"
# as found on https://lists.macosforge.org/pipermail/macports-dev/2013-May/022735.html
LDFLAGS = '-shared -Wl,-undefined,dynamic_lookup'
else: else:
LDFLAGS = ' -openmp -Wl' # some f2py versions/configurations compile with openMP, so linking against openMP is needed to prevent errors during loading of core module # some f2py versions/configurations compile with openMP, so linking against openMP is needed
# to prevent errors during loading of core module
LDFLAGS = ' -openmp -Wl'
#--- run path of for fftw during runtime ---------------------------------------------------------- #--- run path of for fftw during runtime ----------------------------------------------------------
LDFLAGS += ',-rpath,%s/lib,-rpath,%s/lib64'%(options['FFTW_ROOT'],options['FFTW_ROOT']) LDFLAGS += ',-rpath,%s/lib,-rpath,%s/lib64'%(options['FFTW_ROOT'],options['FFTW_ROOT'])

View File

@ -1,7 +1,6 @@
# #
# DAMASK Abaqus Environment File # DAMASK Abaqus Environment File
# #
# $Id$
# ------------------------------------ # ------------------------------------
# originally taken from Abaqus ver. 6.11.1 # originally taken from Abaqus ver. 6.11.1
# #

View File

@ -1,7 +1,6 @@
# #
# DAMASK Abaqus Environment File # DAMASK Abaqus Environment File
# #
# $Id$
# ------------------------------------ # ------------------------------------
# originally taken from Abaqus ver. 6.11.1 # originally taken from Abaqus ver. 6.11.1
# #

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os,sys import os,sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
# Makes postprocessing routines acessible from everywhere. # Makes postprocessing routines acessible from everywhere.

View File

@ -1,7 +1,5 @@
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
# $Id$
import os,sys import os,sys
import numpy as np import numpy as np
@ -27,7 +25,7 @@ class ASCIItable():
self.__IO__ = {'output': [], self.__IO__ = {'output': [],
'buffered': buffered, 'buffered': buffered,
'labeled': labeled, # header contains labels 'labeled': labeled, # header contains labels
'labels': [], # labels according to file info 'tags': [], # labels according to file info
'readBuffer': [], # buffer to hold non-advancing reads 'readBuffer': [], # buffer to hold non-advancing reads
'dataStart': 0, 'dataStart': 0,
} }
@ -51,7 +49,7 @@ class ASCIItable():
self.__IO__['out'] = outname self.__IO__['out'] = outname
self.info = [] self.info = []
self.labels = [] self.tags = []
self.data = [] self.data = []
self.line = '' self.line = ''
@ -141,10 +139,10 @@ class ASCIItable():
# ------------------------------------------------------------------ # ------------------------------------------------------------------
def head_read(self): def head_read(self):
""" """
get column labels by either reading get column labels
the first row or, if keyword "head[*]" is present, by either reading the first row or,
the last line of the header if keyword "head[*]" is present, the last line of the header
""" """
import re,shlex import re,shlex
@ -161,7 +159,7 @@ class ASCIItable():
if self.__IO__['labeled']: # table features labels if self.__IO__['labeled']: # table features labels
self.info = [self.__IO__['in'].readline().strip() for i in xrange(1,int(m.group(1)))] self.info = [self.__IO__['in'].readline().strip() for i in xrange(1,int(m.group(1)))]
self.labels = shlex.split(self.__IO__['in'].readline()) # store labels found in last line self.tags = shlex.split(self.__IO__['in'].readline()) # store tags found in last line
else: else:
@ -180,11 +178,11 @@ class ASCIItable():
else: break # last line of comments else: break # last line of comments
if self.__IO__['labeled']: # table features labels if self.__IO__['labeled']: # table features labels
self.labels = self.data # get labels from last line in "header"... self.tags = self.data # get tags from last line in "header"...
self.data_read() # ...and remove from buffer self.data_read() # ...and remove from buffer
if self.__IO__['labeled']: # table features labels if self.__IO__['labeled']: # table features tags
self.__IO__['labels'] = list(self.labels) # backup labels (make COPY, not link) self.__IO__['tags'] = list(self.tags) # backup tags (make COPY, not link)
try: try:
self.__IO__['dataStart'] = self.__IO__['in'].tell() # current file position is at start of data self.__IO__['dataStart'] = self.__IO__['in'].tell() # current file position is at start of data
@ -197,7 +195,7 @@ class ASCIItable():
"""write current header information (info + labels)""" """write current header information (info + labels)"""
head = ['{}\theader'.format(len(self.info)+self.__IO__['labeled'])] if header else [] head = ['{}\theader'.format(len(self.info)+self.__IO__['labeled'])] if header else []
head.append(self.info) head.append(self.info)
if self.__IO__['labeled']: head.append('\t'.join(map(self._quote,self.labels))) if self.__IO__['labeled']: head.append('\t'.join(map(self._quote,self.tags)))
return self.output_write(head) return self.output_write(head)
@ -261,19 +259,57 @@ class ASCIItable():
try: try:
for item in what: self.labels_append(item) for item in what: self.labels_append(item)
except: except:
self.labels += [self._removeCRLF(str(what))] self.tags += [self._removeCRLF(str(what))]
else: else:
self.labels += [self._removeCRLF(what)] self.tags += [self._removeCRLF(what)]
self.__IO__['labeled'] = True # switch on processing (in particular writing) of labels self.__IO__['labeled'] = True # switch on processing (in particular writing) of tags
if reset: self.__IO__['labels'] = list(self.labels) # subsequent data_read uses current labels as data size if reset: self.__IO__['tags'] = list(self.tags) # subsequent data_read uses current tags as data size
# ------------------------------------------------------------------ # ------------------------------------------------------------------
def labels_clear(self): def labels_clear(self):
"""delete existing labels and switch to no labeling""" """delete existing labels and switch to no labeling"""
self.labels = [] self.tags = []
self.__IO__['labeled'] = False self.__IO__['labeled'] = False
# ------------------------------------------------------------------
def labels(self,
tags = None,
raw = False):
"""
tell abstract labels.
"x" for "1_x","2_x",... unless raw output is requested.
operates on object tags or given list.
"""
from collections import Iterable
if tags is None: tags = self.tags
if isinstance(tags, Iterable) and not raw: # check whether list of tags is requested
id = 0
dim = 1
labelList = []
while id < len(tags):
if not tags[id].startswith('1_'):
labelList.append(tags[id])
else:
label = tags[id][2:] # get label
while id < len(tags) and tags[id] == '{}_{}'.format(dim,label): # check successors
id += 1 # next label...
dim += 1 # ...should be one higher dimension
labelList.append(label) # reached end --> store
id -= 1 # rewind one to consider again
id += 1
dim = 1
else:
labelList = self.tags
return labelList
# ------------------------------------------------------------------ # ------------------------------------------------------------------
def label_index(self, def label_index(self,
labels): labels):
@ -293,10 +329,10 @@ class ASCIItable():
idx.append(int(label)-1) # column given as integer number? idx.append(int(label)-1) # column given as integer number?
except ValueError: except ValueError:
try: try:
idx.append(self.labels.index(label)) # locate string in label list idx.append(self.tags.index(label)) # locate string in label list
except ValueError: except ValueError:
try: try:
idx.append(self.labels.index('1_'+label)) # locate '1_'+string in label list idx.append(self.tags.index('1_'+label)) # locate '1_'+string in label list
except ValueError: except ValueError:
idx.append(-1) # not found... idx.append(-1) # not found...
else: else:
@ -304,10 +340,10 @@ class ASCIItable():
idx = int(labels)-1 # offset for python array indexing idx = int(labels)-1 # offset for python array indexing
except ValueError: except ValueError:
try: try:
idx = self.labels.index(labels) idx = self.tags.index(labels)
except ValueError: except ValueError:
try: try:
idx = self.labels.index('1_'+labels) # locate '1_'+string in label list idx = self.tags.index('1_'+labels) # locate '1_'+string in label list
except ValueError: except ValueError:
idx = None if labels is None else -1 idx = None if labels is None else -1
@ -332,16 +368,16 @@ class ASCIItable():
try: # column given as number? try: # column given as number?
idx = int(label)-1 idx = int(label)-1
myDim = 1 # if found has at least dimension 1 myDim = 1 # if found has at least dimension 1
if self.labels[idx].startswith('1_'): # column has multidim indicator? if self.tags[idx].startswith('1_'): # column has multidim indicator?
while idx+myDim < len(self.labels) and self.labels[idx+myDim].startswith("%i_"%(myDim+1)): while idx+myDim < len(self.tags) and self.tags[idx+myDim].startswith("%i_"%(myDim+1)):
myDim += 1 # add while found myDim += 1 # add while found
except ValueError: # column has string label except ValueError: # column has string label
if label in self.labels: # can be directly found? if label in self.tags: # can be directly found?
myDim = 1 # scalar by definition myDim = 1 # scalar by definition
elif '1_'+label in self.labels: # look for first entry of possible multidim object elif '1_'+label in self.tags: # look for first entry of possible multidim object
idx = self.labels.index('1_'+label) # get starting column idx = self.tags.index('1_'+label) # get starting column
myDim = 1 # (at least) one-dimensional myDim = 1 # (at least) one-dimensional
while idx+myDim < len(self.labels) and self.labels[idx+myDim].startswith("%i_"%(myDim+1)): while idx+myDim < len(self.tags) and self.tags[idx+myDim].startswith("%i_"%(myDim+1)):
myDim += 1 # keep adding while going through object myDim += 1 # keep adding while going through object
dim.append(myDim) dim.append(myDim)
@ -351,16 +387,16 @@ class ASCIItable():
try: # column given as number? try: # column given as number?
idx = int(labels)-1 idx = int(labels)-1
dim = 1 # if found has at least dimension 1 dim = 1 # if found has at least dimension 1
if self.labels[idx].startswith('1_'): # column has multidim indicator? if self.tags[idx].startswith('1_'): # column has multidim indicator?
while idx+dim < len(self.labels) and self.labels[idx+dim].startswith("%i_"%(dim+1)): while idx+dim < len(self.tags) and self.tags[idx+dim].startswith("%i_"%(dim+1)):
dim += 1 # add as long as found dim += 1 # add as long as found
except ValueError: # column has string label except ValueError: # column has string label
if labels in self.labels: # can be directly found? if labels in self.tags: # can be directly found?
dim = 1 # scalar by definition dim = 1 # scalar by definition
elif '1_'+labels in self.labels: # look for first entry of possible multidim object elif '1_'+labels in self.tags: # look for first entry of possible multidim object
idx = self.labels.index('1_'+labels) # get starting column idx = self.tags.index('1_'+labels) # get starting column
dim = 1 # is (at least) one-dimensional dim = 1 # is (at least) one-dimensional
while idx+dim < len(self.labels) and self.labels[idx+dim].startswith("%i_"%(dim+1)): while idx+dim < len(self.tags) and self.tags[idx+dim].startswith("%i_"%(dim+1)):
dim += 1 # keep adding while going through object dim += 1 # keep adding while going through object
return np.array(dim) if isinstance(dim,Iterable) else dim return np.array(dim) if isinstance(dim,Iterable) else dim
@ -404,8 +440,8 @@ class ASCIItable():
def data_rewind(self): def data_rewind(self):
self.__IO__['in'].seek(self.__IO__['dataStart']) # position file to start of data section self.__IO__['in'].seek(self.__IO__['dataStart']) # position file to start of data section
self.__IO__['readBuffer'] = [] # delete any non-advancing data reads self.__IO__['readBuffer'] = [] # delete any non-advancing data reads
self.labels = list(self.__IO__['labels']) # restore label info found in header (as COPY, not link) self.tags = list(self.__IO__['tags']) # restore label info found in header (as COPY, not link)
self.__IO__['labeled'] = len(self.labels) > 0 self.__IO__['labeled'] = len(self.tags) > 0
# ------------------------------------------------------------------ # ------------------------------------------------------------------
def data_skipLines(self, def data_skipLines(self,
@ -432,8 +468,8 @@ class ASCIItable():
self.line = self.line.rstrip('\n') self.line = self.line.rstrip('\n')
if self.__IO__['labeled'] and respectLabels: # if table has labels if self.__IO__['labeled'] and respectLabels: # if table has labels
items = shlex.split(self.line)[:len(self.__IO__['labels'])] # use up to label count (from original file info) items = shlex.split(self.line)[:len(self.__IO__['tags'])] # use up to label count (from original file info)
self.data = items if len(items) == len(self.__IO__['labels']) else [] # take entries if label count matches self.data = items if len(items) == len(self.__IO__['tags']) else [] # take entries if label count matches
else: else:
self.data = shlex.split(self.line) # otherwise take all self.data = shlex.split(self.line) # otherwise take all
@ -470,7 +506,7 @@ class ASCIItable():
1)) 1))
use = np.array(columns) use = np.array(columns)
self.labels = list(np.array(self.labels)[use]) # update labels with valid subset self.tags = list(np.array(self.tags)[use]) # update labels with valid subset
self.data = np.loadtxt(self.__IO__['in'],usecols=use,ndmin=2) self.data = np.loadtxt(self.__IO__['in'],usecols=use,ndmin=2)
@ -545,8 +581,8 @@ class ASCIItable():
def datatype(item): def datatype(item):
return int(item) if type.lower() == 'i' else float(item) return int(item) if type.lower() == 'i' else float(item)
N = grid.prod() # expected number of microstructure indices in data N = grid.prod() # expected number of microstructure indices in data
microstructure = np.zeros(N,type) # initialize as flat array microstructure = np.zeros(N,type) # initialize as flat array
i = 0 i = 0
while i < N and self.data_read(): while i < N and self.data_read():
@ -557,7 +593,7 @@ class ASCIItable():
else: items = map(datatype,items) else: items = map(datatype,items)
else: items = map(datatype,items) else: items = map(datatype,items)
s = min(len(items), N-i) # prevent overflow of microstructure array s = min(len(items), N-i) # prevent overflow of microstructure array
microstructure[i:i+s] = items[:s] microstructure[i:i+s] = items[:s]
i += len(items) i += len(items)

View File

@ -1,6 +1,5 @@
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
# $Id$
import re import re
class Section(): class Section():

View File

@ -1,6 +1,5 @@
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
# $Id$
import os,subprocess,shlex import os,subprocess,shlex

View File

@ -1,6 +1,5 @@
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
# $Id$
import damask.geometry import damask.geometry

View File

@ -1,6 +1,5 @@
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
# $Id$
from .geometry import Geometry from .geometry import Geometry

View File

@ -1,6 +1,5 @@
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
# $Id$
from .geometry import Geometry from .geometry import Geometry

View File

@ -1,14 +1,13 @@
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
# $Id$
import numpy as np import numpy as np
import sys #import sys
try: try:
import h5py import h5py
except (ImportError) as e: except (ImportError) as e:
sys.stderr.write('\nREMARK: h5py module not available \n\n') pass # sys.stderr.write('\nREMARK: h5py module not available \n\n')
class Result(): class Result():
""" """

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
from distutils.core import setup from distutils.core import setup

View File

@ -1,6 +1,5 @@
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
# $Id$
from .solver import Solver from .solver import Solver

View File

@ -1,6 +1,5 @@
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
# $Id$
from .solver import Solver from .solver import Solver

View File

@ -1,6 +1,5 @@
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
# $Id$
import damask.solver import damask.solver

View File

@ -1,6 +1,5 @@
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
# $Id$
from .solver import Solver from .solver import Solver

View File

@ -1,6 +1,5 @@
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
# $Id$
import os,sys,shutil import os,sys,shutil
import logging,logging.config import logging,logging.config
@ -41,7 +40,7 @@ class Test():
+'----------------------------------------------------------------') +'----------------------------------------------------------------')
self.dirBase = os.path.dirname(os.path.realpath(sys.modules[self.__class__.__module__].__file__)) self.dirBase = os.path.dirname(os.path.realpath(sys.modules[self.__class__.__module__].__file__))
self.parser = OptionParser( self.parser = OptionParser(
description = test_description+' (using class: $Id$)', description = test_description+' (using class: {})'.format(damask.version),
usage='./test.py [options]') usage='./test.py [options]')
self.updateRequested = False self.updateRequested = False
self.parser.add_option("-d", "--debug", action="store_true",\ self.parser.add_option("-d", "--debug", action="store_true",\
@ -337,16 +336,16 @@ class Test():
key0 = ('1_' if length[i]>1 else '') + headings0[i]['label'] key0 = ('1_' if length[i]>1 else '') + headings0[i]['label']
key1 = ('1_' if length[i]>1 else '') + headings1[i]['label'] key1 = ('1_' if length[i]>1 else '') + headings1[i]['label']
normKey = ('1_' if normLength[i]>1 else '') + normHeadings[i]['label'] normKey = ('1_' if normLength[i]>1 else '') + normHeadings[i]['label']
if key0 not in table0.labels: if key0 not in table0.labels(raw = True):
raise Exception('column {} not found in 1. table...\n'.format(key0)) raise Exception('column {} not found in 1. table...\n'.format(key0))
elif key1 not in table1.labels: elif key1 not in table1.labels(raw = True):
raise Exception('column {} not found in 2. table...\n'.format(key1)) raise Exception('column {} not found in 2. table...\n'.format(key1))
elif normKey not in table0.labels: elif normKey not in table0.labels(raw = True):
raise Exception('column {} not found in 1. table...\n'.format(normKey)) raise Exception('column {} not found in 1. table...\n'.format(normKey))
else: else:
column[0][i] = table0.labels.index(key0) column[0][i] = table0.label_index(key0)
column[1][i] = table1.labels.index(key1) column[1][i] = table1.label_index(key1)
normColumn[i] = table0.labels.index(normKey) normColumn[i] = table0.label_index(normKey)
line0 = 0 line0 = 0
while table0.data_read(): # read next data line of ASCII table while table0.data_read(): # read next data line of ASCII table
@ -422,7 +421,7 @@ class Test():
columns = columns[:len(files)] # truncate to same length as files columns = columns[:len(files)] # truncate to same length as files
for i,column in enumerate(columns): for i,column in enumerate(columns):
if column is None: columns[i] = tables[i].labels # if no column is given, read all if column is None: columns[i] = tables[i].labels(raw = True) # if no column is given, read all
logging.info('comparing ASCIItables statistically') logging.info('comparing ASCIItables statistically')
for i in xrange(len(columns)): for i in xrange(len(columns)):
@ -478,7 +477,7 @@ class Test():
columns = columns[:len(files)] # truncate to same length as files columns = columns[:len(files)] # truncate to same length as files
for i,column in enumerate(columns): for i,column in enumerate(columns):
if column is None: columns[i] = tables[i].labels # if no column is given, read all if column is None: columns[i] = tables[i].labels(raw = True) # if no column is given, read all
logging.info('comparing ASCIItables') logging.info('comparing ASCIItables')
for i in xrange(len(columns)): for i in xrange(len(columns)):

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os import os

View File

@ -1,4 +1,3 @@
#!/usr/bin/python
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import threading,os,string import threading,os,string

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os,string,scipy import os,string,scipy

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os,string,vtk import os,string,vtk

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import threading,time,os import threading,time,os
@ -138,7 +138,7 @@ def principalStrs_Der(p, (s1, s2, s3, s4, s5, s6), dim, Karafillis=False):
return np.array([np.dot(dSdI[:,:,i],dIdc[:,:,i]).T for i in xrange(num)]).T return np.array([np.dot(dSdI[:,:,i],dIdc[:,:,i]).T for i in xrange(num)]).T
def invariant(sigmas): def invariant(sigmas):
I=np.zeros(3) I = np.zeros(3)
s11,s22,s33,s12,s23,s31 = sigmas s11,s22,s33,s12,s23,s31 = sigmas
I[0] = s11 + s22 + s33 I[0] = s11 + s22 + s33
I[1] = s11*s22 + s22*s33 + s33*s11 - s12**2 - s23**2 - s31**2 I[1] = s11*s22 + s22*s33 + s33*s11 - s12**2 - s23**2 - s31**2
@ -1271,13 +1271,12 @@ def doSim(thread):
table = damask.ASCIItable(refFile,readonly=True) table = damask.ASCIItable(refFile,readonly=True)
table.head_read() table.head_read()
if options.fitting =='equivalentStrain': thresholdKey = {'equivalentStrain':'Mises(ln(V))',
thresholdKey = 'Mises(ln(V))' 'totalshear': 'totalshear',
elif options.fitting =='totalshear': }[options.fitting]
thresholdKey = 'totalshear'
for l in [thresholdKey,'1_Cauchy']: for l in [thresholdKey,'1_Cauchy']:
if l not in table.labels: damask.util.croak('%s not found'%l) if l not in table.labels(raw = True): damask.util.croak('%s not found'%l)
s.release() s.release()
table.data_readArray(['%i_Cauchy'%(i+1) for i in xrange(9)]+[thresholdKey]+['%i_ln(V)'%(i+1) for i in xrange(9)]) table.data_readArray(['%i_Cauchy'%(i+1) for i in xrange(9)]+[thresholdKey]+['%i_ln(V)'%(i+1) for i in xrange(9)])
@ -1380,51 +1379,46 @@ parser.add_option('-e', '--exponent', dest='exponent', type='float',
parser.add_option('-u', '--uniaxial', dest='eqStress', type='float', parser.add_option('-u', '--uniaxial', dest='eqStress', type='float',
help='Equivalent stress', metavar='float') help='Equivalent stress', metavar='float')
parser.set_defaults(min = 12) parser.set_defaults(min = 12,
parser.set_defaults(max = 30) max = 30,
parser.set_defaults(threads = 4) threads = 4,
parser.set_defaults(yieldValue = (0.002,0.004,2)) yieldValue = (0.002,0.004,2),
parser.set_defaults(load = (0.010,100,100.0)) load = (0.010,100,100.0),
parser.set_defaults(criterion = 'vonmises') criterion = 'vonmises',
parser.set_defaults(fitting = 'totalshear') fitting = 'totalshear',
parser.set_defaults(geometry = '20grains16x16x16') geometry = '20grains16x16x16',
parser.set_defaults(bounds = None) bounds = None,
parser.set_defaults(dimension = '3') dimension = '3',
parser.set_defaults(exponent = -1.0) exponent = -1.0,
)
options = parser.parse_args()[0] options = parser.parse_args()[0]
if not os.path.isfile(options.geometry+'.geom'): if options.threads < 1:
parser.error('geometry file %s.geom not found'%options.geometry) parser.error('invalid number of threads {}'.format(options.threads))
if not os.path.isfile('material.config'): if options.min < 0:
parser.error('material.config file not found') parser.error('invalid minimum number of simulations {}'.format(options.min))
if options.threads<1: if options.max < options.min:
parser.error('invalid number of threads %i'%options.threads)
if options.min<0:
parser.error('invalid minimum number of simulations %i'%options.min)
if options.max<options.min:
parser.error('invalid maximum number of simulations (below minimum)') parser.error('invalid maximum number of simulations (below minimum)')
if options.yieldValue[0]>options.yieldValue[1]: if options.yieldValue[0] > options.yieldValue[1]:
parser.error('invalid yield start (below yield end)') parser.error('invalid yield start (below yield end)')
if options.yieldValue[2] != int(options.yieldValue[2]): if options.yieldValue[2] != int(options.yieldValue[2]):
parser.error('count must be an integer') parser.error('count must be an integer')
if not os.path.isfile('numerics.config'): for check in [options.geometry+'.geom','numerics.config','material.config']:
damask.util.croak('numerics.config file not found') if not os.path.isfile(check):
if not os.path.isfile('material.config'): damask.util.croak('"{}" file not found'.format(check))
damask.util.croak('material.config file not found')
options.dimension = int(options.dimension) options.dimension = int(options.dimension)
if options.criterion == 'hill1948': stressUnit = 1.0e9 stressUnit = 1.0e9 if options.criterion == 'hill1948' else 1.0e6
else : stressUnit = 1.0e6
if options.dimension not in fitCriteria[options.criterion]['dimen']: if options.dimension not in fitCriteria[options.criterion]['dimen']:
parser.error('invalid dimension for selected criterion') parser.error('invalid dimension for selected criterion')
if options.criterion not in ['vonmises','tresca','drucker','hill1984'] and options.eqStress is None: if options.criterion not in ['vonmises','tresca','drucker','hill1948'] and options.eqStress is None:
parser.error('please specifie an equivalent stress (e.g. fitting to von Mises)') parser.error('please specify an equivalent stress (e.g. fitting to von Mises)')
run = runFit(options.exponent, options.eqStress, options.dimension, options.criterion) run = runFit(options.exponent, options.eqStress, options.dimension, options.criterion)

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os,sys,re,fnmatch,vtk import os,sys,re,fnmatch,vtk
@ -227,7 +227,7 @@ for filename in args:
locol = -1 locol = -1
for col,head in enumerate(headings): for col,head in enumerate(headings):
if head == {True:'1_ipinitialcoord',False:'1_nodeinitialcoord'}[options.cell]: if head == {True:'1_pos',False:'1_nodeinitialcoord'}[options.cell]:
locol = col locol = col
maxcol = max(maxcol,col+3) maxcol = max(maxcol,col+3)
break break
@ -430,4 +430,4 @@ for filename in args:
vtk = open(os.path.join(head,what+'_'+os.path.splitext(tail)[0]+'.vtk'), 'w') vtk = open(os.path.join(head,what+'_'+os.path.splitext(tail)[0]+'.vtk'), 'w')
output(out[what],{'filepointer':vtk},'File') output(out[what],{'filepointer':vtk},'File')
vtk.close() vtk.close()
print print

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os,sys import os,sys
@ -59,7 +59,7 @@ for name in filenames:
for label in datainfo['label']: for label in datainfo['label']:
key = label key = label
if key in table.labels: if key in table.labels(raw = True):
active.append(label) active.append(label)
column[label] = table.labels.index(key) # remember columns of requested data column[label] = table.labels.index(key) # remember columns of requested data
else: else:

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os,re,sys import os,re,sys
@ -10,16 +10,12 @@ import damask
scriptName = os.path.splitext(os.path.basename(__file__))[0] scriptName = os.path.splitext(os.path.basename(__file__))[0]
scriptID = ' '.join([scriptName,damask.version]) scriptID = ' '.join([scriptName,damask.version])
def unravel(item):
if hasattr(item,'__contains__'): return ' '.join(map(unravel,item))
else: return str(item)
# -------------------------------------------------------------------- # --------------------------------------------------------------------
# MAIN # MAIN
# -------------------------------------------------------------------- # --------------------------------------------------------------------
parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """ parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """
Add column(s) with derived values according to user-defined arithmetic operation between column(s). Add or alter column(s) with derived values according to user-defined arithmetic operation between column(s).
Column labels are tagged by '#label#' in formulas. Use ';' for ',' in functions. Column labels are tagged by '#label#' in formulas. Use ';' for ',' in functions.
Numpy is available as np. Numpy is available as np.
@ -37,6 +33,13 @@ parser.add_option('-f','--formula',
action = 'extend', metavar = '<string LIST>', action = 'extend', metavar = '<string LIST>',
help = '(list of) formulas corresponding to labels') help = '(list of) formulas corresponding to labels')
parser.add_option('-c','--condition',
dest = 'condition', metavar='string',
help = 'condition to filter rows')
parser.set_defaults(condition = None,
)
(options,filenames) = parser.parse_args() (options,filenames) = parser.parse_args()
if options.labels is None or options.formulas is None: if options.labels is None or options.formulas is None:
@ -53,7 +56,10 @@ if filenames == []: filenames = [None]
for name in filenames: for name in filenames:
try: try:
table = damask.ASCIItable(name = name, buffered = False) table = damask.ASCIItable(name = name,
buffered = False)
output = damask.ASCIItable(name = name,
buffered = False)
except: except:
continue continue
damask.util.report(scriptName,name) damask.util.report(scriptName,name)
@ -62,14 +68,41 @@ for name in filenames:
table.head_read() table.head_read()
# ------------------------------------------ build formulae ---------------------------------------- # -----------------------------------------------------------------------------------------------------
specials = { \ specials = { \
'_row_': 0, '_row_': 0,
} }
# ------------------------------------------ Evaluate condition ---------------------------------------
if options.condition:
interpolator = []
condition = options.condition # copy per file, since might be altered inline
breaker = False
for position,operand in enumerate(set(re.findall(r'#(([s]#)?(.+?))#',condition))): # find three groups
condition = condition.replace('#'+operand[0]+'#',
{ '': '{%i}'%position,
's#':'"{%i}"'%position}[operand[1]])
if operand[2] in specials: # special label
interpolator += ['specials["%s"]'%operand[2]]
else:
try:
interpolator += ['%s(table.data[%i])'%({ '':'float',
's#':'str'}[operand[1]],
table.label_index(operand[2]))] # ccould be generalized to indexrange as array lookup
except:
damask.util.croak('column "{}" not found.'.format(operand[2]))
breaker = True
if breaker: continue # found mistake in condition evaluation --> next file
evaluator_condition = "'" + condition + "'.format(" + ','.join(interpolator) + ")"
else: condition = ''
# ------------------------------------------ build formulae ----------------------------------------
evaluator = {} evaluator = {}
brokenFormula = {}
for label,formula in zip(options.labels,options.formulas): for label,formula in zip(options.labels,options.formulas):
for column in re.findall(r'#(.+?)#',formula): # loop over column labels in formula for column in re.findall(r'#(.+?)#',formula): # loop over column labels in formula
@ -82,15 +115,15 @@ for name in filenames:
elif dim > 1: # multidimensional input (vector, tensor, etc.) elif dim > 1: # multidimensional input (vector, tensor, etc.)
replacement = 'np.array(table.data[{}:{}],dtype=float)'.format(idx,idx+dim) # use (flat) array representation replacement = 'np.array(table.data[{}:{}],dtype=float)'.format(idx,idx+dim) # use (flat) array representation
else: else:
damask.util.croak('column {} not found...'.format(column)) damask.util.croak('column {} not found, skipping {}...'.format(column,label))
brokenFormula[label] = True options.labels.remove(label)
break break
formula = formula.replace('#'+column+'#',replacement) formula = formula.replace('#'+column+'#',replacement)
if label not in brokenFormula:
evaluator[label] = formula
evaluator[label] = formula
# ------------------------------------------ process data ------------------------------------------ # ------------------------------------------ process data ------------------------------------------
firstLine = True firstLine = True
@ -98,32 +131,53 @@ for name in filenames:
while outputAlive and table.data_read(): # read next data line of ASCII table while outputAlive and table.data_read(): # read next data line of ASCII table
specials['_row_'] += 1 # count row specials['_row_'] += 1 # count row
output.data_clear()
# ------------------------------------------ calculate one result to get length of labels --------- # ------------------------------------------ calculate one result to get length of labels ---------
if firstLine: if firstLine:
firstLine = False firstLine = False
labelDim = {} labelDim = {}
for label in [x for x in options.labels if x not in set(brokenFormula)]: for label in [x for x in options.labels]:
labelDim[label] = np.size(eval(evaluator[label])) labelDim[label] = np.size(eval(evaluator[label]))
if labelDim[label] == 0: brokenFormula[label] = True if labelDim[label] == 0: options.labels.remove(label)
# ------------------------------------------ assemble header --------------------------------------- # ------------------------------------------ assemble header ---------------------------------------
if label not in brokenFormula: output.labels_clear()
table.labels_append(['{}_{}'.format(i+1,label) for i in xrange(labelDim[label])] if labelDim[label] > 1 tabLabels = table.labels()
else label) for label in tabLabels:
dim = labelDim[label] if label in options.labels \
else table.label_dimension(label)
output.labels_append(['{}_{}'.format(i+1,label) for i in xrange(dim)] if dim > 1 else label)
table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:])) for label in options.labels:
table.head_write() if label in tabLabels: continue
output.labels_append(['{}_{}'.format(i+1,label) for i in xrange(labelDim[label])]
if labelDim[label] > 1
else label)
output.info = table.info
output.info_append(scriptID + '\t' + ' '.join(sys.argv[1:]))
output.head_write()
# ------------------------------------------ process data ------------------------------------------ # ------------------------------------------ process data ------------------------------------------
for label in [x for x in options.labels if x not in set(brokenFormula)]: for label in output.labels():
table.data_append(unravel(eval(evaluator[label]))) oldIndices = table.label_indexrange(label)
Nold = max(1,len(oldIndices)) # Nold could be zero for new columns
Nnew = len(output.label_indexrange(label))
output.data_append(eval(evaluator[label]) if label in options.labels and
(condition == '' or eval(eval(evaluator_condition)))
else np.tile([table.data[i] for i in oldIndices]
if label in tabLabels
else np.nan,
np.ceil(float(Nnew)/Nold))[:Nnew]) # spread formula result into given number of columns
outputAlive = table.data_write() # output processed line outputAlive = output.data_write() # output processed line
# ------------------------------------------ output finalization ----------------------------------- # ------------------------------------------ output finalization -----------------------------------
table.close() # close ASCII tables table.input_close() # close ASCII tables
output.close() # close ASCII tables

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os,sys import os,sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os,sys import os,sys
@ -64,10 +64,12 @@ for name in filenames:
errors = [] errors = []
remarks = [] remarks = []
if table.label_dimension(options.pos) != 3: errors.append('coordinates {} are not a vector.'.format(options.pos)) if table.label_dimension(options.pos) != 3:
errors.append('coordinates "{}" are not a vector.'.format(options.pos))
else: colCoord = table.label_index(options.pos) else: colCoord = table.label_index(options.pos)
if table.label_dimension(options.defgrad) != 9: errors.append('deformation gradient {} is not a tensor.'.format(options.defgrad)) if table.label_dimension(options.defgrad) != 9:
errors.append('deformation gradient "{}" is not a tensor.'.format(options.defgrad))
else: colF = table.label_index(options.defgrad) else: colF = table.label_index(options.defgrad)
if remarks != []: damask.util.croak(remarks) if remarks != []: damask.util.croak(remarks)
@ -91,21 +93,21 @@ for name in filenames:
maxcorner = np.array(map(max,coords)) maxcorner = np.array(map(max,coords))
grid = np.array(map(len,coords),'i') grid = np.array(map(len,coords),'i')
size = grid/np.maximum(np.ones(3,'d'), grid-1.0) * (maxcorner-mincorner) # size from edge to edge = dim * n/(n-1) size = grid/np.maximum(np.ones(3,'d'), grid-1.0) * (maxcorner-mincorner) # size from edge to edge = dim * n/(n-1)
size = np.where(grid > 1, size, min(size[grid > 1]/grid[grid > 1])) # spacing for grid==1 set to smallest among other spacings size = np.where(grid > 1, size, min(size[grid > 1]/grid[grid > 1])) # grid==1 spacing set to smallest among other ones
N = grid.prod() N = grid.prod()
# --------------- figure out columns to process --------------------------------------------------- # --------------- figure out columns to process ---------------------------------------------------
key = '1_%s'%options.defgrad key = '1_'+options.defgrad
if key not in table.labels: if table.label_index(key) == -1:
file['croak'].write('column %s not found...\n'%key) damask.util.croak('column "{}" not found...'.format(key))
continue continue
else: else:
column = table.labels.index(key) # remember columns of requested data column = table.label_index(key) # remember columns of requested data
# ------------------------------------------ assemble header --------------------------------------- # ------------------------------------------ assemble header ---------------------------------------
if options.shape: table.labels_append(['shapeMismatch(%s)' %options.defgrad]) if options.shape: table.labels_append(['shapeMismatch({})'.format(options.defgrad)])
if options.volume: table.labels_append(['volMismatch(%s)'%options.defgrad]) if options.volume: table.labels_append(['volMismatch({})'.format(options.defgrad)])
table.head_write() table.head_write()
# ------------------------------------------ read deformation gradient field ----------------------- # ------------------------------------------ read deformation gradient field -----------------------

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os,sys import os,sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os,sys,math import os,sys,math

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os,sys import os,sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os,sys import os,sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os,sys,math import os,sys,math
@ -87,7 +87,7 @@ def displacementFluctFFT(F,grid,size,nodal=False,transformed=False):
# MAIN # MAIN
# -------------------------------------------------------------------- # --------------------------------------------------------------------
parser = OptionParser(option_class=damask.extendableOption, usage='%prog options file[s]', description = """ parser = OptionParser(option_class=damask.extendableOption, usage='%prog [options] [ASCIItable(s)]', description = """
Add displacments resulting from deformation gradient field. Add displacments resulting from deformation gradient field.
Operates on periodic three-dimensional x,y,z-ordered data sets. Operates on periodic three-dimensional x,y,z-ordered data sets.
Outputs at cell centers or cell nodes (into separate file). Outputs at cell centers or cell nodes (into separate file).
@ -98,7 +98,7 @@ parser.add_option('-f',
'--defgrad', '--defgrad',
dest = 'defgrad', dest = 'defgrad',
metavar = 'string', metavar = 'string',
help = 'column label of deformation gradient [%default]') help = 'label of deformation gradient [%default]')
parser.add_option('-p', parser.add_option('-p',
'--pos', '--position', '--pos', '--position',
dest = 'pos', dest = 'pos',

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os,sys,math import os,sys,math

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os,sys import os,sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os,sys,itertools import os,sys,itertools

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os,sys,math import os,sys,math

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*-
import os,sys,time,copy import os,sys,time,copy
import numpy as np import numpy as np
@ -10,7 +11,7 @@ scriptName = os.path.splitext(os.path.basename(__file__))[0]
scriptID = ' '.join([scriptName,damask.version]) scriptID = ' '.join([scriptName,damask.version])
parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """ parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [ASCIItable(s)]', description = """
Add grain index based on similiarity of crystal lattice orientation. Add grain index based on similiarity of crystal lattice orientation.
""", version = scriptID) """, version = scriptID)

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os,sys,math import os,sys,math

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os import os

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os,sys import os,sys
@ -89,14 +89,14 @@ for name in filenames:
# ------------------------------------------ assemble header -------------------------------------- # ------------------------------------------ assemble header --------------------------------------
table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:])) table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:]))
table.labels_append(mappedTable.labels) # extend ASCII header with new labels table.labels_append(mappedTable.labels(raw = True)) # extend ASCII header with new labels
table.head_write() table.head_write()
# ------------------------------------------ process data ------------------------------------------ # ------------------------------------------ process data ------------------------------------------
outputAlive = True outputAlive = True
while outputAlive and table.data_read(): # read next data line of ASCII table while outputAlive and table.data_read(): # read next data line of ASCII table
table.data_append(mappedTable.data[int(round(float(table.data[mappedColumn])))+options.offset-1]) # add all mapped data types table.data_append(mappedTable.data[int(round(float(table.data[mappedColumn])))+options.offset-1]) # add all mapped data types
outputAlive = table.data_write() # output processed line outputAlive = table.data_write() # output processed line
# ------------------------------------------ output finalization ----------------------------------- # ------------------------------------------ output finalization -----------------------------------

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os,sys,math import os,sys,math

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os,sys,math import os,sys,math

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os,sys,math import os,sys,math

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os,sys import os,sys

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os,sys,math import os,sys,math

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
# -*- coding: UTF-8 no BOM -*- # -*- coding: UTF-8 no BOM -*-
import os,sys,math import os,sys,math

Some files were not shown because too many files have changed in this diff Show More