NetDEM v1.0
Loading...
Searching...
No Matches
netdem::ContactModel Class Reference

An abstract base class for contact models. More...

#include <contact_model.hpp>

Inheritance diagram for netdem::ContactModel:
netdem::HertzMindlin netdem::LinearSpring netdem::ParallelBond netdem::VolumeBased

Public Types

enum  Type {
  none , linear_spring , hertz_mindlin , volume_based ,
  parallel_bond
}
 

Public Member Functions

virtual nlohmann::json PackJson ()
 Serialize this contact model to JSON format.
 
virtual void InitFromJson (nlohmann::json const &js)
 Initialize this contact model from a JSON configuration object.
 
virtual void SetProperty (nlohmann::json const &js)
 Set a property of this contact model from a JSON object.
 
virtual void SetProperty (std::string const &name, double value)
 Set a property of this contact model by name and value.
 
virtual ContactModelClone () const
 Create a new instance of this contact model.
 
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.
 
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.
 
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.
 
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.
 
virtual void Print () const
 Print debugging information about this contact model.
 
virtual ~ContactModel ()
 

Public Attributes

int id {0}
 
std::string label {"default"}
 
int model_type {0}
 
std::string model_name {"contact_model"}
 

Detailed Description

An abstract base class for contact models.

This class defines a set of virtual methods and member variables that must be implemented by any subclass representing a specific contact model. The Type enumeration provides a list of possible model types, while the id, label, and model_name variables can be used to identify and describe individual instances of contact models.

Member Enumeration Documentation

◆ Type

An enumeration of possible contact model types.

Enumerator
none 
linear_spring 
hertz_mindlin 
volume_based 
parallel_bond 

Constructor & Destructor Documentation

◆ ~ContactModel()

virtual netdem::ContactModel::~ContactModel ( )
inlinevirtual

A virtual destructor for this class.

Member Function Documentation

◆ Clone()

virtual ContactModel * netdem::ContactModel::Clone ( ) const
inlinevirtual

Create a new instance of this contact model.

This method creates a new instance of the current contact model and returns a pointer to it. This is a virtual method that can be overridden in any subclass of ContactModel that needs to customize the cloning behavior.

Returns
A pointer to a new instance of this contact model.

Reimplemented in netdem::HertzMindlin, netdem::LinearSpring, netdem::ParallelBond, and netdem::VolumeBased.

◆ EvaluateForces() [1/4]

virtual void netdem::ContactModel::EvaluateForces ( ContactForces *const cnt_forces,
BondGeometries & cnt_geoms,
ContactPP *const cnt,
double dt ) const
inlinevirtual

Calculate the contact forces and moments due to this model.

Given a set of bond geometries representing the contact interaction, this method calculates the resulting contact forces and moments and stores them in the provided ContactForces object. This is a pure virtual method that must be implemented by any subclass of ContactModel.

Parameters
cnt_forcesA pointer to the ContactForces object to store the resulting forces and moments in.
cnt_geomsThe bond geometries representing the contact interaction.
cntA pointer to the ContactPP or ContactPW object representing the contact point(s).
dtThe time step size for the simulation.

Reimplemented in netdem::ParallelBond.

◆ EvaluateForces() [2/4]

virtual void netdem::ContactModel::EvaluateForces ( ContactForces *const cnt_forces,
BondGeometries & cnt_geoms,
ContactPW *const cnt,
double dt ) const
inlinevirtual

Calculate the contact forces and moments due to this model.

Given a set of bond geometries representing the contact interaction, this method calculates the resulting contact forces and moments and stores them in the provided ContactForces object. This is a pure virtual method that must be implemented by any subclass of ContactModel.

Parameters
cnt_forcesA pointer to the ContactForces object to store the resulting forces and moments in.
cnt_geomsThe bond geometries representing the contact interaction.
cntA pointer to the ContactPW object representing the contact point(s).
dtThe time step size for the simulation.

Reimplemented in netdem::ParallelBond.

◆ EvaluateForces() [3/4]

virtual void netdem::ContactModel::EvaluateForces ( ContactForces *const cnt_forces,
CollisionGeometries & cnt_geoms,
ContactPP *const cnt,
double dt ) const
inlinevirtual

Calculate the contact forces and moments due to this model.

Given a set of collision or bond geometries representing the contact interaction, this method calculates the resulting contact forces and moments and stores them in the provided ContactForces object. This is a pure virtual method that must be implemented by any subclass of ContactModel.

Parameters
cnt_forcesA pointer to the ContactForces object to store the resulting forces and moments in.
cnt_geomsThe collision or bond geometries representing the contact interaction.
cntA pointer to the ContactPP or ContactPW object representing the contact point(s).
dtThe time step size for the simulation.

Reimplemented in netdem::HertzMindlin, netdem::LinearSpring, and netdem::VolumeBased.

◆ EvaluateForces() [4/4]

virtual void netdem::ContactModel::EvaluateForces ( ContactForces *const cnt_forces,
CollisionGeometries & cnt_geoms,
ContactPW *const cnt,
double dt ) const
inlinevirtual

Calculate the contact forces and moments due to this model.

Given a set of collision geometries representing the contact interaction, this method calculates the resulting contact forces and moments and stores them in the provided ContactForces object. This is a pure virtual method that must be implemented by any subclass of ContactModel.

Parameters
cnt_forcesA pointer to the ContactForces object to store the resulting forces and moments in.
cnt_geomsThe collision geometries representing the contact interaction.
cntA pointer to the ContactPW object representing the contact point(s).
dtThe time step size for the simulation.

Reimplemented in netdem::HertzMindlin, netdem::LinearSpring, and netdem::VolumeBased.

◆ InitFromJson()

virtual void netdem::ContactModel::InitFromJson ( nlohmann::json const & js)
inlinevirtual

Initialize this contact model from a JSON configuration object.

Given a JSON object containing configuration data for this contact model, this method reads the data and updates the state of the object accordingly. This is a pure virtual method that must be implemented by any subclass of ContactModel.

Parameters
jsA JSON object containing configuration data for this contact model.

Reimplemented in netdem::HertzMindlin, netdem::LinearSpring, netdem::ParallelBond, and netdem::VolumeBased.

◆ PackJson()

virtual nlohmann::json netdem::ContactModel::PackJson ( )
inlinevirtual

Serialize this contact model to JSON format.

This method converts the current state of the contact model to a JSON object and returns it as the result value.

Returns
A JSON object containing serialization data for this contact model.

Reimplemented in netdem::HertzMindlin, netdem::LinearSpring, netdem::ParallelBond, and netdem::VolumeBased.

◆ Print()

virtual void netdem::ContactModel::Print ( ) const
inlinevirtual

Print debugging information about this contact model.

This method prints a summary of the current state of the contact model to the console or log file, including the values of all member variables and any other relevant information.

Reimplemented in netdem::HertzMindlin, netdem::LinearSpring, netdem::ParallelBond, and netdem::VolumeBased.

◆ SetProperty() [1/2]

virtual void netdem::ContactModel::SetProperty ( nlohmann::json const & js)
inlinevirtual

Set a property of this contact model from a JSON object.

Given a JSON object representing a named property of this contact model, this method reads the value of the property and updates the state of the object accordingly. This is a pure virtual method that must be implemented by any subclass of ContactModel.

Parameters
jsA JSON object representing a named property of this contact model.

Reimplemented in netdem::HertzMindlin, netdem::LinearSpring, netdem::ParallelBond, and netdem::VolumeBased.

◆ SetProperty() [2/2]

virtual void netdem::ContactModel::SetProperty ( std::string const & name,
double value )
inlinevirtual

Set a property of this contact model by name and value.

Given a string representing the name of a property and a value to set it to, this method updates the state of the contact model accordingly. This is a pure virtual method that must be implemented by any subclass of ContactModel.

Parameters
nameThe name of the property to set.
valueThe new value of the property.

Reimplemented in netdem::HertzMindlin, and netdem::LinearSpring.

Member Data Documentation

◆ id

int netdem::ContactModel::id {0}

A unique identifier for this instance of the contact model.

◆ label

◆ model_name

std::string netdem::ContactModel::model_name {"contact_model"}

The name of this contact model, used primarily for debugging and logging purposes.

◆ model_type

int netdem::ContactModel::model_type {0}

The type of this contact model, as one of the Type enumeration values.


The documentation for this class was generated from the following file: