PLaSK library
Loading...
Searching...
No Matches
plask::GeometryObjectContainer< dim > Struct Template Referenceabstract

Template of base class for all container nodes. More...

#include <plask/geometry/container.hpp>

Inheritance diagram for plask::GeometryObjectContainer< dim >:
[legend]
Collaboration diagram for plask::GeometryObjectContainer< dim >:
[legend]

Public Types

typedef GeometryObjectContainer< dim >::DVec DVec
 Vector of doubles type in space on this, vector in space with dim number of dimensions.
 
typedef GeometryObjectContainer< dim >::Box Box
 Rectangle type in space on this, rectangle in space with dim number of dimensions.
 
typedef GeometryObjectD< dim > ChildType
 Type of the container children.
 
typedef Translation< dim > TranslationT
 Type of translation geometry object in space of this.
 
typedef std::vector< shared_ptr< TranslationT > > TranslationVector
 Type of the vector holding container children.
 
- Public Types inherited from plask::GeometryObjectD< dim >
typedef Primitive< dim >::Box Box
 
typedef Primitive< dim >::DVec DVec
 
- 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

virtual void writeXML (XMLWriter::Element &parent_xml_object, GeometryObject::WriteXMLCallback &write_cb, AxisNames axes) const override
 Call writeXMLAttr for this container attribute and writeXMLChildAttr for each child tag.
 
 ~GeometryObjectContainer ()
 Disconnect onChildChanged from current child change signal.
 
virtual void onChildChanged (const GeometryObject::Event &evt)
 Called by child.change signal, call this change.
 
void connectOnChildChanged (Translation< dim > &child)
 Connect onChildChanged to current child change signal.
 
void disconnectOnChildChanged (Translation< dim > &child)
 Disconnect onChildChanged from current child change signal.
 
const TranslationVectorgetChildrenVector () const
 Get physically stored children (with translations).
 
GeometryObject::Type getType () const override
 
bool contains (const DVec &p) const override
 
Box getBoundingBox () const override
 Calculate minimal rectangle which contains all points of geometry object.
 
shared_ptr< MaterialgetMaterial (const DVec &p) const override
 Iterate over children in reverse order and check if any returns material.
 
void getBoundingBoxesToVec (const GeometryObject::Predicate &predicate, std::vector< Box > &dest, const PathHints *path=0) const override
 
void getObjectsToVec (const GeometryObject::Predicate &predicate, std::vector< shared_ptr< const GeometryObject > > &dest, const PathHints *path=0) const override
 Append all objects from subtree with this in root, which fulfill predicate to vector dest.
 
virtual void getPositionsToVec (const GeometryObject::Predicate &predicate, std::vector< DVec > &dest, const PathHints *path=0) const override
 
bool hasInSubtree (const GeometryObject &el) const override
 Check if el is in subtree with this in root.
 
template<typename ChildIter >
GeometryObject::Subtree findPathsFromChildTo (ChildIter childBegin, ChildIter childEnd, const GeometryObject &el, const PathHints *path=0) const
 
GeometryObject::Subtree getPathsTo (const GeometryObject &el, const PathHints *path=0) const override
 Find paths to el.
 
GeometryObject::Subtree getPathsAt (const DVec &point, bool all=false) const override
 
std::size_t getChildrenCount () const override
 Get number of all children of this in geometry graph.
 
shared_ptr< GeometryObjectgetChildNo (std::size_t child_no) const override
 Get child with given index.
 
std::size_t getChildIndex (const shared_ptr< ChildType > &el, const PathHints *path=0) const
 Return index of the given item.
 
std::size_t getChildIndex (const shared_ptr< ChildType > &el, const PathHints &path) const
 Return index of the given item.
 
virtual shared_ptr< const GeometryObjectchangedVersion (const GeometryObject::Changer &changer, Vec< 3, double > *translation=0) const override
 Get this or copy of this with some changes in subtree.
 
virtual bool removeIfTUnsafe (const std::function< bool(const shared_ptr< TranslationT > &c)> &predicate)
 Remove all children which fulfil predicate.
 
bool removeIfT (const std::function< bool(const shared_ptr< TranslationT > &c)> &predicate)
 Remove all children which fulfil predicate.
 
