micromechanical
Micromechanical model for granular materials
- GitHub: https://github.com/hailin-wang/micromechanical/
- Documentation (Python): https://hailin-wang.github.io/micromechanical/
- Documentation (C++): https://hailin-wang.github.io/micromechanical/dev/doxygen/
Install the package from pre-built wheels
Install GitHub CLI and Python 3.8+ first.
Download the latest pre-built wheels from GitHub releases and install them with pip
(only if you have the access to
the hailin-wang/micromechanical repository):
gh release download --pattern *.whl --pattern *.tar.gz --dir wheelhouse --clobber --repo hailin-wang/micromechanical
pip install --find-links wheelhouse micromechanical[all]
Build and install the package from source
Generate pybind11 binding sources
It is recommended to generate the pybind11 binding sources on Linux or Windows Subsystem for Linux (WSL) on Windows. Binder on Windows is not tested and may not work properly.
Install binder to generate the pybind11 binding sources:
Make sure that the binder
executable is in the system PATH
.
Type binder --help
to see if the installation is successful.
Update the configuration file micromechanical/cpp/binder_config.txt
and micromechanical/cpp/binder-includes.hpp if necessary.
Generate the pybind11 binding sources with the following command in the micromechanical/cpp
directory:
Reformat the generated pybind11 binding sources with (in the root directory):
Build and install the package
Please install one of the following C/C++ compilers to build the C++ extension:
- GNU GCC (tested on 11.4.0)
- LLVM Clang (not tested)
- Microsoft Visual C++ (MSVC) (tested on 19.37.32822)
Install the package from the source with pip
:
# Install dependencies with pinned versions
pip install -r https://micromechanical.hailin.wang/requirements.txt
pip install -e .[all]
or with pdm
:
Generate the bindings stubs wit:
Run tests
Run tests with tox
with all supported Python versions, backends, and precisions:
or directly with pytest
under the current Python version, preferred backend (cpp
), and precision (double
):