SheafSystem  0.0.0.0
explicit_index_space_state.cc
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 #include "SheafSystem/explicit_index_space_state.h"
22 
23 #include "SheafSystem/abstract_product_structure.h"
24 #include "SheafSystem/assert_contract.h"
25 #include "SheafSystem/explicit_index_space_interval.h"
26 #include "SheafSystem/explicit_index_space_iterator.h"
27 #include "SheafSystem/factory.h"
28 #include "SheafSystem/hub_index_space_handle.h"
29 #include "SheafSystem/index_space_collection.h"
30 #include "SheafSystem/index_space_family.h"
31 #include "SheafSystem/scoped_index.h"
32 #include "SheafSystem/std_iomanip.h"
33 
34 // ===========================================================
35 // EXPLICIT_INDEX_SPACE_STATE FACET
36 // ===========================================================
37 
38 // PUBLIC MEMBER FUNCTIONS
39 
42 {
43  // Preconditions:
44 
45  // Body:
46 
47  if(_product != 0)
48  {
49  delete _product;
50  }
51 
52  // Postconditions:
53 
54  // Exit:
55 
56  return;
57 }
58 
59 bool
62 {
63  // Preconditions:
64 
65  require(is_ancestor_of(&xother));
66 
67  // Body:
68 
69  bool result = (_host == xother._host);
70  result = result && (_index == xother._index);
71  result = result && (_ct == xother._ct);
72  result = result && (_begin == xother._begin);
73  result = result && (_end == xother._end);
74  result = result && (_is_persistent == xother._is_persistent);
75  result = result && ((_product == 0) == (xother._product == 0));
76 
77  if(result && (_product != 0))
78  {
79  result = result && (*_product == *xother._product);
80  }
81 
82  // Postconditions:
83 
84  // Exit
85 
86  return result;
87 }
88 
91 host() const
92 {
93  // Preconditions:
94 
95  // Body:
96 
97  const index_space_collection& result = *_host;
98 
99  // Postconditions:
100 
101  ensure(is_basic_query);
102 
103  // Exit:
104 
105  return result;
106 }
107 
111 {
112  // Preconditions:
113 
114  // Body:
115 
116  index_space_collection& result = *_host;
117 
118  // Postconditions:
119 
120  ensure(is_basic_query);
121 
122  // Exit:
123 
124  return result;
125 }
126 
129 index() const
130 {
131  // Preconditions:
132 
133  // Body:
134 
135  pod_type result = _index;
136 
137  // Postconditions:
138 
139  ensure(is_basic_query);
140 
141  // Exit:
142 
143  return result;
144 }
145 
146 // PROTECTED MEMBER FUNCTIONS
147 
150  : _host(0),
152  _ct(0),
155  _is_persistent(false),
156  _product(0)
157 {
158  // Preconditions:
159 
160  // Body:
161 
162  // Postconditions:
163 
164  ensure(invariant());
165 
166  // Exit:
167 
168  return;
169 }
170 
174 {
175  // Preconditions:
176 
177  require(is_ancestor_of(&xother));
178 
179  // Body:
180 
181  _host = xother._host;
182  _index = xother._index;
183  _ct = xother._ct;
184  _begin = xother._begin;
185  _end = xother._end;
187  _product = (xother._product != 0) ? xother._product->clone() : 0;
188 
189  // Postconditions:
190 
191  ensure(invariant());
192  ensure((*this) == xother);
193 
194  // Exit
195 
196  return *this;
197 }
198 
199 void
202  const std::string& xname,
203  bool xis_persistent)
204 {
205  // Preconditions:
206 
207  require(!xname.empty());
208  require(!xid_spaces.contains(xname));
209 
210  // Body:
211 
212  // Reserve the next explicit index space id.
213 
214  pod_type result = xid_spaces.reserve_next_explicit_id();
215 
216  // Construct an explicit index space at id, result.
217 
218  new_state(xid_spaces, result, xname, xis_persistent);
219 
220  // Postconditions:
221 
222  ensure(invariant());
223 
224  ensure(&id_spaces() == &xid_spaces);
225  ensure(is_persistent() == xis_persistent);
226  ensure(xid_spaces.name(index()) == xname);
227 
228  ensure(xid_spaces.contains(index()));
229  ensure(xid_spaces.contains(xname));
230 
231  // Exit:
232 
233  return;
234 }
235 
236 void
239  pod_type xid,
240  const std::string& xname,
241  bool xis_persistent)
242 {
243  // Preconditions:
244 
245  require(!xid_spaces.contains(xid));
246  require(xid_spaces.is_explicit_interval(xid));
247  require(!xname.empty());
248  require(!xid_spaces.contains(xname));
249 
250  // Body:
251 
252  pod_type result = xid;
253 
254  // Get the explicit interval.
255 
256  explicit_index_space_interval* lexplicit_interval =
257  reinterpret_cast<explicit_index_space_interval*>(xid_spaces.collection(result));
258 
259  // Set the data members.
260 
261  _host = lexplicit_interval;
262  _is_persistent = xis_persistent;
263  _index = xid;
264 
265  // Insert state into the explicit interval.
266 
267  lexplicit_interval->insert(*this);
268 
269  // Insert the name.
270 
271  xid_spaces.put_name(xid, xname);
272 
273  // Postconditions:
274 
275  ensure(invariant());
276 
277  ensure(&id_spaces() == &xid_spaces);
278  ensure(index() == xid);
279  ensure(is_persistent() == xis_persistent);
280  ensure(xid_spaces.name(index()) == xname);
281 
282  ensure(xid_spaces.contains(index()));
283  ensure(xid_spaces.contains(xname));
284 
285  // Exit:
286 
287  return;
288 }
289 
292 deep_size(bool xinclude_shallow) const
293 {
294  // Preconditions:
295 
296  // Body:
297 
298  size_type result = sheaf::deep_size(*this, xinclude_shallow);
299 
300  // Postconditions:
301 
302  ensure(result >= 0);
303 
304  // Exit:
305 
306  return result;
307 }
308 
309 // PRIVATE MEMBER FUNCTIONS
310 
311 
312 // ===========================================================
313 // INDEX SPACE FACET
314 // ===========================================================
315 
316 // PUBLIC MEMBER FUNCTIONS
317 
320 id_spaces() const
321 {
322  // Preconditions:
323 
324  // Body:
325 
326  const index_space_family& result = _host->id_spaces();
327 
328  // Postconditions:
329 
330  ensure(is_basic_query);
331 
332  // Exit:
333 
334  return result;
335 }
336 
340 {
341  // Preconditions:
342 
343  // Body:
344 
345  index_space_family& result = _host->id_spaces();
346 
347  // Postconditions:
348 
349  ensure(is_basic_query);
350 
351  // Exit:
352 
353  return result;
354 }
355 
359 {
360  // Preconditions:
361 
362  // Body:
363 
364  const hub_index_space_handle& result = id_spaces().hub_id_space();
365 
366  // Postconditions:
367 
368  ensure(is_basic_query);
369 
370  // Exit:
371 
372  return result;
373 }
374 
377 ct() const
378 {
379  // Preconditions:
380 
381  // Body:
382 
383  size_type result = _ct;
384 
385  // Postconditions:
386 
387  ensure(is_basic_query);
388 
389  // Exit:
390 
391  return result;
392 }
393 
394 bool
396 is_empty() const
397 {
398  // Preconditions:
399 
400  // Body:
401 
402  bool result = (_ct == 0);
403 
404  // Postconditions:
405 
406  ensure(is_basic_query);
407 
408  // Exit:
409 
410  return result;
411 }
412 
415 begin() const
416 {
417  // Preconditions:
418 
419  // Body:
420 
421  pod_type result = _begin;
422 
423  // Postconditions:
424 
425  ensure(is_basic_query);
426 
427  // Exit:
428 
429  return result;
430 }
431 
434 end() const
435 {
436  // Preconditions:
437 
438  // Body:
439 
440  pod_type result = _end;
441 
442  // Postconditions:
443 
444  ensure(is_basic_query);
445 
446  // Exit:
447 
448  return result;
449 }
450 
451 bool
453 is_gathered() const
454 {
455  // Preconditions:
456 
457  // Body:
458 
459  bool result = (begin() == 0) && (end() == ct());
460 
461  // Postconditions:
462 
463  ensure(is_basic_query);
464 
465  // Exit:
466 
467  return result;
468 }
469 
470 bool
472 contains(pod_type xid) const
473 {
474  // Preconditions:
475 
476  // Body:
477 
478  bool result = false; // Just to silence compiler warnings.
479 
480  is_abstract();
481 
482  // Postconditions:
483 
484  ensure(is_basic_query);
485 
486  // Exit:
487 
488  return result;
489 }
490 
491 bool
493 contains(const scoped_index& xid) const
494 {
495  // Preconditions:
496 
497  // Body:
498 
499  bool result = contains_hub(xid.hub_pod());
500 
501  // Postconditions:
502 
503  ensure(is_basic_query);
504 
505  // Exit:
506 
507  return result;
508 }
509 
510 bool
513 {
514  // Preconditions:
515 
516  // Body:
517 
518  bool result = contains_unglued_hub(xid);
519 
520  // Postconditions:
521 
522  ensure(is_basic_query);
523 
524  // Exit:
525 
526  return result;
527 }
528 
529 bool
532 {
533  // Preconditions:
534 
535  // Body:
536 
537  bool result = false; // Just to silence compiler warnings.
538 
539  is_abstract();
540 
541  // Postconditions:
542 
543  ensure(is_basic_query);
544 
545  // Exit:
546 
547  return result;
548 }
549 
550 bool
553 {
554  // Preconditions:
555 
556  // Body:
557 
558  bool result =
560 
561  // Postconditions:
562 
563  ensure(is_basic_query);
564 
565  // Exit:
566 
567  return result;
568 }
569 
570 bool
572 contains(pod_type xid, const scoped_index& xhub_id) const
573 {
574  // Preconditions:
575 
576  // Body:
577 
578  bool result = contains(xid, xhub_id.hub_pod());
579 
580  // Postconditions:
581 
582  ensure(is_basic_query);
583 
584  // Exit:
585 
586  return result;
587 }
588 
589 bool
591 contains(pod_type xid, pod_type xhub_id) const
592 {
593  // Preconditions:
594 
595  // Body:
596 
597  bool result = (contains(xid) && (hub_pod(xid) == xhub_id));
598 
599  // Postconditions:
600 
601  ensure(is_basic_query);
602 
603  // Exit:
604 
605  return result;
606 }
607 
610 pod(pod_type xid) const
611 {
612  // Preconditions:
613 
614  // Body:
615 
616  pod_type result = 0; // Just to silence compiler warnings.
617 
618  is_abstract();
619 
620  // Postconditions:
621 
622  ensure(!is_valid(result) || contains(result));
623 
624  // Exit:
625 
626  return result;
627 }
628 
631 pod(const scoped_index& xid) const
632 {
633  // Preconditions:
634 
635  // Body:
636 
637  pod_type result = pod(xid.hub_pod());
638 
639  // Postconditions:
640 
641  ensure(!is_valid(result) || contains(result));
642 
643  // Exit:
644 
645  return result;
646 }
647 
650 hub_pod(pod_type xid) const
651 {
652  // Preconditions:
653 
654  // Body:
655 
656  pod_type result = unglued_hub_pod(xid);
657 
658  // Postconditions:
659 
660  ensure(!is_valid(result) || contains_hub(result));
661 
662  // Exit:
663 
664  return result;
665 }
666 
670 {
671  // Preconditions:
672 
673  // Body:
674 
675  pod_type result = 0; // Just to silence compiler warnings.
676 
677  is_abstract();
678 
679  // Postconditions:
680 
681  ensure(!is_valid(result) || contains_unglued_hub(result));
682 
683  // Exit:
684 
685  return result;
686 }
687 
691 {
692  // Preconditions:
693 
694  // Body:
695 
696  pod_type result =
698 
699  // Postconditions:
700 
701  ensure(!is_valid(result) || contains_glued_hub(result));
702 
703  // Exit:
704 
705  return result;
706 }
707 
708 bool
711 {
712  // Preconditions:
713 
714  // Body:
715 
716  bool result = _is_persistent;
717 
718  // Postconditions:
719 
720  ensure(is_basic_query);
721 
722  // Exit:
723 
724  return result;
725 }
726 
727 // PROTECTED MEMBER FUNCTIONS
728 
729 void
732 {
733  // Preconditions:
734 
735  // Body:
736 
739 
740  // Posconditions:
741 
742  ensure(!is_valid(begin()));
743  ensure(!is_valid(end()));
744 
745  // Exit:
746 
747  return;
748 }
749 
750 // PRIVATE MEMBER FUNCTIONS
751 
752 
753 // ===========================================================
754 // PRODUCT STRUCTURE FACET
755 // ===========================================================
756 
757 // PUBLIC MEMBER FUNCTIONS
758 
759 void
762 {
763  // Preconditions:
764 
765  // Body:
766 
767  _product = xproduct.clone();
768 
769  // Postconditions:
770 
771  ensure(has_product_structure());
772 
773  // Exit:
774 
775  return;
776 }
777 
778 void
781 {
782  // Preconditions:
783 
784  // Body:
785 
786  if(_product != 0)
787  {
788  delete _product;
789  _product = 0;
790  }
791 
792  // Postconditions:
793 
794  ensure(!has_product_structure());
795 
796  // Exit:
797 
798  return;
799 }
800 
804 {
805  // Preconditions:
806 
807  require(has_product_structure());
808 
809  // Body:
810 
811  const abstract_product_structure& result = *_product;
812 
813  // Postconditions:
814 
815  ensure(is_basic_query);
816 
817  // Exit:
818 
819  return result;
820 }
821 
825 {
826  // Preconditions:
827 
828  require(has_product_structure());
829 
830  // Body:
831 
833 
834  // Postconditions:
835 
836  ensure(is_basic_query);
837 
838  // Exit:
839 
840  return result;
841 }
842 
843 bool
846 {
847  // Preconditions:
848 
849  // Body:
850 
851  bool result = (_product != 0);
852 
853  // Postconditions:
854 
855  ensure(is_basic_query);
856 
857  // Exit:
858 
859  return result;
860 }
861 
862 // PROTECTED MEMBER FUNCTIONS
863 
864 // PRIVATE MEMBER FUNCTIONS
865 
866 
867 // ===========================================================
868 // HANDLE POOL FACET
869 // ===========================================================
870 
871 // PUBLIC MEMBER FUNCTIONS
872 
876 {
877  // Preconditions:
878 
879  // Body:
880 
881  index_space_handle* result = 0; // Just to silence compiler warnings.
882 
883  is_abstract();
884 
885  // Postconditions:
886 
887  ensure(result->is_attached());
888 
889  // Exit:
890 
891  return *result;
892 }
893 
894 void
897 {
898  // Preconditions:
899 
900  require(allocated_id_space(xid_space));
901 
902  // Body:
903 
904  is_abstract();
905 
906  // Postconditions:
907 
908  ensure(is_basic_query);
909 
910  // Exit:
911 
912  return;
913 }
914 
915 bool
917 allocated_id_space(const index_space_handle& xid_space) const
918 {
919  // Preconditions:
920 
921  // Body:
922 
923  bool result = false; // Just to silence compiler warnings.
924 
925  is_abstract();
926 
927  // Postconditions:
928 
929  ensure(is_basic_query);
930 
931  // Exit:
932 
933  return result;
934 }
935 
936 // PROTECTED MEMBER FUNCTIONS
937 
938 void
941 {
942  // Preconditions:
943 
944  // Body:
945 
946  // This function is const because it does not change this
947  // object. It only passes it to the handle. However, the
948  // handle wants a mutable version of this object because
949  // it may export mutation functions to the user. These mutation
950  // function only depend on the constness of the handle.
951 
952  xid_space.attach_to(const_cast<explicit_index_space_state*>(this));
953 
954  // Postconditions:
955 
956  ensure(xid_space.is_attached());
957 
958  // Exit:
959 
960  return;
961 }
962 
963 // PRIVATE MEMBER FUNCTIONS
964 
965 
966 // ===========================================================
967 // ITERATOR POOL FACET
968 // ===========================================================
969 
970 // PUBLIC MEMBER FUNCTIONS
971 
975 {
976  // Preconditions:
977 
978  // Body:
979 
980  index_space_iterator* result = 0; // Just to silence compiler warnings.
981 
982  is_abstract();
983 
984  // Postconditions:
985 
986  ensure(result->is_attached());
987 
988  // Exit:
989 
990  return *result;
991 }
992 
993 void
996 {
997  // Preconditions:
998 
999  require(allocated_iterator(xitr));
1000 
1001  // Body:
1002 
1003  is_abstract();
1004 
1005  // Postconditions:
1006 
1007  ensure(is_basic_query);
1008 
1009  // Exit:
1010 
1011  return;
1012 }
1013 
1014 bool
1017 {
1018  // Preconditions:
1019 
1020  // Body:
1021 
1022  bool result = false; // Just to silence compiler warnings.
1023 
1024  is_abstract();
1025 
1026  // Postconditions:
1027 
1028  ensure(is_basic_query);
1029 
1030  // Exit:
1031 
1032  return result;
1033 }
1034 
1035 // PROTECTED MEMBER FUNCTIONS
1036 
1037 void
1040 {
1041  // Preconditions:
1042 
1043  // Body:
1044 
1045  // This function is const because it does not change this
1046  // object. It only passes it to the iterator. However, the
1047  // iterator wants a mutable version of this object because
1048  // it may export mutation functions to the user. These mutation
1049  // function only depend on the constness of the iterator.
1050 
1051  xitr.attach_to(const_cast<explicit_index_space_state*>(this));
1052 
1053  // Postconditions:
1054 
1055  ensure(xitr.is_attached());
1056 
1057  // Exit:
1058 
1059  return;
1060 }
1061 
1062 // PRIVATE MEMBER FUNCTIONS
1063 
1064 
1065 // ===========================================================
1066 // FACTORY FACET
1067 // ===========================================================
1068 
1069 // PUBLIC MEMBER FUNCTIONS
1070 
1071 const std::string&
1073 class_name() const
1074 {
1075  static const std::string result("explicit_index_space_state");
1076  return result;
1077 }
1078 
1082 {
1083  // Preconditions:
1084 
1085  // Body:
1086 
1088 
1089  // Postconditions:
1090 
1091  // Exit:
1092 
1093  return result;
1094 }
1095 
1098 clone() const
1099 {
1100  // Preconditions:
1101 
1102  // Body:
1103 
1104  explicit_index_space_state* result = 0; // Just to silence compiler warnings.
1105 
1106  is_abstract();
1107 
1108  // Postconditions:
1109 
1110  ensure(result != 0);
1111  ensure(is_same_type(result));
1112 
1113  // Exit:
1114 
1115  return result;
1116 }
1117 
1118 // PROTECTED MEMBER FUNCTIONS
1119 
1120 // PRIVATE MEMBER FUNCTIONS
1121 
1122 
1123 // ===========================================================
1124 // ANY FACET
1125 // ===========================================================
1126 
1127 // PUBLIC MEMBER FUNCTIONS
1128 
1129 bool
1131 is_ancestor_of(const any *other) const
1132 {
1133  // Preconditions:
1134 
1135  require(other != 0);
1136 
1137  // Body:
1138 
1139  // True if other conforms to this
1140 
1141  bool result = dynamic_cast<const explicit_index_space_state*>(other) != 0;
1142 
1143  // Postconditions:
1144 
1145  // Exit:
1146 
1147  return result;
1148 }
1149 
1150 bool
1152 invariant() const
1153 {
1154  bool result = true;
1155 
1156  if(invariant_check())
1157  {
1158  // Prevent recursive calls to invariant
1159 
1161 
1162  // Must satisfy base class invariant
1163 
1164  invariance(any::invariant());
1165 
1166  // Invariances for this class:
1167 
1168  invariance(is_empty() ? !is_valid(begin()) : contains(begin()));
1169  invariance(begin() <= end());
1170 
1171  // Finished, turn invariant checking back on.
1172 
1174  }
1175 
1176  // Exit
1177 
1178  return result;
1179 }
1180 
1181 // PROTECTED MEMBER FUNCTIONS
1182 
1183 // PRIVATE MEMBER FUNCTIONS
1184 
1185 
1186 // ===========================================================
1187 // NON-MEMBER FUNCTIONS
1188 // ===========================================================
1189 
1190 size_t
1191 sheaf::
1192 deep_size(const explicit_index_space_state& xn, bool xinclude_shallow)
1193 {
1194  // Preconditions:
1195 
1196  // Body:
1197 
1198  size_t result = xinclude_shallow ? sizeof(xn) : 0;
1199 
1200  // Add contributions for the product structure.
1201 
1202  if(xn.has_product_structure())
1203  {
1208 
1209  result += sizeof(xn.product_structure());
1210  }
1211 
1212  // Postconditions:
1213 
1214  ensure(result >= 0);
1215 
1216  // Exit
1217 
1218  return result;
1219 }
1220 
1221 std::ostream&
1222 sheaf::
1223 operator << (std::ostream& xos, const explicit_index_space_state& xe)
1224 {
1225  // Preconditions:
1226 
1227  // Body:
1228 
1229  using namespace std;
1230 
1231  xos << "class name: " << xe.class_name() << endl;
1232  xos << "index: " << xe.index() << endl;
1233  xos << "ct: " << xe.ct() << endl;
1234  xos << "begin: " << xe.begin() << endl;
1235  xos << "end: " << xe.end() << endl;
1236  xos << "persistent: " << boolalpha << xe.is_persistent() << noboolalpha << endl;
1237 
1238  xos << "ids: ";
1239  index_space_iterator& litr = xe.get_iterator();
1240  while(!litr.is_done())
1241  {
1242  xos << setw(10) << litr.pod();
1243  litr.next();
1244  }
1245  xos << endl;
1246 
1247  xos << "hub ids: ";
1248  litr.reset();
1249  while(!litr.is_done())
1250  {
1251  xos << setw(10) << litr.hub_pod();
1252  litr.next();
1253  }
1254  xos << endl;
1255  xe.release_iterator(litr);
1256 
1257  // Postconditions:
1258 
1259  // Exit:
1260 
1261  return xos;
1262 }
virtual pod_type glued_hub_pod(pod_type xid) const
The pod index in the hub id space equivalent to xid in this id space. synonym for unglued_hub_pod(xid...
virtual void release_id_space(index_space_handle &xid_space) const =0
Returns the id space handle xid_space to the handle pool.
virtual bool allocated_iterator(const index_space_iterator &xitr) const =0
True if and only if id space iterator xitr was allocated by the iterator pool.
virtual bool invariant() const
Class invariant, intended to be redefined in each descendant. See below for template for invariant in...
Definition: any.cc:153
const index_space_collection * collection(pod_type xid) const
Id space collection for id xid (const version).
bool is_persistent() const
True if this id space should be written to disk.
bool contains_hub(pod_type xid) const
True if this space contains an id equivalent to xid in the unglued hub id space. synonym for contains...
abstract_product_structure * _product
The product structure for this id space.
virtual index_space_handle & get_id_space() const =0
Allocates an id space handle from the handle pool.
virtual void attach_to(pod_type xindex)
Attach to the state with index xindex in the id space family id_spaces().
virtual const std::string & class_name() const
The name of this class.
virtual explicit_index_space_state & operator=(const explicit_index_space_state &xother)
Assignment operator.
const index_space_collection & host() const
The host collection (const version).
size_type ct() const
The number of members.
std::string name(pod_type xid) const
The name for id xid.
virtual void attach_to(pod_type xindex)
Attach to the state with index xindex in the id space family id_spaces().
An abstract class that defines the product structure for an id space.
virtual explicit_index_space_state * clone() const =0
Virtual constructor; create a new instance of the same type at this.
An abstract iterator over the ids of an id space.
virtual pod_type unglued_hub_pod(pod_type xid) const =0
The pod index in the unglued hub id space equivalent to xid in this id space.
pod_type end() const
Ending id of this space.
pod_type pod() const
The current id in the iteration.
virtual size_type deep_size(bool xinclude_shallow) const
The deep size of this.
virtual bool operator==(const explicit_index_space_state &xother) const
True if this is equivalent to xother.
virtual void release_iterator(index_space_iterator &xitr) const =0
Returns the id space iterator xitr to the iterator pool.
STL namespace.
const abstract_product_structure & product_structure() const
The product structure for this id space (const version).
bool is_gathered() const
True if begin() == 0 and end() == ct().
An abstract handle to a space of alternate integer identifiers (aliases) for a subset of a hub set of...
void put_name(pod_type xid, const std::string &xname)
Associate name xname with id space index xid.
const index_space_family & id_spaces() const
The id space family for this (const version).
bool has_product_structure() const
True if this id space has a product structure.
virtual void next()=0
Makes id() the next id in the iteration.
virtual bool is_attached() const =0
True if this handle is attached to a state.
An implementation of class sum_index_space_handle that has a primary sum id space state...
virtual const index_space_family & id_spaces() const =0
The id space family for this (const version).
void attach(explicit_index_space_handle &xid_space) const
Attach the id space handle xid_space to this state.
pod_type _end
Ending id of this space.
virtual bool contains_glued_hub(pod_type xid) const
True if this space contains an id equivalent to xid in the hub id space.
virtual void reset()=0
Restarts the iteration.
virtual void new_product_structure(const abstract_product_structure &xproduct)
Creates a new product structure for this id space by cloning the product structure, xproduct.
Abstract base class with useful features for all objects.
Definition: any.h:39
virtual pod_type pod(pod_type xid) const =0
The pod index in this space equivalent to xid in the unglued hub id space.
pod_type _index
The index of this id space.
bool is_done() const
True if iteration is finished.
An immutable abstract state for a space of alternate integer identifiers (aliases) for a subset of th...
A factory for instanting descendants of an abstract type T, given the class name of the descendant...
Definition: eval_family.h:49
An implementation of class index_space_handle for an explicit_index_space_state.
pod_type begin() const
Beginning id of this space.
An index within the external ("client") scope of a given id space.
Definition: scoped_index.h:116
virtual bool is_attached() const
True if this handle is attached to a state.
void invalidate_extrema()
Invalidate the extrema.
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.
virtual void delete_product_structure()
Deletes the product structure for this id space.
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
Definition: sheaf.h:52
const hub_index_space_handle & hub_id_space() const
The hub id space.
bool is_explicit_interval(pod_type xid)
True, if and only if the id space interval that contains index xid is an explicit interval...
virtual bool contains_unglued_hub(pod_type xid) const =0
True if this space contains an id equivalent to xid in the unglued hub id space.
A collection of id space states. This is a virtual class with provides an interface for accessing the...
void disable_invariant_check() const
Disable invariant check. Intended for preventing recursive calls to invariant and for suppressing inv...
Definition: any.h:97
virtual index_space_iterator & get_iterator() const =0
Allocates an id space iterator from the iterator pool.
void new_state(index_space_family &xid_spaces, const std::string &xname, bool xis_persistent)
Create a new id space state in the id space family xid_spaces at the next available id space index wi...
An implementation of index_space_interval for an interval of explicit id spaces.
void insert(explicit_index_space_state &xid_space)
Insert the explicit id space xid_space into this interval.
size_type _ct
The number of members.
virtual bool is_attached() const =0
True if this iterator is attached to a state.
bool invariant_check() const
True if invariant checking is enabled.
Definition: any.h:79
virtual bool contains(pod_type xid) const =0
True if this space contains id xid.
pod_index_type pod_type
The "plain old data" index type for this.
virtual bool allocated_id_space(const index_space_handle &xid_space) const =0
True if and only if id space handle xid_space was allocated by the handle pool.
An implementation of class index_space_iterator for an explicit_index_space_state.
pod_type index() const
The index of this id space.
virtual bool is_ancestor_of(const any *other) const
Conformance test; true if other conforms to this.
SHEAF_DLL_SPEC std::ostream & operator<<(std::ostream &os, const dof_descriptor_array &p)
Insert dof_descriptor_array& p into ostream& os.
virtual bool invariant() const
Class invariant.
bool contains(pod_type xid) const
True, if this contains an id space with id xid.
virtual pod_type glued_hub_pod(pod_type xid) const
The pod index in the glued hub id space equivalent to xid in this id space.
bool is_empty() const
True if there are no ids in the space.
bool _is_persistent
True if this id space should be written to disk.
Factory and container for a family of id spaces.
SHEAF_DLL_SPEC bool is_valid(pod_index_type xpod_index)
True if an only if xpod_index is valid.
Definition: pod_types.cc:37
static factory< explicit_index_space_state > & id_space_factory()
A factory for making descendants of this class.
pod_type _begin
Beginning id of this space.
SHEAF_DLL_SPEC pod_index_type invalid_pod_index()
The invalid pod index value.
Definition: pod_types.cc:31
bool is_same_type(const any *other) const
True if other is the same type as this.
Definition: any.cc:79
void enable_invariant_check() const
Enable invariant checking.
Definition: any.h:87
virtual bool is_attached() const
True if this iterator is attached to a state.
pod_type reserve_next_explicit_id()
Reserve the next available id for an explicit index space.
pod_type hub_pod(pod_type xid) const
The pod index in the unglued hub id space equivalent to xid in this id space. synonym for unglued_hub...
const hub_index_space_handle & hub_id_space() const
The hub id space of this family.
virtual abstract_product_structure * clone() const =0
Virtual constructor, makes a new instance of the same type as this.
index_space_collection * _host
The host collection.
pod_type hub_pod() const
The current unglued hub id in the iteration. synonym for unglued_hub_pod().
pod_type hub_pod() const
The pod value of this mapped to the unglued hub id space.
Definition: scoped_index.h:710