⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 signature.py

📁 finite element library for mathematic majored research
💻 PY
字号:
"""This module contains utilities for computing signatures ofproducts. Signatures are used to uniquely identify referencetensors that may be common to a group of terms."""__author__ = "Anders Logg (logg@simula.no)"__date__ = "2005-09-06 -- 2007-01-11"__copyright__ = "Copyright (C) 2005-2006 Anders Logg"__license__  = "GNU GPL version 3 or any later version"# Modified by Kristian Oelgaard 2006# Python modulesfrom re import sub# FFC modulesfrom algebra import *from tokens import *def compute_hard_signature(product):    "Compute hard (unique) signature."        # Create signature for numeric constant    numeric = "%.15e" % product.numeric        # Create signatures for basis functions    factors = []    for v in product.basisfunctions:        factors += ["{%s;%s;%s;%s;%s}" % \                    (str(v.element),     \                     str(v.index),       \                     "[" + ", ".join([str(c) for c in v.component]) + "]",                     "[" + ", ".join([str(d) for d in v.derivatives]) + "]",                     str(v.restriction))]    # Sort signatures for basis functions    factors.sort()    # Create signature for integral    integral = str(product.integral)    # Create signature for product    return "*".join([numeric] + factors + [integral])def compute_soft_signature(product):    "Compute soft (modulo secondary index numbers) signature."    # Compute hard signature    signature = compute_hard_signature(product)    # Ignore secondary index numbers    return sub('a\d+', 'a', signature)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -