NetDEM v1.0
Loading...
Searching...
No Matches
contact_model.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "bond_geometries.hpp"
5#include "contact_forces.hpp"
6#include "utils_io.hpp"
7#include <iostream>
8#include <nlohmann/json.hpp>
9#include <string>
10
11namespace netdem {
12
13class ContactPP;
14class ContactPW;
15
26public:
29
31 int id{0};
32
34 std::string label{"default"};
35
38 int model_type{0};
39
42 std::string model_name{"contact_model"};
43
52 virtual nlohmann::json PackJson() {
53 IO::PrintWarning("in ContactModel::PackJson, method not implemented for: " +
55 return nlohmann::json();
56 }
57
69 virtual void InitFromJson(nlohmann::json const &js) {
71 "in ContactModel::InitFromJson, method not implemented for: " +
73 }
74
86 virtual void SetProperty(nlohmann::json const &js) {
88 "in ContactModel::SetProperty, method not implemented for: " +
90 }
91
103 virtual void SetProperty(std::string const &name, double value) {
105 "in ContactModel::SetProperty, method not implemented for: " +
106 model_name);
107 }
108
118 virtual ContactModel *Clone() const { return new ContactModel(*this); }
119
137 virtual void EvaluateForces(ContactForces *const cnt_forces,
138 CollisionGeometries &cnt_geoms,
139 ContactPP *const cnt, double dt) const {
141 "in ContactModel::EvaluateForces, method not implemented for: " +
142 model_name);
143 }
144
160 virtual void EvaluateForces(ContactForces *const cnt_forces,
161 BondGeometries &cnt_geoms, ContactPP *const cnt,
162 double dt) const {
164 "in ContactModel::EvaluateForces, method not implemented for: " +
165 model_name);
166 }
167
184 virtual void EvaluateForces(ContactForces *const cnt_forces,
185 CollisionGeometries &cnt_geoms,
186 ContactPW *const cnt, double dt) const {
188 "in ContactModel::EvaluateForces, method not implemented for: " +
189 model_name);
190 }
191
207 virtual void EvaluateForces(ContactForces *const cnt_forces,
208 BondGeometries &cnt_geoms, ContactPW *const cnt,
209 double dt) const {
211 "in ContactModel::EvaluateForces, method not implemented for: " +
212 model_name);
213 }
214
222 virtual void Print() const {
223 IO::PrintWarning("in ContactModel::Print, method not implemented for: " +
224 model_name);
225 }
226
228 virtual ~ContactModel() {}
229};
230
231} // namespace netdem
The BondGeometries class represents the geometrical properties of a bond.
Definition bond_geometries.hpp:11
A class representing the geometries associated with a collision.
Definition collision_geometries.hpp:15
A class representing the contact forces and moments arising from a contact interaction.
Definition contact_forces.hpp:18
An abstract base class for contact models.
Definition contact_model.hpp:25
virtual void SetProperty(nlohmann::json const &js)
Set a property of this contact model from a JSON object.
Definition contact_model.hpp:86
virtual nlohmann::json PackJson()
Serialize this contact model to JSON format.
Definition contact_model.hpp:52
virtual void EvaluateForces(ContactForces *const cnt_forces, CollisionGeometries &cnt_geoms, ContactPP *const cnt, double dt) const
Calculate the contact forces and moments due to this model.
Definition contact_model.hpp:137
virtual void EvaluateForces(ContactForces *const cnt_forces, BondGeometries &cnt_geoms, ContactPW *const cnt, double dt) const
Calculate the contact forces and moments due to this model.
Definition contact_model.hpp:207
virtual void SetProperty(std::string const &name, double value)
Set a property of this contact model by name and value.
Definition contact_model.hpp:103
virtual void Print() const
Print debugging information about this contact model.
Definition contact_model.hpp:222
virtual ContactModel * Clone() const
Create a new instance of this contact model.
Definition contact_model.hpp:118
int model_type
Definition contact_model.hpp:38
virtual void EvaluateForces(ContactForces *const cnt_forces, BondGeometries &cnt_geoms, ContactPP *const cnt, double dt) const
Calculate the contact forces and moments due to this model.
Definition contact_model.hpp:160
virtual void EvaluateForces(ContactForces *const cnt_forces, CollisionGeometries &cnt_geoms, ContactPW *const cnt, double dt) const
Calculate the contact forces and moments due to this model.
Definition contact_model.hpp:184
Type
Definition contact_model.hpp:28
@ none
Definition contact_model.hpp:28
@ parallel_bond
Definition contact_model.hpp:28
@ linear_spring
Definition contact_model.hpp:28
@ hertz_mindlin
Definition contact_model.hpp:28
@ volume_based
Definition contact_model.hpp:28
virtual ~ContactModel()
Definition contact_model.hpp:228
std::string label
Definition contact_model.hpp:34
virtual void InitFromJson(nlohmann::json const &js)
Initialize this contact model from a JSON configuration object.
Definition contact_model.hpp:69
std::string model_name
Definition contact_model.hpp:42
A class representing a contact between two particles.
Definition contact_pp.hpp:20
A class representing a contact between a particle and a wall.
Definition contact_pw.hpp:22
static void PrintWarning(std::string const &info)
Definition utils_io.cpp:14
Definition bond_entry.hpp:7