spaceSet.hh

Go to the documentation of this file.
1 
6 #ifndef SpaceSet_hh
7 #define SpaceSet_hh
8 
9 #include "space.hh"
10 #include "toolbox/set.hh"
11 
12 namespace concepts {
13 
14  // ******************************************************* Set<IndexRange> **
15 
16  template<>
17  class Set<IndexRange> : public BaseSet<IndexRange> {
18  public:
20  template<class F>
21  Set(const F& set) : BaseSet<IndexRange>(set) {}
22  Set(const IndexRange set) : BaseSet<IndexRange>() { insert(set); }
23  virtual ~Set() {}
24 
28  std::pair<bool, uint> exist(uint i) const;
32  void insert(const IndexRange& i);
36  void erase(const IndexRange& i);
38  uint dim() const;
40  uint max() const;
42  uint operator[](uint i) const;
43 
44  // Return set union
46 
47  class index_iterator : public virtual OutputOperator {
48  public:
54  index_iterator(const_iterator first, const_iterator last);
56  index_iterator(const index_iterator& i);
58  index_iterator& operator++();
60  index_iterator operator++(int);
62  bool operator==(const index_iterator i);
63  bool operator!=(const index_iterator i) { return !(*this == i); }
65  operator const uint*() const;
66  protected:
67  virtual std::ostream& info(std::ostream& os) const;
68  private:
71  uint j_;
72  };
73 
75  index_iterator index_begin(uint i = 0) const;
77  const index_iterator index_end() const;
78  protected:
79  virtual std::ostream& info(std::ostream& os) const;
80  private:
81  virtual void union_(const_iterator_ first, const_iterator_ last,
82  insert_iterator_ i) const;
83  virtual void intersection_(const_iterator_ first, const_iterator_ last,
84  insert_iterator_ i) const;
85  virtual void difference_(const_iterator_ first, const_iterator_ last,
86  insert_iterator_ i) const;
87  };
88 
89 } // namespace concepts
90 
91 #endif // SpaceSet_hh
92 
Set< IndexRange > & operator|=(const Set< IndexRange > &set)
uint dim() const
Returns the number of incides in the set.
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
void insert(const IndexRange &i)
Inserts a index range with possible merging, e.g.
Class for a range of global indices.
Definition: space.hh:226
Set with operations, output operator, and method of the particular element types.
Definition: traces.hh:18
index_iterator index_begin(uint i=0) const
Returns an iterator to the i th index.
std::insert_iterator< std::set< IndexRange > > insert_iterator_
Definition: set.hh:115
void erase(const IndexRange &i)
Erases a index range with splitting, e.g.
bool operator!=(const index_iterator i)
Definition: spaceSet.hh:63
virtual void union_(const_iterator_ first, const_iterator_ last, insert_iterator_ i) const
Insert the set union of this set with that between iterator first and second into i.
Set< IndexRange >::const_iterator last_
Definition: spaceSet.hh:69
virtual void intersection_(const_iterator_ first, const_iterator_ last, insert_iterator_ i) const
Insert the set intersection of this set with that between iterator first and second into i.
bool operator==(const index_iterator i)
Comparison operator.
index_iterator operator++(int)
Post fix ++-operator.
std::set< IndexRange >::const_iterator const_iterator_
Definition: set.hh:114
Set with operations and output operator.
Definition: set.hh:28
index_iterator & operator++()
Pre fix ++-operator.
virtual std::ostream & info(std::ostream &os) const
const index_iterator index_end() const
Returns an iterator behind the last index.
index_iterator(const index_iterator &i)
Copy constructor.
std::pair< bool, uint > exist(uint i) const
Returns true and the position, if a index is in the set, otherwise false.
uint max() const
Returns the largest index.
Set(const IndexRange set)
Definition: spaceSet.hh:22
uint operator[](uint i) const
Returns the i th index.
Class providing an output operator.
index_iterator(const_iterator first, const_iterator last)
Constructor.
Basic namespace for Concepts-2.
Definition: pml_formula.h:16
virtual void difference_(const_iterator_ first, const_iterator_ last, insert_iterator_ i) const
Insert the set difference of this set with that between iterator first and second into i.
Page URL: http://wiki.math.ethz.ch/bin/view/Concepts/WebHome
21 August 2020
© 2020 Eidgenössische Technische Hochschule Zürich