ContactMechanics.Tools package
Submodules
ContactMechanics.Tools.Logger module
Log status to screen or file
- class ContactMechanics.Tools.Logger.Logger(logfile=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>, outevery=1, sepevery=10)
Bases:
object
Methods
flush
get_logfile
has_logfile
iteration_finished
pr
set_logfile
set_outevery
st
warn
- flush()
- get_logfile()
- has_logfile()
- iteration_finished()
- pr(s, caller=None, logfile=None)
- set_logfile(logfile)
- set_outevery(outevery)
- st(hdr, vals, force_print=False)
- warn(s, caller=None)
- ContactMechanics.Tools.Logger.flatten(x)
- ContactMechanics.Tools.Logger.hdr_str(s, x)
Return header description strings
- ContactMechanics.Tools.Logger.hdrfmt_str(x, i)
Return header format string for datatype x
- ContactMechanics.Tools.Logger.numfmt_str(x, i)
Return numeric format string for datatype x
ContactMechanics.Tools.common module
Bin for small common helper function and classes
- ContactMechanics.Tools.common.compare_containers(cont_a, cont_b)
compares whether two containers have the same content regardless of their type. eg, compares [1, 2, 3] and (1, 2., 3.) as True Keyword Arguments: cont_a – one container cont_b – other container
- ContactMechanics.Tools.common.compute_wavevectors(nb_grid_pts, physical_sizes, nb_dims)
computes and returns the wavevectors q that exist for the surfaces physical_sizes and nb_grid_pts as one vector of components per dimension
- ContactMechanics.Tools.common.evaluate_gradient(fun, x, delta)
Don’t actually use this function in production code, it’s not efficient. Returns an approximation of the gradient evaluated using central differences.
(grad f)_i = ((f(x+e_i*delta/2)-f(x-e_i*delta/2))/delta)
Arguments: fun – function to be evaluated x – point of evaluation delta – step width
- ContactMechanics.Tools.common.fftn(arr, integral)
n-dimensional fft according to the conventions detailed in power_spectrum.tex in the notes folder.
Keyword Arguments: arr – Input array, can be complex integral – depending of dimensionality:
1D: Length of domain 2D: Area etc
- ContactMechanics.Tools.common.get_q_from_lambda(lambda_min, lambda_max)
Conversion between wavelength and angular frequency
- ContactMechanics.Tools.common.ifftn(arr, integral)
n-dimensional ifft according to the conventions detailed in power_spectrum.tex in the notes folder.
Keyword Arguments: arr – Input array, can be complex integral – depending of dimensionality:
1D: Length of domain 2D: Area etc
- ContactMechanics.Tools.common.mean_err(arr1, arr2, rfft=False)
computes the mean element-wise difference between two containers
Module contents
Helper tools for PyCo