PLaSK library

Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions | List of all members
plask::Geometry Struct Referenceabstract

Base class for all geometry trunks. More...

`#include <plask/geometry/space.hpp>`

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

## Public Types
enum | Direction { DIRECTION_LONG = Primitive<3>::DIRECTION_LONG , DIRECTION_TRAN = Primitive<3>::DIRECTION_TRAN , DIRECTION_VERT = Primitive<3>::DIRECTION_VERT }
Public Types inherited from plask::GeometryObject
enum | Type { TYPE_LEAF = 0 , TYPE_TRANSFORM = 1 , TYPE_SPACE_CHANGER = 2 , TYPE_CONTAINER = 3 , TYPE_GEOMETRY = 4 , TYPE_SEPARATOR = 5 }
| Type of geometry object. More...
typedef std::function< bool(const GeometryObject &)> | Predicate
| Predicate on GeometryObject.

## Public Member Functions
| Geometry (shared_ptr< Material > defaultMaterial=make_shared< materials::Air >())
| Calculation space constructor, set default material.
| Geometry (const Geometry &to_copy)
| Initialize this to be the same as `to_copy` but doesn't have any changes observer.
Geometry & | operator= (const Geometry &to_copy)
| Set this to be the same as `to_copy` but doesn't changed changes observer.
virtual | ~Geometry ()
| Inform observators that this is being deleted.
virtual void | setEdges (Direction direction, const edge::Strategy &border_lo, const edge::Strategy &border_hi)=0
| Set all edges in given direction or throw exception if this edges can't be set for this calculation space or direction.
virtual void | setEdges (Direction direction, const edge::Strategy &border_to_set)
| Set all edges in given direction or throw exception if this edges can't be set for this calculation space or direction.
virtual void | setPlanarEdges (const edge::Strategy &border_to_set)=0
| Set all planar edges or throw exception if this edges can't be set for this calculation space or direction.
void | setAllEdges (const edge::Strategy &border_to_set)
| Set all edges (planar and up-bottom).
virtual void | setEdge (Direction direction, bool higher, const edge::Strategy &border_to_set)=0
| Set edge or throw exception if this edge can't be set for this calculation space or direction.
void | setEdges (const std::function< plask::optional< std::string >(const std::string &s)> &borderValuesGetter, const AxisNames &axesNames, const MaterialsDB &materialsDB=MaterialsDB::getDefault(), bool draft=false)
| Set edges using string value which is gotten from `borderValuesGetter`.
virtual const edge::Strategy & | getEdge (Direction direction, bool higher) const =0
| Get edge strategy or throw exception if edge can't be get for this calculation space or direction.
virtual bool | isSymmetric (Direction direction) const
| Check if structure in given direction is symmetric, i.e.
bool | isPeriodic (Direction direction) const
| Check if structure in given direction is periodic, i.e.
bool | isExtended (Direction direction, bool higher) const
| Check if structure extends in given direction.
Type | getType () const override
| Check if geometry is: leaf, transform or container type object.
virtual shared_ptr< GeometryObjectD< 3 > > | getObject3D () const =0
| Get 3D object held by this geometry (which has type Extrusion or Revolution for 2D geometries).
Public Member Functions inherited from plask::GeometryObject
void | setMaxSteps (unsigned value)
| Set max_steps.
void | setMinStepSize (double value)
| Set min_step_size.
template<typename ClassT , typename methodT >
boost::signals2::connection | changedConnectMethod (ClassT *obj, methodT method, boost::signals2::connect_position at=boost::signals2::at_back)
| Connect a method to changed signal.
template<typename ClassT , typename methodT >
void | changedDisconnectMethod (ClassT *obj, methodT method)
| Disconnect a method from changed signal.
template<typename EventT = Event, typename... Args>
void | fireChanged (Args &&... event_constructor_params_without_source)
| Call changed with this as event source.
| GeometryObject (const GeometryObject &to_copy)
| Initialize this to be the same as `to_copy` but doesn't have any changes observer.
GeometryObject & | operator= (const GeometryObject &to_copy)
| Set this to be the same as `to_copy` but doesn't change changes observer.
| GeometryObject ()
| GeometryObject (unsigned max_steps, double min_step_size)
virtual | ~GeometryObject ()
| Virtual destructor.
virtual std::string | getTypeName () const =0
| Get name of object type (like: "block2d", "shelf", "stack3d", etc.).
virtual void | writeXML (XMLWriter::Element &parent_xml_object, WriteXMLCallback &write_cb, AxisNames parent_axes) const
| Write geometry tree branch rooted by this to XML.
void | writeXML (XMLWriter::Element &parent_xml_object, WriteXMLCallback &write_cb) const
| Write geometry tree branch rooted by this to XML.
void | writeXML (XMLWriter::Element &parent_xml_object) const
| Write geometry tree branch rooted by this to XML.
template<int DIMS>
shared_ptr< GeometryObjectD< DIMS > > | asD ()
| Cast this to GeometryObjectD<DIMS>.
template<int DIMS>
shared_ptr< const GeometryObjectD< DIMS > > | asD () const
| Cast this to GeometryObjectD<DIMS> (const version).
shared_ptr< Geometry > | asGeometry ()
| Cast this to Geometry.
shared_ptr< const Geometry > | asGeometry () const
| Cast this to Geometry.
bool | isLeaf () const
bool | isTransform () const
bool | isSpaceChanger () const
bool | isContainer () const
bool | isGeometry () const
virtual void | addPointsAlongToSet (std::set< double > &points, Primitive< 3 >::Direction PLASK_UNUSED(direction), unsigned PLASK_UNUSED(max_steps), double PLASK_UNUSED(min_step_size)) const =0
| Add characteristic points information along specified axis to set.
std::set< double > | getPointsAlong (Primitive< 3 >::Direction direction, unsigned max_steps=PLASK_GEOMETRY_MAX_STEPS, double min_step_size=PLASK_GEOMETRY_MIN_STEP_SIZE) const
| Get characteristic points information along specified axis.
bool | hasRole (std::string role_name) const
| Check if this object belongs to class (has tag) with name `role_name`.
void | addRole (std::string role_name)
| Add this to given class.
void | removeRole (std::string role_name)
| Remove this from given class, do nothing if this is not in given class.
void | clearRoles ()
| Clear set of roles of this.
virtual int | getDimensionsCount () const =0
| Get number of dimensions.
virtual void | validate () const
| Check if object is ready for calculation.
virtual bool | hasInSubtree (const GeometryObject &el) const
| Check if el is in subtree with `this` in root.
bool | hasInSubtree (const GeometryObject &el, const PathHints *pathHints) const
bool | hasInSubtree (shared_ptr< const GeometryObject > el, const PathHints *pathHints) const
virtual Subtree | getPathsTo (const GeometryObject &el, const PathHints *pathHints=0) const =0
| Find paths to el.
virtual void | getObjectsToVec (const Predicate &predicate, std::vector< shared_ptr< const GeometryObject > > &dest, const PathHints *path=0) const =0
| Append all objects from subtree with this in root, which fulfill predicate to vector `dest`.
void | getObjectsToVec (const Predicate &predicate, std::vector< shared_ptr< const GeometryObject > > &dest, const PathHints &path) const
| Append all objects from subtree with this in root, which fulfill predicate to vector `dest`.
std::vector< shared_ptr< const GeometryObject > > | getObjects (const Predicate &predicate, const PathHints *path=0) const
| Get vector of all objects from subtree with this in root, which fulfill predicate.
std::vector< shared_ptr< const GeometryObject > > | getObjects (const Predicate &predicate, const PathHints &path) const
| Get vector of all objects from subtree with this in root, which fulfill predicate.
void | getLeafsToVec (std::vector< shared_ptr< const GeometryObject > > &dest, const PathHints *path=0) const
| Append all leafs in subtree with this in root to vector `dest`.
void | getLeafsToVec (std::vector< shared_ptr< const GeometryObject > > &dest, const PathHints &path) const
| Append all leafs in subtree with this in root to vector `dest`.
std::vector< shared_ptr< const GeometryObject > > | getLeafs (const PathHints *path=0) const
| Get all leafs in subtree with this object as root.
std::vector< shared_ptr< const GeometryObject > > | getLeafs (const PathHints &path) const
| Get all leafs in subtree with this object as root.
void | getObjectsWithRoleToVec (const std::string &role, std::vector< shared_ptr< const GeometryObject > > &dest) const
| Append all objects with a specified role in subtree with this in root to vector `dest`.
std::vector< shared_ptr< const GeometryObject > > | getObjectsWithRole (const std::string &role) const
| Get all objects with a specified role in subtree with this object as root.
virtual std::size_t | getChildrenCount () const =0
| Get number of all children of this in geometry graph.
virtual shared_ptr< GeometryObject > | getChildNo (std::size_t child_no) const =0
| Get child with given index.
virtual std::size_t | getRealChildrenCount () const
| Get number of real (physically stored) children in geometry graph.
virtual shared_ptr< GeometryObject > | getRealChildNo (std::size_t child_no) const
| Get real (physically stored) child with given index.
virtual void | removeAtUnsafe (std::size_t index)
| Remove child at given `index`.
void | removeAt (std::size_t index)
| Remove child at given `index`.
void | removeRangeUnsafe (std::size_t index_begin, std::size_t index_end)
bool | removeRange (std::size_t index_begin, std::size_t index_end)
| Remove all children in given range [index_begin, index_end).
virtual void | forEachRealObjectInSubtree (std::function< bool(const GeometryObject &)> callback) const
| Call a `callback` for each object in subtree with `this` in root.
FunctorIndexedIterator< ChildGetter > | begin () const
FunctorIndexedIterator< ChildGetter > | end () const
virtual shared_ptr< const GeometryObject > | changedVersion (const Changer &changer, Vec< 3, double > *translation=0) const =0
| Get this or copy of this with some changes in subtree.
virtual shared_ptr< GeometryObject > | shallowCopy () const =0
| Get shallow copy of this.
virtual shared_ptr< GeometryObject > | deepCopy (std::map< const GeometryObject *, shared_ptr< GeometryObject > > &copied) const =0
| Get deep copy of this.
shared_ptr< GeometryObject > | deepCopy ()
| Get deep copy of this.
bool | canHasAsChild (const GeometryObject &potential_child) const
bool | canHasAsParent (const GeometryObject &potential_parent) const
void | ensureCanHasAsParent (const GeometryObject &potential_parent) const
| Throw CyclicReferenceException if `potential_parent` is in subtree with this in root.
void | ensureCanHaveAsChild (const GeometryObject &potential_child) const
| Throw CyclicReferenceException if `potential_child` has this in subtree.

