Skip to content

Class rayx::Group

ClassList > rayx > Group

More...

  • #include <Beamline.h>

Inherits the following classes: rayx::BeamlineNode

Public Functions

Type Name
Group ()
Group (std::string name)
Group (const Group &) = delete
Group (Group && other) noexcept
void addChild (std::unique_ptr< BeamlineNode > child)
Adds a child to this Group .
auto begin ()
auto begin () const
MaterialTables calcMinimalMaterialTables () const
Calculates the minimal set of material tables required by elements in this Group .
auto cbegin () const
auto cend () const
virtual std::unique_ptr< BeamlineNode > clone () override const
Creates a deep copy of this group and its children.
std::vector< OpticalElementAndTransform > compileElements () const
Recursively converts all DesignElement nodes into OpticalElements with full transforms.
void ctraverse (const std::function< bool(const BeamlineNode &)> & callback) const
Recursively traverse the model/scene graph down from this node.
auto end ()
auto end () const
const DesignElement * findElement (const std::function< bool(const DesignElement &)> & pred) const
DesignElement * findElement (const std::function< bool(const DesignElement &)> & pred)
const DesignElement * findElementByName (const std::string & name) const
DesignElement * findElementByName (const std::string & name)
const Group * findGroup (const std::function< bool(const Group &)> & pred) const
Group * findGroup (const std::function< bool(const Group &)> & pred)
const Group * findGroupByName (const std::string & name) const
Group * findGroupByName (const std::string & name)
const BeamlineNode * findNode (const std::function< bool(const BeamlineNode &)> & pred) const
BeamlineNode * findNode (const std::function< bool(const BeamlineNode &)> & pred)
const BeamlineNode * findNodeByName (const std::string & name) const
BeamlineNode * findNodeByName (const std::string & name)
const BeamlineNode * findNodeByObjectId (const size_t objectId) const
BeamlineNode * findNodeByObjectId (const size_t objectId)
size_t findObjectIdByNode (const BeamlineNode * node) const
const DesignSource * findSource (const std::function< bool(const DesignSource &)> & pred) const
DesignSource * findSource (const std::function< bool(const DesignSource &)> & pred)
const DesignSource * findSourceByName (const std::string & name) const
DesignSource * findSourceByName (const std::string & name)
const std::vector< std::unique_ptr< BeamlineNode > > & getChildren () const
std::vector< std::string > getElementNames () const
std::vector< const DesignElement * > getElements () const
virtual std::string getName () override const
std::vector< std::string > getObjectNames () const
virtual glm::dmat4 getOrientation () override const
Gets the local orientation (rotation/transform) of this node.
virtual glm::dvec4 getPosition () override const
Gets the local position of this node.
std::vector< std::string > getSourceNames () const
std::vector< const DesignSource * > getSources () const
virtual bool isGroup () override const
size_t numElements () const
size_t numObjects () const
size_t numRayPaths () const
size_t numSources () const
Group & operator= (const Group &) = delete
Group & operator= (Group && other) noexcept
virtual const BeamlineNode * operator[] (size_t index) override const
virtual BeamlineNode * operator[] (size_t index) override
virtual const BeamlineNode * operator[] (const std::string & name) override const
virtual BeamlineNode * operator[] (const std::string & name) override
std::unique_ptr< BeamlineNode > releaseNodeFromChildren (const BeamlineNode * node)
std::unique_ptr< BeamlineNode > releaseNodeFromTree (const BeamlineNode * node)
virtual void setName (std::string name) override
void setOrientation (const glm::dmat4 & orientation)
void setPosition (const glm::dvec4 & pos)
void traverse (const std::function< bool(BeamlineNode &)> & callback)
Recursively traverses this Group and its children (non-const).
~Group () = default

Public Functions inherited from rayx::BeamlineNode

See rayx::BeamlineNode

Type Name
const DesignElement * asElement () const
DesignElement * asElement ()
const Group * asGroup () const
Group * asGroup ()
const DesignSource * asSource () const
DesignSource * asSource ()
virtual std::unique_ptr< BeamlineNode > clone () const = 0
Creates a deep copy (clone) of this BeamlineNode .
virtual std::string getName () const = 0
int getObjectId () const
virtual glm::dmat4 getOrientation () const = 0
Gets the local orientation (rotation/transform) of this node.
const BeamlineNode * getParent () const
BeamlineNode * getParent ()
virtual glm::dvec4 getPosition () const = 0
Gets the local position of this node.
const BeamlineNode * getRoot () const
BeamlineNode * getRoot ()
glm::dmat4 getWorldOrientation () const
Computes the absolute/world orientation of this node.
glm::dvec4 getWorldPosition () const
Computes the absolute/world position of this node.
bool hasParent () const
virtual bool isElement () const
virtual bool isGroup () const
virtual bool isSource () const
virtual const BeamlineNode * operator[] (size_t index) const
virtual BeamlineNode * operator[] (size_t index)
virtual const BeamlineNode * operator[] (const std::string & name) const
virtual BeamlineNode * operator[] (const std::string & name)
virtual void setName (std::string name) = 0
virtual ~BeamlineNode () = default

Public Static Functions

Type Name
void accumulateLightSourcesWorldPositions (const Group & group, const glm::dvec4 & parentPos, const glm::dmat4 & parentOri, std::vector< glm::dvec4 > & positions)
Gathers the world positions of all light sources within a Group hierarchy.

Detailed Description

A beamline group that can contain child nodes (elements, sources, or other groups). A Group is a building block for the model/scene graph.

Public Functions Documentation

function Group [1/4]

rayx::Group::Group () 

function Group [2/4]

rayx::Group::Group (
    std::string name
) 

function Group [3/4]

rayx::Group::Group (
    const Group &
) = delete

function Group [4/4]

rayx::Group::Group (
    Group && other
) noexcept

function addChild

Adds a child to this Group .

void rayx::Group::addChild (
    std::unique_ptr< BeamlineNode > child
) 

Parameters:


function begin [1/2]

inline auto rayx::Group::begin () 

function begin [2/2]

inline auto rayx::Group::begin () const

function calcMinimalMaterialTables

Calculates the minimal set of material tables required by elements in this Group .

MaterialTables rayx::Group::calcMinimalMaterialTables () const

Gathers the material IDs used by all child DesignElements and merges them into a single MaterialTables object.

Returns:

A MaterialTables object with data for all relevant materials.


function cbegin

inline auto rayx::Group::cbegin () const

function cend

inline auto rayx::Group::cend () const

function clone

Creates a deep copy of this group and its children.

virtual std::unique_ptr< BeamlineNode > rayx::Group::clone () override const

Returns:

unique_ptr to the base class (can be statically casted)

Implements rayx::BeamlineNode::clone


function compileElements

Recursively converts all DesignElement nodes into OpticalElements with full transforms.

std::vector< OpticalElementAndTransform > rayx::Group::compileElements () const

Returns:

A vector of OpticalElementAndTransform objects compiled from the Group hierarchy.


function ctraverse

Recursively traverse the model/scene graph down from this node.

void rayx::Group::ctraverse (
    const std::function< bool(const BeamlineNode &)> & callback
) const

Calls the callback function on each node.

Parameters:

  • callback Callback function which takes a BeamlineNode reference and returns a bool. Returning true stops the traversal and returning false continues it.

function end [1/2]

inline auto rayx::Group::end () 

function end [2/2]

inline auto rayx::Group::end () const

function findElement [1/2]

const DesignElement * rayx::Group::findElement (
    const std::function< bool(const DesignElement &)> & pred
) const

function findElement [2/2]

DesignElement * rayx::Group::findElement (
    const std::function< bool(const DesignElement &)> & pred
) 

function findElementByName [1/2]

const DesignElement * rayx::Group::findElementByName (
    const std::string & name
) const

function findElementByName [2/2]

DesignElement * rayx::Group::findElementByName (
    const std::string & name
) 

function findGroup [1/2]

const Group * rayx::Group::findGroup (
    const std::function< bool(const Group &)> & pred
) const

function findGroup [2/2]

Group * rayx::Group::findGroup (
    const std::function< bool(const Group &)> & pred
) 

function findGroupByName [1/2]

const Group * rayx::Group::findGroupByName (
    const std::string & name
) const

function findGroupByName [2/2]

Group * rayx::Group::findGroupByName (
    const std::string & name
) 

function findNode [1/2]

const BeamlineNode * rayx::Group::findNode (
    const std::function< bool(const BeamlineNode &)> & pred
) const

function findNode [2/2]

BeamlineNode * rayx::Group::findNode (
    const std::function< bool(const BeamlineNode &)> & pred
) 

function findNodeByName [1/2]

const BeamlineNode * rayx::Group::findNodeByName (
    const std::string & name
) const

function findNodeByName [2/2]

BeamlineNode * rayx::Group::findNodeByName (
    const std::string & name
) 

function findNodeByObjectId [1/2]

const BeamlineNode * rayx::Group::findNodeByObjectId (
    const size_t objectId
) const

function findNodeByObjectId [2/2]

BeamlineNode * rayx::Group::findNodeByObjectId (
    const size_t objectId
) 

function findObjectIdByNode

