📄 builtins.py
字号:
"""This module provides a set of FFC built-ins such as specialfunctions and predefined variables."""__author__ = "Anders Logg (logg@simula.no)"__date__ = "2006-12-01 -- 2007-05-10"__copyright__ = "Copyright (C) 2006-2007 Anders Logg"__license__ = "GNU GPL version 3 or any later version"# FFC fem modulesfrom ffc.fem.vectorelement import VectorElementfrom ffc.fem.finiteelement import FiniteElement, shape_to_dim, string_to_shape# FFC language modulesfrom algebra import Functionfrom integral import Integralfrom index import Indexdef Constant(shape): """This like a class but is really a function. It returns a DG(0) function which may be thought of as a Constant.""" # Create discontinuous Lagrange element element = FiniteElement("Discontinuous Lagrange", shape, 0) return Function(element)('+/-')def VectorConstant(shape, vector_dim=None): """This looks like a class but is really a function. It returns a vector DG(0) function which may be thought of as a vector Constant.""" # Find out vector dimension if vector_dim == None: vector_dim = shape_to_dim[string_to_shape[shape]] # Create discontinuous vector Lagrange element element = VectorElement("Discontinuous Lagrange", shape, 0, vector_dim) return Function(element)('+/-')def MeshSize(shape): """This looks like a class but is really a function. It returns a DG(0) function which may function as the placeholder for a function defining the mesh size.""" element = FiniteElement("Discontinuous Lagrange", shape, 0) h = Function(element) h.name = "mesh size" return hdef FacetNormal(shape): """This looks like a class but is really a function. It returns a vectorDG(0) function which may function as the placeholder for a function defining the facet normal.""" element = VectorElement("Discontinuous Lagrange", shape, 0) n = Function(element) n.name = "facet normal" return n# Predefined integralsdx = Integral("cell")ds = Integral("exterior facet")dS = Integral("interior facet")# Predefined indicesi = Index()j = Index()k = Index()l = Index()m = Index()n = Index()
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -