codac 2.0.0
Loading...
Searching...
No Matches
codac2::CtcInter<> Class Reference

Default CtcInter specialization for box contractors. More...

#include <codac2_CtcInter.h>

Inheritance diagram for codac2::CtcInter<>:
Collaboration diagram for codac2::CtcInter<>:

Public Member Functions

 CtcInter (Index n)
 Builds a neutral intersection contractor with a prescribed domain size.
size_t nb () const
 Returns the number of stored contractors.
void contract (X &... x) const
 Contracts the given domain(s) by applying all stored contractors in sequence.
CtcInter< X... > & operator&= (const C &c)
 Appends a contractor to the current intersection.
Public Member Functions inherited from codac2::CtcInter< IntervalVector >
 CtcInter (Index n)
 Builds a neutral intersection contractor with a prescribed domain size.
size_t nb () const
 Returns the number of stored contractors.
void contract (X &... x) const
 Contracts the given domain(s) by applying all stored contractors in sequence.
CtcInter< X... > & operator&= (const C &c)
 Appends a contractor to the current intersection.

Protected Attributes

Collection< CtcBase< X... > > _ctcs
 Internal collection of contractors composing the intersection.
Protected Attributes inherited from codac2::CtcInter< IntervalVector >
Collection< CtcBase< X... > > _ctcs
 Internal collection of contractors composing the intersection.

Detailed Description

Default CtcInter specialization for box contractors.

CtcInter<> is an alias-like specialization inheriting from CtcInter<IntervalVector>.

Constructor & Destructor Documentation

◆ CtcInter()

codac2::CtcInter< X >::CtcInter ( Index n)
inlineexplicit

Builds a neutral intersection contractor with a prescribed domain size.

This constructor is mainly useful when building a contractor incrementally with operator&=. Otherwise it has no effect.

Parameters
nDimension of the contracted object.
Note
When X... is Interval, the size must be 1.
69 : Ctc<CtcInter<X...>,X...>(n)
70 {
71 if constexpr(std::is_same_v<X...,Interval>)
72 {
73 assert(n == 1);
74 }
75 }
Sequential intersection of several contractors:
Definition codac2_CtcInter.h:55
CtcInter(Index n)
Definition codac2_CtcInter.h:68

Member Function Documentation

◆ nb()

size_t codac2::CtcInter< X >::nb ( ) const
inline

Returns the number of stored contractors.

Returns
Size of the internal contractor collection.
113 {
114 return _ctcs.size();
115 }
Collection< CtcBase< X... > > _ctcs
Definition codac2_CtcInter.h:157

◆ contract()

void codac2::CtcInter< X >::contract ( X &... x) const
inline

Contracts the given domain(s) by applying all stored contractors in sequence.

The domains are updated in place. If one contractor empties one of the domains, the remaining contractors are not evaluated.

Parameters
xDomain(s) to contract.
126 {
127 for(const auto& ci : _ctcs)
128 {
129 ci->contract(x...);
130 if((x.is_empty() | ...))
131 return;
132 }
133 }
void contract(X &... x) const
Contracts the given domain(s) by applying all stored contractors in sequence.
Definition codac2_CtcInter.h:125

◆ operator&=()

CtcInter< X... > & codac2::CtcInter< X >::operator&= ( const C & c)
inline

Appends a contractor to the current intersection.

The contractor is added at the end of the internal sequence, so it will be applied after the already stored ones.

Template Parameters
CType of the contractor or contractor pointer.
Parameters
cContractor to append.
Returns
A reference to *this.
148 {
149 assert_release(size_of(c) == this->size());
150 _ctcs.push_back(c);
151 return *this;
152 }

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