PLaSK library

Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
plask::MaterialsDB Struct Reference

Materials database. More...

`#include <plask/material/db.hpp>`

Inheritance diagram for plask::MaterialsDB:
[legend]
Collaboration diagram for plask::MaterialsDB:
[legend]

## Classes
struct | DelegateMaterialConstructor
| Specialization of this implements MaterialConstructor. More...
struct | DelegateMaterialConstructor< MaterialType, false, false >
struct | DelegateMaterialConstructor< MaterialType, false, true >
struct | DelegateMaterialConstructor< MaterialType, true, false >
struct | DelegateMaterialConstructor< MaterialType, true, true >
struct | DummyMixedCompositionFactory
| Dummy mixed factory for use in draft mode. More...
struct | MaterialConstructor
| Object of this class (inherited from it) construct material instance. More...
struct | MixedCompositionAndDopantFactory
| Factory of alloy material which construct its versions with mixed version of two compositions and dopants. More...
struct | MixedCompositionFactory
| Base class for factories of alloy materials which construct their versions with mixed compositions and/or doping amounts. More...
struct | MixedCompositionOnlyFactory
| Factory of alloy material which construct it version with mixed version of two compositions (for materials without dopants). More...
struct | MixedDopantFactory
| Factory of alloy material which construct its versions with mixed versions of two dopants (for material with same compositions). More...
class | ProxyMaterialConstructor
| Material constructor that holds other constructor or complete material object based on the provided name. More...
struct | Register
| Helper which calls getDefault().add<MaterialType>([name]) in constructor. More...
struct | RegisterUnderName
| Same as Register but for materials without static field NAME. More...

## Public Types
typedef TemporaryReplaceDefault | TemporaryClearDefault
typedef boost::transform_iterator< iter_val, constructors_map_t::const_iterator > | iterator
| Iterator over material constructors (shared_ptr<shared_ptr<const MaterialConstructor>>).
typedef iterator | const_iterator
| Iterator over material constructors (shared_ptr<shared_ptr<const MaterialConstructor>>).

## Public Member Functions
void | clear ()
| Clear the database.
void | update (const MaterialsDB &src)
| Update with values from different database.
const_iterator | begin () const
| Get iterator which refer to first record in database.
const_iterator | end () const
| Get iterator which refer one step after last record in database.
size_t | size () const
| Get number of material types in database.
shared_ptr< Material > | get (const Material::Composition &composition, const std::string &label, const std::string &dopant_name, double doping) const
| Create material object.
shared_ptr< Material > | get (const Material::Composition &composition, const std::string &dopant_name, double doping) const
| Create material object.
shared_ptr< Material > | get (const Material::Composition &composition, const std::string &label="") const
| Create material object.
shared_ptr< Material > | get (const std::string &name_with_dopant, double doping) const
| Create material object.
shared_ptr< const MaterialConstructor > | getConstructor (const std::string &name_without_composition) const
| Get constructor of material.
shared_ptr< Material > | get (const Material::Parameters &param) const
shared_ptr< Material > | get (const std::string &full_name) const
| Create material object.
shared_ptr< MixedCompositionFactory > | getFactory (const std::string &material1_fullname, const std::string &material2_fullname, double shape=1.) const
| Construct mixed material factory.
void | addSimple (shared_ptr< MaterialConstructor > constructor)
| Add simple material (which does snot require composition parsing) to DB.
void | addAlloy (shared_ptr< MaterialConstructor > constructor)
| Add alloy material (which require composition parsing) to DB.
template<typename MaterialType , bool requireComposition, bool requireDopant>
void | add (const std::string &name)
| Add material to DB.
template<typename MaterialType >
void | add (const std::string &name)
| Add material to DB.
template<typename MaterialType >
void | add ()
| Add material to DB.
void | remove (const std::string &name)
| Remove material from DB.
bool | isAlloy (const std::string &material_name) const
| Check if a material (given without parameters) is simple.
shared_ptr< const MaterialConstructor > | getConstructor (const Material::Composition &composition, const std::string &label="", const std::string &dopant_name="") const
shared_ptr< const MaterialConstructor > | getConstructor (const Material::Parameters &material, bool allow_alloy_without_composition=false) const
| TemporaryReplaceDefault (const TemporaryReplaceDefault &)=delete
TemporaryReplaceDefault & | operator= (const TemporaryReplaceDefault &)=delete
| TemporaryReplaceDefault (TemporaryReplaceDefault &&)=delete
TemporaryReplaceDefault & | operator= (TemporaryReplaceDefault &&)=delete
| TemporaryReplaceDefault (MaterialsDB temporaryValue=MaterialsDB())
| Construct an object which replace default database with `temporaryValue` and revert its original state in destructor.
| ~TemporaryReplaceDefault ()

## Static Public Member Functions
static MaterialsDB & | getDefault ()
| Get default material database.
static void | loadToDefault (const std::string &fileName_mainpart)
| Load materials from file (dynamic library which is in plask directory with materials) to default database.
static void | loadAllToDefault (const std::string &dir=plaskMaterialsPath())
| Load all materials from given `dir` (plask materials directory by default) to default database.
static void | ensureCompositionIsNotEmpty (const Material::Composition &composition)
| Throw exception if given composition is empty.

## Public Attributes
MaterialInfo::DB | info
| Info for this database.
MaterialsDB | toRevert

## Detailed Description

Materials database.

Create materials with given name, composition and dopant.

Definition at line 34 of file db.hpp.

## Member Typedef Documentation

## ◆ const_iterator

typedef iterator plask::MaterialsDB::const_iterator

Iterator over material constructors (shared_ptr<shared_ptr<const MaterialConstructor>>).

Definition at line 334 of file db.hpp.

## ◆ iterator

typedef boost::transform_iterator<iter_val, constructors_map_t::const_iterator> plask::MaterialsDB::iterator

Iterator over material constructors (shared_ptr<shared_ptr<const MaterialConstructor>>).

Definition at line 331 of file db.hpp.

## ◆ TemporaryClearDefault

typedef TemporaryReplaceDefault plask::MaterialsDB::TemporaryClearDefault

Definition at line 44 of file db.hpp.

## Constructor & Destructor Documentation

## ◆ ~TemporaryReplaceDefault()

plask::MaterialsDB::~TemporaryReplaceDefault | ( |  | ) |
| inline

Definition at line 663 of file db.hpp.

## Member Function Documentation

## ◆ add() [1/3]

template<typename MaterialType >

void plask::MaterialsDB::add | ( |  | ) |
| inline

Add material to DB.

Replace existing material if there is one already in DB.

Use DelegateMaterialConstructor as material construction object. Deduce from constructors if material needs either composition or dopant information. Material name is read from static field MaterialType::NAME.

Definition at line 597 of file db.hpp.

## ◆ add() [2/3]

template<typename MaterialType , bool requireComposition, bool requireDopant>

void plask::MaterialsDB::add | ( | const std::string & | name | ) |
| inline

Add material to DB.

Replace existing material if there is one already in DB.

Use DelegateMaterialConstructor as material construction object.

Parameters

  name | material name (with dopant after ':')

Template Parameters

  MaterialType,requireComposition,requireDopant | see DelegateMaterialConstructor

Definition at line 570 of file db.hpp.

## ◆ add() [3/3]

template<typename MaterialType >

void plask::MaterialsDB::add | ( | const std::string & | name | ) |
| inline

Add material to DB.

Replace existing material if there is one already in DB.

Use DelegateMaterialConstructor as material construction object. Deduce from constructors if material needs either composition or dopant information.

Parameters

  name | material name (with dopant after ':')

Definition at line 585 of file db.hpp.

## ◆ addAlloy()

void plask::MaterialsDB::addAlloy | ( | shared_ptr< MaterialConstructor > | constructor | ) |

Add alloy material (which require composition parsing) to DB.

Replace existing material if there is one already in DB.

Parameters

  constructor | object which can create material instance

Definition at line 324 of file db.cpp.

## ◆ addSimple()

void plask::MaterialsDB::addSimple | ( | shared_ptr< MaterialConstructor > | constructor | ) |

Add simple material (which does snot require composition parsing) to DB.

Replace existing material if there is one already in DB.

Parameters

  constructor | object which can create material instance

Definition at line 316 of file db.cpp.

## ◆ begin()

const_iterator plask::MaterialsDB::begin | ( |  | ) | const
| inline

Get iterator which refer to first record in database.

Returns
  iterator which refer to first record in database

Definition at line 340 of file db.hpp.

## ◆ clear()

void plask::MaterialsDB::clear | ( |  | ) |
| inline

Clear the database.

