Public Types | Public Member Functions | Protected Types | Protected Attributes

OpenTissue::mbd::MaterialLibrary< mbd_types > Class Template Reference

#include <mbd_material_library.h>

List of all members.

Public Types

typedef
mbd_types::math_policy::real_type 
real_type
typedef
mbd_types::math_policy::index_type 
index_type
typedef
mbd_types::math_policy::index_type 
size_type
typedef mbd_types::material_type material_type
typedef
boost::indirect_iterator
< material_ptr_lut_iterator
material_iterator

Public Member Functions

 MaterialLibrary ()
virtual ~MaterialLibrary ()
void add (material_type const &m)
material_typeget (index_type A, index_type B)
void clear ()
material_typedefault_material ()
size_type size_materials () const
material_iterator material_begin ()
material_iterator material_end ()

Protected Types

typedef stdext::hash_map
< index_type, material_type * > 
material_ptr_lut_type
typedef
OpenTissue::utility::map_data_iterator
< typename
material_ptr_lut_type::iterator > 
material_ptr_lut_iterator

Protected Attributes

material_ptr_lut_type m_storage
 Storage of material properties.
material_type m_default
 Default material property.

Detailed Description

template<typename mbd_types>
class OpenTissue::mbd::MaterialLibrary< mbd_types >

Modelling Material Properties.

First one should create some unique positive material indices,

  size_t ground_material_idx = 1;
  size_t wheel_material_idx  = 2;

The material index value of zero has special meaning since it is hardwired to the default material properties. The default material properties is used between two objects having both material index zero.

Notice that iIf no materials exist with material indices matching those of the rigid bodies then the engine works like the material indices of the rigid bodies were both set to zero.

After having defined some material indices one can now assign the materials to the rigid bodies that one like. In our little example we will setup an interesting material between the wheels of vechicle and a ground surface. The material indices should be assigned in a maner similar to this

  m_ground.set_material_idx(ground_material_idx);
  ...
  m_configuration.add(&m_ground);
  for(size_t i ....)
  {
    m_wheels[i].set_material_idx(wheel_material_idx);
    ...
    m_configuration.add(&m_wheels[i]);
  }

Notice that the material indices are simply assigned using the method set_material_idx. Material indices should be assigned prior to the first run of a simulator. Perferably before adding a rigid body to a configuration.

Next one should create the material properties and assign their values. First we need a container for the material properties,

  material_type          wheel_ground_material;
  wheel_ground_material.set_material_indices(wheel_material_idx, ground_material_idx);

Following this one can assign how many friction directions that should be used

    wheel_ground_material.set_number_of_friction_directions(2);

Next one should decide whether an isotropic or an anisotrpic friction cone should be used. If one choice an isotropic model then the friction coefficient can be set for all friction directions by a single invokation of the method set_friction_coefficient,

  real_type my_friction_value = ...;
  wheel_ground_material.set_friction_coefficient( my_friction_value );

However, for a wheel like object one would most likely choose an anisotropic model, and the friction coefficients for each friction direction must be specified individually like this,

    wheel_ground_material.set_friction_coefficient(0,2.0);
    wheel_ground_material.set_friction_coefficient(1,5.0);

By default the friction directions of the friction cone is determined by the relative slinding direction of two rigid bodies at a single contact point. This behavior can be turned off and another scheme can be used for determining the friction directions.

    wheel_ground_material.set_use_sliding_direction(false);

The technique of using the relative slidning directin takes precedence over any other settings, thus default behavior can be established simply by turning this setting on again.

For a tire-ground contact it makes sense to use a prefixed friction direction determined by the forward/backward moving direction of the wheels. First we will tell the material properties to use a prefixed direction,

    wheel_ground_material.set_use_prefixed_direction(true);

Following this we have to specify how the prefixed direction should be determined. In our case we want to have the direction prefixed wrt. the local frame of the wheel body. This is done by specifying the material index of the rigid body wrt. which the prefixed direction should be set.

    wheel_ground_material.set_prefixed_material_index( wheel_material_idx );

If one uses values not equal to any of the two rigid bodies (wheel and gound in the case) then the prefixed direction is given wrt. the world coordinate system. Now we can specify the prefixed direction as a local vector in the wheel model frame.

    wheel_ground_material.set_prefixed_direction( vector3_type( 0.0, 0.0, 1.0 ) );

