################################################################################
# This Python file is part of PyFEM, the code that accompanies the book: #
# #
# 'Non-Linear Finite Element Analysis of Solids and Structures' #
# R. de Borst, M.A. Crisfield, J.J.C. Remmers and C.V. Verhoosel #
# John Wiley and Sons, 2012, ISBN 978-0470666449 #
# #
# Copyright (C) 2011-2025. The code is written in 2011-2012 by #
# Joris J.C. Remmers, Clemens V. Verhoosel and Rene de Borst and since #
# then augmented and maintained by Joris J.C. Remmers. #
# All rights reserved. #
# #
# A github repository, with the most up to date version of the code, #
# can be found here: #
# https://github.com/jjcremmers/PyFEM/ #
# https://pyfem.readthedocs.io/ #
# #
# The original code can be downloaded from the web-site: #
# http://www.wiley.com/go/deborst #
# #
# The code is open source and intended for educational and scientific #
# purposes only. If you use PyFEM in your research, the developers would #
# be grateful if you could cite the book. #
# #
# Disclaimer: #
# The authors reserve all rights but do not guarantee that the code is #
# free from errors. Furthermore, the authors shall not be liable in any #
# event caused by the use of the program. #
################################################################################
[docs]
def macauley( x : float ) -> float:
"""
Function that performs the macaulay operation to a variable. The macaulay
operation returns the exact same value when that value is positive and
returns zero when the values is negative.
Args:
x (float): The input to the function
Returns:
float: The macauley value.
"""
if x >= 0.:
return x
else:
return 0.
[docs]
def sign( x : float ) -> float:
"""
Function that returns the sign of a value
Args:
x (float): The input to the function
Returns:
float: the sign (-1.0 or 1.0).
"""
if x < 0.:
return -1.0
else:
return 0.0