INET Framework for OMNeT++/OMNEST
inet::physicalenvironment::MaterialRegistry Class Reference

#include <MaterialRegistry.h>

Inheritance diagram for inet::physicalenvironment::MaterialRegistry:
inet::physicalenvironment::IMaterialRegistry

Public Member Functions

 MaterialRegistry ()
 
virtual ~MaterialRegistry ()
 
virtual const MaterialgetMaterial (const char *name) const override
 

Static Public Attributes

static MaterialRegistry singleton
 

Protected Member Functions

void addMaterial (const Material *material) const
 

Protected Attributes

std::map< const std::string, const Material * > materials
 

Constructor & Destructor Documentation

inet::physicalenvironment::MaterialRegistry::MaterialRegistry ( )
28 {
29 }
inet::physicalenvironment::MaterialRegistry::~MaterialRegistry ( )
virtual
32 {
33  for (auto & entry : materials)
34  delete entry.second;
35 }
std::map< const std::string, const Material * > materials
Definition: MaterialRegistry.h:31

Member Function Documentation

void inet::physicalenvironment::MaterialRegistry::addMaterial ( const Material material) const
protected

Referenced by getMaterial().

38 {
39  materials.insert(std::pair<const std::string, const Material *>(material->getName(), material));
40 }
std::map< const std::string, const Material * > materials
Definition: MaterialRegistry.h:31
const Material * inet::physicalenvironment::MaterialRegistry::getMaterial ( const char *  name) const
overridevirtual

Implements inet::physicalenvironment::IMaterialRegistry.

43 {
44  if (materials.size() == 0)
45  {
46  // TODO: verify values
47  addMaterial(new Material("vacuum", Ohmm(NaN), 1, 1));
48  addMaterial(new Material("air", Ohmm(NaN), 1.00058986, 1.00000037));
49  addMaterial(new Material("copper", Ohmm(1.68), NaN, NaN));
50  addMaterial(new Material("aluminium", Ohmm(2.65), NaN, NaN));
51  addMaterial(new Material("wood", Ohmm(1E+15), 5, 1.00000043));
52  addMaterial(new Material("forest", Ohmm(37E+3), 1.6, 1));
53  addMaterial(new Material("brick", Ohmm(3E+3), 4.5, 1));
54  addMaterial(new Material("concrete", Ohmm(1E+2), 4.5, 1));
55  addMaterial(new Material("glass", Ohmm(1E+12), 7, 1));
56  }
57  auto it = materials.find(name);
58  return it != materials.end() ? it->second : nullptr;
59 }
compose< Ohm, m > Ohmm
Definition: Units.h:775
std::map< const std::string, const Material * > materials
Definition: MaterialRegistry.h:31
#define NaN
Definition: INETMath.h:103
void addMaterial(const Material *material) const
Definition: MaterialRegistry.cc:37

Member Data Documentation

std::map<const std::string, const Material *> inet::physicalenvironment::MaterialRegistry::materials
mutableprotected

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