waLBerla 7.3
Loading...
Searching...
No Matches
walberla::selectable::SetSelectableObject< T, U > Class Template Reference

Detailed Description

template<typename T, typename U>
class walberla::selectable::SetSelectableObject< T, U >

Implementation of SelectableObject using objects of type SetSelectionPair (see "SetSelectionPair.h") as selection attributes, and objects of type Set (see "Set.h") as selector.

SetSelectableObject is an implementation of SelectableObject that stores objects of type T which are attached with selection attributes of type SetSelectionPair<U>. Every object of type SetSelectionPair<U> contains two sets of type Set<U> - one "include" and one "exclude" set. For information on which objects are selected given a certain selection request see the documentation of the function "select".

#include <SetSelectableObject.h>

Inheritance diagram for walberla::selectable::SetSelectableObject< T, U >:

Classes

struct  Compare

Public Member Functions

 SetSelectableObject ()=default
 SetSelectableObject (const T &object, const Set< U > &include, const Set< U > &exclude, const std::string &identifier=std::string())
 ~SetSelectableObject () override=default
void add (const T &object, const Set< U > &include, const Set< U > &exclude, const std::string &identifier=std::string())
virtual ~SelectableObject ()=default
void add (const T &object, const SetSelectionPair< U > &attributes, const std::string &identifier=std::string())
 This function is used to add an object together with its selection attributes stored in "attributes".
iterator begin ()
iterator end ()
size_t getNumberOfMatching (const Set< U > &selector) const
 Returns the number of objects matching the specified "selector".
size_t get (T &object, const Set< U > &selector) const
 This function can be used to retrieve the one object whose attributes match with "selector".
T * getUnique (const Set< U > &selector)
 Non-const version of getUnique().
void toStream (std::ostream &os) const
std::string toString () const
size_t size () const
bool empty () const

Private Member Functions

void select (std::vector< size_t > &index, const Set< U > &selector) const override
 Given a certain selection request 'R' (= "selector" [set of objects of type U]), this function returns the index 'i' of every attribute 'A_i' (A_0 <=> attributes_[0], A_1 <=> attributes_[1], etc.) that matches the request 'R'.

Additional Inherited Members

std::vector< SetSelectionPair< U > > attributes_

Constructor & Destructor Documentation

◆ SetSelectableObject() [1/2]

template<typename T, typename U>
walberla::selectable::SetSelectableObject< T, U >::SetSelectableObject ( )
default

◆ SetSelectableObject() [2/2]

template<typename T, typename U>
walberla::selectable::SetSelectableObject< T, U >::SetSelectableObject ( const T & object,
const Set< U > & include,
const Set< U > & exclude,
const std::string & identifier = std::string() )
inline

◆ ~SetSelectableObject()

template<typename T, typename U>
walberla::selectable::SetSelectableObject< T, U >::~SetSelectableObject ( )
overridedefault

Member Function Documentation

◆ add()

template<typename T, typename U>
void walberla::selectable::SetSelectableObject< T, U >::add ( const T & object,
const Set< U > & include,
const Set< U > & exclude,
const std::string & identifier = std::string() )
inline

◆ select()

template<typename T, typename U>
void walberla::selectable::SetSelectableObject< T, U >::select ( std::vector< size_t > & index,
const Set< U > & selector ) const
inlineoverrideprivatevirtual

Given a certain selection request 'R' (= "selector" [set of objects of type U]), this function returns the index 'i' of every attribute 'A_i' (A_0 <=> attributes_[0], A_1 <=> attributes_[1], etc.) that matches the request 'R'.

Possible candidates are all A_i ...

  • ... whose "include" sets are completely contained within the set R and ...
  • ... whose "exclude" sets do not intersect with R.

Out of these possible candidates, the attribute A_x whose "include" set contains most elements is chosen. Additionally, out of all candidates, every A_i whose "include" set contains as many elements as A_x is also chosen.

Implements walberla::selectable::SelectableObject< T, SetSelectionPair< U >, Set< U > >.


The documentation for this class was generated from the following file: