codac 1.5.6
Loading...
Searching...
No Matches
codac::Paving Class Reference

Multi-dimensional paving as representation of a set. More...

#include <codac_Paving.h>

Inheritance diagram for codac::Paving:
Collaboration diagram for codac::Paving:

Public Member Functions

Basics
 Paving (const IntervalVector &box, SetValue value=SetValue::UNKNOWN)
 Creates a paving.
 
 ~Paving ()
 Paving destructor.
 
Binary tree structure
Pavingget_first_subpaving ()
 Points to the first subpaving of the binary tree implementing this paving set.
 
const Pavingget_first_subpaving () const
 Points to the first subpaving of the binary tree implementing this paving set.
 
Pavingget_second_subpaving ()
 Points to the second subpaving of the binary tree implementing this paving set.
 
const Pavingget_second_subpaving () const
 Points to the second subpaving of the binary tree implementing this paving set.
 
Pavingget_root ()
 Returns a pointer to the root of the paving structure.
 
const Pavingget_root () const
 Returns a pointer to the root of the paving structure.
 
Pavingget_first_leaf (SetValue val, bool without_flag=false)
 Points to the first leaf of the specified value.
 
const Pavingget_first_leaf (SetValue val, bool without_flag=false) const
 Points to the first leaf of the paving structure.
 
void bisect (float ratio=0.49)
 Bisects this paving into two subpavings with some ratio bisection.
 
bool is_leaf () const
 Returns true if this paving is made of two subpavings.
 
Flags
bool flag () const
 Tests whether this paving has been flagged or not.
 
void set_flag () const
 Flags this paving and all its children.
 
void reset_flags () const
 Removes the flags of this Paving and all its children.
 
void reset_paving (SetValue value=SetValue::UNKNOWN)
 Same as building a new Paving object.
 
Extract methods
void get_boxes (std::list< IntervalVector > &l_subpavings, SetValue val, SetValue neg_val=SetValue::DEFAULT) const
 Returns a set of boxes leaves of some value.
 
void get_pavings_intersecting (SetValue val, const IntervalVector &box_to_intersect, std::vector< const Paving * > &v_subpavings, bool no_degenerated_intersection=false) const
 Returns a set of Paving leaves of some value and intersecting a given box.
 
void get_neighbours (std::vector< const Paving * > &v_neighbours, SetValue val=SetValue::IN|SetValue::OUT|SetValue::UNKNOWN, bool without_flag=false) const
 Returns the neighbors (adjacent items) of this Paving, having some value.
 
std::vector< ConnectedSubsetget_connected_subsets (bool sort_by_size=false, SetValue val=SetValue::UNKNOWN|SetValue::IN) const
 Returns the set of connected subsets of this paving.
 
- Public Member Functions inherited from codac::Set
 Set (const IntervalVector &box, SetValue value=SetValue::UNKNOWN)
 Creates a set.
 
 ~Set ()
 Set destructor.
 
SetValue value () const
 Returns the value of this set.
 
int size () const
 Returns the dimension of the paving.
 
const IntervalVector & box () const
 Returns the n-dimensional box representing this set.
 
void set_value (SetValue value)
 Sets the integer value for this set.
 

Public Attributes

bool m_flag = false
 optional flag, can be used by search algorithms
 
Pavingm_root = nullptr
 pointer to the root
 
Pavingm_second_subpaving = nullptr
 tree structure
 

Additional Inherited Members

- Protected Attributes inherited from codac::Set
SetValue m_value
 integer value of this set
 
IntervalVector m_box
 box representing this set
 

Detailed Description

Multi-dimensional paving as representation of a set.

The paving is made of a set of multi-dimensional boxes. The implementation of this paving is made as a binary tree.

Constructor & Destructor Documentation

◆ Paving()

codac::Paving::Paving ( const IntervalVector & box,
SetValue value = SetValue::UNKNOWN )

Creates a paving.

Parameters
boxn-dimensional box defining the paving
valueinteger of the set, SetValue::UNKNOWN by default

Member Function Documentation

◆ get_first_subpaving() [1/2]

Paving * codac::Paving::get_first_subpaving ( )

Points to the first subpaving of the binary tree implementing this paving set.

Returns
a pointer to the first Paving object, or nullptr is this set is a leaf

◆ get_first_subpaving() [2/2]

const Paving * codac::Paving::get_first_subpaving ( ) const

Points to the first subpaving of the binary tree implementing this paving set.

