config
Config
Bases: HashableBaseModelIO
Configuration class. There are mainly two backends:
cpp
(default): C++ implementation,is_cpp_backend = True
, environment variableMICROMECHANICAL_BACKEND=cpp
-
python
: Python implementation,is_python_backend = True
, environment variableMICROMECHANICAL_BACKEND=python
-
numba
(default): Python implementation with numba enabled,is_numba_backend = True
, environment variableNUMBA_DISABLE_JIT=0
pure python
: pure Python implementation with numba disabled,is_pure_python_backend = True
, environment variableNUMBA_DISABLE_JIT=1
For the numba
and cpp
backends, there are two precisions:
double
(default): double precision,is_double_precision = True
, environment variableMICROMECHANICAL_PRECISION=double
single
: single precision,is_single_precision = True
, environment variableMICROMECHANICAL_PRECISION=single
, the single precision backend is not fully tested yet
backend
class-attribute
instance-attribute
backend: Literal['python', 'cpp'] = 'cpp'
Backend, python
or cpp
cache_contact
class-attribute
instance-attribute
cache_contact: bool = True
Whether to cache contact state variables by default
is_double_cpp_backend
property
is_double_cpp_backend: bool
Return True if the backend is cpp
and the precision is double
.
is_double_numba_backend
property
is_double_numba_backend: bool
Return True if the backend is python
and numba is enabled and the precision is double
.
is_numba_backend
property
is_numba_backend: bool
Return True if the backend is python
and numba is enabled.
is_pure_python_backend
property
is_pure_python_backend: bool
Return True if the backend is python
and numba is disabled.
is_single_cpp_backend
property
is_single_cpp_backend: bool
Return True if the backend is cpp
and the precision is single
.
is_single_numba_backend
property
is_single_numba_backend: bool
Return True if the backend is python
and numba is enabled and the precision is single
.
lang_suffix
property
lang_suffix: str
Return the language suffix for file names, empty for en
, -zh
for zh
.
matplotlib_styles
class-attribute
instance-attribute
Matplotlib styles
numba_enabled
class-attribute
instance-attribute
numba_enabled: bool = True
Is Numba enabled, True
or False
plotting_backend
class-attribute
instance-attribute
plotting_backend: Literal['matplotlib', 'bokeh'] = 'matplotlib'
Plotting backend, matplotlib
or bokeh
precision
class-attribute
instance-attribute
precision: Literal['single', 'double'] = 'double'
Precision, single
or double
suppress_output
class-attribute
instance-attribute
suppress_output: bool = False
Whether to suppress output
suppress_warnings
class-attribute
instance-attribute
suppress_warnings: bool = False
Whether to suppress warnings
translation_file
class-attribute
instance-attribute
translation_file: str = 'micromechanical-translations.yaml'
Translation file