## Public Attributes
shared_ptr< Material > | defaultMaterial
| Default material (which will be used for places in which geometry doesn't define any material), typically air.
AxisNames | axisNames
| Axis names for this geometry.
Public Attributes inherited from plask::GeometryObject
unsigned | max_steps
| Maximum number of points to split a single leaf.
double | min_step_size
| Minimum distance between divisions for a single leaf.
std::set< std::string > | roles
| Roles/tags.
boost::signals2::signal< void(Event &)> | changed
| Changed signal, fired when object was changed.

## Protected Member Functions
virtual const char * | alternativeDirectionName (std::size_t ax, std::size_t orient) const
void | storeEdgeInXML (XMLWriter::Element &dest_xml_object, Direction direction, bool higher) const
Protected Member Functions inherited from plask::GeometryObject
virtual void | writeXMLAttr (XMLWriter::Element &dest_xml_object, const AxisNames &axes) const
| Append XML attributes of this to `dest_xml_object`.
virtual void | writeXMLChildren (XMLWriter::Element &dest_xml_object, WriteXMLCallback &write_cb, const AxisNames &axes) const
| Append all children of this to XML `dest_xml_object`.
void | ensureIsValidChildNr (std::size_t child_no, const char *method_name="getChildNo", const char *arg_name="child_no") const
| Check if given `index` is valid child index and throw exception of it is not.
void | ensureIsValidInsertPosition (std::size_t child_no, const char *method_name="insert", const char *arg_name="pos") const
| Check if given `index` is valid insert index and throw exception of it is not.
void | fireChildrenChanged ()
| Inform observers that children list was changed (also that this is resized)
void | fireChildrenRemoved (std::size_t beginIndex, std::size_t endIndex)
void | fireChildrenInserted (std::size_t beginIndex, std::size_t endIndex)

## Static Protected Member Functions
template<typename EdgeType >
static const EdgeType & | castEdge (const edge::Strategy &strategy)
| Dynamic cast edge to given type and throw exception in case of bad cast.

## Additional Inherited Members
Static Public Member Functions inherited from plask::GeometryObject
static bool | PredicateIsLeaf (const GeometryObject &el)
| Predicate which check if given object is leaf.

## Detailed Description

Base class for all geometry trunks.

Solvers can do calculation in calculation space with specific type.

Almost all GeometryObject methods are delegate to child of this.

Definition at line 34 of file space.hpp.

## Member Enumeration Documentation

## ◆ Direction

enum plask::Geometry::Direction

Enumerator
DIRECTION_LONG |
DIRECTION_TRAN |
DIRECTION_VERT |

Definition at line 41 of file space.hpp.

## Constructor & Destructor Documentation

## ◆ Geometry() [1/2]

plask::Geometry::Geometry | ( | shared_ptr< Material > | defaultMaterial = `make_shared<materials::Air>()` | ) |
| inline

Calculation space constructor, set default material.

Parameters

  defaultMaterial | material which will be used for places in which geometry doesn't define any material, air by default

Definition at line 52 of file space.hpp.

## ◆ Geometry() [2/2]

plask::Geometry::Geometry | ( | const Geometry & | to_copy | ) |
| inline

Initialize this to be the same as `to_copy` but doesn't have any changes observer.

Parameters

  to_copy | object to copy

Definition at line 59 of file space.hpp.

## ◆ ~Geometry()

virtual plask::Geometry::~Geometry | ( |  | ) |
| inline virtual

Inform observators that this is being deleted.

Definition at line 72 of file space.hpp.

## Member Function Documentation

## ◆ alternativeDirectionName()

virtual const char * plask::Geometry::alternativeDirectionName | ( | std::size_t | ax,
|  | std::size_t | orient
| ) |  | const
| inline protected virtual

Returns
  alternative direction name

Parameters

  ax | axis
  orient | orientation

Reimplemented in plask::Geometry2DCylindrical.

Definition at line 190 of file space.hpp.

## ◆ castEdge()

template<typename EdgeType >

static const EdgeType & plask::Geometry::castEdge | ( | const edge::Strategy & | strategy | ) |
| inline static protected

Dynamic cast edge to given type and throw exception in case of bad cast.

Parameters

  strategy | edge strategy to cast

Definition at line 183 of file space.hpp.

## ◆ getEdge()

virtual const edge::Strategy & plask::Geometry::getEdge | ( | Direction | direction,
|  | bool | higher
| ) |  | const
| pure virtual

Get edge strategy or throw exception if edge can't be get for this calculation space or direction.

Parameters

  direction | see Direction
  higher | `true` for higher bound, `false` for lower

Returns
  edge strategy for given edge

Implemented in plask::Geometry2DCartesian, plask::Geometry2DCylindrical, and plask::Geometry3D.

## ◆ getObject3D()

virtual shared_ptr< GeometryObjectD< 3 > > plask::Geometry::getObject3D | ( |  | ) | const
| pure virtual

Get 3D object held by this geometry (which has type Extrusion or Revolution for 2D geometries).

Returns
  3D geometry object held by this geometry

Implemented in plask::Geometry2DCartesian, plask::Geometry2DCylindrical, and plask::Geometry3D.

## ◆ getType()

Type plask::Geometry::getType | ( |  | ) | const
| inline override virtual

Check if geometry is: leaf, transform or container type object.

Returns
  type of this object

Implements plask::GeometryObject.

Definition at line 170 of file space.hpp.

## ◆ isExtended()

bool plask::Geometry::isExtended | ( | Direction | direction,
|  | bool | higher
| ) |  | const
| inline

Check if structure extends in given direction.

Parameters

  direction | direction to check
  higher | `true` for higher bound, `false` for lower

Returns
  `true` only if structure is periodic in given `direction`

Definition at line 168 of file space.hpp.

## ◆ isPeriodic()

bool plask::Geometry::isPeriodic | ( | Direction | direction | ) | const
| inline

Check if structure in given direction is periodic, i.e.

two edges in this direction are periodic.

Parameters

  direction | direction to check

Returns
  `true` only if structure is periodic in given `direction`

Definition at line 157 of file space.hpp.

## ◆ isSymmetric()

virtual bool plask::Geometry::isSymmetric | ( | Direction | direction | ) | const
| inline virtual

Check if structure in given direction is symmetric, i.e.

one of edge in this direction is mirror.

Parameters

  direction | direction to check

Returns
  `true` only if structure is symmetric in given `direction`

Reimplemented in plask::Geometry2DCylindrical.

Definition at line 147 of file space.hpp.

## ◆ operator=()

Geometry & plask::Geometry::operator= | ( | const Geometry & | to_copy | ) |
| inline

Set this to be the same as `to_copy` but doesn't changed changes observer.

Parameters

  to_copy | object to copy

Definition at line 65 of file space.hpp.

## ◆ setAllEdges()

void plask::Geometry::setAllEdges | ( | const edge::Strategy & | border_to_set | ) |
| inline

Set all edges (planar and up-bottom).

Parameters

  border_to_set | new edge strategy for all edges

Definition at line 105 of file space.hpp.

## ◆ setEdge()

virtual void plask::Geometry::setEdge | ( | Direction | direction,
|  | bool | higher,
|  | const edge::Strategy & | border_to_set
| ) |  |
| pure virtual

Set edge or throw exception if this edge can't be set for this calculation space or direction.

Parameters

  direction | see Direction
  higher | `true` for higher bound, `false` for lower
  border_to_set | new edge strategy for given edge

Implemented in plask::Geometry2DCartesian, plask::Geometry2DCylindrical, and plask::Geometry3D.

## ◆ setEdges() [1/3]

void plask::Geometry::setEdges | ( | const std::function< plask::optional< std::string >(const std::string &s)> & | borderValuesGetter,
|  | const AxisNames & | axesNames,
|  | const MaterialsDB & | materialsDB = `MaterialsDB::getDefault()`,
|  | bool | draft = `false`
| ) |  |

Set edges using string value which is gotten from `borderValuesGetter`.

Parameters

  borderValuesGetter | optionally return edge strategy string for direction(s) given in argument, argument can be one of: "edges", "planar", "<axis_name>", "<axis_name>-lo", "<axis_name>-hi"
  axesNames | name of axes, use to create arguments for `borderValuesGetter`
  materialsDB | source of materials
  draft | ignore errors

Definition at line 21 of file space.cpp.

## ◆ setEdges() [2/3]

virtual void plask::Geometry::setEdges | ( | Direction | direction,
|  | const edge::Strategy & | border_lo,
|  | const edge::Strategy & | border_hi
| ) |  |
| pure virtual

Set all edges in given direction or throw exception if this edges can't be set for this calculation space or direction.

Parameters

  direction | see Direction
  border_lo | new edge strategy for lower edge in given `direction`
  border_hi | new edge strategy for higher edge in given `direction`

Implemented in plask::Geometry2DCartesian, plask::Geometry2DCylindrical, and plask::Geometry3D.

## ◆ setEdges() [3/3]

virtual void plask::Geometry::setEdges | ( | Direction | direction,
|  | const edge::Strategy & | border_to_set
| ) |  |
| inline virtual

Set all edges in given direction or throw exception if this edges can't be set for this calculation space or direction.

Parameters

  direction | see Direction
  border_to_set | new edge strategy for given edges

Reimplemented in plask::Geometry2DCylindrical, and plask::Geometry3D.

Definition at line 89 of file space.hpp.

## ◆ setPlanarEdges()

virtual void plask::Geometry::setPlanarEdges | ( | const edge::Strategy & | border_to_set | ) |
| pure virtual

Set all planar edges or throw exception if this edges can't be set for this calculation space or direction.

Planar edges are all edges but up-bottom.

Parameters

  border_to_set | new edge strategy for all planar edges

Implemented in plask::GeometryD< dim >, plask::GeometryD< 2 >, plask::GeometryD< 3 >, plask::GeometryD< dim >, plask::GeometryD< 2 >, plask::GeometryD< 3 >, plask::GeometryD< dim >, plask::GeometryD< 2 >, and plask::GeometryD< 3 >.

## ◆ storeEdgeInXML()

void plask::Geometry::storeEdgeInXML | ( | XMLWriter::Element & | dest_xml_object,
|  | Geometry::Direction | direction,
|  | bool | higher
| ) |  | const
| protected

Definition at line 99 of file space.cpp.

## Member Data Documentation

## ◆ axisNames

AxisNames plask::Geometry::axisNames

Axis names for this geometry.

Definition at line 39 of file space.hpp.

## ◆ defaultMaterial

shared_ptr<Material> plask::Geometry::defaultMaterial

Default material (which will be used for places in which geometry doesn't define any material), typically air.

Definition at line 36 of file space.hpp.

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

- plask/geometry/space.hpp
- plask/geometry/space.cpp