Skip to content
Snippets Groups Projects
Commit 3c74d1c3 authored by Martin Bauer's avatar Martin Bauer
Browse files

Bugfixes in benchmark & boundary handling convenience class

parent 4c924c8e
No related merge requests found
......@@ -80,7 +80,6 @@ class KernelFunction(Node):
# these variables are assumed to be global, so no automatic parameter is generated for them
self.globalVariables = set()
@property
def symbolsDefined(self):
return set()
......
......@@ -19,6 +19,14 @@ CONFIG_INTEL = {
'LM_PROJECT': 'iwia',
}
}
CONFIG_INTEL_SUPERMUC = {
'compiler': '/lrz/sys/intel/studio2017_u1/compilers_and_libraries_2017.1.132/linux/bin/intel64/icpc',
'flags': '-Ofast -DNDEBUG -fPIC -shared -march=native -fopenmp -Wl,'
'-rpath=/lrz/sys/intel/studio2016_u4/compilers_and_libraries_2016.4.258/linux/mkl/lib/intel64',
'env': {
'INTEL_LICENSE_FILE': '/lrz/sys/intel/licenses',
}
}
CONFIG_CLANG = {
'compiler': 'clang++',
'flags': '-Ofast -DNDEBUG -fPIC -shared -march=native -fopenmp',
......
import sympy as sp
class SliceMaker(object):
def __getitem__(self, item):
return item
......@@ -43,3 +44,37 @@ def normalizeSlice(slices, sizes):
result.append(slice(newStart, newStop, s.step if s.step is not None else 1))
return tuple(result)
def sliceFromDirection(directionName, dim, normalOffset=0, tangentialOffset=0):
"""
Create a slice from a direction named by compass scheme:
i.e. 'N' for north returns same as makeSlice[:, -1]
the naming is:
- x: W, E (west, east)
- y: S, N (south, north)
- z: B, T (bottom, top)
Also combinations are allowed like north-east 'NE'
:param directionName: name of direction as explained above
:param dim: dimension of the returned slice (should be 2 or 3)
:param normalOffset: the offset in 'normal' direction: e.g. sliceFromDirection('N',2, normalOffset=2)
would return makeSlice[:, -3]
:param tangentialOffset: offset in the other directions: e.g. sliceFromDirection('N',2, tangentialOffset=2)
would return makeSlice[2:-2, -1]
"""
if tangentialOffset == 0:
result = [slice(None, None, None)] * dim
else:
result = [slice(tangentialOffset, -tangentialOffset, None)] * dim
normalSliceHigh, normalSliceLow = -1-normalOffset, normalOffset
for dimIdx, (lowName, highName) in enumerate([('W', 'E'), ('S', 'N'), ('B', 'T')]):
if lowName in directionName:
assert highName not in directionName, "Invalid direction name"
result[dimIdx] = normalSliceLow
if highName in directionName:
assert lowName not in directionName, "Invalid direction name"
result[dimIdx] = normalSliceHigh
return tuple(result)
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment