SheafSystem  0.0.0.0
ij_adjacency_index_space_interval.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/ij_adjacency_index_space_interval.h"
22 
23 #include "SheafSystem/abstract_product_structure.h"
24 #include "SheafSystem/assert_contract.h"
25 #include "SheafSystem/ij_adjacency_implicit_index_space_iterator.h"
26 #include "SheafSystem/ij_product_structure.h"
27 #include "SheafSystem/forwarding_index_space_handle.h"
28 #include "SheafSystem/explicit_index_space_state.h"
29 #include "SheafSystem/hub_index_space_handle.h"
30 #include "SheafSystem/index_space_family.h"
31 
32 using namespace std;
33 using namespace fiber_bundle; // Workaround for MS C++ bug.
34 
35 // ===========================================================
36 // SPACE FACTORY FACET
37 // ===========================================================
38 
39 // PUBLIC MEMBER FUNCTIONS
40 
44  size_type xub,
45  pod_type xzone_hub_begin,
46  size_type xi_size,
47  size_type xj_size)
48 {
49  // Preconditions:
50 
51  require(xub > 0);
52  require(xid_spaces.hub_id_space().contains(xzone_hub_begin));
53  require(xi_size > 0);
54  require(xj_size > 0);
55 
56  // Body:
57 
58  define_old_variable(size_type old_id_spaces_end = xid_spaces.end());
59 
61  result_ptr->new_state(xid_spaces, xub);
62 
63  result_ptr->_zone_hub_begin = xzone_hub_begin;
64  result_ptr->_i_size = xi_size;
65  result_ptr->_j_size = xj_size;
66 
67  result_ptr->_i_vertex_size = result_ptr->_i_size+1;
68  result_ptr->_j_vertex_size = result_ptr->_j_size+1;
69 
70  const ij_adjacency_index_space_interval& result = *result_ptr;
71 
72  // Postconditions:
73 
74  ensure(&result.id_spaces() == &xid_spaces);
75  ensure(result.begin() == old_id_spaces_end);
76  ensure(result.end() == xid_spaces.end());
77  ensure(result.end() == result.begin() + xub);
78 
79  ensure(result.zone_hub_begin() == xzone_hub_begin);
80  ensure(result.i_size() == xi_size);
81  ensure(result.j_size() == xj_size);
82 
83  // Exit:
84 
85  return result;
86 }
87 
88 // PROTECTED MEMBER FUNCTIONS
89 
90 // PRIVATE MEMBER FUNCTIONS
91 
92 
93 // ===========================================================
94 // IJ_ADJACENCY_INDEX_SPACE_INTERVAL FACET
95 // ===========================================================
96 
97 // PUBLIC MEMBER FUNCTIONS
98 
101 {
102  // Preconditions:
103 
104  // Body:
105 
106  // Nothing to do.
107 
108  // Postconditions:
109 
110  // Exit:
111 
112  return;
113 }
114 
118 {
119  // Preconditions:
120 
121  // Body:
122 
123  // Postconditions:
124 
125  ensure(is_basic_query);
126 
127  // Exit:
128 
129  return _zone_hub_begin;
130 }
131 
134 zone_hub_begin(pod_type xlocal_id) const
135 {
136  // Preconditions:
137 
138  // Body:
139 
140  // xlocal_id is the vertex id, compute the i, j indices.
141 
142  pod_type i, j;
143  sheaf::tuple(xlocal_id, _j_vertex_size, i, j);
144 
145  pod_type result = ordinal(i, j, _j_size) + _zone_hub_begin;
146 
147  if(i > 0)
148  {
149  result -= _j_size;
150  }
151 
152  if(j > 0)
153  {
154  result -= 1;
155  }
156 
157  // Postconditions:
158 
159  ensure(result >= zone_hub_begin());
160 
161  // Exit:
162 
163  return result;
164 }
165 
166 void
169  pod_type& xzone_hub_begin,
170  size_type& xi_ct,
171  size_type& xj_ct) const
172 {
173  // Preconditions:
174 
175  require(contains(xlocal_id));
176 
177  // Body:
178 
179  // xlocal_id is the vertex id, compute the i, j indices.
180 
181  pod_type i, j;
182  sheaf::tuple(xlocal_id, _j_vertex_size, i, j);
183 
184  // Calculate the first adjacent zone id and the number of adjacent
185  // zones in the i and j directions.
186 
187  xi_ct = 0;
188  xj_ct = 0;
189  xzone_hub_begin = ordinal(i, j, _j_size) + _zone_hub_begin;
190 
191  if(i > 0)
192  {
193  xi_ct++;
194  xzone_hub_begin -= _j_size;
195  }
196 
197  if(i < _i_size)
198  {
199  xi_ct++;
200  }
201 
202  if(j > 0)
203  {
204  xj_ct++;
205  xzone_hub_begin -= 1;
206  }
207 
208  if(j < _j_size)
209  {
210  xj_ct++;
211  }
212 
213  // Postconditions:
214 
215  ensure(xzone_hub_begin >= zone_hub_begin());
216  ensure((0 < xi_ct) && (xi_ct <= 2));
217  ensure((0 < xj_ct) && (xj_ct <= 2));
218 
219  // Exit:
220 
221  return;
222 }
223 
226 i_size() const
227 {
228  // Preconditions:
229 
230  // Body:
231 
232  // Postconditions:
233 
234  ensure(is_basic_query);
235 
236  // Exit:
237 
238  return _i_size;
239 }
240 
243 j_size() const
244 {
245  // Preconditions:
246 
247  // Body:
248 
249  // Postconditions:
250 
251  ensure(is_basic_query);
252 
253  // Exit:
254 
255  return _j_size;
256 }
257 
261 {
262  // Preconditions:
263 
264  // Body:
265 
266  // Postconditions:
267 
268  ensure(is_basic_query);
269 
270  // Exit:
271 
272  return _i_vertex_size;
273 }
274 
278 {
279  // Preconditions:
280 
281  // Body:
282 
283  // Postconditions:
284 
285  ensure(is_basic_query);
286 
287  // Exit:
288 
289  return _j_vertex_size;
290 }
291 
292 // PROTECTED MEMBER FUNCTIONS
293 
297 {
298  // Preconditions:
299 
300  // Body:
301 
302  // Postconditions:
303 
304  ensure(invariant());
305 
306  // Exit:
307 
308  return;
309 }
310 
311 // PRIVATE MEMBER FUNCTIONS
312 
313 
314 // ===========================================================
315 // INDEX_SPACE_INTERVAL FACET
316 // ===========================================================
317 
318 // PUBLIC MEMBER FUNCTIONS
319 
320 // PROTECTED MEMBER FUNCTIONS
321 
322 // PRIVATE MEMBER FUNCTIONS
323 
324 
325 // ===========================================================
326 // FACTORY FACET
327 // ===========================================================
328 
329 // PUBLIC MEMBER FUNCTIONS
330 
331 const std::string&
333 class_name() const
334 {
335  static const string result("ij_adjacency_index_space_interval");
336  return result;
337 }
338 
341 clone() const
342 {
343  // Preconditions:
344 
345  // Body:
346 
349 
350  // Postconditions:
351 
352  ensure(result != 0);
353  ensure(is_same_type(result));
354 
355  // Exit:
356 
357  return result;
358 }
359 
360 // PROTECTED MEMBER FUNCTIONS
361 
362 // PRIVATE MEMBER FUNCTIONS
363 
364 bool
365 fiber_bundle::ij_adjacency_index_space_interval::
366 make_prototype()
367 {
368  // Preconditions:
369 
370  // Body:
371 
373 
374  id_space_interval_factory().insert_prototype(lproto);
375 
376  // Postconditions:
377 
378  // Exit:
379 
380  return true;
381 }
382 
383 
384 // ===========================================================
385 // INDEX_SPACE_COLLECTION FACET
386 // ===========================================================
387 
388 // PUBLIC MEMBER FUNCTIONS
389 
390 bool
392 operator==(const index_space_collection& xother) const
393 {
394  // Preconditions:
395 
396  require(is_ancestor_of(&xother));
397 
398  // Body:
399 
400  const ij_adjacency_index_space_interval& lother =
401  dynamic_cast<const ij_adjacency_index_space_interval&>(xother);
402 
403  bool result = index_space_interval::operator==(xother);
404 
405  result = result && (_zone_hub_begin == lother._zone_hub_begin);
406  result = result && (_i_size == lother._i_size);
407  result = result && (_j_size == lother._j_size);
408  result = result && (_i_vertex_size == lother._i_vertex_size);
409  result = result && (_j_vertex_size == lother._j_vertex_size);
410 
411  // Postconditions:
412 
413  // Exit
414 
415  return result;
416 }
417 
420 deep_size(bool xinclude_shallow) const
421 {
422  // Preconditions:
423 
424  // Body:
425 
426  size_type result = fiber_bundle::deep_size(*this, xinclude_shallow);
427 
428  // Postconditions:
429 
430  ensure(result >= 0);
431 
432  // Exit:
433 
434  return result;
435 }
436 
437 // PROTECTED MEMBER FUNCTIONS
438 
442 {
443  // Preconditions:
444 
445  require(is_ancestor_of(&xother));
446 
447  // Body:
448 
449  const ij_adjacency_index_space_interval& lother =
450  dynamic_cast<const ij_adjacency_index_space_interval&>(xother);
451 
453  _i_size = lother._i_size;
454  _j_size = lother._j_size;
457 
459 
460  // Postconditions:
461 
462  ensure(invariant());
463  ensure((*this) == xother);
464 
465  // Exit:
466 
467  return *this;
468 }
469 
472 explicit_state(pod_type xlocal_id) const
473 {
474  // Preconditions:
475 
476  // Body:
477 
479 
480  explicit_index_space_state* result = 0;
481 
482  // Postconditions:
483 
484  ensure(is_basic_query);
485 
486  // Exit:
487 
488  return result;
489 }
490 
491 // PRIVATE MEMBER FUNCTIONS
492 
493 
494 // ===========================================================
495 // INDEX SPACE FACET
496 // ===========================================================
497 
498 // PUBLIC MEMBER FUNCTIONS
499 
500 void
502 remove(pod_type xlocal_id)
503 {
504  // Preconditions:
505 
506  // Body:
507 
509 
510  not_implemented();
511 
512  // Postconditions:
513 
514  ensure(!contains(xlocal_id));
515 
516  // Exit:
517 
518  return;
519 }
520 
523 ct(pod_type xlocal_id) const
524 {
525  // Preconditions:
526 
527  require(contains(xlocal_id));
528 
529  // Body:
530 
531  // xlocal_id is the zone id, compute the i, j indices.
532 
533  pod_type i, j;
534  sheaf::tuple(xlocal_id, _j_vertex_size, i, j);
535 
536  // Compute the count in each direction.
537 
538  pod_type result = 1;
539 
540  // Factor the adjacent zones in the i direction.
541 
542  if(i > 0 && i < _i_size)
543  {
544  // Not the first or last vertex in the i direction,
545  // this vertex is adjacent to 2 zones in the i direction.
546 
547  result *= 2;
548  }
549 
550  // Factor the adjacent zones in the j direction.
551 
552  if(j > 0 && i < _j_size)
553  {
554  // Not the first or last vertex in the j direction,
555  // this vertex is adjacent to 2 zones in the j direction.
556 
557  result *= 2;
558  }
559 
560  // Postconditions:
561 
562  ensure(is_basic_query);
563 
564  // Exit:
565 
566  return result;
567 }
568 
571 begin(pod_type xlocal_id) const
572 {
573  // Preconditions:
574 
575  require(contains(xlocal_id));
576 
577  // Body:
578 
579  pod_type result = 0;
580 
581  // Postconditions:
582 
583  ensure(is_basic_query);
584 
585  // Exit:
586 
587  return result;
588 }
589 
592 end(pod_type xlocal_id) const
593 {
594  // Preconditions:
595 
596  require(contains(xlocal_id));
597 
598  // Body:
599 
600  pod_type result = ct(xlocal_id);
601 
602  // Postconditions:
603 
604  ensure(is_basic_query);
605 
606  // Exit:
607 
608  return result;
609 }
610 
611 bool
613 contains(pod_type xlocal_id, pod_type xid) const
614 {
615  // Preconditions:
616 
617  require(contains(xlocal_id));
618 
619  // Body:
620 
621  bool result = (0 <= xid) && (xid < end(xlocal_id));
622 
623  // Postconditions:
624 
625  ensure(is_basic_query);
626 
627  // Exit:
628 
629  return result;
630 }
631 
632 bool
635 {
636  // Preconditions:
637 
638  require(contains(xlocal_id));
639 
640  // Body:
641 
642  // Compute the adjacent values.
643 
644  pod_type lzone_hub_begin;
645  size_type li_ct, lj_ct;
646 
647  adjacent_zones(xlocal_id, lzone_hub_begin, li_ct, lj_ct);
648 
649  // Factor the zone id relative to the first adjacent zone
650  // adjacent to vertex xlocal_id.
651 
652  pod_type i, j;
653  sheaf::tuple(xid - lzone_hub_begin, _j_size, i, j);
654 
655  bool result = ((0 <= i) && (i < li_ct) && (0 <= j) && (j < lj_ct));
656 
657  // Postconditions:
658 
659  ensure(is_basic_query);
660 
661  // Exit:
662 
663  return result;
664 }
665 
666 bool
668 contains(pod_type xlocal_id, pod_type xid, pod_type xhub_id) const
669 {
670  // Preconditions:
671 
672  require(contains(xlocal_id));
673 
674  // Body:
675 
676  bool result = is_valid(xhub_id) && (hub_pod(xlocal_id, xid) == xhub_id);
677 
678  // Postconditions:
679 
680  ensure(is_basic_query);
681 
682  // Exit:
683 
684  return result;
685 }
686 
689 pod(pod_type xlocal_id, pod_type xid) const
690 {
691  // Preconditions:
692 
693  require(contains(xlocal_id));
694 
695  // Body:
696 
697  pod_type result;
698 
699  // Compute the adjacent values.
700 
701  pod_type lzone_hub_begin;
702  size_type li_ct, lj_ct;
703 
704  adjacent_zones(xlocal_id, lzone_hub_begin, li_ct, lj_ct);
705 
706  // Factor the zone id relative to the first adjacent zone
707  // adjacent to vertex xlocal_id.
708 
709  pod_type i, j;
710  sheaf::tuple(xid - lzone_hub_begin, _j_size, i, j);
711 
712  // Compute pod.
713 
714  if((0 <= i) && (i < li_ct) && (0 <= j) && (j < lj_ct))
715  {
716  result = ordinal(i, j, lj_ct);
717  }
718  else
719  {
720  result = invalid_pod_index();
721  }
722 
723  // Postconditions:
724 
725  ensure(!is_valid(result) || contains(xlocal_id, result));
726 
727  // Exit:
728 
729  return result;
730 }
731 
734 unglued_hub_pod(pod_type xlocal_id, pod_type xid) const
735 {
736  // Preconditions:
737 
738  require(contains(xlocal_id));
739 
740  // Body:
741 
742  pod_type result;
743 
744  // Compute the adjacent values.
745 
746  pod_type lzone_hub_begin;
747  size_type li_ct, lj_ct;
748 
749  adjacent_zones(xlocal_id, lzone_hub_begin, li_ct, lj_ct);
750 
751  // Factor the pod.
752 
753  pod_type i, j;
754  sheaf::tuple(xid, lj_ct, i, j);
755 
756  // Calculate the hub pod.
757 
758  if((0 <= i) && (i < li_ct) && (0 <= j) && (j < lj_ct))
759  {
760  result = ordinal(i, j, _j_size) + lzone_hub_begin;
761  }
762  else
763  {
764  result = invalid_pod_index();
765  }
766 
767  // Postconditions:
768 
769  ensure(!is_valid(result) || contains_unglued_hub(xlocal_id, result));
770 
771  // Exit:
772 
773  return result;
774 }
775 
776 bool
778 is_persistent(pod_type xlocal_id) const
779 {
780  // Preconditions:
781 
782  require(contains(xlocal_id));
783 
784  // Body:
785 
786  bool result = false;
787 
788  // Postconditions:
789 
790  ensure(is_basic_query);
791 
792  // Exit:
793 
794  return result;
795 }
796 
797 // PROTECTED MEMBER FUNCTIONS
798 
799 // PRIVATE MEMBER FUNCTIONS
800 
801 
802 // ===========================================================
803 // PRODUCT STRUCTURE FACET
804 // ===========================================================
805 
806 // PUBLIC MEMBER FUNCTIONS
807 
808 void
811  const abstract_product_structure& xproduct)
812 {
813  // Preconditions:
814 
815  require(contains(xlocal_id));
816 
817  // Body:
818 
820 
821  not_implemented();
822 
823  // Postconditions:
824 
825  ensure(has_product_structure(xlocal_id));
826 
827  // Exit:
828 
829  return;
830 }
831 
832 void
835 {
836  // Preconditions:
837 
838  require(contains(xlocal_id));
839 
840  // Body:
841 
843 
844  not_implemented();
845 
846  // Postconditions:
847 
848  ensure(!has_product_structure(xlocal_id));
849 
850  // Exit:
851 
852  return;
853 }
854 
857 product_structure(pod_type xlocal_id) const
858 {
859  // Preconditions:
860 
861  require(contains(xlocal_id));
862  require(has_product_structure(xlocal_id));
863 
864  // Body:
865 
867 
868  const abstract_product_structure* result = 0; // Just to silence compiler warnings.
869 
870  not_implemented();
871 
872  // Postconditions:
873 
874  ensure(is_basic_query);
875 
876  // Exit:
877 
878  return *result;
879 }
880 
884 {
885  // Preconditions:
886 
887  require(contains(xlocal_id));
888  require(has_product_structure(xlocal_id));
889 
890  // Body:
891 
893 
894  abstract_product_structure* result = 0; // Just to silence compiler warnings.
895 
896  not_implemented();
897 
898  // Postconditions:
899 
900  ensure(is_basic_query);
901 
902  // Exit:
903 
904  return *result;
905 }
906 
907 bool
910 {
911  // Preconditions:
912 
913  require(contains(xlocal_id));
914 
915  // Body:
916 
918 
919  bool result = false; // Just to silence compiler warnings.
920 
921  not_implemented();
922 
923  // Postconditions:
924 
925  ensure(is_basic_query);
926 
927  // Exit:
928 
929  return result;
930 }
931 
932 // PROTECTED MEMBER FUNCTIONS
933 
934 // PRIVATE MEMBER FUNCTIONS
935 
936 
937 // ===========================================================
938 // HANDLE POOL FACET
939 // ===========================================================
940 
941 // PUBLIC MEMBER FUNCTIONS
942 
945 get_id_space(pod_type xlocal_id) const
946 {
947  // Preconditions:
948 
949  require(contains(xlocal_id));
950 
951  // Body:
952 
953  index_space_handle& result = _handles.get();
954  result.attach_to(*this, xlocal_id);
955 
956  // Postconditions:
957 
958  ensure(result.is_attached());
959 
960  // Exit:
961 
962  return result;
963 }
964 
965 void
968 {
969  // Preconditions:
970 
971  require(allocated_id_space(xid_space));
972 
973  // Body:
974 
975  // Detach the handle.
976 
977  xid_space.detach();
978 
979  // Release the handle to the pool.
980 
981  _handles.release(reinterpret_cast<forwarding_index_space_handle&>(xid_space));
982 
983  // Postconditions:
984 
985  ensure(is_basic_query);
986 
987  // Exit:
988 
989  return;
990 }
991 
992 bool
994 allocated_id_space(const index_space_handle& xid_space) const
995 {
996  // Preconditions:
997 
998  // Body:
999 
1000  const forwarding_index_space_handle* lid_space =
1001  dynamic_cast<const forwarding_index_space_handle*>(&xid_space);
1002 
1003  bool result = (lid_space != 0) && _handles.allocated(*lid_space);
1004 
1005  // Postconditions:
1006 
1007  ensure(is_basic_query);
1008 
1009  // Exit:
1010 
1011  return result;
1012 }
1013 
1014 // PROTECTED MEMBER FUNCTIONS
1015 
1016 // PRIVATE MEMBER FUNCTIONS
1017 
1018 
1019 // ===========================================================
1020 // ITERATOR POOL FACET
1021 // ===========================================================
1022 
1023 // PUBLIC MEMBER FUNCTIONS
1024 
1028 {
1029  // Preconditions:
1030 
1031  require(contains(xlocal_id));
1032 
1033  // Body:
1034 
1035  index_space_iterator& result = _iterators.get();
1036  result.attach_to(*this, xlocal_id);
1037 
1038  // Postconditions:
1039 
1040  ensure(result.is_attached());
1041 
1042  // Exit:
1043 
1044  return result;
1045 }
1046 
1047 void
1050 {
1051  // Preconditions:
1052 
1053  require(allocated_id_space_iterator(xitr));
1054 
1055  // Body:
1056 
1057  // Detach the iterator.
1058 
1059  xitr.detach();
1060 
1061  // Release the iterator to the pool.
1062 
1063  _iterators.release(reinterpret_cast<ij_adjacency_implicit_index_space_iterator&>(xitr));
1064 
1065  // Postconditions:
1066 
1067  ensure(is_basic_query);
1068 
1069  // Exit:
1070 
1071  return;
1072 }
1073 
1074 bool
1077 {
1078  // Preconditions:
1079 
1080  // Body:
1081 
1083  dynamic_cast<const ij_adjacency_implicit_index_space_iterator*>(&xitr);
1084 
1085  bool result = (litr != 0) && _iterators.allocated(*litr);
1086 
1087  // Postconditions:
1088 
1089  ensure(is_basic_query);
1090 
1091  // Exit:
1092 
1093  return result;
1094 }
1095 
1096 // PROTECTED MEMBER FUNCTIONS
1097 
1098 // PRIVATE MEMBER FUNCTIONS
1099 
1100 
1101 // ===========================================================
1102 // ANY FACET
1103 // ===========================================================
1104 
1105 // PUBLIC MEMBER FUNCTIONS
1106 
1107 bool
1109 is_ancestor_of(const any *other) const
1110 {
1111  // Preconditions:
1112 
1113  require(other != 0);
1114 
1115  // Body:
1116 
1117  // True if other conforms to this
1118 
1119  bool result = dynamic_cast<const ij_adjacency_index_space_interval*>(other) != 0;
1120 
1121  // Postconditions:
1122 
1123  // Exit:
1124 
1125  return result;
1126 }
1127 
1128 bool
1130 invariant() const
1131 {
1132  bool result = true;
1133 
1134  if(invariant_check())
1135  {
1136  // Prevent recursive calls to invariant
1137 
1139 
1140  // Must satisfy base class invariant
1141 
1142  invariance(index_space_interval::invariant());
1143 
1144  // Invariances for this class:
1145 
1146  // Finished, turn invariant checking back on.
1147 
1149  }
1150 
1151  // Exit
1152 
1153  return result;
1154 }
1155 
1156 // PROTECTED MEMBER FUNCTIONS
1157 
1158 // PRIVATE MEMBER FUNCTIONS
1159 
1160 
1161 // ===========================================================
1162 // NON-MEMBER FUNCTIONS
1163 // ===========================================================
1164 
1165 size_t
1166 fiber_bundle::
1167 deep_size(const ij_adjacency_index_space_interval& xn, bool xinclude_shallow)
1168 {
1169  // Preconditions:
1170 
1171  // Body:
1172 
1173  size_t result = xinclude_shallow ? sizeof(xn) : 0;
1174 
1175  // Add contributions for _handles.
1176 
1177  result += deep_size(xn._handles, false);
1178 
1179  // Add contributions for _iterators.
1180 
1181  result += deep_size(xn._iterators, false);
1182 
1183  // Postconditions:
1184 
1185  ensure(result >= 0);
1186 
1187  // Exit
1188 
1189  return result;
1190 }
virtual pod_type begin(pod_type xlocal_id) const
Beginning id of this space with id xlocal_id.
virtual pod_type unglued_hub_pod(pod_type xlocal_id, pod_type xid) const
The pod index in the unglued_hub id space equivalent to xid in the id space with id xlocal_id...
pod_type end() const
The ending index of the id spaces.
An abstract class that defines the product structure for an id space.
virtual bool allocated_id_space(const index_space_handle &xid_space) const
True if and only if id space handle xid_space was allocated by the handle pool.
virtual bool operator==(const index_space_collection &xother) const
True if this is equivalent to xother.
size_type i_size() const
The number of zones in the i direction.
virtual const index_space_family & id_spaces() const
The id space family for this (const version).
An abstract iterator over the ids of an id space.
pod_type zone_hub_begin() const
The hub id of the beginning of the zone id space.
virtual bool has_product_structure(pod_type xlocal_id) const
True if the id space with id xlocal_id has a product structure.
An implementation of index_space_interval for an interval of implicit id spaces for the adjacency of ...
size_type _i_size
The number of zones in the i direction.
void adjacent_zones(pod_type xlocal_id, pod_type &xzone_hub_begin, size_type &xi_ct, size_type &xj_ct) const
Compute the hub id of the fist adjacent zone and the number of adjacent zones in each direction for i...
pod_index_type ordinal(pod_index_type xi, pod_index_type xj, size_type xj_ub)
2-tuple to ordinal conversion.
virtual index_space_interval & operator=(const index_space_collection &xother)
Assignment operator.
virtual bool invariant() const
Class invariant.
size_type _i_vertex_size
The number of vertices in the i direction.
static const ij_adjacency_index_space_interval & new_space(index_space_family &xid_spaces, size_type xub, pod_type xzone_hub_begin, size_type xi_size, size_type xj_size)
Create a new interval of id spaces for 2D structured block adjacency in the id space family xid_space...
STL namespace.
virtual void detach()=0
Detach this handle form its state, if any.
An abstract handle to a space of alternate integer identifiers (aliases) for a subset of a hub set of...
virtual bool operator==(const index_space_collection &xother) const
True if this is equivalent to xother.
virtual void release_id_space(index_space_handle &xid_space) const
Returns the id space handle xid_space to the handle pool.
pod_index_type pod_type
The "plain old data" index type for this.
virtual void remove(pod_type xlocal_id)
Remove the id space with id xlocal_id.
virtual size_type ct(pod_type xlocal_id) const
The number of members for the id space with id xlocal_id.
virtual bool is_attached() const =0
True if this handle is attached to a state.
virtual void detach()=0
Detach this handle form its state, if any.
virtual ij_adjacency_index_space_interval & operator=(const index_space_collection &xother)
Assignment operator.
virtual pod_type end(pod_type xlocal_id) const
Ending id of this space with id xlocal_id.
Abstract base class with useful features for all objects.
Definition: any.h:39
size_type i_vertex_size() const
The number of vertices in the i direction.
An implemenation of index_space_collection that adds an interface for the interval [begin()...
An implementation of implicit_index_space_iterator for an implicit id space in an ij_adjacency_index_...
An immutable abstract state for a space of alternate integer identifiers (aliases) for a subset of th...
size_type _j_vertex_size
The number of vertices in the j direction.
virtual ij_adjacency_index_space_interval * clone() const
Virtual constructor; create a new instance of the same type at this.
An implementation of class index_space_handle for an forwarding_index_space_state.
void attach_to(const index_space_family &xid_spaces, pod_type xindex)
Attach to the state with index xindex in the id space family xid_spaces.
virtual void delete_product_structure(pod_type xlocal_id)
Deletes the product structure for the id space with id xlocal_id.
virtual bool contains_unglued_hub(pod_type xlocal_id, pod_type xid) const
True if the space with id xlocal_id contains an id equivalent to xid in the unglued hub id space...
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
Definition: sheaf.h:52
list_pool< forwarding_index_space_handle > _handles
The handle pool.
friend SHEAF_DLL_SPEC size_t deep_size(const ij_adjacency_index_space_interval &xn, bool xinclude_shallow)
The deep size of ij_adjacency_index_space_interval& xn.
size_type j_size() const
The number of zones in the j direction.
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
void attach_to(const index_space_family &xid_spaces, pod_type xindex)
Attach to the state with index xindex in the id space family xid_spaces.
static factory< index_space_interval > & id_space_interval_factory()
A factory for making descendants of this class.
SHEAF_DLL_SPEC size_t deep_size(const sec_vd &x0, bool xinclude_shallow=true)
The deep size of the referenced object of type sec_vd. if xinclude_shallow, add the sizeof x0 to the ...
Definition: sec_vd.cc:1448
pod_type _zone_hub_begin
The hub id of the beginning of the zone id space.
list_pool< ij_adjacency_implicit_index_space_iterator > _iterators
The iterator pool.
virtual const std::string & class_name() const
The name of this class.
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
size_type j_vertex_size() const
The number of vertices in the j direction.
virtual bool is_persistent(pod_type xlocal_id) const
True if the id space with id xlocal_id should be written to disk.
virtual void new_product_structure(pod_type xlocal_id, const abstract_product_structure &xproduct)
Creates a new product structure for the id space with id xlocal_id by cloning the product structure...
pod_type end() const
Ending space id of this interval in the id space family scope.
void tuple(pod_index_type x, size_type xj_ub, pod_index_type &xi, pod_index_type &xj)
Ordinal to 2-tuple conversion.
virtual explicit_index_space_state * explicit_state(pod_type xlocal_id) const
The explicit id space state for id xlocal_id. Returns null if there is no explicit id space for xloca...
virtual const abstract_product_structure & product_structure(pod_type xlocal_id) const
The product structure for the id space with id xlocal_id (const version).
Factory and container for a family of id spaces.
pod_type hub_pod(pod_type xlocal_id, pod_type xid) const
The pod index in the glued hub id space equivalent to xid in the id space with id xlocal_id...
virtual index_space_handle & get_id_space(pod_type xlocal_id) const
Allocates an id space handle from the handle pool attached to state with id xlocal_id.
virtual void release_id_space_iterator(index_space_iterator &xitr) const
Returns the id space iterator xitr to the iterator pool.
virtual bool contains(pod_type xlocal_id, pod_type xid) const
True if the space with id xlocal_id contains id xid.
virtual pod_type pod(pod_type xlocal_id, pod_type xid) const
The pod index in the space with id xlocal_id equivalent to xid in the hub id space.
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
Namespace for the fiber_bundles component of the sheaf system.
pod_type begin() const
Beginning space id of this interval in the id space family scope.
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
size_type _j_size
The number of zones in the j direction.
virtual index_space_iterator & get_id_space_iterator(pod_type xlocal_id) const
Allocates an id space iterator from the iterator pool attached to state with id xlocal_id.
const hub_index_space_handle & hub_id_space() const
The hub id space of this family.
virtual bool contains(pod_type xid) const
True if this space contains id xid.
virtual bool allocated_id_space_iterator(const index_space_iterator &xitr) const
True if and only if id space iterator xitr was allocated by the iterator pool.
virtual bool is_ancestor_of(const any *other) const
Conformance test; true if other conforms to this.