This is advantages because we want the friction coefficient along the rolling direction to be smaller than the friction direction across the rolling direction of the wheel. This will prevent a car model from skiding when making sharp turns.

Next one could specify how bouncy a wheel object should be on the ground surface

   wheel_ground_material.normal_restitution() = 0.1;

Hereafter one could make the wheel-ground contacts a little soft by adding a sligt amount of regularization, it has the effect of adding a certain amount of damping.

   wheel_ground_material.set_normal_regularization(0.1);

In the same go one would most likely also specify the value of the error reduction paramter,

   wheel_ground_material.wheel_ground_material.set_error_reduction_parameter(0.1);

This effect will correspond to adding a small spring to prevent penetrations at wheel ground contacts. Overall the error-reduction-parameter and the regularization add some elasticity to the wheel-ground contacts.

As a finally step we can add the new material properties to our material library, like this

  m_library.add( wheel_ground_material );

In general one should also setup the default material properties, these properties are used whenever the material liberay can not find a pre-set material properties for a pair of rigid bodies. First we need to obtain access to the defualt material properties,

  material_type * default_material = data.m_library.default_material();

If one has already used the material properties in a previously configuration then one can clear all previously settings by invoking the clear method.

  default_material->clear();

Next one simply set the values as one please, here we simply choice a low friction bouncy type of material.

  default_material->set_friction_coefficient(0.25);
  default_material->normal_restitution() = (0.15);

Member Typedef Documentation

template<typename mbd_types >
typedef mbd_types::math_policy::index_type OpenTissue::mbd::MaterialLibrary< mbd_types >::index_type
template<typename mbd_types >
typedef boost::indirect_iterator<material_ptr_lut_iterator> OpenTissue::mbd::MaterialLibrary< mbd_types >::material_iterator
template<typename mbd_types >
typedef OpenTissue::utility::map_data_iterator<typename material_ptr_lut_type::iterator> OpenTissue::mbd::MaterialLibrary< mbd_types >::material_ptr_lut_iterator [protected]
template<typename mbd_types >
typedef stdext::hash_map<index_type, material_type*> OpenTissue::mbd::MaterialLibrary< mbd_types >::material_ptr_lut_type [protected]
template<typename mbd_types >
typedef mbd_types::material_type OpenTissue::mbd::MaterialLibrary< mbd_types >::material_type
template<typename mbd_types >
typedef mbd_types::math_policy::real_type OpenTissue::mbd::MaterialLibrary< mbd_types >::real_type
template<typename mbd_types >
typedef mbd_types::math_policy::index_type OpenTissue::mbd::MaterialLibrary< mbd_types >::size_type

Constructor & Destructor Documentation

template<typename mbd_types >
OpenTissue::mbd::MaterialLibrary< mbd_types >::MaterialLibrary (  )  [inline]
template<typename mbd_types >
virtual OpenTissue::mbd::MaterialLibrary< mbd_types >::~MaterialLibrary (  )  [inline, virtual]

Member Function Documentation

template<typename mbd_types >
void OpenTissue::mbd::MaterialLibrary< mbd_types >::add ( material_type const &  m  )  [inline]
template<typename mbd_types >
void OpenTissue::mbd::MaterialLibrary< mbd_types >::clear (  )  [inline]
template<typename mbd_types >
material_type* OpenTissue::mbd::MaterialLibrary< mbd_types >::default_material (  )  [inline]
template<typename mbd_types >
material_type* OpenTissue::mbd::MaterialLibrary< mbd_types >::get ( index_type  A,
index_type  B 
) [inline]
template<typename mbd_types >
material_iterator OpenTissue::mbd::MaterialLibrary< mbd_types >::material_begin (  )  [inline]
template<typename mbd_types >
material_iterator OpenTissue::mbd::MaterialLibrary< mbd_types >::material_end (  )  [inline]
template<typename mbd_types >
size_type OpenTissue::mbd::MaterialLibrary< mbd_types >::size_materials (  )  const [inline]

Member Data Documentation

template<typename mbd_types >
material_type OpenTissue::mbd::MaterialLibrary< mbd_types >::m_default [protected]

Default material property.

template<typename mbd_types >
material_ptr_lut_type OpenTissue::mbd::MaterialLibrary< mbd_types >::m_storage [protected]

Storage of material properties.


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