How to use the petsc.get_petsc_dir function in petsc

To help you get started, we’ve selected a few petsc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github firedrakeproject / firedrake / firedrake / slate / slac.py View on Github external
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)),
github firedrakeproject / firedrake / setup.py View on Github external
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.
github OP2 / PyOP2 / setup.py View on Github external
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.
github OP2 / PyOP2 / pyop2 / utils.py View on Github external
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.
github firedrakeproject / firedrake / setup.py View on Github external
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.

petsc

PETSc: Portable, Extensible Toolkit for Scientific Computation

BSD-2-Clause
Latest version published 1 month ago

Package Health Score

60 / 100
Full package analysis