xref: /libCEED/python/ceed_constants.py (revision 61dbc9d25335c1a7855bdb901ed4d560d51eee1f)
1bfbc6bf6Sjeremylt# Copyright (c) 2017, Lawrence Livermore National Security, LLC. Produced at
2bfbc6bf6Sjeremylt# the Lawrence Livermore National Laboratory. LLNL-CODE-734707. All Rights
3bfbc6bf6Sjeremylt# reserved. See files LICENSE and NOTICE for details.
4bfbc6bf6Sjeremylt#
5bfbc6bf6Sjeremylt# This file is part of CEED, a collection of benchmarks, miniapps, software
6bfbc6bf6Sjeremylt# libraries and APIs for efficient high-order finite element and spectral
7bfbc6bf6Sjeremylt# element discretizations for exascale applications. For more information and
8bfbc6bf6Sjeremylt# source code availability see http://github.com/ceed.
9bfbc6bf6Sjeremylt#
10bfbc6bf6Sjeremylt# The CEED research is supported by the Exascale Computing Project 17-SC-20-SC,
11bfbc6bf6Sjeremylt# a collaborative effort of two U.S. Department of Energy organizations (Office
12bfbc6bf6Sjeremylt# of Science and the National Nuclear Security Administration) responsible for
13bfbc6bf6Sjeremylt# the planning and preparation of a capable exascale ecosystem, including
14bfbc6bf6Sjeremylt# software, applications, hardware, advanced system engineering and early
15bfbc6bf6Sjeremylt# testbed platforms, in support of the nation's exascale computing imperative.
16bfbc6bf6Sjeremylt
17bfbc6bf6Sjeremyltfrom _ceed_cffi import ffi, lib
18bfbc6bf6Sjeremyltfrom abc import ABC
19bfbc6bf6Sjeremylt
20bfbc6bf6Sjeremylt# ------------------------------------------------------------------------------
21bfbc6bf6Sjeremylt# Ceed Enums
22bfbc6bf6Sjeremylt# ------------------------------------------------------------------------------
23bfbc6bf6Sjeremylt# CeedMemType
24bfbc6bf6SjeremyltMEM_HOST        = lib.CEED_MEM_HOST
25bfbc6bf6SjeremyltMEM_DEVICE      = lib.CEED_MEM_DEVICE
26bfbc6bf6Sjeremyltmem_types       = {MEM_HOST:       "host",
27bfbc6bf6Sjeremylt                   MEM_DEVICE:     "device"}
28bfbc6bf6Sjeremylt
29bfbc6bf6Sjeremylt# CeedCopyMode
30bfbc6bf6SjeremyltCOPY_VALUES     = lib.CEED_COPY_VALUES
31bfbc6bf6SjeremyltUSE_POINTER     = lib.CEED_USE_POINTER
32bfbc6bf6SjeremyltOWN_POINTER     = lib.CEED_OWN_POINTER
33bfbc6bf6Sjeremyltcopy_modes      = {COPY_VALUES:    "copy values",
34bfbc6bf6Sjeremylt                   USE_POINTER:    "use pointer",
35bfbc6bf6Sjeremylt                   OWN_POINTER:    "own pointer"}
36bfbc6bf6Sjeremylt
37*61dbc9d2Sjeremylt# CeedLayoutMode
38*61dbc9d2SjeremyltNONINTERLACED   = lib.CEED_NONINTERLACED
39*61dbc9d2SjeremyltINTERLACED      = lib.CEED_INTERLACED
40*61dbc9d2Sjeremyltlayout_modes    = {NONINTERLACED:  "not interlaced",
41*61dbc9d2Sjeremylt                   INTERLACED:     "interlaced"}
42*61dbc9d2Sjeremylt
43547d9b97Sjeremylt# CeedNormType
44547d9b97SjeremyltNORM_1          = lib.CEED_NORM_1
45547d9b97SjeremyltNORM_2          = lib.CEED_NORM_2
46547d9b97SjeremyltNORM_MAX        = lib.CEED_NORM_MAX
47547d9b97Sjeremyltnorm_types      = {NORM_1:        "L1 norm",
48547d9b97Sjeremylt                   NORM_2:        "L2 norm",
49547d9b97Sjeremylt                   NORM_MAX:      "max norm"}
50547d9b97Sjeremylt
51bfbc6bf6Sjeremylt# CeedTransposeMode
52bfbc6bf6SjeremyltTRANSPOSE       = lib.CEED_TRANSPOSE
53bfbc6bf6SjeremyltNOTRANSPOSE     = lib.CEED_NOTRANSPOSE
54bfbc6bf6Sjeremylttranspose_modes = {TRANSPOSE:      "transpose",
55bfbc6bf6Sjeremylt                   NOTRANSPOSE:    "no transpose"}
56bfbc6bf6Sjeremylt
57bfbc6bf6Sjeremylt# CeedEvalMode
58bfbc6bf6SjeremyltEVAL_NONE       = lib.CEED_EVAL_NONE
59bfbc6bf6SjeremyltEVAL_INTERP     = lib.CEED_EVAL_INTERP
60bfbc6bf6SjeremyltEVAL_GRAD       = lib.CEED_EVAL_GRAD
61bfbc6bf6SjeremyltEVAL_DIV        = lib.CEED_EVAL_DIV
62bfbc6bf6SjeremyltEVAL_CURL       = lib.CEED_EVAL_CURL
63bfbc6bf6SjeremyltEVAL_WEIGHT     = lib.CEED_EVAL_WEIGHT
64bfbc6bf6Sjeremylteval_modes      = {EVAL_NONE:      "none",
65bfbc6bf6Sjeremylt                   EVAL_INTERP:    "interpolation",
66bfbc6bf6Sjeremylt                   EVAL_GRAD:      "gradient",
67bfbc6bf6Sjeremylt                   EVAL_DIV:       "divergence",
68bfbc6bf6Sjeremylt                   EVAL_CURL:      "curl",
69bfbc6bf6Sjeremylt                   EVAL_WEIGHT:    "quadrature weights"}
70bfbc6bf6Sjeremylt
71bfbc6bf6Sjeremylt# CeedQuadMode
72bfbc6bf6SjeremyltGAUSS           = lib.CEED_GAUSS
73bfbc6bf6SjeremyltGAUSS_LOBATTO   = lib.CEED_GAUSS_LOBATTO
74bfbc6bf6Sjeremyltquad_modes      = {GAUSS:          "Gauss",
75bfbc6bf6Sjeremylt                   GAUSS_LOBATTO:  "Gauss Lobatto"}
76bfbc6bf6Sjeremylt
77bfbc6bf6Sjeremylt# CeedElemTopology
78bfbc6bf6SjeremyltLINE            = lib.CEED_LINE
79bfbc6bf6SjeremyltTRIANGLE        = lib.CEED_TRIANGLE
80bfbc6bf6SjeremyltQUAD            = lib.CEED_QUAD
81bfbc6bf6SjeremyltTET             = lib.CEED_TET
82bfbc6bf6SjeremyltPYRAMID         = lib.CEED_PYRAMID
83bfbc6bf6SjeremyltPRISM           = lib.CEED_PRISM
84bfbc6bf6SjeremyltHEX             = lib.CEED_HEX
85bfbc6bf6Sjeremyltelem_topologies = {LINE:           "line",
86bfbc6bf6Sjeremylt                   TRIANGLE:       "triangle",
87bfbc6bf6Sjeremylt                   QUAD:           "quadrilateral",
88bfbc6bf6Sjeremylt                   TET:            "tetrahedron",
89bfbc6bf6Sjeremylt                   PYRAMID:        "pyramid",
90bfbc6bf6Sjeremylt                   PRISM:          "prism",
91bfbc6bf6Sjeremylt                   HEX:            "hexahedron"}
92bfbc6bf6Sjeremylt
93bfbc6bf6Sjeremylt# ------------------------------------------------------------------------------
94bfbc6bf6Sjeremylt# Ceed Constants
95bfbc6bf6Sjeremylt# ------------------------------------------------------------------------------
96bfbc6bf6Sjeremylt
97bfbc6bf6Sjeremylt# Requests
98bfbc6bf6SjeremyltREQUEST_IMMEDIATE = lib.CEED_REQUEST_IMMEDIATE
99bfbc6bf6SjeremyltREQUEST_ORDERED = lib.CEED_REQUEST_ORDERED
100bfbc6bf6Sjeremylt
101bfbc6bf6Sjeremylt# Object shell
102bfbc6bf6Sjeremyltclass _CeedConstantObject(ABC):
103bfbc6bf6Sjeremylt  """Shell for holding constant Vector and Basis constants."""
104bfbc6bf6Sjeremylt
105bfbc6bf6Sjeremylt  def __init__(self, constant):
106bfbc6bf6Sjeremylt    self._pointer = [constant]
107bfbc6bf6Sjeremylt
108bfbc6bf6Sjeremylt# Vectors
109bfbc6bf6SjeremyltVECTOR_ACTIVE = _CeedConstantObject(lib.CEED_VECTOR_ACTIVE)
110bfbc6bf6SjeremyltVECTOR_NONE = _CeedConstantObject(lib.CEED_VECTOR_NONE)
111bfbc6bf6Sjeremylt
112bfbc6bf6Sjeremylt# Basis
113bfbc6bf6SjeremyltBASIS_COLLOCATED = _CeedConstantObject(lib.CEED_BASIS_COLLOCATED)
114bfbc6bf6Sjeremylt
115bfbc6bf6Sjeremylt# ------------------------------------------------------------------------------
116