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

◆ MaterialRegistry()

inet::physicalenvironment::MaterialRegistry::MaterialRegistry ( )
19 {
20 }

◆ ~MaterialRegistry()

inet::physicalenvironment::MaterialRegistry::~MaterialRegistry ( )
virtual
23 {
24  for (auto& entry : materials)
25  delete entry.second;
26 }

Member Function Documentation

◆ addMaterial()

void inet::physicalenvironment::MaterialRegistry::addMaterial ( const Material material) const
protected
29 {
30  materials.insert(std::pair<const std::string, const Material *>(material->getName(), material));
31 }

Referenced by getMaterial().

◆ getMaterial()

const Material * inet::physicalenvironment::MaterialRegistry::getMaterial ( const char *  name) const
overridevirtual

Implements inet::physicalenvironment::IMaterialRegistry.

34 {
35  if (materials.size() == 0) {
36  // TODO verify values
37  addMaterial(new Material("vacuum", Ohmm(NaN), 1, 1));
38  addMaterial(new Material("air", Ohmm(NaN), 1.00058986, 1.00000037));
39  addMaterial(new Material("copper", Ohmm(1.68), NaN, NaN));
40  addMaterial(new Material("aluminium", Ohmm(2.65), NaN, NaN));
41  addMaterial(new Material("wood", Ohmm(1E+15), 5, 1.00000043));
42  addMaterial(new Material("forest", Ohmm(37E+3), 1.6, 1));
43  addMaterial(new Material("brick", Ohmm(3E+3), 4.5, 1));
44  addMaterial(new Material("concrete", Ohmm(1E+2), 4.5, 1));
45  addMaterial(new Material("glass", Ohmm(1E+12), 7, 1));
46  }
47  auto it = materials.find(name);
48  return it != materials.end() ? it->second : nullptr;
49 }

Referenced by inet::physicalenvironment::PhysicalEnvironment::parseObjects().

Member Data Documentation

◆ materials

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

◆ singleton


The documentation for this class was generated from the following files:
inet::physicalenvironment::MaterialRegistry::materials
std::map< const std::string, const Material * > materials
Definition: MaterialRegistry.h:22
NaN
#define NaN
Definition: INETMath.h:91
inet::units::units::Ohmm
compose< Ohm, m > Ohmm
Definition: Units.h:945
inet::physicalenvironment::MaterialRegistry::addMaterial
void addMaterial(const Material *material) const
Definition: MaterialRegistry.cc:28