size_t rayx::Group::findObjectIdByNode (
    const BeamlineNode * node
) const

function findSource [1/2]

const DesignSource * rayx::Group::findSource (
    const std::function< bool(const DesignSource &)> & pred
) const

function findSource [2/2]

DesignSource * rayx::Group::findSource (
    const std::function< bool(const DesignSource &)> & pred
) 

function findSourceByName [1/2]

const DesignSource * rayx::Group::findSourceByName (
    const std::string & name
) const

function findSourceByName [2/2]

DesignSource * rayx::Group::findSourceByName (
    const std::string & name
) 

function getChildren

inline const std::vector< std::unique_ptr< BeamlineNode > > & rayx::Group::getChildren () const

function getElementNames

std::vector< std::string > rayx::Group::getElementNames () const

function getElements

std::vector< const DesignElement * > rayx::Group::getElements () const

function getName

virtual std::string rayx::Group::getName () override const

Implements rayx::BeamlineNode::getName


function getObjectNames

std::vector< std::string > rayx::Group::getObjectNames () const

function getOrientation

Gets the local orientation (rotation/transform) of this node.

inline virtual glm::dmat4 rayx::Group::getOrientation () override const

Each node may have its own transform relative to its parent.

Returns:

A 4x4 matrix (dmat4) representing the local orientation.

Implements rayx::BeamlineNode::getOrientation


function getPosition

Gets the local position of this node.

inline virtual glm::dvec4 rayx::Group::getPosition () override const

Each node may have its own transform relative to its parent.

Returns:

A 4D vector (dvec4) representing the local position.

Implements rayx::BeamlineNode::getPosition


function getSourceNames

std::vector< std::string > rayx::Group::getSourceNames () const

function getSources

std::vector< const DesignSource * > rayx::Group::getSources () const

function isGroup

inline virtual bool rayx::Group::isGroup () override const

Implements rayx::BeamlineNode::isGroup


function numElements

size_t rayx::Group::numElements () const

function numObjects

size_t rayx::Group::numObjects () const

function numRayPaths

size_t rayx::Group::numRayPaths () const

function numSources

size_t rayx::Group::numSources () const

function operator=

Group & rayx::Group::operator= (
    const Group &
) = delete

function operator=

Group & rayx::Group::operator= (
    Group && other
) noexcept

function operator[]

virtual const BeamlineNode * rayx::Group::operator[] (
    size_t index
) override const

Implements rayx::BeamlineNode::operator[]


function operator[]

virtual BeamlineNode * rayx::Group::operator[] (
    size_t index
) override

Implements rayx::BeamlineNode::operator[]


function operator[]

virtual const BeamlineNode * rayx::Group::operator[] (
    const std::string & name
) override const

Implements rayx::BeamlineNode::operator[]


function operator[]

virtual BeamlineNode * rayx::Group::operator[] (
    const std::string & name
) override

Implements rayx::BeamlineNode::operator[]


function releaseNodeFromChildren

std::unique_ptr< BeamlineNode > rayx::Group::releaseNodeFromChildren (
    const BeamlineNode * node
) 

function releaseNodeFromTree

std::unique_ptr< BeamlineNode > rayx::Group::releaseNodeFromTree (
    const BeamlineNode * node
) 

function setName

virtual void rayx::Group::setName (
    std::string name
) override

Implements rayx::BeamlineNode::setName


function setOrientation

inline void rayx::Group::setOrientation (
    const glm::dmat4 & orientation
) 

function setPosition

inline void rayx::Group::setPosition (
    const glm::dvec4 & pos
) 

function traverse

Recursively traverses this Group and its children (non-const).

void rayx::Group::traverse (
    const std::function< bool( BeamlineNode &)> & callback
) 

Calls callback on each node (including nested Groups). If the callback returns true at any point, the traversal stops early.

Parameters:

  • callback A function that takes a BeamlineNode& and returns a bool (true = stop traversal, false = continue).

function ~Group

rayx::Group::~Group () = default

Public Static Functions Documentation

function accumulateLightSourcesWorldPositions

Gathers the world positions of all light sources within a Group hierarchy.

static void rayx::Group::accumulateLightSourcesWorldPositions (
    const Group & group,
    const glm::dvec4 & parentPos,
    const glm::dmat4 & parentOri,
    std::vector< glm::dvec4 > & positions
) 

Parameters:

  • group A reference to the current Group to process.
  • parentPos The position of the parent Group (in world coords).
  • parentOri The orientation of the parent Group (in world coords).
  • positions A reference to a vector of world positions. New positions are appended.


The documentation for this class was generated from the following file Intern/rayx-core/src/Beamline/Beamline.h