Plugin system
Prerequisites
First, you need to install the musica Python package for the musica command to be available. To do so, run the following command in the root directory of the project:
Install cmake and one of the following C/C++ compilers:
Then, use the musica plugin make command to compile the plugins:
musica plugin make elastic.cpp changhicher.cpp --working_directory=plugin --build=build
This will compile the elastic.cpp and changhicher.cpp plugins to dynamic libraries in the plugin directory using cmake as the build system. Type musica plugin make --help for more information about the command. After compiling the plugins, you can use the built plugins in your simulations:
#include <unordered_map>
#include <string>
std::unordered_map<std::string, double> props = {{"kt0", 32.0}, {"R", 2.5}};
Manager for micromechanical models.
Micromechanical models.
Definition changhicher.hpp:15
static MicromechanicalBase< T > * create(const std::variant< MicromechanicalType, std::string, MicromechanicalBase< T > * > &model, const std::variant< ContactLawType, std::string, ContactLawBase< T > * > &contact, const std::unordered_map< std::string, T > &props={}, T npv=1e9, T radius=0.65e-3)
Create a micromechanical model.
Definition models.hpp:69
Create plugins for micromechanical models
A plugin for a micromechanical model is a .cpp file that contains a function named micromechanical_model that returns a pointer to a MicromechanicalBase object. The function must have the following signature:
const std::unordered_map<std::string, double>& props = {},
double npv = 1e9,
double radius = 0.65e-3) {
}
Base class for micromechanical models.
Definition average.hpp:11
Base class for micromechanical models.
Definition micromechanical.hpp:25
Create plugins for contact laws
A plugin for a contact law is a .cpp file that contains a function named micromechanical_contact that returns a pointer to a ContactLawBase object. The function must have the following signature:
#include <unordered_map>
#include <string>
extern "C" ContactLawBase<double>* micromechanical_contact(
const std::unordered_map<std::string, double>& props) {
}