Returns
a const pointer to the first Paving object, or nullptr is this set is a leaf

◆ get_second_subpaving() [1/2]

Paving * codac::Paving::get_second_subpaving ( )

Points to the second subpaving of the binary tree implementing this paving set.

Returns
a pointer to the second Paving object, or nullptr is this set is a leaf

◆ get_second_subpaving() [2/2]

const Paving * codac::Paving::get_second_subpaving ( ) const

Points to the second subpaving of the binary tree implementing this paving set.

Returns
a const pointer to the second Paving object, or nullptr is this set is a leaf

◆ get_root() [1/2]

Paving * codac::Paving::get_root ( )

Returns a pointer to the root of the paving structure.

Returns
a pointer to the Paving object

◆ get_root() [2/2]

const Paving * codac::Paving::get_root ( ) const

Returns a pointer to the root of the paving structure.

Returns
a const pointer to the Paving object

◆ get_first_leaf() [1/2]

Paving * codac::Paving::get_first_leaf ( SetValue val,
bool without_flag = false )

Points to the first leaf of the specified value.

Parameters
valthe value of the leaf we are looking for
without_flagoptional research mode: select the first leaf among non-flagged items only
Returns
a pointer to the Paving object

◆ get_first_leaf() [2/2]

const Paving * codac::Paving::get_first_leaf ( SetValue val,
bool without_flag = false ) const

Points to the first leaf of the paving structure.

Parameters
valthe value of the leaf we are looking for
without_flagoptional research mode: select the first leaf among non-flagged items only
Returns
a const pointer to the Paving object

◆ bisect()

void codac::Paving::bisect ( float ratio = 0.49)

Bisects this paving into two subpavings with some ratio bisection.

Will create two nodes in the binary tree implementing this set.

Parameters
ratiothe bisection ratio (default value: 0.49)

◆ is_leaf()

bool codac::Paving::is_leaf ( ) const

Returns true if this paving is made of two subpavings.

Returns
true if this is a leaf, false otherwise

◆ flag()

bool codac::Paving::flag ( ) const

Tests whether this paving has been flagged or not.

Returns
true if flagged

◆ reset_paving()

void codac::Paving::reset_paving ( SetValue value = SetValue::UNKNOWN)

Same as building a new Paving object.

Parameters
valueinteger of the set, SetValue::UNKNOWN by default

◆ get_boxes()

void codac::Paving::get_boxes ( std::list< IntervalVector > & l_subpavings,
SetValue val,
SetValue neg_val = SetValue::DEFAULT ) const

Returns a set of boxes leaves of some value.

Parameters
l_subpavingsthe set of returned objects
valthe value of the leaves (boxes of the paving) we are looking for
neg_valthe value for which we reject the leaves, optional argument used for faster execution along the tree

◆ get_pavings_intersecting()

void codac::Paving::get_pavings_intersecting ( SetValue val,
const IntervalVector & box_to_intersect,
std::vector< const Paving * > & v_subpavings,
bool no_degenerated_intersection = false ) const

Returns a set of Paving leaves of some value and intersecting a given box.

Parameters
valthe value of the leaves we are looking for
box_to_intersectthe box the returned leaves will intersect
v_subpavingsthe set of returned objects
no_degenerated_intersectionif true, then the objects for which the intersection amounts to a point will not be returned

◆ get_neighbours()

void codac::Paving::get_neighbours ( std::vector< const Paving * > & v_neighbours,
SetValue val = SetValue::IN|SetValue::OUT|SetValue::UNKNOWN,
bool without_flag = false ) const

Returns the neighbors (adjacent items) of this Paving, having some value.

Parameters
v_neighboursthe set of leaves to be returned
valoptional value of the leaves we are looking for, -1 for no restriction
without_flagoptional research mode: select the leaves among non-flagged items only

◆ get_connected_subsets()

std::vector< ConnectedSubset > codac::Paving::get_connected_subsets ( bool sort_by_size = false,
SetValue val = SetValue::UNKNOWN|SetValue::IN ) const

Returns the set of connected subsets of this paving.

A connected subset is a topological space that cannot be represented as the union of two or more disjoint non-empty open subsets.

Note
Note that this method is preferably called from the root Paving.
Parameters
sort_by_size(optional) if true then the subsets will be sort by the number of boxes they are made of
valthe value of the leaves defining the connected items
Returns
the set of connected subsets

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