SheafSystem  0.0.0.0
d_bin_coordinates.h
Go to the documentation of this file.
1 
2 //
3 // Copyright (c) 2014 Limit Point Systems, Inc.
4 //
5 // Licensed under the Apache License, Version 2.0 (the "License");
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17 
20 
21 #ifndef D_BIN_COORDINATES_H
22 #define D_BIN_COORDINATES_H
23 
24 #ifndef SHEAF_DLL_SPEC_H
25 #include "SheafSystem/sheaf_dll_spec.h"
26 #endif
27 
28 #ifndef SECTION_EVALUATOR_H
29 #include "SheafSystem/section_evaluator.h"
30 #endif
31 
32 #ifndef SHEAF_H
33 #include "SheafSystem/sheaf.h"
34 #endif
35 
36 #ifndef STD_CMATH_H
37 #include "SheafSystem/std_cmath.h"
38 #endif
39 
40 #ifndef STD_IOSTREAM_H
41 #include "SheafSystem/std_iostream.h"
42 #endif
43 
44 namespace geometry
45 {
46 
47 using namespace sheaf;
48 using namespace fiber_bundle;
49 
53 template <int DC, int DB>
54 class SHEAF_DLL_SPEC d_bin_coordinates
55 {
56 
57  // ===========================================================
59  // ===========================================================
61 
62 public:
63 
68 
72  typedef typename sheaf::size_type size_type;
73 
77  typedef unsigned long long int_type;
78 
83 
88 
92  d_bin_coordinates(const value_type* xcoord);
93 
98 
102  bool invariant() const;
103 
107  d_bin_coordinates& operator=(const d_bin_coordinates<DC, DB>& xother);
108 
112  d_bin_coordinates& operator=(const value_type* xcoord);
113 
117  bool operator==(const d_bin_coordinates<DC, DB>& xother) const;
118 
122  bool operator==(int_type xother) const;
123 
127  bool operator<(const d_bin_coordinates<DC, DB>& xother) const;
128 
133  bool operator<=(const d_bin_coordinates<DC, DB>& xother) const;
134 
138  d_bin_coordinates<DC, DB>& operator>>=(int xbits);
139 
144 
148  size_type branch(size_type xbit) const;
149 
153  void put_branch(size_type xbit, size_type xbranch);
154 
158  static int_type ub();
159 
163  static size_type bits();
164 
168  static size_type leftmost_bit_id();
169 
173  static size_type rightmost_bit_id();
174 
178  static size_type degree();
179 
183  static size_type dc();
184 
188  const int_type* int_value() const;
189 
193  const int_type& operator[](size_type xi) const;
194 
198  int_type& operator[](size_type xi);
199 
200 
201 private:
202 
206  d_bin_coordinates(int_type xint_value);
207 
211  int_type _int_value[DC];
212 
214 
215 };
216 
217 // ===========================================================
218 // NON-MEMBER FUNCTIONS
219 // ===========================================================
220 
221 // #ifndef STD_BITSET_H
222 // #include "SheafSystem/std_bitset.h"
223 // #endif
224 
228 template <int DC, int DB>
229 SHEAF_DLL_SPEC
230 std::ostream&
231 operator<<(std::ostream& xos, const d_bin_coordinates<DC, DB>& xcoords);
232 
233 
234 // ===========================================================
235 // SPECIALIZATIONS
236 // ===========================================================
237 
238 //
239 // The branch index at bit position xbit (1d specialization).
240 //
241 template<>
242 SHEAF_DLL_SPEC
245 
246 //
247 // Set the branch index at bit position xbit to xbranch (1d specialization).
248 //
249 template<>
250 SHEAF_DLL_SPEC
251 void
253 
254 //
255 // The branch index at bit position xbit (2d specialization).
256 //
257 template<>
258 SHEAF_DLL_SPEC
261 
262 //
263 // Set the branch index at bit position xbit to xbranch (2d specialization).
264 //
265 template<>
266 SHEAF_DLL_SPEC
267 void
269 
270 //
271 // The branch index at bit position xbit.
272 //
273 template<>
274 SHEAF_DLL_SPEC
277 
278 //
279 // Set the branch index at bit position xbit to xbranch (3d specialization).
280 //
281 template<>
282 SHEAF_DLL_SPEC
283 void
285 
286 //
287 // The branch index at bit position xbit (4d specialization).
288 //
289 template<>
290 SHEAF_DLL_SPEC
293 
294 //
295 // Set the branch index at bit position xbit to xbranch (4d specialization).
296 //
297 template<>
298 SHEAF_DLL_SPEC
299 void
301 
302 } // namespace geometry
303 
304 #endif // ifndef D_BIN_COORDINATES_H
unsigned long long int_type
The type used for integer coordinates.
T & operator-=(T &xresult, const T &xother)
x0 -= x1 (self-allocated for volatile types); synonym for subtract_equal(x0, x1). ...
Definition: vd.impl.h:305
void put_branch(size_type xbit, size_type xbranch)
Set the branch index at bit position xbit to xbranch.
Fixed point relative coordinates for a tree domain.
size_type branch(size_type xbit) const
The branch index at bit position xbit.
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
Definition: sheaf.h:52
vd_value_type value_type
The type of component in the value; the scalar type in the range vector space.
sheaf::size_type size_type
An unsigned integral type used to represent sizes and capacities.
bool operator==(const singly_linked_list< T, Alloc > &lhs, const singly_linked_list< T, Alloc > &rhs)
Checks if the contents of lhs and rhs are equal, that is, whether lhs.size() == rhs.size() and each element in lhs compares equal with the element in rhs at the same position.
Namespace for the sheaves component of the sheaf system.
Namespace for the fiber_bundles component of the sheaf system.
Namespace for geometry component of sheaf system.
Definition: field_vd.h:54
section_evaluator::value_type value_type
The type used for floating point coordinates.