Sector decomposition
multi_index.h
Go to the documentation of this file.
1
8/*
9 * Copyright (C) 2003 Stefan Weinzierl
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 */
25
26#ifndef __SECTOR_DECOMPOSITION_MULTI_INDEX_H__
27#define __SECTOR_DECOMPOSITION_MULTI_INDEX_H__
28
29#include <ostream>
30#include <cstddef>
31#include <vector>
32
33namespace sector_decomposition {
34
41
42 // ctors
43 public :
45 explicit basic_multi_index(size_t N, size_t k);
46 explicit basic_multi_index(size_t N, const std::vector<size_t> & vv);
47
48 // functions
49 public :
50 size_t size(void) const;
51 bool overflow(void) const;
52
53 // subscripting
54 public :
55 size_t operator[](size_t i) const;
56 size_t & operator[](size_t i);
57
58 size_t operator()(size_t i) const;
59 size_t & operator()(size_t i);
60
61 // virtual functions
62 public :
63 // initialization
64 virtual basic_multi_index & init(void);
65 // postfix increment
66 virtual basic_multi_index & operator++ (int);
67
68 // I/O operators
69 friend std::ostream & operator<< (std::ostream & os, const basic_multi_index & v);
70
71 // member variables :
72 protected :
74 size_t N;
76 std::vector<size_t> v;
79
80 };
81
97
98 // ctors
99 public :
101 explicit multi_index_ordered(size_t N, size_t k);
102 explicit multi_index_ordered(size_t N, const std::vector<size_t> & vv);
103
104 // overriding virtual functions from base class
105 public :
106 // initialization
107 basic_multi_index & init(void);
108 // postfix increment
110
111 // I/O operators
112 friend std::ostream & operator<< (std::ostream & os, const multi_index_ordered & v);
113
114 };
115
126
127 // ctors
128 public :
130 explicit multi_index_counter(size_t N, size_t k);
131 explicit multi_index_counter(size_t N, const std::vector<size_t> & vv);
132
133 // overriding virtual functions from base class
134 public :
135 // initialization
136 basic_multi_index & init(void);
137 // postfix increment
139
140 // I/O operators
141 friend std::ostream & operator<< (std::ostream & os, const multi_index_counter & v);
142
143 };
144
155
156 // ctors
157 public :
159 explicit multi_index_counter_indv(const std::vector<size_t> & Nv, size_t k);
160 explicit multi_index_counter_indv(const std::vector<size_t> & Nv, const std::vector<size_t> & vv);
161
162 // overriding virtual functions from base class
163 public :
164 // initialization
165 basic_multi_index & init(void);
166 // postfix increment
168
169 // I/O operators
170 friend std::ostream & operator<< (std::ostream & os, const multi_index_counter_indv & v);
171
172 // member variables :
173 protected :
175 std::vector<size_t> Nv;
176 };
177
178} // namespace sector_decomposition
179
180#endif // ndef __SECTOR_DECOMPOSITION_MULTI_INDEX_H__
181
Definition: multi_index.h:40
size_t size(void) const
Definition: multi_index.cc:63
friend std::ostream & operator<<(std::ostream &os, const basic_multi_index &v)
Definition: multi_index.cc:158
bool overflow(void) const
Definition: multi_index.cc:92
bool flag_overflow
a flag indicating overflow
Definition: multi_index.h:78
size_t operator()(size_t i) const
Definition: multi_index.cc:124
virtual basic_multi_index & init(void)
Definition: multi_index.cc:76
std::vector< size_t > v
a vector holding the multi-index
Definition: multi_index.h:76
size_t operator[](size_t i) const
Definition: multi_index.cc:104
size_t N
upper limit for all components
Definition: multi_index.h:74
basic_multi_index(void)
Definition: multi_index.cc:37
virtual basic_multi_index & operator++(int)
Definition: multi_index.cc:145
basic_multi_index & init(void)
Definition: multi_index.cc:436
multi_index_counter_indv(void)
Definition: multi_index.cc:407
basic_multi_index & operator++(int)
Definition: multi_index.cc:458
std::vector< size_t > Nv
upper limit for the individual components
Definition: multi_index.h:175
friend std::ostream & operator<<(std::ostream &os, const multi_index_counter_indv &v)
Definition: multi_index.cc:500
Definition: multi_index.h:125
basic_multi_index & init(void)
Definition: multi_index.cc:324
friend std::ostream & operator<<(std::ostream &os, const multi_index_counter &v)
Definition: multi_index.cc:388
basic_multi_index & operator++(int)
Definition: multi_index.cc:346
multi_index_counter(void)
Definition: multi_index.cc:295
Definition: multi_index.h:96
basic_multi_index & init(void)
Definition: multi_index.cc:209
multi_index_ordered(void)
Definition: multi_index.cc:180
basic_multi_index & operator++(int)
Definition: multi_index.cc:231
friend std::ostream & operator<<(std::ostream &os, const multi_index_ordered &v)
Definition: multi_index.cc:276
Definition: basic_sector_decomposition.cc:36