bool removeIf (const std::function< bool(const shared_ptr< ChildType > &c)> &predicate)
 Remove all children which fulfil predicate.
 
bool removeT (shared_ptr< const TranslationT > el)
 Remove all children exactly equal to el.
 
bool remove (shared_ptr< const ChildType > el)
 Remove all children exactly equal to el.
 
bool remove (const PathHints &hints)
 Remove child pointed, for this container, in hints.
 
void removeAtUnsafe (std::size_t index) override
 Remove child at given index.
 
void clear ()
 Remove all children from the container.
 
template<typename UnaryFunction >
void forEachChild (UnaryFunction fun, const PathHints *path=nullptr) const
 Call fun(child) for each real child of this.
 
void addPointsAlongToSet (std::set< double > &points, Primitive< 3 >::Direction direction, unsigned max_steps, double min_step_size) const override
 
void addLineSegmentsToSet (std::set< typename GeometryObjectD< dim >::LineSegment > &segments, unsigned max_steps, double min_step_size) const override
 
- Public Member Functions inherited from plask::GeometryObjectD< dim >
int getDimensionsCount () const override
 Get number of dimensions.
 
virtual Subtree getPathsAt (const DVec &point, bool all=false) const =0
 Find all paths to objects which lies at given point.
 
virtual bool contains (const DVec &point) const =0
 Check if this geometry object contains point.
 
virtual DVec getBoundingBoxSize () const
 
virtual Box getRealBoundingBox () const
 Calculate minimal rectangle which contains all points of real geometry object.
 
virtual shared_ptr< MaterialgetMaterial (const DVec &p) const =0
 Return material in a given point inside the geometry object.
 
shared_ptr< MaterialgetMaterialOrAir (const DVec &p) const
 Return material in a given point inside the geometry object.
 
virtual void getBoundingBoxesToVec (const GeometryObject::Predicate &predicate, std::vector< Box > &dest, const PathHints *path=0) const =0
 Calculate and append to vector bounding boxes of all nodes which fulfill given predicate, optionally marked by path.
 
void getBoundingBoxesToVec (const GeometryObject::Predicate &predicate, std::vector< Box > &dest, const PathHints &path) const
 Calculate and append to vector bounding boxes of all nodes which fulfill given predicate, marked by path.
 
std::vector< BoxgetBoundingBoxes (const GeometryObject::Predicate &predicate, const PathHints *path=0) const
 Calculate the vector of bounding boxes of all nodes which fulfill given predicate, optionally marked by path.
 
std::vector< BoxgetBoundingBoxes (const GeometryObject::Predicate &predicate, const PathHints &path)
 Calculate the vector of bounding boxes of all nodes which fulfill given predicate, marked by path.
 
void getLeafsBoundingBoxesToVec (std::vector< Box > &dest, const PathHints *path=0) const
 Calculate and append to vector bounding boxes of all leafs, optionally marked by path.
 
void getLeafsBoundingBoxesToVec (std::vector< Box > &dest, const PathHints &path) const
 Calculate and append to vector bounding boxes of all leafs, marked by path.
 
std::vector< BoxgetLeafsBoundingBoxes (const PathHints *path=0) const
 Calculate bounding boxes of all leafs, optionally marked by path.
 
std::vector< BoxgetLeafsBoundingBoxes (const PathHints &path) const
 Calculate bounding boxes of all leafs, marked by path.
 
void getObjectBoundingBoxesToVec (std::vector< Box > &dest, const GeometryObject &object, const PathHints *path=0) const
 Calculate and append to vector bounding boxes of all instances of given object, optionally marked by path.
 
void getObjectBoundingBoxesToVec (std::vector< Box > &dest, const GeometryObject &object, const PathHints &path) const
 Calculate and append to vector bounding boxes of all instances of given object, marked by path.
 
std::vector< BoxgetObjectBoundingBoxes (const GeometryObject &object, const PathHints *path=0) const
 Calculate bounding boxes of all instances of given object, optionally marked by path.
 
std::vector< BoxgetObjectBoundingBoxes (const GeometryObject &object, const PathHints &path) const
 Calculate bounding boxes of all instances of given objects, marked by path.
 
virtual void getPositionsToVec (const Predicate &predicate, std::vector< DVec > &dest, const PathHints *path=0) const =0
 Calculate and append to vector positions of all nodes which fulfill given predicate, optionally marked by path.
 
