43 #ifndef DOMI_SLICE_HPP
44 #define DOMI_SLICE_HPP
52 #include "Teuchos_Assert.hpp"
55 #include "Domi_ConfigDefs.hpp"
56 #include "Domi_Exceptions.hpp"
57 #include "Domi_Utils.hpp"
219 inline const dim_type
start()
const;
232 inline const dim_type
stop()
const;
241 inline const dim_type
step()
const;
303 friend std::ostream &
operator<<(std::ostream & os,
304 const Slice & slice);
385 _stop(
Slice::Default),
398 _bounded_pos((_stop >= 0 && _stop !=
Slice::Default)),
406 _start(((startVal==
Slice::Default) && (stepVal > 0)) ? 0 : startVal),
407 _stop( ((stopVal ==
Slice::Default) && (stepVal < 0)) ? 0 : stopVal ),
408 _step( (stepVal ==
Slice::Default) ? 1 : stepVal),
409 _bounded_pos(((_step > 0) && (_stop >= 0 && _stop !=
Slice::Default))),
410 _bounded_neg(((_step < 0) && (_start >= 0 && _start !=
Slice::Default)))
412 TEUCHOS_TEST_FOR_EXCEPTION(
421 _start(source._start),
424 _bounded_pos(source._bounded_pos),
425 _bounded_neg(source._bounded_neg)
454 _start = slice._start ;
455 _stop = slice._stop ;
456 _step = slice._step ;
457 _bounded_pos = slice._bounded_pos;
458 _bounded_neg = slice._bounded_neg;
466 return ((_start == slice._start) &&
467 (_stop == slice._stop ) &&
468 (_step == slice._step ) );
475 return (not
operator==(slice));
Slice()
Default constructor.
Definition: Domi_Slice.hpp:383
virtual ~ConcreteSlice()
Destructor.
Definition: Domi_Slice.hpp:367
Slice bounds(dim_type size) const
Simply return this ConcreteSlice.
Definition: Domi_Slice.hpp:371
Domi::dim_type dim_type
The type for start indexes, stop indexes, and step intervals.
Definition: Domi_Slice.hpp:144
bool operator!=(const Slice &slice) const
Inequality operator.
Definition: Domi_Slice.hpp:473
const dim_type stop() const
Stop index.
Definition: Domi_Slice.hpp:438
virtual Slice bounds(dim_type size) const
Return a Slice with concrete start and stop values.
bool operator==(const Slice &slice) const
Equals operator.
Definition: Domi_Slice.hpp:464
A ConcreteSlice is a Slice that does not accept Default or negative start or stop values...
Definition: Domi_Slice.hpp:340
Slice & operator=(const Slice &source)
Assignment operator.
Definition: Domi_Slice.hpp:452
A Slice contains a start, stop, and step index, describing a subset of an ordered container...
Definition: Domi_Slice.hpp:137
virtual ~Slice()
Destructor.
Definition: Domi_Slice.hpp:200
const dim_type step() const
Step interval.
Definition: Domi_Slice.hpp:445
static const dim_type Default
Default value for Slice constructors.
Definition: Domi_Slice.hpp:155
friend std::ostream & operator<<(std::ostream &os, const Slice &slice)
Streaming output operator.
const dim_type start() const
Start index.
Definition: Domi_Slice.hpp:431
std::string toString() const
Return a string representation of the Slice.
Invalid argument exception type.
Definition: Domi_Exceptions.hpp:53