SheafSystem  0.0.0.0
poset_powerset_state.h
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 
18 // Interface for class POSET_POWERSET_STATE
19 
20 #ifndef POSET_POWERSET_STATE_H
21 #define POSET_POWERSET_STATE_H
22 
23 #ifndef SHEAF_DLL_SPEC_H
24 #include "SheafSystem/sheaf_dll_spec.h"
25 #endif
26 
27 #ifndef ANY_H
28 #include "SheafSystem/any.h"
29 #endif
30 
31 #ifndef BLOCK_H
32 #include "SheafSystem/block.h"
33 #endif
34 
35 #ifndef INDEX_SPACE_FAMILY_H
36 #include "SheafSystem/index_space_family.h"
37 #endif
38 
39 #ifndef SCOPED_INDEX_H
40 #include "SheafSystem/scoped_index.h"
41 #endif
42 
43 #ifndef SUBPOSET_H
44 #include "SheafSystem/subposet.h"
45 #endif
46 
47 #ifndef SUBPOSET_STATE_H
48 #include "SheafSystem/subposet_state.h"
49 #endif
50 
51 #ifndef NAME_MULTIMAP_H
52 #include "SheafSystem/name_multimap.h"
53 #endif
54 
55 namespace sheaf
56 {
57 
58 // Forward declaration to support friend declaration.
59 SHEAF_DLL_SPEC std::ostream & operator << (std::ostream &os, const poset_powerset_state& p);
60 
64 class SHEAF_DLL_SPEC poset_powerset_state : public any
65 {
66  friend class poset_state_handle;
67  friend class subposet;
68  friend class storage_agent; // needs to create an id space.
69  friend class poset_scaffold; // needs to create an id space.
70  friend SHEAF_DLL_SPEC std::ostream & operator << (std::ostream &os, const poset_powerset_state& p);
71  friend SHEAF_DLL_SPEC size_t deep_size(const poset_powerset_state& xp, bool xinclude_shallow);
72 
73  // ===========================================================
75  // ===========================================================
77 
78 public:
79 
84  poset_powerset_state(size_type xcapacity, const scoped_index& xsubposet_member_index_ub);
85 
90 
91 protected:
92 
93 private:
94 
96 
97 
98  // ===========================================================
100  // ===========================================================
102 
103 public:
104 
108  subposet_state& member(pod_index_type xindex);
109 
113  subposet_state& member(const scoped_index& xindex);
114 
118  const subposet_state& member(pod_index_type xindex) const;
119 
123  const subposet_state& member(const scoped_index& xindex) const;
124 
128  pod_index_type new_subposet(bool xinitializ);
129 
133  void new_subposet(bool xinitialize, scoped_index& xresult);
134 
138  pod_index_type new_subposet(const block<pod_index_type>& xmembers);
139 
143  void new_subposet(const block<scoped_index>& xmembers,
144  scoped_index& xresult);
145 
149  void delete_subposet(pod_index_type xindex);
150 
154  void delete_subposet(const scoped_index& xindex);
155 
159  const scoped_index& subposet_index_ub() const;
160 
164  size_type subposet_ct() const;
165 
170  index_space_iterator& get_subposet_id_space_iterator() const;
171 
175  void release_subposet_id_space_iterator(index_space_iterator& xitr) const;
176 
180  bool contains_subposet(pod_index_type xindex) const;
181 
185  bool contains_subposet(const scoped_index& xindex) const;
186 
187 protected:
188 
189 private:
190 
195 
200 
204  subposets_type _subposets;
205 
209  scoped_index _subposet_index_ub;
210 
212 
213 
214  // ===========================================================
216  // ===========================================================
218 
219 public:
220 
224  const index_space_family& id_spaces() const;
225 
229  const hub_index_space_handle& hub_id_space() const;
230 
236  const scoped_index& hub_id() const;
237 
241  scoped_index hub_id(pod_index_type xid) const;
242 
243 protected:
244 
245 private:
246 
250  index_space_family _id_spaces;
251 
253 
254 
255  // ===========================================================
257  // ===========================================================
259 
260 public:
261 
266 
270  subposet_name_map_type& subposet_name_map();
271 
275  const subposet_name_map_type& subposet_name_map() const;
276 
277 protected:
278 
279 private:
280 
284  subposet_name_map_type _subposet_name_map;
285 
287 
288 
289  // ===========================================================
291  // ===========================================================
293 
294 public:
295 
299  const scoped_index& subposet_member_index_ub() const;
300 
304  void put_subposet_member_index_ub(const scoped_index& xub);
305 
309  bool is_dof_subposet(pod_index_type xindex) const;
310 
314  bool is_dof_subposet(const scoped_index& xindex) const;
315 
319  void delete_poset_member(pod_index_type xindex);
320 
324  void delete_poset_member(const scoped_index& xindex);
325 
330  bool subposet_contains_member(pod_index_type xsubposet_index,
331  pod_index_type xmbr_index) const;
332 
337  bool subposet_contains_member(const scoped_index& xsubposet_index,
338  const scoped_index& xmbr_index) const;
339 
340 protected:
341 
342 private:
343 
344  // Upper bound for member index in all subposets.
345 
346  scoped_index _subposet_member_index_ub;
347 
349 
350 
351  // ===========================================================
353  // ===========================================================
355 
356 public:
357 
361  subposet& coarsest_common_refinement();
362 
366  const subposet& coarsest_common_refinement() const;
367 
371  subposet& coarsest_common_refinement_jims();
372 
376  const subposet& coarsest_common_refinement_jims() const;
377 
381  subposet& whole();
382 
386  subposet& jims();
387 
391  subposet& table_dof_subposet();
392 
396  const subposet& table_dof_subposet() const;
397 
401  subposet& row_dof_subposet();
402 
406  const subposet& row_dof_subposet() const;
407 
412  int standard_subposet_ct() const;
413 
418  void put_standard_subposet_ct(int xct);
419 
420 protected:
421 
422 private:
423 
427  subposet _coarsest_common_refinement;
428 
432  subposet _coarsest_common_refinement_jims;
433 
437  subposet _whole;
438 
442  subposet _jims;
443 
447  subposet _table_dof_subposet;
448 
452  subposet _row_dof_subposet;
453 
458  int _standard_subposet_ct;
459 
461 
462 
463  // ===========================================================
465  // ===========================================================
467 
468 public:
469 
473  virtual bool is_ancestor_of(const any* other) const;
474 
478  virtual poset_powerset_state* clone() const;
479 
483  bool invariant() const;
484 
485 protected:
486 
487 private:
488 
490 
491 };
492 
493 // ===========================================================
494 // NON-MEMBER FUNCTIONS
495 // ===========================================================
496 
500 SHEAF_DLL_SPEC std::ostream & operator << (std::ostream &os, const poset_powerset_state& p);
501 
505 SHEAF_DLL_SPEC size_t deep_size(const poset_powerset_state& xp, bool xinclude_shallow = true);
506 
507 } // namespace sheaf
508 
509 #endif // ifndef POSET_POWERSET_STATE_H
510 
A client handle for a subposet.
Definition: subposet.h:86
An abstract iterator over the ids of an id space.
The data structure representing the state of a subposet.
A client handle for a general, abstract partially order set.
A partial multi-valued relation with total injective inverse between names and indices of type index_...
Definition: name_multimap.h:63
An implementation of class sum_index_space_handle that has a primary sum id space state...
A auto_block initialization policy that initializes the values to zero.
Definition: auto_block.h:102
Abstract base class with useful features for all objects.
Definition: any.h:39
An index within the external ("client") scope of a given id space.
Definition: scoped_index.h:116
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.
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
Definition: sheaf.h:52
int_type pod_index_type
The plain old data index type.
Definition: pod_types.h:49
SHEAF_DLL_SPEC std::ostream & operator<<(std::ostream &os, const dof_descriptor_array &p)
Insert dof_descriptor_array& p into ostream& os.
Namespace for the sheaves component of the sheaf system.
A poset specific collection of data converters, various buffers and other data used while transferrin...
Factory and container for a family of id spaces.
The set of subsets of a poset.
Agent responsible for importing and exporting posets from an external name space which resides on dis...
Definition: storage_agent.h:74
name_multimap subposet_name_map_type
The type of the subposet_name_map.