void getPositionsToVec (const Predicate &predicate, std::vector< DVec > &dest, const PathHints &path) const
 Calculate and append to vector positions of all nodes which fulfill given predicate, marked by path.
 
std::vector< DVecgetPositions (const Predicate &predicate, const PathHints *path=0) const
 Calculate and append to vector positions of all nodes which fulfill given predicate, optionally marked by path.
 
std::vector< DVecgetPositions (const Predicate &predicate, const PathHints &path) const
 Calculate and append to vector positions of all nodes which fulfill given predicate, marked by path.
 
void getLeafsPositionsToVec (std::vector< DVec > &dest, const PathHints *path=0) const
 Calculate and append to vector positions of all leafs, optionally marked by path.
 
void getLeafsPositionsToVec (std::vector< DVec > &dest, const PathHints &path) const
 Calculate and append to vector positions of all leafs, marked by path.
 
std::vector< DVecgetLeafsPositions (const PathHints *path=0) const
 Calculate and return a vector of positions of all leafs, optionally marked by path.
 
std::vector< DVecgetLeafsPositions (const PathHints &path) const
 Calculate and return a vector of positions of all leafs, marked by path.
 
void getObjectPositionsToVec (std::vector< DVec > &dest, const GeometryObject &object, const PathHints *path=0) const
 Calculate and append to vector positions of all instances of given object, optionally marked by path.
 
void getObjectPositionsToVec (std::vector< DVec > &dest, const GeometryObject &object, const PathHints &path) const
 Calculate and append to vector positions of all instances of given object, marked by path.
 
std::vector< DVecgetObjectPositions (const GeometryObject &object, const PathHints *path=0) const
 Calculate and return a vector of positions of all instances of given object, optionally marked by path.
 
std::vector< DVecgetObjectPositions (const GeometryObject &object, const PathHints &path) const
 Calculate and return a vector of positions of all instances of given object, marked by path.
 
shared_ptr< const GeometryObjectgetMatchingAt (const DVec &point, const Predicate &predicate, const PathHints *path=0) const
 Get object closest to the root, which contains specific point and fulfills the predicate.
 
shared_ptr< const GeometryObjectgetMatchingAt (const DVec &point, const Predicate &predicate, const PathHints &path) const
 Get object closest to the root, which contains specific point and fulfills the predicate.
 
bool objectIncludes (const GeometryObject &object, const PathHints *path, const DVec &point) const
 Check if specified geometry object contains a point point.
 
bool objectIncludes (const GeometryObject &object, const PathHints &path, const DVec &point) const
 Check if specified geometry object contains a point point.
 
bool objectIncludes (const GeometryObject &object, const DVec &point) const
 Check if specified geometry object contains a point point.
 
std::set< std::string > getRolesAt (const DVec &point, const plask::PathHints *path=0) const
 Get a sum of roles sets of all objects which lies on path from this to leaf at given point.
 
std::set< std::string > getRolesAt (const DVec &point, const plask::PathHints &path) const
 Get a sum of roles sets of all objects which lies on path from this to leaf at given point.
 
shared_ptr< const GeometryObjecthasRoleAt (const std::string &role_name, const DVec &point, const plask::PathHints *path=0) const
 Check if any object at given point, not hidden by another object, plays role with given name role_name (if so, returns non-nullptr).
 
shared_ptr< const GeometryObjecthasRoleAt (const std::string &role_name, const DVec &point, const plask::PathHints &path) const
 Check if any object at given point, not hidden by another object, plays role with given name role_name (if so, returns non-nullptr).
 
virtual void addLineSegmentsToSet (std::set< LineSegment > &PLASK_UNUSED(segments), unsigned PLASK_UNUSED(max_steps), double PLASK_UNUSED(min_step_size)) const =0
 Add characteristic points to the set and edges connecting them.
 
std::set< LineSegmentgetLineSegments (unsigned max_steps=PLASK_GEOMETRY_MAX_STEPS, double min_step_size=PLASK_GEOMETRY_MIN_STEP_SIZE) const
 Add characteristic points to the set and edges connecting them.
 