Definition at line 61 of file db.hpp.

## ◆ end()

const_iterator plask::MaterialsDB::end | ( |  | ) | const
| inline

Get iterator which refer one step after last record in database.

Returns
  iterator which refer just after last record in database

Definition at line 346 of file db.hpp.

## ◆ ensureCompositionIsNotEmpty()

void plask::MaterialsDB::ensureCompositionIsNotEmpty | ( | const Material::Composition & | composition | ) |
| static

Throw exception if given composition is empty.

Parameters

  composition | composition to check

Definition at line 151 of file db.cpp.

## ◆ get() [1/6]

shared_ptr< Material > plask::MaterialsDB::get | ( | const Material::Composition & | composition,
|  | const std::string & | dopant_name,
|  | double | doping
| ) |  | const
| inline

Create material object.

Parameters

  composition | complete objects composition
  dopant_name | name of dopant
  doping | amount of dopant

Returns
  constructed material

Exceptions

  NoSuchMaterial | if database doesn't know material with name `parsed_name_with_donor`

See also
  Material::completeComposition

Definition at line 475 of file db.hpp.

## ◆ get() [2/6]

shared_ptr< Material > plask::MaterialsDB::get | ( | const Material::Composition & | composition,
|  | const std::string & | label,
|  | const std::string & | dopant_name,
|  | double | doping
| ) |  | const

Create material object.

Parameters

  composition | complete objects composition
  label | optional material label
  dopant_name | name of dopant
  doping | amount of dopant

Returns
  constructed material

Exceptions

  NoSuchMaterial | if database doesn't know material with name `parsed_name_with_donor`

See also
  Material::completeComposition

Definition at line 234 of file db.cpp.

## ◆ get() [3/6]

shared_ptr< Material > plask::MaterialsDB::get | ( | const Material::Composition & | composition,
|  | const std::string & | label = `""`
| ) |  | const
| inline

Create material object.

Parameters

  composition | complete objects composition
  label | optional material label

Returns
  constructed material

Exceptions

  NoSuchMaterial | if database doesn't know material with name `parsed_name_with_donor`

See also
  Material::completeComposition

Definition at line 487 of file db.hpp.

## ◆ get() [4/6]

shared_ptr< Material > plask::MaterialsDB::get | ( | const Material::Parameters & | param | ) | const

Definition at line 268 of file db.cpp.

## ◆ get() [5/6]

shared_ptr< Material > plask::MaterialsDB::get | ( | const std::string & | full_name | ) | const

Create material object.

Parameters

  full_name | material name, with encoded parameters in format composition[:dopant], see get(const std::string&, const std::string&)

Returns
  material with `full_name`

Exceptions

  NoSuchMaterial | if material with given name not exists
  MaterialParseException | if can't parse `full_name`

Definition at line 272 of file db.cpp.

## ◆ get() [6/6]

shared_ptr< Material > plask::MaterialsDB::get | ( | const std::string & | name_with_dopant,
|  | double | doping
| ) |  | const

Create material object.

Parameters

  name_with_dopant | material name with dopant name in format material[_label][:dopant_name], for example: "Al(0.2)GaN" or "Al(0.2)GaN:Mg"
  doping | amount of dopant

Returns
  constructed material

Exceptions

  NoSuchMaterial | if database doesn't know material with name `parsed_name_with_donor`

Definition at line 252 of file db.cpp.

## ◆ getConstructor() [1/3]

shared_ptr< const MaterialsDB::MaterialConstructor > plask::MaterialsDB::getConstructor | ( | const Material::Composition & | composition,
|  | const std::string & | label = `""`,
|  | const std::string & | dopant_name = `""`
| ) |  | const

Definition at line 225 of file db.cpp.

## ◆ getConstructor() [2/3]

shared_ptr< const MaterialsDB::MaterialConstructor > plask::MaterialsDB::getConstructor | ( | const Material::Parameters & | material,
|  | bool | allow_alloy_without_composition = `false`
| ) |  | const

Definition at line 229 of file db.cpp.

## ◆ getConstructor() [3/3]

shared_ptr< const MaterialsDB::MaterialConstructor > plask::MaterialsDB::getConstructor | ( | const std::string & | name_without_composition | ) | const

Get constructor of material.

Parameters

  name_without_composition | material name, without encoded parameters, in format composition[_label][:dopant]

