codac 2.0.0
Loading...
Searching...
No Matches
codac2::TSlice Class Reference

Temporal slice shared by sliced tubes. More...

#include <codac2_TSlice.h>

Inheritance diagram for codac2::TSlice:
codac2::Interval

Public Member Functions

 TSlice (const Interval &tdomain)
 Creates a temporal slice over the given time interval.
 TSlice (const TSlice &tslice, const Interval &tdomain)
 Creates a temporal slice from another one over a new time interval.
bool is_gate () const
 Tests whether this temporal slice is a gate.
const std::map< const SlicedTubeBase *, std::shared_ptr< SliceBase > > & slices () const
 Returns the slices attached to this temporal slice.
const Interval & t0_tf () const
 Returns a read-only reference to the temporal interval.
double lb () const
 Returns the lower bound of this.
double ub () const
 Returns the upper bound of this.
double mid () const
 Returns the midpoint of this.
double rad () const
 Returns the radius of this.
double diam () const
 Returns the diameter of this.
bool is_empty () const
 Tests if this is empty.
bool is_unbounded () const
 Tests if one of the bounds of this is infinite.
bool is_degenerated () const
 Tests if this is degenerated, that is, in the form of \([a,a]\).
bool contains (const double &x) const
 Tests if this contains x.
bool intersects (const Interval &x) const
 Tests if this and x intersect.
bool is_subset (const Interval &x) const
 Tests if this is a subset of x.
bool is_superset (const Interval &x) const
 Tests if this is a superset of x.

Protected Attributes

std::map< const SlicedTubeBase *, std::shared_ptr< SliceBase > > _slices
 Slices attached to each sliced tube over this temporal interval.

Detailed Description

Temporal slice shared by sliced tubes.

A TSlice represents a temporal interval of a TDomain. It privately inherits from Interval so that only TDomain can modify its temporal bounds. It may correspond either to:

  • a non-degenerate time slice \([t_i,t_{i+1}]\), or
  • a degenerate interval \([t_i,t_i]\), referred to as a gate.

For each sliced tube defined on the same temporal partition, this object stores the corresponding SliceBase instance.

Constructor & Destructor Documentation

◆ TSlice() [1/2]

codac2::TSlice::TSlice ( const Interval & tdomain)
explicit

Creates a temporal slice over the given time interval.

Parameters
tdomaintemporal interval associated with this slice

◆ TSlice() [2/2]

codac2::TSlice::TSlice ( const TSlice & tslice,
const Interval & tdomain )

Creates a temporal slice from another one over a new time interval.

This constructor duplicates the slice container associated with each tube by performing a deep copy of the underlying SliceBase objects.

Parameters
tslicesource temporal slice
tdomaintemporal interval associated with the copied slice

Member Function Documentation

◆ is_gate()

bool codac2::TSlice::is_gate ( ) const

Tests whether this temporal slice is a gate.

A temporal slice is considered as a gate when its temporal interval is degenerate, i.e., when \(t^-=t^+\).

Returns
true if this slice is a gate, false otherwise

◆ slices()

const std::map< const SlicedTubeBase *, std::shared_ptr< SliceBase > > & codac2::TSlice::slices ( ) const

Returns the slices attached to this temporal slice.

The returned map associates each SlicedTubeBase defined on the same temporal partition with its corresponding SliceBase over this temporal interval.

Returns
constant reference to the map of attached slices

◆ t0_tf()

const Interval & codac2::TSlice::t0_tf ( ) const
inline

Returns a read-only reference to the temporal interval.

Returns
temporal interval of this slice
100 {
101 return *this;
102 }

◆ lb()

double codac2::Interval::lb ( ) const
inline

Returns the lower bound of this.

Returns
lower bound
127 {
128 return gaol::interval::left();
129 }

◆ ub()

double codac2::Interval::ub ( ) const
inline

Returns the upper bound of this.

Returns
upper bound
132 {
133 return gaol::interval::right();
134 }

◆ mid()

double codac2::Interval::mid ( ) const
inline

Returns the midpoint of this.

Note
The return point is guaranteed to be included in this but not necessarily to be the closest floating point from the real midpoint. In particular, cases are:
  • [empty] -> Quiet NaN
  • [-oo,+oo] -> mid = 0.0
  • [-oo,b] -> mid = -MAXREAL
  • [a,+oo] -> mid = MAXREAL
  • [a,b] -> mid ~ a + .5*(b-a)
Returns
midpoint
137 {
138 double m = gaol::interval::midpoint();
139 gaol::round_upward();
140 return m;
141 }

◆ rad()

double codac2::Interval::rad ( ) const
inline

Returns the radius of this.

Returns
the radius, or 0 if this is empty
177 {
178 if(is_empty())
179 return std::numeric_limits<double>::quiet_NaN();
180
181 else if(is_unbounded())
182 return oo;
183
184 else
185 {
186 double t = mid();
187 double t1 = (t-*this).ub();
188 double t2 = (*this-t).ub();
189 return (t1>t2) ? t1 : t2;
190 }
191 }
bool is_unbounded() const
Tests if one of the bounds of this is infinite.
Definition codac2_Interval_impl.h:236
bool is_empty() const
Tests if this is empty.
Definition codac2_Interval_impl.h:221
double ub() const
Returns the upper bound of this.
Definition codac2_Interval_impl.h:131
double mid() const
Returns the midpoint of this.
Definition codac2_Interval_impl.h:136

◆ diam()

double codac2::Interval::diam ( ) const
inline

Returns the diameter of this.

Returns
the diameter, or 0 if this is empty
194 {
195 if(is_empty())
196 return std::numeric_limits<double>::quiet_NaN();
197
198 else
199 {
200 double d = gaol::interval::width();
201 gaol::round_upward();
202 return d;
203 }
204 }

◆ is_empty()

bool codac2::Interval::is_empty ( ) const
inline

Tests if this is empty.

Returns
true in case of empty set
222 {
223 return gaol::interval::is_empty();
224 }

◆ is_unbounded()

bool codac2::Interval::is_unbounded ( ) const
inline

Tests if one of the bounds of this is infinite.

Note
An empty interval is always bounded
Returns
true if of the bounds of this is infinite
237 {
238 return !gaol::interval::is_finite();
239 }

◆ is_degenerated()

bool codac2::Interval::is_degenerated ( ) const
inline

Tests if this is degenerated, that is, in the form of \([a,a]\).

Note
An empty interval is considered here as degenerated
Returns
true if this is degenerated
242 {
243 return is_empty() || gaol::interval::is_a_double();
244 }

◆ contains()

bool codac2::Interval::contains ( const double & x) const
inline

Tests if this contains x.

Note
x can also be an "open bound", i.e., infinity. So this function is not restricted to a set-membership interpretation.
Parameters
xreal value
Returns
true if this contains x
227 {
228 return gaol::interval::set_contains(x);
229 }

◆ intersects()

bool codac2::Interval::intersects ( const Interval & x) const
inline

Tests if this and x intersect.

Parameters
xthe other interval
Returns
true if the intervals intersect
257 {
258 return !is_empty() && !x.is_empty() && lb() <= x.ub() && ub() >= x.lb();
259 }
double lb() const
Returns the lower bound of this.
Definition codac2_Interval_impl.h:126

◆ is_subset()

bool codac2::Interval::is_subset ( const Interval & x) const
inline

Tests if this is a subset of x.

Note
If this is empty, always returns true
Parameters
xthe other interval
Returns
true iff this interval is a subset of x
272 {
273 return is_empty() || (!x.is_empty() && x.lb() <= lb() && x.ub() >= ub());
274 }

◆ is_superset()

bool codac2::Interval::is_superset ( const Interval & x) const
inline

Tests if this is a superset of x.

Note
If this is empty, always returns true
Parameters
xthe other interval
Returns
true iff this interval is a superset of x
295 {
296 return x.is_subset(*this);
297 }

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