virtual Subtree getPathsTo (const GeometryObject &el, const PathHints *pathHints=0) const=0
 Find paths to el.
 
- 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.
 
GeometryObjectoperator= (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.).
 
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< GeometryasGeometry ()
 Cast this to Geometry.
 
shared_ptr< const GeometryasGeometry () 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< doublegetPointsAlong (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 void validate () const
 Check if object is ready for calculation.
 
bool hasInSubtree (const GeometryObject &el, const PathHints *pathHints) const
 
bool hasInSubtree (shared_ptr< const GeometryObject > el, const PathHints *pathHints) const
 
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 getRealChildrenCount () const
 Get number of real (physically stored) children in geometry graph.
 
virtual shared_ptr< GeometryObjectgetRealChildNo (std::size_t child_no) const
 Get real (physically stored) child with 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< GeometryObjectshallowCopy () const =0
 Get shallow copy of this.
 
virtual shared_ptr< GeometryObjectdeepCopy (std::map< const GeometryObject *, shared_ptr< GeometryObject > > &copied) const =0
 Get deep copy of this.
 
shared_ptr< GeometryObjectdeepCopy ()
 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.
 

Protected Member Functions

virtual void writeXMLChildAttr (XMLWriter::Element &dest_xml_child_tag, std::size_t child_index, const AxisNames &axes) const
 Add attributes to child tag.
 
virtual shared_ptr< GeometryObjectchangedVersionForChildren (std::vector< std::pair< shared_ptr< ChildType >, Vec< 3, double > > > &children_after_change, Vec< 3, double > *recomended_translation) const =0
 This is called by changedVersion method to create new version of this container which consists of new children.
 
- 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)
 

Protected Attributes

TranslationVector children
 

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.
 
- 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.
 
- Static Public Attributes inherited from plask::GeometryObjectD< dim >
static const int DIM = dim
 

Detailed Description

template<int dim>
struct plask::GeometryObjectContainer< dim >

Template of base class for all container nodes.

Container nodes can include one or more child nodes with translations.

Template Parameters
dimGeometryObjectContainer dimension

Definition at line 41 of file container.hpp.

Member Typedef Documentation

◆ Box

Rectangle type in space on this, rectangle in space with dim number of dimensions.

Definition at line 46 of file container.hpp.

◆ ChildType

template<int dim>
typedef GeometryObjectD<dim> plask::GeometryObjectContainer< dim >::ChildType

Type of the container children.

Definition at line 49 of file container.hpp.

◆ DVec

template<int dim>
typedef GeometryObjectContainer<dim>::DVec plask::GeometryObjectContainer< dim >::DVec

Vector of doubles type in space on this, vector in space with dim number of dimensions.

Definition at line 43 of file container.hpp.

◆ TranslationT

template<int dim>
typedef Translation<dim> plask::GeometryObjectContainer< dim >::TranslationT

Type of translation geometry object in space of this.

Definition at line 52 of file container.hpp.

◆ TranslationVector

template<int dim>
typedef std::vector<shared_ptr<TranslationT> > plask::GeometryObjectContainer< dim >::TranslationVector

Type of the vector holding container children.

Definition at line 55 of file container.hpp.

Constructor & Destructor Documentation

◆ ~GeometryObjectContainer()

template<int dim>
plask::GeometryObjectContainer< dim >::~GeometryObjectContainer ( )
inline

Disconnect onChildChanged from current child change signal.

Definition at line 98 of file container.hpp.

Member Function Documentation

◆ addLineSegmentsToSet()

template<int dim>
void plask::GeometryObjectContainer< dim >::addLineSegmentsToSet ( std::set< typename GeometryObjectD< dim >::LineSegment > &  segments,
unsigned  max_steps,
double  min_step_size 
) const
override

Definition at line 282 of file container.cpp.

◆ addPointsAlongToSet()

template<int dim>
void plask::GeometryObjectContainer< dim >::addPointsAlongToSet ( std::set< double > &  points,
Primitive< 3 >::Direction  direction,
unsigned  max_steps,
double  min_step_size 
) const
override

Definition at line 270 of file container.cpp.

◆ changedVersion()

template<int dim>
shared_ptr< const GeometryObject > plask::GeometryObjectContainer< dim >::changedVersion ( const GeometryObject::Changer changer,
Vec< 3, double > *  translation = 0 
) const
overridevirtual

