restructured results class, starting to write the unified damask result class

This commit is contained in:
Martin Diehl 2014-01-09 21:35:21 +00:00
parent 3d64f1f9ff
commit 22aa934a7d
6 changed files with 23 additions and 41 deletions

View File

@ -7,7 +7,7 @@ from .config import Material # will be extended to debug and numeri
from .colormaps import Colormap, Color
from .orientation import Quaternion, Rodrigues, Symmetry, Orientation
#from .block import Block # only one class
from .result import Result # one class with subclasses
from .result import Result # only one class
from .geometry import Geometry # one class with subclasses
from .solver import Solver # one class with subclasses
from .test import Test

22
lib/damask/result.py Normal file
View File

@ -0,0 +1,22 @@
# $Id$
import numpy as np
try:
import h5py
except:
print('Could not import h5py.')
class Result():
'''
General class for result parsing.
Needs h5py to be installed
'''
def __init__(self,resultsFile):
outFile=h5py.File(resultsFile,"a")
print("Opened "+resultsFile+" with %i points"%outFile.attrs['Number of Materialpoints'])

View File

@ -1,5 +0,0 @@
# $Id$
from .result import Result # only one class
from .spectral import Spectral # only one class
from .marc import Marc # only one class

View File

@ -1,8 +0,0 @@
# $Id$
from .result import Result
class Marc(Result):
def __init__(self):
self.solver='Marc'

View File

@ -1,19 +0,0 @@
# $Id$
import damask.result
class Result():
'''
General class for result parsing.
Sub-classed by the individual solvers.
'''
def __init__(self,solver=''):
solverClass = {
'spectral': damask.result.Spectral,
'marc': damask.result.Marc,
}
if solver.lower() in solverClass.keys():
self.__class__=solverClass[solver.lower()]
self.__init__()

View File

@ -1,8 +0,0 @@
# $Id$
from .result import Result
class Spectral(Result):
def __init__(self):
self.solver='Spectral'