Ignition Math

API Reference

6.9.3~pre2

Contains information about a single material. More...

#include <Material.hh>

Public Member Functions

 Material ()
 Constructor. More...
 
 Material (const MaterialType _type)
 Construct a material based on a type. More...
 
 Material (const std::string &_typename)
 Construct a material based on a type name. More...
 
 Material (const double _density)
 Construct a material based on a density value. More...
 
 Material (const Material &_material)
 Copy constructor. More...
 
 Material (Material &&_material)
 Move constructor. More...
 
 ~Material ()
 Destructor. More...
 
double Density () const
 Get the density value of the material in kg/m^3. More...
 
std::string Name () const
 Get the name of the material. This will match the enum type names used in MaterialType, but in lowercase, if a built-in material is used. More...
 
bool operator!= (const Material &_material) const
 Inequality operator. This compares type and density values. More...
 
Materialoperator= (const Material &_material)
 Copy operator. More...
 
Materialoperator= (Material &&_material)
 Move operator. More...
 
bool operator== (const Material &_material) const
 Equality operator. This compares type and density values. More...
 
void SetDensity (const double _density)
 Set the density value of the material in kg/m^3. More...
 
void SetName (const std::string &_name)
 Set the name of the material. More...
 
void SetToNearestDensity (const double _value, const double _epsilon=std::numeric_limits< double >::max())
 Set this Material to the built-in Material with the nearest density value within _epsilon. If a built-in material could not be found, then this Material is not changed. More...
 
void SetType (const MaterialType _type)
 Set the material's type. This will only set the type value. Other properties, such as density, will not be changed. More...
 
MaterialType Type () const
 Get the material's type. More...
 

Static Public Member Functions

static const std::map< MaterialType, Material > & Predefined ()
 Get all the built-in materials. More...
 

Detailed Description

Contains information about a single material.

Steel, wood, and iron are examples of materials. This class allows you to create custom materials, or use built-in materials. The list of built-in materials can be found in the MaterialType enum.

This class will replace the MaterialDensity class found in the Ignition Common library, which was at version 1 at the time of this writing.

How to create a wood material:

std::cout << "The density of " << mat.Name() << " is "
<< mat.Density() << std::endl;

How to create a custom material:

mat.SetDensity(12.23);
mat.SetName("my_material");
std::cout << "The density of " << mat.Name() is "
<< mat.Density() << std::endl;

Constructor & Destructor Documentation

◆ Material() [1/6]

Material ( )

Constructor.

◆ Material() [2/6]

Material ( const MaterialType  _type)
explicit

Construct a material based on a type.

Parameters
[in]_typeBuilt-in type to create.

◆ Material() [3/6]

Material ( const std::string _typename)
explicit

Construct a material based on a type name.

Parameters
[in]_typenameName of the built-in type to create. String names are listed in the MaterialType documentation.

◆ Material() [4/6]

Material ( const double  _density)
explicit

Construct a material based on a density value.

Parameters
[in]_densityMaterial density.

◆ Material() [5/6]

Material ( const Material _material)

Copy constructor.

Parameters
[in]_materialMaterial to copy.

◆ Material() [6/6]

Material ( Material &&  _material)

Move constructor.

Parameters
[in]_materialMaterial to move. The _material object will have default values after the move.

◆ ~Material()

~Material ( )

Destructor.

Member Function Documentation

◆ Density()

double Density ( ) const

Get the density value of the material in kg/m^3.

Returns
The density of this material in kg/m^3.

Referenced by MassMatrix3< T >::SetFromBox(), MassMatrix3< T >::SetFromCylinderZ(), and MassMatrix3< T >::SetFromSphere().

◆ Name()

std::string Name ( ) const

Get the name of the material. This will match the enum type names used in MaterialType, but in lowercase, if a built-in material is used.

Returns
The material's name.
See also
void SetName(const std::string &_name)

◆ operator!=()

bool operator!= ( const Material _material) const

Inequality operator. This compares type and density values.

Parameters
[in]_materialMaterial to evaluate this object against.
Returns
True if this material is not equal to the given _material.

◆ operator=() [1/2]

Material& operator= ( const Material _material)

Copy operator.

Parameters
[in]_materialMaterial to copy.
Returns
Reference to this material.

◆ operator=() [2/2]

Material& operator= ( Material &&  _material)

Move operator.

Parameters
[in]_materialMaterial to move. The _material object will contain default values after this move.
Returns
Reference to this Material.

◆ operator==()

bool operator== ( const Material _material) const

Equality operator. This compares type and density values.

Parameters
[in]_materialMaterial to evaluate this object against.
Returns
True if this material is equal to the given _material.

◆ Predefined()

static const std::map<MaterialType, Material>& Predefined ( )
static

Get all the built-in materials.

Returns
A map of all the materials. The map's key is material type and the map's value is the material object.

◆ SetDensity()

void SetDensity ( const double  _density)

Set the density value of the material in kg/m^3.

Parameters
[in]_densityThe density of this material in kg/m^3.

Referenced by OrientedBox< T >::SetDensityFromMass().

◆ SetName()

void SetName ( const std::string _name)

Set the name of the material.

Parameters
[in]_nameThe material's name.
See also
std::string Name() const

◆ SetToNearestDensity()

void SetToNearestDensity ( const double  _value,
const double  _epsilon = std::numeric_limits< double >::max() 
)

Set this Material to the built-in Material with the nearest density value within _epsilon. If a built-in material could not be found, then this Material is not changed.

Parameters
[in]_valueDensity value of entry to match.
[in]_epsilonAllowable range of difference between _value, and a material's density.

◆ SetType()

void SetType ( const MaterialType  _type)

Set the material's type. This will only set the type value. Other properties, such as density, will not be changed.

Parameters
[in]_typeThe material's type.

◆ Type()

MaterialType Type ( ) const

Get the material's type.

Returns
The material's type.

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