Get this or copy of this with some changes in subtree.

Parameters
[in]changerchanger which will be applied to subtree with this in root
[out]translationoptional, if non-null, recommended translation of this after change will be stored
Returns
pointer to this (if nothing was changed) or copy of this with some changes in subtree

Implements plask::GeometryObject.

Definition at line 216 of file container.cpp.

◆ changedVersionForChildren()

template<int dim>
virtual shared_ptr< GeometryObject > plask::GeometryObjectContainer< dim >::changedVersionForChildren ( std::vector< std::pair< shared_ptr< ChildType >, Vec< 3, double > > > &  children_after_change,
Vec< 3, double > *  recomended_translation 
) const
protectedpure virtual

This is called by changedVersion method to create new version of this container which consists of new children.

Parameters
[in]children_after_changevector of new children
[out]recomended_translationoptional, place to store recommended translation (if is not nullptr, it has all coordinates equals to 0.0)
Returns
copy of this, with new children

Implemented in plask::ShelfContainer2D, plask::StackContainer< dim >, and plask::TranslationContainer< dim >.

◆ clear()

template<int dim>
void plask::GeometryObjectContainer< dim >::clear ( )
inline

Remove all children from the container.

Definition at line 288 of file container.hpp.

◆ connectOnChildChanged()

template<int dim>
void plask::GeometryObjectContainer< dim >::connectOnChildChanged ( Translation< dim > &  child)

Connect onChildChanged to current child change signal.

Definition at line 42 of file container.cpp.

◆ contains()

template<int dim>
bool plask::GeometryObjectContainer< dim >::contains ( const DVec p) const
override

Definition at line 51 of file container.cpp.

◆ disconnectOnChildChanged()

template<int dim>
void plask::GeometryObjectContainer< dim >::disconnectOnChildChanged ( Translation< dim > &  child)

Disconnect onChildChanged from current child change signal.

Definition at line 46 of file container.cpp.

◆ findPathsFromChildTo()

template<int dim>
template<typename ChildIter >
GeometryObject::Subtree plask::GeometryObjectContainer< dim >::findPathsFromChildTo ( ChildIter  childBegin,
ChildIter  childEnd,
const GeometryObject el,
const PathHints path = 0 
) const
inline

Definition at line 175 of file container.hpp.

◆ forEachChild()

template<int dim>
template<typename UnaryFunction >
void plask::GeometryObjectContainer< dim >::forEachChild ( UnaryFunction  fun,
const PathHints path = nullptr 
) const
inline

Call fun(child) for each real child of this.

Set of children considered is restricted to given path if the path is given and the set is non-empty.

Parameters
fununction object, to be applied to the each child. The signature of the function should be equivalent to the following: void fun(const Translation<dim> &child);
pathpath hints which limits search space

Definition at line 299 of file container.hpp.

◆ getBoundingBox()

template<int dim>
GeometryObjectContainer< dim >::Box plask::GeometryObjectContainer< dim >::getBoundingBox ( ) const
overridevirtual

Calculate minimal rectangle which contains all points of geometry object.

Returns
calculated rectangle

Implements plask::GeometryObjectD< dim >.

Definition at line 57 of file container.cpp.

◆ getBoundingBoxesToVec()

template<int dim>
void plask::GeometryObjectContainer< dim >::getBoundingBoxesToVec ( const GeometryObject::Predicate predicate,
std::vector< Box > &  dest,
const PathHints path = 0 
) const
override

Definition at line 73 of file container.cpp.

◆ getChildIndex() [1/2]

template<int dim>
std::size_t plask::GeometryObjectContainer< dim >::getChildIndex ( const shared_ptr< ChildType > &  el,
const PathHints path 
) const
inline

Return index of the given item.

Parameters
objectObject which lower edge should lie at height 0
pathPath specifying a particular item instance

Definition at line 208 of file container.hpp.

◆ getChildIndex() [2/2]

template<int dim>
std::size_t plask::GeometryObjectContainer< dim >::getChildIndex ( const shared_ptr< ChildType > &  el,
const PathHints path = 0 
) const

Return index of the given item.

Parameters
objectObject which lower edge should lie at height 0
pathPath specifying a particular item instance

