SheafSystem  0.0.0.0
sum_index_space_state.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 SUM_INDEX_SPACE_STATE_H
22 #define SUM_INDEX_SPACE_STATE_H
23 
24 #ifndef SHEAF_DLL_SPEC_H
25 #include "SheafSystem/sheaf_dll_spec.h"
26 #endif
27 
28 #ifndef EXPLICIT_INDEX_SPACE_STATE_H
29 #include "SheafSystem/explicit_index_space_state.h"
30 #endif
31 
32 #ifndef BLOCK_H
33 #include "SheafSystem/block.h"
34 #endif
35 
36 #ifndef STD_UNORDERED_MAP_H
37 #include "SheafSystem/std_unordered_map.h"
38 #endif
39 
40 #ifndef STD_MAP_H
41 #include "SheafSystem/std_map.h"
42 #endif
43 
44 #ifndef STD_LIST_H
45 #include "SheafSystem/std_list.h"
46 #endif
47 
48 namespace sheaf
49 {
50 
51 class sum_index_space_state;
52 
84 {
85 
86  friend SHEAF_DLL_SPEC size_t deep_size(const sum_index_space_state& xn, bool xinclude_shallow);
87 
88  // ===========================================================
90  // ===========================================================
92 
93 public:
94 
95 protected:
96 
101 
106 
110  virtual ~sum_index_space_state();
111 
112 private:
113 
115 
116 
117  // ===========================================================
119  // ===========================================================
121 
122 public:
123 
127  typedef std::list<pod_type> equivalence_class_type;
128 
132  void equivalence_class(pod_type xhub_id, equivalence_class_type& result) const;
133 
137  size_type equivalence_ct(pod_type xhub_id) const;
138 
143  virtual bool contains_rep(pod_type xhub_id) const = 0;
144 
149  bool contains_unique_rep(pod_type xhub_id) const;
150 
154  virtual pod_type rep(pod_type xhub_id) const = 0;
155 
160  virtual pod_type host_rep(pod_type xhub_id) const = 0;
161 
165  virtual pod_type term_id_begin() const = 0;
166 
170  virtual pod_type term_id_end() const = 0;
171 
175  virtual bool contains_term_id(pod_type xi) const = 0;
176 
180  const index_space_handle& term(pod_type xi) const;
181 
185  const index_space_handle& term_of(pod_type xid) const;
186 
190  const index_space_handle& term_of(const scoped_index& xid) const;
191 
195  const index_space_handle& last_term() const;
196 
200  pod_type term_begin(pod_type xi) const;
201 
205  pod_type term_end(pod_type xi) const;
206 
210  pod_type term_hub_begin(pod_type xi) const;
211 
215  pod_type term_hub_end(pod_type xi) const;
216 
220  pod_type term_id(pod_type xid) const;
221 
225  void binary(pod_type xindex, pod_type& xterm_id, pod_type& xlocal) const;
226 
230  void simple(pod_type xterm_id, pod_type xlocal_id, pod_type& xindex) const;
231 
235  virtual void clear();
236 
237 protected:
238 
242  typedef unordered::unordered_multimap<pod_type, pod_type> rem_inv_type;
243 
247  rem_inv_type _rem_inv;
248 
253 
258 
262  terms_type _terms;
263 
268 
273 
277  typedef std::map<pod_type, pod_type> sum_to_term_type;
278 
282  sum_to_term_type _sum_to_term_map;
283 
284 private:
285 
287 
288 
289  // ===========================================================
291  // ===========================================================
293 
294 public:
295 
299  virtual bool operator==(const explicit_index_space_state& xother) const;
300 
304  virtual size_type deep_size(bool xinclude_shallow) const;
305 
306 protected:
307 
311  virtual sum_index_space_state& operator=(const explicit_index_space_state& xother);
312 
313 private:
314 
316 
317 
318  // ===========================================================
320  // ===========================================================
322 
323 public:
324 
325 protected:
326 
327 private:
328 
330 
331 
332  // ===========================================================
334  // ===========================================================
336 
337 public:
338 
342  virtual const std::string& class_name() const;
343 
344 protected:
345 
346 private:
347 
349 
350 
351  // ===========================================================
353  // ===========================================================
355 
356 public:
357 
361  virtual bool is_ancestor_of(const any* other) const;
362 
366  virtual bool invariant() const;
367 
368 protected:
369 
370 private:
371 
373 
374 };
375 
376 // ===========================================================
377 // NON-MEMBER FUNCTIONS
378 // ===========================================================
379 
383 SHEAF_DLL_SPEC
384 size_t deep_size(const sum_index_space_state& xn, bool xinclude_shallow = true);
385 
386 } // end namespace sheaf
387 
388 #endif // ifndef SUM_INDEX_SPACE_STATE_H
An abstract handle to a space of alternate integer identifiers (aliases) for a subset of a hub set of...
block< pod_type > _term_end
The end of the interval in the sum id space for each term.
A auto_block initialization policy that initializes the values to zero.
Definition: auto_block.h:102
sum_index_space_state(const sum_index_space_state &xother)
Copy constructor; disabled.
Abstract base class with useful features for all objects.
Definition: any.h:39
An immutable abstract state for a space of alternate integer identifiers (aliases) for a subset of th...
std::list< pod_type > equivalence_class_type
The type used to represent an equivalence class.
An index within the external ("client") scope of a given id space.
Definition: scoped_index.h:116
An abstract id space of alternate integer identifiers which is the sum (disjoint union) of two or mor...
SHEAF_DLL_SPEC size_t deep_size(const dof_descriptor_array &xp, bool xinclude_shallow=true)
The deep size of the referenced object of type dof_descriptor_array.
terms_type _terms
The terms of this sum.
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
Definition: sheaf.h:52
unordered::unordered_multimap< pod_type, pod_type > rem_inv_type
The type of the inverse of the rem map.
zero_block_initialization_policy< index_space_handle * > terms_init_type
The type of the terms block initialization policy.
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.
auto_block< index_space_handle *, terms_init_type > terms_type
The type of the terms block.
pod_index_type pod_type
The "plain old data" index type for this.
block< pod_type > _term_begin
The beginning of the interval in the sum id space for each term.
Namespace for the sheaves component of the sheaf system.
sum_to_term_type _sum_to_term_map
The term id corresponding to each sum id.
rem_inv_type _rem_inv
The inverse rem map.
std::map< pod_type, pod_type > sum_to_term_type
The type of sum_to_term_map.