Source code for Muscat.FE.WeakForms.Operators

# -*- coding: utf-8 -*-
#
# This file is subject to the terms and conditions defined in
# file 'LICENSE.txt', which is part of this source code package.
#
from enum import Enum


[docs] class NumericalOperators(Enum): # /!\ DO NOT OVERFLOW 32 NONE = 0 # Operands from this value COORDINATE = 1 NUMERICAL = 2 SCALAR = 3 UNKNOWN_FIELD = 4 TEST_FIELD = 5 KNOWN_FE_FIELD = 6 KNOWN_IP_FIELD = 7 NORMAL = 8 # Binary Operators from this value ADDITION = 10 SUBTRACTION = 11 PRODUCT = 12 DIVISION = 13 POW = 14 # Unary operators SQRT = 25 COS = 26 SIN = 27 TAN = 28 LOG = 29 EXP = 30 ABS = 31 # not use over 32
[docs] def isOperand(self): return self.value >= 0 and self.value < 10
[docs] def isOperator(self): return self.value >= 10 and self.value <= 32
[docs] def isBinaryOperator(self): return self.value >= 10 and self.value < 25
[docs] def isUnaryOperator(self): return self.value >= 25 and self.value <= 32
def __str__(self): return self.name
[docs] def isCommutative(self): commutatives = [ NumericalOperators.ADDITION, NumericalOperators.PRODUCT, ] return self in commutatives
[docs] def CheckIntegrity(GUI: bool = False): return "ok"
if __name__ == "__main__": print(CheckIntegrity(GUI=True)) # pragma: no cover