Definition at line 198 of file container.cpp.

◆ getChildNo()

template<int dim>
shared_ptr< GeometryObject > plask::GeometryObjectContainer< dim >::getChildNo ( std::size_t  child_no) const
overridevirtual

Get child with given index.

Parameters
child_noindex of child to get
Returns
child with index child_no

Implements plask::GeometryObject.

Definition at line 191 of file container.cpp.

◆ getChildrenCount()

template<int dim>
std::size_t plask::GeometryObjectContainer< dim >::getChildrenCount ( ) const
overridevirtual

Get number of all children of this in geometry graph.

Returns
number of children

Implements plask::GeometryObject.

Definition at line 189 of file container.cpp.

◆ getChildrenVector()

template<int dim>
const TranslationVector & plask::GeometryObjectContainer< dim >::getChildrenVector ( ) const
inline

Get physically stored children (with translations).

Returns
vector of translations object, each include children

Definition at line 115 of file container.hpp.

◆ getMaterial()

template<int dim>
shared_ptr< Material > plask::GeometryObjectContainer< dim >::getMaterial ( const DVec p) const
override

Iterate over children in reverse order and check if any returns material.

Returns
material of first child which returns non nullptr or nullptr if all children return nullptr

Definition at line 64 of file container.cpp.

◆ getObjectsToVec()

template<int dim>
void plask::GeometryObjectContainer< dim >::getObjectsToVec ( const GeometryObject::Predicate predicate,
std::vector< shared_ptr< const GeometryObject > > &  dest,
const PathHints path = 0 
) const
overridevirtual

Append all objects from subtree with this in root, which fulfill predicate to vector dest.

Parameters
predicatepredicate required to match
destdestination vector
path(optional) path hints which limits search space

Implements plask::GeometryObject.

Definition at line 93 of file container.cpp.

◆ getPathsAt()

template<int dim>
GeometryObject::Subtree plask::GeometryObjectContainer< dim >::getPathsAt ( const DVec point,
bool  all = false 
) const
override

Definition at line 168 of file container.cpp.

◆ getPathsTo()

template<int dim>
GeometryObject::Subtree plask::GeometryObjectContainer< dim >::getPathsTo ( const GeometryObject el,
const PathHints pathHints = 0 
) const
overridevirtual

Find paths to el.

Parameters
elobject to search for
pathHints(optional) path hints which limits search space
Returns
sub-tree with paths to given object (el is in all leafs), empty sub-tree if el is not in subtree with this in root

Implements plask::GeometryObject.

Definition at line 157 of file container.cpp.

◆ getPositionsToVec()

template<int dim>
void plask::GeometryObjectContainer< dim >::getPositionsToVec ( const GeometryObject::Predicate predicate,
std::vector< DVec > &  dest,
const PathHints path = 0 
) const
overridevirtual

Definition at line 113 of file container.cpp.

◆ getType()

template<int dim>
GeometryObject::Type plask::GeometryObjectContainer< dim >::getType ( ) const
inlineoverridevirtual
Returns
GE_TYPE_CONTAINER

Implements plask::GeometryObject.

Definition at line 118 of file container.hpp.

◆ hasInSubtree()

template<int dim>
bool plask::GeometryObjectContainer< dim >::hasInSubtree ( const GeometryObject el) const
overridevirtual

Check if el is in subtree with this in root.

Parameters
elobject to search for
Returns
true only if el is in subtree with this in root

Reimplemented from plask::GeometryObject.

Definition at line 149 of file container.cpp.

◆ onChildChanged()

◆ remove() [1/2]

template<int dim>
bool plask::GeometryObjectContainer< dim >::remove ( const PathHints hints)
inline

Remove child pointed, for this container, in hints.

Parameters
hintspath hints, see Paths
Returns
true if anything has been removed

Definition at line 271 of file container.hpp.

◆ remove() [2/2]

template<int dim>
bool plask::GeometryObjectContainer< dim >::remove ( shared_ptr< const ChildType el)
inline

Remove all children exactly equal to el.

Parameters
elchild(ren) to remove
Returns
true if anything has been removed

Definition at line 262 of file container.hpp.

◆ removeAtUnsafe()

template<int dim>
void plask::GeometryObjectContainer< dim >::removeAtUnsafe ( std::size_t  index)
overridevirtual

