Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
klist = []
transformkernel = Transformer()
oriented = False
for v in kernel_exprs.values():
for ks in v:
oriented = oriented or ks.kinfo.oriented
# TODO: Think about this. Is this true for SLATE?
assert ks.kinfo.subdomain_id == "otherwise"
kast = transformkernel.visit(ks.kinfo.kernel._ast)
klist.append(kast)
klist.append(kernel)
kernelast = ast.Node(klist)
# Need to get the correct PETSc directory
inc.append(petsc.get_petsc_dir() + '/include/eigen3/')
# Produce the op2 kernel object for assembly
op2kernel = op2.Kernel(kernelast,
"slac_compile_slate",
cpp=True,
include_dirs=inc,
headers=['#include ', '#define restrict __restrict'])
# TODO: What happens for multiple ufl domains?
assert len(slate_expr.ufl_domains()) == 1
kinfo = KernelInfo(kernel=op2kernel,
integral_type="cell",
oriented=oriented,
subdomain_id="otherwise",
domain_number=0,
coefficient_map=range(len(coeffs)),
def get_petsc_dir():
try:
petsc_arch = env.get('PETSC_ARCH', '')
petsc_dir = env['PETSC_DIR']
if petsc_arch:
return (petsc_dir, path.join(petsc_dir, petsc_arch))
return (petsc_dir,)
except KeyError:
try:
import petsc
return (petsc.get_petsc_dir(), )
except ImportError:
sys.exit("""Error: Could not find PETSc library.
def get_petsc_dir():
try:
arch = '/' + env.get('PETSC_ARCH', '')
dir = env['PETSC_DIR']
return (dir, dir + arch)
except KeyError:
try:
import petsc
return (petsc.get_petsc_dir(), )
except ImportError:
sys.exit("""Error: Could not find PETSc library.
def get_petsc_dir():
try:
arch = '/' + os.environ.get('PETSC_ARCH', '')
dir = os.environ['PETSC_DIR']
return (dir, dir + arch)
except KeyError:
try:
import petsc
return (petsc.get_petsc_dir(), )
except ImportError:
sys.exit("""Error: Could not find PETSc library.
def get_petsc_dir():
try:
petsc_arch = env.get('PETSC_ARCH', '')
petsc_dir = env['PETSC_DIR']
if petsc_arch:
return (petsc_dir, path.join(petsc_dir, petsc_arch))
return (petsc_dir,)
except KeyError:
try:
import petsc
return (petsc.get_petsc_dir(), )
except ImportError:
sys.exit("""Error: Could not find PETSc library.