Returns
  constructor of material or nullptr if there is no such material in database

Exceptions

  NoSuchMaterial | if database doesn't know material with name `name_without_composition`

Definition at line 260 of file db.cpp.

## ◆ getDefault()

MaterialsDB & plask::MaterialsDB::getDefault | ( |  | ) |
| static

Get default material database.

Returns
  default material database

Definition at line 116 of file db.cpp.

## ◆ getFactory()

shared_ptr< MaterialsDB::MixedCompositionFactory > plask::MaterialsDB::getFactory | ( | const std::string & | material1_fullname,
|  | const std::string & | material2_fullname,
|  | double | shape = `1.`
| ) |  | const

Construct mixed material factory.

Parameters

  material1_fullname,material2_fullname | materials name, with encoded parameters in format composition[_label][:dopant], both must refer to the same material with the same dopant and in case of doping materials, amounts of dopants must be given in the same format
  shape | changing material shape exponent

Returns
  constructed factory

Definition at line 279 of file db.cpp.

## ◆ isAlloy()

bool plask::MaterialsDB::isAlloy | ( | const std::string & | material_name | ) | const

Check if a material (given without parameters) is simple.

Parameters

  name_without_composition | material name, without encoded parameters, in format composition[:dopant]

Returns
  `true` only if the material is simple

Exceptions

  NoSuchMaterial | if database doesn't know the material with name `name_without_composition`

Definition at line 343 of file db.cpp.

## ◆ loadAllToDefault()

void plask::MaterialsDB::loadAllToDefault | ( | const std::string & | dir = `plaskMaterialsPath()` | ) |
| static

Load all materials from given `dir` (plask materials directory by default) to default database.

Parameters

  dir | directory with materials shared libraries (all files from this dir will be loaded)

Definition at line 136 of file db.cpp.

## ◆ loadToDefault()

void plask::MaterialsDB::loadToDefault | ( | const std::string & | fileName_mainpart | ) |
| static

Load materials from file (dynamic library which is in plask directory with materials) to default database.

Parameters

  fileName_mainpart | main part of file name (filename without lib prefix and extension)

Definition at line 132 of file db.cpp.

## ◆ operator=() [1/2]

TemporaryReplaceDefault & plask::MaterialsDB::operator= | ( | const TemporaryReplaceDefault & |  | ) |
| delete

## ◆ operator=() [2/2]

TemporaryReplaceDefault & plask::MaterialsDB::operator= | ( | TemporaryReplaceDefault && |  | ) |
| delete

## ◆ remove()

void plask::MaterialsDB::remove | ( | const std::string & | name | ) |

Remove material from DB.

Deduce from name if material is either alloy or simple.

Parameters

  name | material name (with dopant after ':')

Definition at line 328 of file db.cpp.

## ◆ size()

size_t plask::MaterialsDB::size | ( |  | ) | const
| inline

Get number of material types in database.

This is not the same as number of materials in database, because one material type can have many materials with different compositions and dopants.

Returns
  number of material types in database

Definition at line 355 of file db.hpp.

## ◆ TemporaryReplaceDefault() [1/3]

plask::MaterialsDB::TemporaryReplaceDefault | ( | const TemporaryReplaceDefault & |  | ) |
| delete

## ◆ TemporaryReplaceDefault() [2/3]

plask::MaterialsDB::TemporaryReplaceDefault | ( | MaterialsDB | temporaryValue = `MaterialsDB()` | ) |
| inline

Construct an object which replace default database with `temporaryValue` and revert its original state in destructor.

Parameters

  temporaryValue | new, temporary value for default database (the empty database by default)

Definition at line 659 of file db.hpp.

## ◆ TemporaryReplaceDefault() [3/3]

plask::MaterialsDB::TemporaryReplaceDefault | ( | TemporaryReplaceDefault && |  | ) |
| delete

## ◆ update()

void plask::MaterialsDB::update | ( | const MaterialsDB & | src | ) |
| inline

Update with values from different database.

Parameters

  src | source database

Definition at line 70 of file db.hpp.

## Member Data Documentation

## ◆ info

MaterialInfo::DB plask::MaterialsDB::info

Info for this database.

Definition at line 328 of file db.hpp.

## ◆ toRevert

MaterialsDB plask::MaterialsDB::toRevert

Definition at line 648 of file db.hpp.

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

- plask/material/db.hpp
- plask/material/db.cpp