Remove child at given index.

This is unsafe but fast version, it doesn't check index and doesn't call fireChildrenChanged() to inform listeners about this object changes. Caller should do this manually or call removeAt(std::size_t) instead.

Parameters
indexindex of real child to remove

Reimplemented from plask::GeometryObject.

Reimplemented in plask::WithAligners< GeometryObjectContainer< dim >, align::AlignerD< dim > >, plask::WithAligners< StackContainerBaseImpl< dim >, StackContainerChildAligner< dim > >, plask::StackContainerBaseImpl< dim, growingDirection >, plask::StackContainerBaseImpl< 2, Primitive< 2 >::DIRECTION_TRAN >, plask::StackContainer< dim >, and plask::TranslationContainer< dim >.

Definition at line 264 of file container.cpp.

◆ removeIf()

template<int dim>
bool plask::GeometryObjectContainer< dim >::removeIf ( const std::function< bool(const shared_ptr< ChildType > &c)> &  predicate)
inline

Remove all children which fulfil predicate.

Template Parameters
PredicateTfunctor which can take child as argument and return something convertable to bool
Parameters
predicatereturns true only if the child passed as an argument should be deleted
Returns
true if anything has been removed

Definition at line 243 of file container.hpp.

◆ removeIfT()

template<int dim>
bool plask::GeometryObjectContainer< dim >::removeIfT ( const std::function< bool(const shared_ptr< TranslationT > &c)> &  predicate)

Remove all children which fulfil predicate.

Parameters
predicatereturns true only if the child (with translation) passed as an argument should be deleted
Returns
true if anything has been removed

Definition at line 256 of file container.cpp.

◆ removeIfTUnsafe()

template<int dim>
bool plask::GeometryObjectContainer< dim >::removeIfTUnsafe ( const std::function< bool(const shared_ptr< TranslationT > &c)> &  predicate)
virtual

Remove all children which fulfil predicate.

This is unsafe but fast version, it doesn't call fireChildrenChanged() to inform listeners about this object changes. Caller should do this manually or call removeIfT instead.

Parameters
predicatereturns true only if the child (with translation) passed as an argument should be deleted
Returns
true if anything has been removed

Reimplemented in plask::StackContainerBaseImpl< dim, growingDirection >, plask::StackContainerBaseImpl< 2, Primitive< 2 >::DIRECTION_TRAN >, plask::StackContainer< dim >, and plask::TranslationContainer< dim >.

Definition at line 241 of file container.cpp.

◆ removeT()

template<int dim>
bool plask::GeometryObjectContainer< dim >::removeT ( shared_ptr< const TranslationT el)
inline

Remove all children exactly equal to el.

Parameters
elchild(ren) to remove
Returns
true if anything has been removed

Definition at line 253 of file container.hpp.

◆ writeXML()

template<int dim>
void plask::GeometryObjectContainer< dim >::writeXML ( XMLWriter::Element parent_xml_object,
GeometryObject::WriteXMLCallback write_cb,
AxisNames  axes 
) const
overridevirtual

Call writeXMLAttr for this container attribute and writeXMLChildAttr for each child tag.

Parameters
parent_xml_object
write_cb
axes

Reimplemented from plask::GeometryObject.

Reimplemented in plask::StackContainer< dim >.

Definition at line 24 of file container.cpp.

◆ writeXMLChildAttr()

template<int dim>
void plask::GeometryObjectContainer< dim >::writeXMLChildAttr ( XMLWriter::Element dest_xml_child_tag,
std::size_t  child_index,
const AxisNames axes 
) const
protectedvirtual

Add attributes to child tag.

Default implementation do nothing.

Parameters
dest_xml_child_tagdestination, child tag
child_indexindex of child
axesnames of axes

Reimplemented in plask::WithAligners< GeometryObjectContainer< dim >, align::AlignerD< dim > >, plask::WithAligners< StackContainerBaseImpl< dim >, StackContainerChildAligner< dim > >, and plask::StackContainer< dim >.

Definition at line 19 of file container.cpp.

Member Data Documentation

◆ children

template<int dim>
TranslationVector plask::GeometryObjectContainer< dim >::children
protected

Definition at line 58 of file container.hpp.


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