add Cython version of orientation module to provide faster orientation calculation.

This commit is contained in:
Chen Zhang 2015-07-29 19:23:06 +00:00
parent 599bb768ef
commit 5f74f3e95e
4 changed files with 1247 additions and 4 deletions

View File

@ -19,14 +19,20 @@ marc:
.PHONY: processing
processing:
@if hash cython 2>/dev/null; then \
cd ./lib/damask; \
python setup_corientation.py build_ext --inplace; \
rm -rv build; \
rm *.c; \
fi
@./installation/compile_CoreModule.py ${MAKEFLAGS}
.PHONY: tidy
tidy:
tidy:
@$(MAKE) tidy -C code >/dev/null
.PHONY: clean
clean:
clean:
@$(MAKE) clean -C code >/dev/null
.PHONY: install

View File

@ -7,9 +7,13 @@ from .environment import Environment # only one class
from .asciitable import ASCIItable # only one class
from .config import Material # will be extended to debug and numerics
from .colormaps import Colormap, Color
from .orientation import Quaternion, Rodrigues, Symmetry, Orientation
try:
from .corientation import Quaternion, Rodrigues, Symmetry, Orientation
print "Import Cython version of Orientation module"
except:
from .orientation import Quaternion, Rodrigues, Symmetry, Orientation
#from .block import Block # only one class
from .result import Result # only one class
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
@ -31,6 +35,7 @@ try:
core.debug.init = core.debug.debug_init
core.math.init = core.math.math_init
core.math.periodicNearestNeighbor = core.math.math_periodicNearestNeighbor
core.math.barycentricInterpolate = core.math.math_barycentricInterpolate
core.math.periodicNearestNeighborDistances = core.math.math_periodicNearestNeighborDistances
core.math.tensorAvg = core.math.math_tensorAvg
core.FEsolving.init = core.FEsolving.FE_init

1216
lib/damask/corientation.pyx Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,16 @@
#!/usr/bin/env python
# -*- coding: UTF-8 no BOM -*-
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import numpy as np
ext = [Extension("corientation", ["corientation.pyx"])]
setup(
name="corientation",
include_dirs=[np.get_include()],
cmdclass = {'build_ext': build_ext},
ext_modules=ext
)